![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/pub/static/frontend/Magento/luma/en_US/js/bundle/ |
require.config({"config": { "jsbuild":{"Smartwave_Filterproducts/js/owl.carousel/owl.carousel.min.js":"/**\n * Owl Carousel v2.3.4\n * Copyright 2013-2018 David Deutsch\n * Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE\n */!(function (factory) {\n 'use strict';\n\n if (typeof define === 'function' && define.amd) {\n define([\n 'jquery'\n ], factory);\n } else {\n factory(window.jQuery);\n }\n}(function (a) {\n 'use strict';\n !function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:[\"busy\"],animating:[\"busy\"],dragging:[\"interacting\"]}},a.each([\"onResize\",\"onThrottledResize\"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:\"swing\",slideTransition:\"\",info:!1,nestedItemSelector:!1,itemElement:\"div\",stageElement:\"div\",refreshClass:\"owl-refresh\",loadedClass:\"owl-loaded\",loadingClass:\"owl-loading\",rtlClass:\"owl-rtl\",responsiveClass:\"owl-responsive\",dragClass:\"owl-drag\",itemClass:\"owl-item\",stageClass:\"owl-stage\",stageOuterClass:\"owl-stage-outer\",grabClass:\"owl-grab\"},e.Width={Default:\"default\",Inner:\"inner\",Outer:\"outer\"},e.Type={Event:\"event\",State:\"state\"},e.Plugins={},e.Workers=[{filter:[\"width\",\"settings\"],run:function(){this._width=this.$element.width()}},{filter:[\"width\",\"items\",\"settings\"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:[\"items\",\"settings\"],run:function(){this.$stage.children(\".cloned\").remove()}},{filter:[\"width\",\"items\",\"settings\"],run:function(a){var b=this.settings.margin||\"\",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:\"auto\",\"margin-left\":d?b:\"\",\"margin-right\":d?\"\":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:[\"width\",\"items\",\"settings\"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:[\"items\",\"settings\"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h=\"\",i=\"\";for(g/=2;g>0;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i,g-=1;this._clones=b,a(h).addClass(\"cloned\").appendTo(this.$stage),a(i).addClass(\"cloned\").prependTo(this.$stage)}},{filter:[\"width\",\"items\",\"settings\"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:[\"width\",\"items\",\"settings\"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,\"padding-left\":a||\"\",\"padding-right\":a||\"\"};this.$stage.css(c)}},{filter:[\"width\",\"items\",\"settings\"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:[\"items\"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr(\"style\")}},{filter:[\"width\",\"items\",\"settings\"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:[\"position\"],run:function(){this.animate(this.coordinates(this._current))}},{filter:[\"width\",\"position\",\"items\",\"settings\"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;c<d;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,\"<=\",g)&&this.op(a,\">\",h)||this.op(b,\"<\",g)&&this.op(b,\">\",h))&&i.push(c);this.$stage.children(\".active\").removeClass(\"active\"),this.$stage.children(\":eq(\"+i.join(\"), :eq(\")+\")\").addClass(\"active\"),this.$stage.children(\".center\").removeClass(\"center\"),this.settings.center&&this.$stage.children().eq(this.current()).addClass(\"center\")}}],e.prototype.initializeStage=function(){this.$stage=this.$element.find(\".\"+this.settings.stageClass),this.$stage.length||(this.$element.addClass(this.options.loadingClass),this.$stage=a(\"<\"+this.settings.stageElement+\">\",{class:this.settings.stageClass}).wrap(a(\"<div/>\",{class:this.settings.stageOuterClass})),this.$element.append(this.$stage.parent()))},e.prototype.initializeItems=function(){var b=this.$element.find(\".owl-item\");if(b.length)return this._items=b.get().map(function(b){return a(b)}),this._mergers=this._items.map(function(){return 1}),void this.refresh();this.replace(this.$element.children().not(this.$stage.parent())),this.isVisible()?this.refresh():this.invalidate(\"width\"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass)},e.prototype.initialize=function(){if(this.enter(\"initializing\"),this.trigger(\"initialize\"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is(\"pre-loading\")){var a,b,c;a=this.$element.find(\"img\"),b=this.settings.nestedItemSelector?\".\"+this.settings.nestedItemSelector:d,c=this.$element.children(b).width(),a.length&&c<=0&&this.preloadAutoWidthImages(a)}this.initializeStage(),this.initializeItems(),this.registerEventHandlers(),this.leave(\"initializing\"),this.trigger(\"initialized\")},e.prototype.isVisible=function(){return!this.settings.checkVisibility||this.$element.is(\":visible\")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){a<=b&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),\"function\"==typeof e.stagePadding&&(e.stagePadding=e.stagePadding()),delete e.responsive,e.responsiveClass&&this.$element.attr(\"class\",this.$element.attr(\"class\").replace(new RegExp(\"(\"+this.options.responsiveClass+\"-)\\\\S+\\\\s\",\"g\"),\"$1\"+d))):e=a.extend({},this.options),this.trigger(\"change\",{property:{name:\"settings\",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate(\"settings\"),this.trigger(\"changed\",{property:{name:\"settings\",value:this.settings}})},e.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger(\"prepare\",{content:b});return c.data||(c.data=a(\"<\"+this.settings.itemElement+\"/>\").addClass(this.options.itemClass).append(b)),this.trigger(\"prepared\",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};b<c;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={},!this.is(\"valid\")&&this.enter(\"valid\")},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){this.enter(\"refreshing\"),this.trigger(\"refresh\"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave(\"refreshing\"),this.trigger(\"refreshed\")},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return!!this._items.length&&(this._width!==this.$element.width()&&(!!this.isVisible()&&(this.enter(\"resizing\"),this.trigger(\"resize\").isDefaultPrevented()?(this.leave(\"resizing\"),!1):(this.invalidate(\"width\"),this.refresh(),this.leave(\"resizing\"),void this.trigger(\"resized\")))))},e.prototype.registerEventHandlers=function(){a.support.transition&&this.$stage.on(a.support.transition.end+\".owl.core\",a.proxy(this.onTransitionEnd,this)),!1!==this.settings.responsive&&this.on(b,\"resize\",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on(\"mousedown.owl.core\",a.proxy(this.onDragStart,this)),this.$stage.on(\"dragstart.owl.core selectstart.owl.core\",function(){return!1})),this.settings.touchDrag&&(this.$stage.on(\"touchstart.owl.core\",a.proxy(this.onDragStart,this)),this.$stage.on(\"touchcancel.owl.core\",a.proxy(this.onDragEnd,this)))},e.prototype.onDragStart=function(b){var d=null;3!==b.which&&(a.support.transform?(d=this.$stage.css(\"transform\").replace(/.*\\(|\\)| /g,\"\").split(\",\"),d={x:d[16===d.length?12:4],y:d[16===d.length?13:5]}):(d=this.$stage.position(),d={x:this.settings.rtl?d.left+this.$stage.width()-this.width()+this.settings.margin:d.left,y:d.top}),this.is(\"animating\")&&(a.support.transform?this.animate(d.x):this.$stage.stop(),this.invalidate(\"position\")),this.$element.toggleClass(this.options.grabClass,\"mousedown\"===b.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=a(b.target),this._drag.stage.start=d,this._drag.stage.current=d,this._drag.pointer=this.pointer(b),a(c).on(\"mouseup.owl.core touchend.owl.core\",a.proxy(this.onDragEnd,this)),a(c).one(\"mousemove.owl.core touchmove.owl.core\",a.proxy(function(b){var d=this.difference(this._drag.pointer,this.pointer(b));a(c).on(\"mousemove.owl.core touchmove.owl.core\",a.proxy(this.onDragMove,this)),Math.abs(d.x)<Math.abs(d.y)&&this.is(\"valid\")||(b.preventDefault(),this.enter(\"dragging\"),this.trigger(\"drag\"))},this)))},e.prototype.onDragMove=function(a){var b=null,c=null,d=null,e=this.difference(this._drag.pointer,this.pointer(a)),f=this.difference(this._drag.stage.start,e);this.is(\"dragging\")&&(a.preventDefault(),this.settings.loop?(b=this.coordinates(this.minimum()),c=this.coordinates(this.maximum()+1)-b,f.x=((f.x-b)%c+c)%c+b):(b=this.settings.rtl?this.coordinates(this.maximum()):this.coordinates(this.minimum()),c=this.settings.rtl?this.coordinates(this.minimum()):this.coordinates(this.maximum()),d=this.settings.pullDrag?-1*e.x/5:0,f.x=Math.max(Math.min(f.x,b+d),c+d)),this._drag.stage.current=f,this.animate(f.x))},e.prototype.onDragEnd=function(b){var d=this.difference(this._drag.pointer,this.pointer(b)),e=this._drag.stage.current,f=d.x>0^this.settings.rtl?\"left\":\"right\";a(c).off(\".owl.core\"),this.$element.removeClass(this.options.grabClass),(0!==d.x&&this.is(\"dragging\")||!this.is(\"valid\"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==d.x?f:this._drag.direction)),this.invalidate(\"position\"),this.update(),this._drag.direction=f,(Math.abs(d.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one(\"click.owl.core\",function(){return!1})),this.is(\"dragging\")&&(this.leave(\"dragging\"),this.trigger(\"dragged\"))},e.prototype.closest=function(b,c){var e=-1,f=30,g=this.width(),h=this.coordinates();return this.settings.freeDrag||a.each(h,a.proxy(function(a,i){return\"left\"===c&&b>i-f&&b<i+f?e=a:\"right\"===c&&b>i-g-f&&b<i-g+f?e=a+1:this.op(b,\"<\",i)&&this.op(b,\">\",h[a+1]!==d?h[a+1]:i-g)&&(e=\"left\"===c?a+1:a),-1===e},this)),this.settings.loop||(this.op(b,\">\",h[this.minimum()])?e=b=this.minimum():this.op(b,\"<\",h[this.maximum()])&&(e=b=this.maximum())),e},e.prototype.animate=function(b){var c=this.speed()>0;this.is(\"animating\")&&this.onTransitionEnd(),c&&(this.enter(\"animating\"),this.trigger(\"translate\")),a.support.transform3d&&a.support.transition?this.$stage.css({transform:\"translate3d(\"+b+\"px,0px,0px)\",transition:this.speed()/1e3+\"s\"+(this.settings.slideTransition?\" \"+this.settings.slideTransition:\"\")}):c?this.$stage.animate({left:b+\"px\"},this.speed(),this.settings.fallbackEasing,a.proxy(this.onTransitionEnd,this)):this.$stage.css({left:b+\"px\"})},e.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger(\"change\",{property:{name:\"position\",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate(\"position\"),this.trigger(\"changed\",{property:{name:\"position\",value:this._current}})}return this._current},e.prototype.invalidate=function(b){return\"string\"===a.type(b)&&(this._invalidated[b]=!0,this.is(\"valid\")&&this.leave(\"valid\")),a.map(this._invalidated,function(a,b){return b})},e.prototype.reset=function(a){(a=this.normalize(a))!==d&&(this._speed=0,this._current=a,this.suppress([\"translate\",\"translated\"]),this.animate(this.coordinates(a)),this.release([\"translate\",\"translated\"]))},e.prototype.normalize=function(a,b){var c=this._items.length,e=b?0:this._clones.length;return!this.isNumeric(a)||c<1?a=d:(a<0||a>=c+e)&&(a=((a-e/2)%c+c)%c+e/2),a},e.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=this.settings,f=this._coordinates.length;if(e.loop)f=this._clones.length/2+this._items.length-1;else if(e.autoWidth||e.merge){if(b=this._items.length)for(c=this._items[--b].width(),d=this.$element.width();b--&&!((c+=this._items[b].width()+this.settings.margin)>d););f=b+1}else f=e.center?this._items.length-1:this._items.length-e.items;return a&&(f-=this._clones.length/2),Math.max(f,0)},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2==0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c,e=1,f=b-1;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(this.settings.rtl&&(e=-1,f=b+1),c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[f]||0))/2*e):c=this._coordinates[f]||0,c=Math.ceil(c))},e.prototype.duration=function(a,b,c){return 0===c?0:Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(a,b){var c=this.current(),d=null,e=a-this.relative(c),f=(e>0)-(e<0),g=this._items.length,h=this.minimum(),i=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(e)>g/2&&(e+=-1*f*g),a=c+e,(d=((a-h)%g+g)%g+h)!==a&&d-e<=i&&d-e>0&&(c=d-e,a=d,this.reset(c))):this.settings.rewind?(i+=1,a=(a%i+i)%i):a=Math.max(h,Math.min(i,a)),this.speed(this.duration(c,a,b)),this.current(a),this.isVisible()&&this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.onTransitionEnd=function(a){if(a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0)))return!1;this.leave(\"animating\"),this.trigger(\"translated\")},e.prototype.viewport=function(){var d;return this.options.responsiveBaseElement!==b?d=a(this.options.responsiveBaseElement).width():b.innerWidth?d=b.innerWidth:c.documentElement&&c.documentElement.clientWidth?d=c.documentElement.clientWidth:console.warn(\"Can not detect viewport width.\"),d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find(\".\"+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find(\"[data-merge]\").addBack(\"[data-merge]\").attr(\"data-merge\")||1)},this)),this.reset(this.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate(\"items\")},e.prototype.add=function(b,c){var e=this.relative(this._current);c=c===d?this._items.length:this.normalize(c,!0),b=b instanceof jQuery?b:a(b),this.trigger(\"add\",{content:b,position:c}),b=this.prepare(b),0===this._items.length||c===this._items.length?(0===this._items.length&&this.$stage.append(b),0!==this._items.length&&this._items[c-1].after(b),this._items.push(b),this._mergers.push(1*b.find(\"[data-merge]\").addBack(\"[data-merge]\").attr(\"data-merge\")||1)):(this._items[c].before(b),this._items.splice(c,0,b),this._mergers.splice(c,0,1*b.find(\"[data-merge]\").addBack(\"[data-merge]\").attr(\"data-merge\")||1)),this._items[e]&&this.reset(this._items[e].index()),this.invalidate(\"items\"),this.trigger(\"added\",{content:b,position:c})},e.prototype.remove=function(a){(a=this.normalize(a,!0))!==d&&(this.trigger(\"remove\",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate(\"items\"),this.trigger(\"removed\",{content:null,position:a}))},e.prototype.preloadAutoWidthImages=function(b){b.each(a.proxy(function(b,c){this.enter(\"pre-loading\"),c=a(c),a(new Image).one(\"load\",a.proxy(function(a){c.attr(\"src\",a.target.src),c.css(\"opacity\",1),this.leave(\"pre-loading\"),!this.is(\"pre-loading\")&&!this.is(\"initializing\")&&this.refresh()},this)).attr(\"src\",c.attr(\"src\")||c.attr(\"data-src\")||c.attr(\"data-src-retina\"))},this))},e.prototype.destroy=function(){this.$element.off(\".owl.core\"),this.$stage.off(\".owl.core\"),a(c).off(\".owl.core\"),!1!==this.settings.responsive&&(b.clearTimeout(this.resizeTimer),this.off(b,\"resize\",this._handlers.onThrottledResize));for(var d in this._plugins)this._plugins[d].destroy();this.$stage.children(\".cloned\").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.remove(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr(\"class\",this.$element.attr(\"class\").replace(new RegExp(this.options.responsiveClass+\"-\\\\S+\\\\s\",\"g\"),\"\")).removeData(\"owl.carousel\")},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case\"<\":return d?a>c:a<c;case\">\":return d?a<c:a>c;case\">=\":return d?a<=c:a>=c;case\"<=\":return d?a>=c:a<=c}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent(\"on\"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent(\"on\"+b,c)},e.prototype.trigger=function(b,c,d,f,g){var h={item:{count:this._items.length,index:this.current()}},i=a.camelCase(a.grep([\"on\",b,d],function(a){return a}).join(\"-\").toLowerCase()),j=a.Event([b,\"owl\",d||\"carousel\"].join(\".\").toLowerCase(),a.extend({relatedTarget:this},h,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(j)}),this.register({type:e.Type.Event,name:b}),this.$element.trigger(j),this.settings&&\"function\"==typeof this.settings[i]&&this.settings[i].call(this,j)),j},e.prototype.enter=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]===d&&(this._states.current[b]=0),this._states.current[b]++},this))},e.prototype.leave=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]--},this))},e.prototype.register=function(b){if(b.type===e.Type.Event){if(a.event.special[b.name]||(a.event.special[b.name]={}),!a.event.special[b.name].owl){var c=a.event.special[b.name]._default;a.event.special[b.name]._default=function(a){return!c||!c.apply||a.namespace&&-1!==a.namespace.indexOf(\"owl\")?a.namespace&&a.namespace.indexOf(\"owl\")>-1:c.apply(this,arguments)},a.event.special[b.name].owl=!0}}else b.type===e.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=a.grep(this._states.tags[b.name],a.proxy(function(c,d){return a.inArray(c,this._states.tags[b.name])===d},this)))},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.pointer=function(a){var c={x:null,y:null};return a=a.originalEvent||a||b.event,a=a.touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,a.pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},e.prototype.isNumeric=function(a){return!isNaN(parseFloat(a))},e.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},a.fn.owlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),f=d.data(\"owl.carousel\");f||(f=new e(this,\"object\"==typeof b&&b),d.data(\"owl.carousel\",f),a.each([\"next\",\"prev\",\"to\",\"destroy\",\"refresh\",\"replace\",\"add\",\"remove\"],function(b,c){f.register({type:e.Type.Event,name:c}),f.$element.on(c+\".owl.carousel.core\",a.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([c]),f[c].apply(this,[].slice.call(arguments,1)),this.release([c]))},f))})),\"string\"==typeof b&&\"_\"!==b.charAt(0)&&f[b].apply(f,c)})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={\"initialized.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoRefresh:!0,autoRefreshInterval:500},e.prototype.watch=function(){this._interval||(this._visible=this._core.isVisible(),this._interval=b.setInterval(a.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},e.prototype.refresh=function(){this._core.isVisible()!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass(\"owl-hidden\",!this._visible),this._visible&&this._core.invalidate(\"width\")&&this._core.refresh())},e.prototype.destroy=function(){var a,c;b.clearInterval(this._interval);for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))\"function\"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoRefresh=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._loaded=[],this._handlers={\"initialized.owl.carousel change.owl.carousel resized.owl.carousel\":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&\"position\"==b.property.name||\"initialized\"==b.type)){var c=this._core.settings,e=c.center&&Math.ceil(c.items/2)||c.items,f=c.center&&-1*e||0,g=(b.property&&b.property.value!==d?b.property.value:this._core.current())+f,h=this._core.clones().length,i=a.proxy(function(a,b){this.load(b)},this);for(c.lazyLoadEager>0&&(e+=c.lazyLoadEager,c.loop&&(g-=c.lazyLoadEager,e++));f++<e;)this.load(h/2+this._core.relative(g)),h&&a.each(this._core.clones(this._core.relative(g)),i),g++}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={lazyLoad:!1,lazyLoadEager:0},e.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(\".owl-lazy\");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr(\"data-src-retina\")||f.attr(\"data-src\")||f.attr(\"data-srcset\");this._core.trigger(\"load\",{element:f,url:g},\"lazy\"),f.is(\"img\")?f.one(\"load.owl.lazy\",a.proxy(function(){f.css(\"opacity\",1),this._core.trigger(\"loaded\",{element:f,url:g},\"lazy\")},this)).attr(\"src\",g):f.is(\"source\")?f.one(\"load.owl.lazy\",a.proxy(function(){this._core.trigger(\"loaded\",{element:f,url:g},\"lazy\")},this)).attr(\"srcset\",g):(e=new Image,e.onload=a.proxy(function(){f.css({\"background-image\":'url(\"'+g+'\")',opacity:\"1\"}),this._core.trigger(\"loaded\",{element:f,url:g},\"lazy\")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(c){this._core=c,this._previousHeight=null,this._handlers={\"initialized.owl.carousel refreshed.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),\"changed.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&\"position\"===a.property.name&&this.update()},this),\"loaded.owl.lazy\":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest(\".\"+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._intervalId=null;var d=this;a(b).on(\"load\",function(){d._core.settings.autoHeight&&d.update()}),a(b).resize(function(){d._core.settings.autoHeight&&(null!=d._intervalId&&clearTimeout(d._intervalId),d._intervalId=setTimeout(function(){d.update()},250))})};e.Defaults={autoHeight:!1,autoHeightClass:\"owl-height\"},e.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.settings.lazyLoad,e=this._core.$stage.children().toArray().slice(b,c),f=[],g=0;a.each(e,function(b,c){f.push(a(c).height())}),g=Math.max.apply(null,f),g<=1&&d&&this._previousHeight&&(g=this._previousHeight),this._previousHeight=g,this._core.$stage.parent().height(g).addClass(this._core.settings.autoHeightClass)},e.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._videos={},this._playing=null,this._handlers={\"initialized.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.register({type:\"state\",name:\"playing\",tags:[\"interacting\"]})},this),\"resize.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),\"refreshed.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.is(\"resizing\")&&this._core.$stage.find(\".cloned .owl-video-frame\").remove()},this),\"changed.owl.carousel\":a.proxy(function(a){a.namespace&&\"position\"===a.property.name&&this._playing&&this.stop()},this),\"prepared.owl.carousel\":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(\".owl-video\");c.length&&(c.css(\"display\",\"none\"),this.fetch(c,a(b.content)))}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on(\"click.owl.video\",\".owl-video-play-icon\",a.proxy(function(a){this.play(a)},this))};e.Defaults={video:!1,videoHeight:!1,videoWidth:!1},e.prototype.fetch=function(a,b){var c=function(){return a.attr(\"data-vimeo-id\")?\"vimeo\":a.attr(\"data-vzaar-id\")?\"vzaar\":\"youtube\"}(),d=a.attr(\"data-vimeo-id\")||a.attr(\"data-youtube-id\")||a.attr(\"data-vzaar-id\"),e=a.attr(\"data-width\")||this._core.settings.videoWidth,f=a.attr(\"data-height\")||this._core.settings.videoHeight,g=a.attr(\"href\");if(!g)throw new Error(\"Missing video URL.\");if(d=g.match(/(http:|https:|)\\/\\/(player.|www.|app.)?(vimeo\\.com|youtu(be\\.com|\\.be|be\\.googleapis\\.com|be\\-nocookie\\.com)|vzaar\\.com)\\/(video\\/|videos\\/|embed\\/|channels\\/.+\\/|groups\\/.+\\/|watch\\?v=|v\\/)?([A-Za-z0-9._%-]*)(\\&\\S+)?/),d[3].indexOf(\"youtu\")>-1)c=\"youtube\";else if(d[3].indexOf(\"vimeo\")>-1)c=\"vimeo\";else{if(!(d[3].indexOf(\"vzaar\")>-1))throw new Error(\"Video URL not supported.\");c=\"vzaar\"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr(\"data-video\",g),this.thumbnail(a,this._videos[g])},e.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?\"width:\"+c.width+\"px;height:\"+c.height+\"px;\":\"\",h=b.find(\"img\"),i=\"src\",j=\"\",k=this._core.settings,l=function(c){e='<div class=\"owl-video-play-icon\"></div>',d=k.lazyLoad?a(\"<div/>\",{class:\"owl-video-tn \"+j,srcType:c}):a(\"<div/>\",{class:\"owl-video-tn\",style:\"opacity:1;background-image:url(\"+c+\")\"}),b.after(d),b.after(e)};if(b.wrap(a(\"<div/>\",{class:\"owl-video-wrapper\",style:g})),this._core.settings.lazyLoad&&(i=\"data-src\",j=\"owl-lazy\"),h.length)return l(h.attr(i)),h.remove(),!1;\"youtube\"===c.type?(f=\"//img.youtube.com/vi/\"+c.id+\"/hqdefault.jpg\",l(f)):\"vimeo\"===c.type?a.ajax({type:\"GET\",url:\"//vimeo.com/api/v2/video/\"+c.id+\".json\",jsonp:\"callback\",dataType:\"jsonp\",success:function(a){f=a[0].thumbnail_large,l(f)}}):\"vzaar\"===c.type&&a.ajax({type:\"GET\",url:\"//vzaar.com/api/videos/\"+c.id+\".json\",jsonp:\"callback\",dataType:\"jsonp\",success:function(a){f=a.framegrab_url,l(f)}})},e.prototype.stop=function(){this._core.trigger(\"stop\",null,\"video\"),this._playing.find(\".owl-video-frame\").remove(),this._playing.removeClass(\"owl-video-playing\"),this._playing=null,this._core.leave(\"playing\"),this._core.trigger(\"stopped\",null,\"video\")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest(\".\"+this._core.settings.itemClass),f=this._videos[e.attr(\"data-video\")],g=f.width||\"100%\",h=f.height||this._core.$stage.height();this._playing||(this._core.enter(\"playing\"),this._core.trigger(\"play\",null,\"video\"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),c=a('<iframe frameborder=\"0\" allowfullscreen mozallowfullscreen webkitAllowFullScreen ></iframe>'),c.attr(\"height\",h),c.attr(\"width\",g),\"youtube\"===f.type?c.attr(\"src\",\"//www.youtube.com/embed/\"+f.id+\"?autoplay=1&rel=0&v=\"+f.id):\"vimeo\"===f.type?c.attr(\"src\",\"//player.vimeo.com/video/\"+f.id+\"?autoplay=1\"):\"vzaar\"===f.type&&c.attr(\"src\",\"//view.vzaar.com/\"+f.id+\"/player?autoplay=true\"),a(c).wrap('<div class=\"owl-video-frame\" />').insertAfter(e.find(\".owl-video\")),this._playing=e.addClass(\"owl-video-playing\"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass(\"owl-video-frame\")},e.prototype.destroy=function(){var a,b;this._core.$element.off(\"click.owl.video\");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={\"change.owl.carousel\":a.proxy(function(a){a.namespace&&\"position\"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),\"drag.owl.carousel dragged.owl.carousel translated.owl.carousel\":a.proxy(function(a){a.namespace&&(this.swapping=\"translated\"==a.type)},this),\"translate.owl.carousel\":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,\n animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+\"px\"}).addClass(\"animated owl-animated-out\").addClass(g)),f&&e.one(a.support.animation.end,c).addClass(\"animated owl-animated-in\").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:\"\"}).removeClass(\"animated owl-animated-out owl-animated-in\").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._call=null,this._time=0,this._timeout=0,this._paused=!0,this._handlers={\"changed.owl.carousel\":a.proxy(function(a){a.namespace&&\"settings\"===a.property.name?this._core.settings.autoplay?this.play():this.stop():a.namespace&&\"position\"===a.property.name&&this._paused&&(this._time=0)},this),\"initialized.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),\"play.owl.autoplay\":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),\"stop.owl.autoplay\":a.proxy(function(a){a.namespace&&this.stop()},this),\"mouseover.owl.autoplay\":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is(\"rotating\")&&this.pause()},this),\"mouseleave.owl.autoplay\":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is(\"rotating\")&&this.play()},this),\"touchstart.owl.core\":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is(\"rotating\")&&this.pause()},this),\"touchend.owl.core\":a.proxy(function(){this._core.settings.autoplayHoverPause&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype._next=function(d){this._call=b.setTimeout(a.proxy(this._next,this,d),this._timeout*(Math.round(this.read()/this._timeout)+1)-this.read()),this._core.is(\"interacting\")||c.hidden||this._core.next(d||this._core.settings.autoplaySpeed)},e.prototype.read=function(){return(new Date).getTime()-this._time},e.prototype.play=function(c,d){var e;this._core.is(\"rotating\")||this._core.enter(\"rotating\"),c=c||this._core.settings.autoplayTimeout,e=Math.min(this._time%(this._timeout||c),c),this._paused?(this._time=this.read(),this._paused=!1):b.clearTimeout(this._call),this._time+=this.read()%c-e,this._timeout=c,this._call=b.setTimeout(a.proxy(this._next,this,d),c-e)},e.prototype.stop=function(){this._core.is(\"rotating\")&&(this._time=0,this._paused=!0,b.clearTimeout(this._call),this._core.leave(\"rotating\"))},e.prototype.pause=function(){this._core.is(\"rotating\")&&!this._paused&&(this._time=this.read(),this._paused=!0,b.clearTimeout(this._call))},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){\"use strict\";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={\"prepared.owl.carousel\":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('<div class=\"'+this._core.settings.dotClass+'\">'+a(b.content).find(\"[data-dot]\").addBack(\"[data-dot]\").attr(\"data-dot\")+\"</div>\")},this),\"added.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),\"remove.owl.carousel\":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),\"changed.owl.carousel\":a.proxy(function(a){a.namespace&&\"position\"==a.property.name&&this.draw()},this),\"initialized.owl.carousel\":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger(\"initialize\",null,\"navigation\"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger(\"initialized\",null,\"navigation\"))},this),\"refreshed.owl.carousel\":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger(\"refresh\",null,\"navigation\"),this.update(),this.draw(),this._core.trigger(\"refreshed\",null,\"navigation\"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:['<span aria-label=\"Previous\">‹</span>','<span aria-label=\"Next\">›</span>'],navSpeed:!1,navElement:'button type=\"button\" role=\"presentation\"',navContainer:!1,navContainerClass:\"owl-nav\",navClass:[\"owl-prev\",\"owl-next\"],slideBy:1,dotClass:\"owl-dot\",dotsClass:\"owl-dots\",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a(\"<div>\").addClass(c.navContainerClass).appendTo(this.$element)).addClass(\"disabled\"),this._controls.$previous=a(\"<\"+c.navElement+\">\").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on(\"click\",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a(\"<\"+c.navElement+\">\").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on(\"click\",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a('<button role=\"button\">').addClass(c.dotClass).append(a(\"<span>\")).prop(\"outerHTML\")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a(\"<div>\").addClass(c.dotsClass).appendTo(this.$element)).addClass(\"disabled\"),this._controls.$absolute.on(\"click\",\"button\",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d,e;e=this._core.settings;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)\"$relative\"===b&&e.navContainer?this._controls[b].html(\"\"):this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))\"function\"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if(\"page\"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||\"page\"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;a<e;a++){if(b>=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length<=c.items,e=this._core.relative(this._core.current()),f=c.loop||c.rewind;this._controls.$relative.toggleClass(\"disabled\",!c.nav||d),c.nav&&(this._controls.$previous.toggleClass(\"disabled\",!f&&e<=this._core.minimum(!0)),this._controls.$next.toggleClass(\"disabled\",!f&&e>=this._core.maximum(!0))),this._controls.$absolute.toggleClass(\"disabled\",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join(\"\")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):b<0&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(\".active\").removeClass(\"active\"),this._controls.$absolute.children().eq(a.inArray(this.current(),this._pages)).addClass(\"active\"))},e.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotsData?1:c.dotsEach||c.items)}},e.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,a.proxy(function(a,c){return a.start<=b&&a.end>=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return\"page\"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;!d&&this._pages.length?(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c)):a.proxy(this._overrides.to,this._core)(b,c)},a.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){\"use strict\";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={\"initialized.owl.carousel\":a.proxy(function(c){c.namespace&&\"URLHash\"===this._core.settings.startPosition&&a(b).trigger(\"hashchange.owl.navigation\")},this),\"prepared.owl.carousel\":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(\"[data-hash]\").addBack(\"[data-hash]\").attr(\"data-hash\");if(!c)return;this._hashes[c]=b.content}},this),\"changed.owl.carousel\":a.proxy(function(c){if(c.namespace&&\"position\"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on(\"hashchange.owl.navigation\",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off(\"hashchange.owl.navigation\");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))\"function\"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+\" \"+h.join(f+\" \")+f).split(\" \"),function(a,b){if(g[b]!==d)return e=!c||b,!1}),e}function f(a){return e(a,!0)}var g=a(\"<support>\").get(0).style,h=\"Webkit Moz O ms\".split(\" \"),i={transition:{end:{WebkitTransition:\"webkitTransitionEnd\",MozTransition:\"transitionend\",OTransition:\"oTransitionEnd\",transition:\"transitionend\"}},animation:{end:{WebkitAnimation:\"webkitAnimationEnd\",MozAnimation:\"animationend\",OAnimation:\"oAnimationEnd\",animation:\"animationend\"}}},j={csstransforms:function(){return!!e(\"transform\")},csstransforms3d:function(){return!!e(\"perspective\")},csstransitions:function(){return!!e(\"transition\")},cssanimations:function(){return!!e(\"animation\")}};j.csstransitions()&&(a.support.transition=new String(f(\"transition\")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f(\"animation\")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f(\"transform\")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document);\n}));\n","Mageplaza_Core/lib/fileUploader/jquery.fileupload-audio.js":"/*\n * jQuery File Upload Audio Preview Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image', 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-process'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(\n require('jquery'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-process')\n );\n } else {\n // Browser globals:\n factory(window.jQuery, window.loadImage);\n }\n})(function ($, loadImage) {\n 'use strict';\n\n // Prepend to the default processQueue:\n $.blueimp.fileupload.prototype.options.processQueue.unshift(\n {\n action: 'loadAudio',\n // Use the action as prefix for the \"@\" options:\n prefix: true,\n fileTypes: '@',\n maxFileSize: '@',\n disabled: '@disableAudioPreview'\n },\n {\n action: 'setAudio',\n name: '@audioPreviewName',\n disabled: '@disableAudioPreview'\n }\n );\n\n // The File Upload Audio Preview plugin extends the fileupload widget\n // with audio preview functionality:\n $.widget('blueimp.fileupload', $.blueimp.fileupload, {\n options: {\n // The regular expression for the types of audio files to load,\n // matched against the file type:\n loadAudioFileTypes: /^audio\\/.*$/\n },\n\n _audioElement: document.createElement('audio'),\n\n processActions: {\n // Loads the audio file given via data.files and data.index\n // as audio element if the browser supports playing it.\n // Accepts the options fileTypes (regular expression)\n // and maxFileSize (integer) to limit the files to load:\n loadAudio: function (data, options) {\n if (options.disabled) {\n return data;\n }\n var file = data.files[data.index],\n url,\n audio;\n if (\n this._audioElement.canPlayType &&\n this._audioElement.canPlayType(file.type) &&\n ($.type(options.maxFileSize) !== 'number' ||\n file.size <= options.maxFileSize) &&\n (!options.fileTypes || options.fileTypes.test(file.type))\n ) {\n url = loadImage.createObjectURL(file);\n if (url) {\n audio = this._audioElement.cloneNode(false);\n audio.src = url;\n audio.controls = true;\n data.audio = audio;\n return data;\n }\n }\n return data;\n },\n\n // Sets the audio element as a property of the file object:\n setAudio: function (data, options) {\n if (data.audio && !options.disabled) {\n data.files[data.index][options.name || 'preview'] = data.audio;\n }\n return data;\n }\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/jquery.fileupload-image.js":"/*\n * jQuery File Upload Image Preview & Resize Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define([\n 'jquery',\n 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image',\n 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta',\n 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-scale',\n 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif',\n 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-orientation',\n 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-canvas-to-blob/js/canvas-to-blob',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-process'\n ], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(\n require('jquery'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-scale'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-orientation'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-canvas-to-blob/js/canvas-to-blob'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-process')\n );\n } else {\n // Browser globals:\n factory(window.jQuery, window.loadImage);\n }\n})(function ($, loadImage) {\n 'use strict';\n\n // Prepend to the default processQueue:\n $.blueimp.fileupload.prototype.options.processQueue.unshift(\n {\n action: 'loadImageMetaData',\n maxMetaDataSize: '@',\n disableImageHead: '@',\n disableMetaDataParsers: '@',\n disableExif: '@',\n disableExifOffsets: '@',\n includeExifTags: '@',\n excludeExifTags: '@',\n disableIptc: '@',\n disableIptcOffsets: '@',\n includeIptcTags: '@',\n excludeIptcTags: '@',\n disabled: '@disableImageMetaDataLoad'\n },\n {\n action: 'loadImage',\n // Use the action as prefix for the \"@\" options:\n prefix: true,\n fileTypes: '@',\n maxFileSize: '@',\n noRevoke: '@',\n disabled: '@disableImageLoad'\n },\n {\n action: 'resizeImage',\n // Use \"image\" as prefix for the \"@\" options:\n prefix: 'image',\n maxWidth: '@',\n maxHeight: '@',\n minWidth: '@',\n minHeight: '@',\n crop: '@',\n orientation: '@',\n forceResize: '@',\n disabled: '@disableImageResize'\n },\n {\n action: 'saveImage',\n quality: '@imageQuality',\n type: '@imageType',\n disabled: '@disableImageResize'\n },\n {\n action: 'saveImageMetaData',\n disabled: '@disableImageMetaDataSave'\n },\n {\n action: 'resizeImage',\n // Use \"preview\" as prefix for the \"@\" options:\n prefix: 'preview',\n maxWidth: '@',\n maxHeight: '@',\n minWidth: '@',\n minHeight: '@',\n crop: '@',\n orientation: '@',\n thumbnail: '@',\n canvas: '@',\n disabled: '@disableImagePreview'\n },\n {\n action: 'setImage',\n name: '@imagePreviewName',\n disabled: '@disableImagePreview'\n },\n {\n action: 'deleteImageReferences',\n disabled: '@disableImageReferencesDeletion'\n }\n );\n\n // The File Upload Resize plugin extends the fileupload widget\n // with image resize functionality:\n $.widget('blueimp.fileupload', $.blueimp.fileupload, {\n options: {\n // The regular expression for the types of images to load:\n // matched against the file type:\n loadImageFileTypes: /^image\\/(gif|jpeg|png|svg\\+xml)$/,\n // The maximum file size of images to load:\n loadImageMaxFileSize: 10000000, // 10MB\n // The maximum width of resized images:\n imageMaxWidth: 1920,\n // The maximum height of resized images:\n imageMaxHeight: 1080,\n // Defines the image orientation (1-8) or takes the orientation\n // value from Exif data if set to true:\n imageOrientation: true,\n // Define if resized images should be cropped or only scaled:\n imageCrop: false,\n // Disable the resize image functionality by default:\n disableImageResize: true,\n // The maximum width of the preview images:\n previewMaxWidth: 80,\n // The maximum height of the preview images:\n previewMaxHeight: 80,\n // Defines the preview orientation (1-8) or takes the orientation\n // value from Exif data if set to true:\n previewOrientation: true,\n // Create the preview using the Exif data thumbnail:\n previewThumbnail: true,\n // Define if preview images should be cropped or only scaled:\n previewCrop: false,\n // Define if preview images should be resized as canvas elements:\n previewCanvas: true\n },\n\n processActions: {\n // Loads the image given via data.files and data.index\n // as img element, if the browser supports the File API.\n // Accepts the options fileTypes (regular expression)\n // and maxFileSize (integer) to limit the files to load:\n loadImage: function (data, options) {\n if (options.disabled) {\n return data;\n }\n var that = this,\n file = data.files[data.index],\n // eslint-disable-next-line new-cap\n dfd = $.Deferred();\n if (\n ($.type(options.maxFileSize) === 'number' &&\n file.size > options.maxFileSize) ||\n (options.fileTypes && !options.fileTypes.test(file.type)) ||\n !loadImage(\n file,\n function (img) {\n if (img.src) {\n data.img = img;\n }\n dfd.resolveWith(that, [data]);\n },\n options\n )\n ) {\n return data;\n }\n return dfd.promise();\n },\n\n // Resizes the image given as data.canvas or data.img\n // and updates data.canvas or data.img with the resized image.\n // Also stores the resized image as preview property.\n // Accepts the options maxWidth, maxHeight, minWidth,\n // minHeight, canvas and crop:\n resizeImage: function (data, options) {\n if (options.disabled || !(data.canvas || data.img)) {\n return data;\n }\n // eslint-disable-next-line no-param-reassign\n options = $.extend({ canvas: true }, options);\n var that = this,\n // eslint-disable-next-line new-cap\n dfd = $.Deferred(),\n img = (options.canvas && data.canvas) || data.img,\n resolve = function (newImg) {\n if (\n newImg &&\n (newImg.width !== img.width ||\n newImg.height !== img.height ||\n options.forceResize)\n ) {\n data[newImg.getContext ? 'canvas' : 'img'] = newImg;\n }\n data.preview = newImg;\n dfd.resolveWith(that, [data]);\n },\n thumbnail,\n thumbnailBlob;\n if (data.exif && options.thumbnail) {\n thumbnail = data.exif.get('Thumbnail');\n thumbnailBlob = thumbnail && thumbnail.get('Blob');\n if (thumbnailBlob) {\n options.orientation = data.exif.get('Orientation');\n loadImage(thumbnailBlob, resolve, options);\n return dfd.promise();\n }\n }\n if (data.orientation) {\n // Prevent orienting the same image twice:\n delete options.orientation;\n } else {\n data.orientation = options.orientation || loadImage.orientation;\n }\n if (img) {\n resolve(loadImage.scale(img, options, data));\n return dfd.promise();\n }\n return data;\n },\n\n // Saves the processed image given as data.canvas\n // inplace at data.index of data.files:\n saveImage: function (data, options) {\n if (!data.canvas || options.disabled) {\n return data;\n }\n var that = this,\n file = data.files[data.index],\n // eslint-disable-next-line new-cap\n dfd = $.Deferred();\n if (data.canvas.toBlob) {\n data.canvas.toBlob(\n function (blob) {\n if (!blob.name) {\n if (file.type === blob.type) {\n blob.name = file.name;\n } else if (file.name) {\n blob.name = file.name.replace(\n /\\.\\w+$/,\n '.' + blob.type.substr(6)\n );\n }\n }\n // Don't restore invalid meta data:\n if (file.type !== blob.type) {\n delete data.imageHead;\n }\n // Store the created blob at the position\n // of the original file in the files list:\n data.files[data.index] = blob;\n dfd.resolveWith(that, [data]);\n },\n options.type || file.type,\n options.quality\n );\n } else {\n return data;\n }\n return dfd.promise();\n },\n\n loadImageMetaData: function (data, options) {\n if (options.disabled) {\n return data;\n }\n var that = this,\n // eslint-disable-next-line new-cap\n dfd = $.Deferred();\n loadImage.parseMetaData(\n data.files[data.index],\n function (result) {\n $.extend(data, result);\n dfd.resolveWith(that, [data]);\n },\n options\n );\n return dfd.promise();\n },\n\n saveImageMetaData: function (data, options) {\n if (\n !(\n data.imageHead &&\n data.canvas &&\n data.canvas.toBlob &&\n !options.disabled\n )\n ) {\n return data;\n }\n var that = this,\n file = data.files[data.index],\n // eslint-disable-next-line new-cap\n dfd = $.Deferred();\n if (data.orientation === true && data.exifOffsets) {\n // Reset Exif Orientation data:\n loadImage.writeExifData(data.imageHead, data, 'Orientation', 1);\n }\n loadImage.replaceHead(file, data.imageHead, function (blob) {\n blob.name = file.name;\n data.files[data.index] = blob;\n dfd.resolveWith(that, [data]);\n });\n return dfd.promise();\n },\n\n // Sets the resized version of the image as a property of the\n // file object, must be called after \"saveImage\":\n setImage: function (data, options) {\n if (data.preview && !options.disabled) {\n data.files[data.index][options.name || 'preview'] = data.preview;\n }\n return data;\n },\n\n deleteImageReferences: function (data, options) {\n if (!options.disabled) {\n delete data.img;\n delete data.canvas;\n delete data.preview;\n delete data.imageHead;\n }\n return data;\n }\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/jquery.iframe-transport.js":"/*\n * jQuery Iframe Transport Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(require('jquery'));\n } else {\n // Browser globals:\n factory(window.jQuery);\n }\n})(function ($) {\n 'use strict';\n\n // Helper variable to create unique names for the transport iframes:\n var counter = 0,\n jsonAPI = $,\n jsonParse = 'parseJSON';\n\n if ('JSON' in window && 'parse' in JSON) {\n jsonAPI = JSON;\n jsonParse = 'parse';\n }\n\n // The iframe transport accepts four additional options:\n // options.fileInput: a jQuery collection of file input fields\n // options.paramName: the parameter name for the file form data,\n // overrides the name property of the file input field(s),\n // can be a string or an array of strings.\n // options.formData: an array of objects with name and value properties,\n // equivalent to the return data of .serializeArray(), e.g.:\n // [{name: 'a', value: 1}, {name: 'b', value: 2}]\n // options.initialIframeSrc: the URL of the initial iframe src,\n // by default set to \"javascript:false;\"\n $.ajaxTransport('iframe', function (options) {\n if (options.async) {\n // javascript:false as initial iframe src\n // prevents warning popups on HTTPS in IE6:\n // eslint-disable-next-line no-script-url\n var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',\n form,\n iframe,\n addParamChar;\n return {\n send: function (_, completeCallback) {\n form = $('<form style=\"display:none;\"></form>');\n form.attr('accept-charset', options.formAcceptCharset);\n addParamChar = /\\?/.test(options.url) ? '&' : '?';\n // XDomainRequest only supports GET and POST:\n if (options.type === 'DELETE') {\n options.url = options.url + addParamChar + '_method=DELETE';\n options.type = 'POST';\n } else if (options.type === 'PUT') {\n options.url = options.url + addParamChar + '_method=PUT';\n options.type = 'POST';\n } else if (options.type === 'PATCH') {\n options.url = options.url + addParamChar + '_method=PATCH';\n options.type = 'POST';\n }\n // IE versions below IE8 cannot set the name property of\n // elements that have already been added to the DOM,\n // so we set the name along with the iframe HTML markup:\n counter += 1;\n iframe = $(\n '<iframe src=\"' +\n initialIframeSrc +\n '\" name=\"iframe-transport-' +\n counter +\n '\"></iframe>'\n ).on('load', function () {\n var fileInputClones,\n paramNames = $.isArray(options.paramName)\n ? options.paramName\n : [options.paramName];\n iframe.off('load').on('load', function () {\n var response;\n // Wrap in a try/catch block to catch exceptions thrown\n // when trying to access cross-domain iframe contents:\n try {\n response = iframe.contents();\n // Google Chrome and Firefox do not throw an\n // exception when calling iframe.contents() on\n // cross-domain requests, so we unify the response:\n if (!response.length || !response[0].firstChild) {\n throw new Error();\n }\n } catch (e) {\n response = undefined;\n }\n // The complete callback returns the\n // iframe content document as response object:\n completeCallback(200, 'success', { iframe: response });\n // Fix for IE endless progress bar activity bug\n // (happens on form submits to iframe targets):\n $('<iframe src=\"' + initialIframeSrc + '\"></iframe>').appendTo(\n form\n );\n window.setTimeout(function () {\n // Removing the form in a setTimeout call\n // allows Chrome's developer tools to display\n // the response result\n form.remove();\n }, 0);\n });\n form\n .prop('target', iframe.prop('name'))\n .prop('action', options.url)\n .prop('method', options.type);\n if (options.formData) {\n $.each(options.formData, function (index, field) {\n $('<input type=\"hidden\"/>')\n .prop('name', field.name)\n .val(field.value)\n .appendTo(form);\n });\n }\n if (\n options.fileInput &&\n options.fileInput.length &&\n options.type === 'POST'\n ) {\n fileInputClones = options.fileInput.clone();\n // Insert a clone for each file input field:\n options.fileInput.after(function (index) {\n return fileInputClones[index];\n });\n if (options.paramName) {\n options.fileInput.each(function (index) {\n $(this).prop('name', paramNames[index] || options.paramName);\n });\n }\n // Appending the file input fields to the hidden form\n // removes them from their original location:\n form\n .append(options.fileInput)\n .prop('enctype', 'multipart/form-data')\n // enctype must be set as encoding for IE:\n .prop('encoding', 'multipart/form-data');\n // Remove the HTML5 form attribute from the input(s):\n options.fileInput.removeAttr('form');\n }\n window.setTimeout(function () {\n // Submitting the form in a setTimeout call fixes an issue with\n // Safari 13 not triggering the iframe load event after resetting\n // the load event handler, see also:\n // https://github.com/blueimp/jQuery-File-Upload/issues/3633\n form.submit();\n // Insert the file input fields at their original location\n // by replacing the clones with the originals:\n if (fileInputClones && fileInputClones.length) {\n options.fileInput.each(function (index, input) {\n var clone = $(fileInputClones[index]);\n // Restore the original name and form properties:\n $(input)\n .prop('name', clone.prop('name'))\n .attr('form', clone.attr('form'));\n clone.replaceWith(input);\n });\n }\n }, 0);\n });\n form.append(iframe).appendTo(document.body);\n },\n abort: function () {\n if (iframe) {\n // javascript:false as iframe src aborts the request\n // and prevents warning popups on HTTPS in IE6.\n iframe.off('load').prop('src', initialIframeSrc);\n }\n if (form) {\n form.remove();\n }\n }\n };\n }\n });\n\n // The iframe transport returns the iframe content document as response.\n // The following adds converters from iframe to text, json, html, xml\n // and script.\n // Please note that the Content-Type for JSON responses has to be text/plain\n // or text/html, if the browser doesn't include application/json in the\n // Accept header, else IE will show a download dialog.\n // The Content-Type for XML responses on the other hand has to be always\n // application/xml or text/xml, so IE properly parses the XML response.\n // See also\n // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation\n $.ajaxSetup({\n converters: {\n 'iframe text': function (iframe) {\n return iframe && $(iframe[0].body).text();\n },\n 'iframe json': function (iframe) {\n return iframe && jsonAPI[jsonParse]($(iframe[0].body).text());\n },\n 'iframe html': function (iframe) {\n return iframe && $(iframe[0].body).html();\n },\n 'iframe xml': function (iframe) {\n var xmlDoc = iframe && iframe[0];\n return xmlDoc && $.isXMLDoc(xmlDoc)\n ? xmlDoc\n : $.parseXML(\n (xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||\n $(xmlDoc.body).html()\n );\n },\n 'iframe script': function (iframe) {\n return iframe && $.globalEval($(iframe[0].body).text());\n }\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/jquery.fileupload-process.js":"/*\n * jQuery File Upload Processing Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2012, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery', 'Mageplaza_Core/lib/fileUploader/jquery.fileupload'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(require('jquery'), require('Mageplaza_Core/lib/fileUploader/jquery.fileupload'));\n } else {\n // Browser globals:\n factory(window.jQuery);\n }\n})(function ($) {\n 'use strict';\n\n var originalAdd = $.blueimp.fileupload.prototype.options.add;\n\n // The File Upload Processing plugin extends the fileupload widget\n // with file processing functionality:\n $.widget('blueimp.fileupload', $.blueimp.fileupload, {\n options: {\n // The list of processing actions:\n processQueue: [\n /*\n {\n action: 'log',\n type: 'debug'\n }\n */\n ],\n add: function (e, data) {\n var $this = $(this);\n data.process(function () {\n return $this.fileupload('process', data);\n });\n originalAdd.call(this, e, data);\n }\n },\n\n processActions: {\n /*\n log: function (data, options) {\n console[options.type](\n 'Processing \"' + data.files[data.index].name + '\"'\n );\n }\n */\n },\n\n _processFile: function (data, originalData) {\n var that = this,\n // eslint-disable-next-line new-cap\n dfd = $.Deferred().resolveWith(that, [data]),\n chain = dfd.promise();\n this._trigger('process', null, data);\n $.each(data.processQueue, function (i, settings) {\n var func = function (data) {\n if (originalData.errorThrown) {\n // eslint-disable-next-line new-cap\n return $.Deferred().rejectWith(that, [originalData]).promise();\n }\n return that.processActions[settings.action].call(\n that,\n data,\n settings\n );\n };\n chain = chain[that._promisePipe](func, settings.always && func);\n });\n chain\n .done(function () {\n that._trigger('processdone', null, data);\n that._trigger('processalways', null, data);\n })\n .fail(function () {\n that._trigger('processfail', null, data);\n that._trigger('processalways', null, data);\n });\n return chain;\n },\n\n // Replaces the settings of each processQueue item that\n // are strings starting with an \"@\", using the remaining\n // substring as key for the option map,\n // e.g. \"@autoUpload\" is replaced with options.autoUpload:\n _transformProcessQueue: function (options) {\n var processQueue = [];\n $.each(options.processQueue, function () {\n var settings = {},\n action = this.action,\n prefix = this.prefix === true ? action : this.prefix;\n $.each(this, function (key, value) {\n if ($.type(value) === 'string' && value.charAt(0) === '@') {\n settings[key] =\n options[\n value.slice(1) ||\n (prefix\n ? prefix + key.charAt(0).toUpperCase() + key.slice(1)\n : key)\n ];\n } else {\n settings[key] = value;\n }\n });\n processQueue.push(settings);\n });\n options.processQueue = processQueue;\n },\n\n // Returns the number of files currently in the processing queue:\n processing: function () {\n return this._processing;\n },\n\n // Processes the files given as files property of the data parameter,\n // returns a Promise object that allows to bind callbacks:\n process: function (data) {\n var that = this,\n options = $.extend({}, this.options, data);\n if (options.processQueue && options.processQueue.length) {\n this._transformProcessQueue(options);\n if (this._processing === 0) {\n this._trigger('processstart');\n }\n $.each(data.files, function (index) {\n var opts = index ? $.extend({}, options) : options,\n func = function () {\n if (data.errorThrown) {\n // eslint-disable-next-line new-cap\n return $.Deferred().rejectWith(that, [data]).promise();\n }\n return that._processFile(opts, data);\n };\n opts.index = index;\n that._processing += 1;\n that._processingQueue = that._processingQueue[that._promisePipe](\n func,\n func\n ).always(function () {\n that._processing -= 1;\n if (that._processing === 0) {\n that._trigger('processstop');\n }\n });\n });\n }\n return this._processingQueue;\n },\n\n _create: function () {\n this._super();\n this._processing = 0;\n // eslint-disable-next-line new-cap\n this._processingQueue = $.Deferred().resolveWith(this).promise();\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/jquery.fileupload-video.js":"/*\n * jQuery File Upload Video Preview Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image', 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-process'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(\n require('jquery'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-process')\n );\n } else {\n // Browser globals:\n factory(window.jQuery, window.loadImage);\n }\n})(function ($, loadImage) {\n 'use strict';\n\n // Prepend to the default processQueue:\n $.blueimp.fileupload.prototype.options.processQueue.unshift(\n {\n action: 'loadVideo',\n // Use the action as prefix for the \"@\" options:\n prefix: true,\n fileTypes: '@',\n maxFileSize: '@',\n disabled: '@disableVideoPreview'\n },\n {\n action: 'setVideo',\n name: '@videoPreviewName',\n disabled: '@disableVideoPreview'\n }\n );\n\n // The File Upload Video Preview plugin extends the fileupload widget\n // with video preview functionality:\n $.widget('blueimp.fileupload', $.blueimp.fileupload, {\n options: {\n // The regular expression for the types of video files to load,\n // matched against the file type:\n loadVideoFileTypes: /^video\\/.*$/\n },\n\n _videoElement: document.createElement('video'),\n\n processActions: {\n // Loads the video file given via data.files and data.index\n // as video element if the browser supports playing it.\n // Accepts the options fileTypes (regular expression)\n // and maxFileSize (integer) to limit the files to load:\n loadVideo: function (data, options) {\n if (options.disabled) {\n return data;\n }\n var file = data.files[data.index],\n url,\n video;\n if (\n this._videoElement.canPlayType &&\n this._videoElement.canPlayType(file.type) &&\n ($.type(options.maxFileSize) !== 'number' ||\n file.size <= options.maxFileSize) &&\n (!options.fileTypes || options.fileTypes.test(file.type))\n ) {\n url = loadImage.createObjectURL(file);\n if (url) {\n video = this._videoElement.cloneNode(false);\n video.src = url;\n video.controls = true;\n data.video = video;\n return data;\n }\n }\n return data;\n },\n\n // Sets the video element as a property of the file object:\n setVideo: function (data, options) {\n if (data.video && !options.disabled) {\n data.files[data.index][options.name || 'preview'] = data.video;\n }\n return data;\n }\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/jquery.fileupload-validate.js":"/*\n * jQuery File Upload Validation Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery', 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-process'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(require('jquery'), require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-process'));\n } else {\n // Browser globals:\n factory(window.jQuery);\n }\n})(function ($) {\n 'use strict';\n\n // Append to the default processQueue:\n $.blueimp.fileupload.prototype.options.processQueue.push({\n action: 'validate',\n // Always trigger this action,\n // even if the previous action was rejected:\n always: true,\n // Options taken from the global options map:\n acceptFileTypes: '@',\n maxFileSize: '@',\n minFileSize: '@',\n maxNumberOfFiles: '@',\n disabled: '@disableValidation'\n });\n\n // The File Upload Validation plugin extends the fileupload widget\n // with file validation functionality:\n $.widget('blueimp.fileupload', $.blueimp.fileupload, {\n options: {\n /*\n // The regular expression for allowed file types, matches\n // against either file type or file name:\n acceptFileTypes: /(\\.|\\/)(gif|jpe?g|png)$/i,\n // The maximum allowed file size in bytes:\n maxFileSize: 10000000, // 10 MB\n // The minimum allowed file size in bytes:\n minFileSize: undefined, // No minimal file size\n // The limit of files to be uploaded:\n maxNumberOfFiles: 10,\n */\n\n // Function returning the current number of files,\n // has to be overridden for maxNumberOfFiles validation:\n getNumberOfFiles: $.noop,\n\n // Error and info messages:\n messages: {\n maxNumberOfFiles: 'Maximum number of files exceeded',\n acceptFileTypes: 'File type not allowed',\n maxFileSize: 'File is too large',\n minFileSize: 'File is too small'\n }\n },\n\n processActions: {\n validate: function (data, options) {\n if (options.disabled) {\n return data;\n }\n // eslint-disable-next-line new-cap\n var dfd = $.Deferred(),\n settings = this.options,\n file = data.files[data.index],\n fileSize;\n if (options.minFileSize || options.maxFileSize) {\n fileSize = file.size;\n }\n if (\n $.type(options.maxNumberOfFiles) === 'number' &&\n (settings.getNumberOfFiles() || 0) + data.files.length >\n options.maxNumberOfFiles\n ) {\n file.error = settings.i18n('maxNumberOfFiles');\n } else if (\n options.acceptFileTypes &&\n !(\n options.acceptFileTypes.test(file.type) ||\n options.acceptFileTypes.test(file.name)\n )\n ) {\n file.error = settings.i18n('acceptFileTypes');\n } else if (fileSize > options.maxFileSize) {\n file.error = settings.i18n('maxFileSize');\n } else if (\n $.type(fileSize) === 'number' &&\n fileSize < options.minFileSize\n ) {\n file.error = settings.i18n('minFileSize');\n } else {\n delete file.error;\n }\n if (file.error || data.files.error) {\n data.files.error = true;\n dfd.rejectWith(this, [data]);\n } else {\n dfd.resolveWith(this, [data]);\n }\n return dfd.promise();\n }\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/jquery.fileuploader.js":"/**\n * Custom Uploader\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define([\n 'jquery',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-image',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-audio',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-video',\n 'Mageplaza_Core/lib/fileUploader/jquery.iframe-transport',\n ], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(\n require('jquery'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-image'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-audio'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-video'),\n require('Mageplaza_Core/lib/fileUploader/jquery.iframe-transport')\n );\n } else {\n // Browser globals:\n factory(window.jQuery);\n }\n})();\n","Mageplaza_Core/lib/fileUploader/jquery.fileupload-ui.js":"/*\n * jQuery File Upload User Interface Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2010, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define([\n 'jquery',\n 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-tmpl/js/tmpl',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-image',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-audio',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-video',\n 'Mageplaza_Core/lib/fileUploader/jquery.fileupload-validate'\n ], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(\n require('jquery'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-tmpl/js/tmpl'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-image'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-audio'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-video'),\n require('Mageplaza_Core/lib/fileUploader/jquery.fileupload-validate')\n );\n } else {\n // Browser globals:\n factory(window.jQuery, window.tmpl);\n }\n})(function ($, tmpl) {\n 'use strict';\n\n $.blueimp.fileupload.prototype._specialOptions.push(\n 'filesContainer',\n 'uploadTemplateId',\n 'downloadTemplateId'\n );\n\n // The UI version extends the file upload widget\n // and adds complete user interface interaction:\n $.widget('blueimp.fileupload', $.blueimp.fileupload, {\n options: {\n // By default, files added to the widget are uploaded as soon\n // as the user clicks on the start buttons. To enable automatic\n // uploads, set the following option to true:\n autoUpload: false,\n // The class to show/hide UI elements:\n showElementClass: 'in',\n // The ID of the upload template:\n uploadTemplateId: 'template-upload',\n // The ID of the download template:\n downloadTemplateId: 'template-download',\n // The container for the list of files. If undefined, it is set to\n // an element with class \"files\" inside of the widget element:\n filesContainer: undefined,\n // By default, files are appended to the files container.\n // Set the following option to true, to prepend files instead:\n prependFiles: false,\n // The expected data type of the upload response, sets the dataType\n // option of the $.ajax upload requests:\n dataType: 'json',\n\n // Error and info messages:\n messages: {\n unknownError: 'Unknown error'\n },\n\n // Function returning the current number of files,\n // used by the maxNumberOfFiles validation:\n getNumberOfFiles: function () {\n return this.filesContainer.children().not('.processing').length;\n },\n\n // Callback to retrieve the list of files from the server response:\n getFilesFromResponse: function (data) {\n if (data.result && $.isArray(data.result.files)) {\n return data.result.files;\n }\n return [];\n },\n\n // The add callback is invoked as soon as files are added to the fileupload\n // widget (via file input selection, drag & drop or add API call).\n // See the basic file upload widget for more information:\n add: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var $this = $(this),\n that = $this.data('blueimp-fileupload') || $this.data('fileupload'),\n options = that.options;\n data.context = that\n ._renderUpload(data.files)\n .data('data', data)\n .addClass('processing');\n options.filesContainer[options.prependFiles ? 'prepend' : 'append'](\n data.context\n );\n that._forceReflow(data.context);\n that._transition(data.context);\n data\n .process(function () {\n return $this.fileupload('process', data);\n })\n .always(function () {\n data.context\n .each(function (index) {\n $(this)\n .find('.size')\n .text(that._formatFileSize(data.files[index].size));\n })\n .removeClass('processing');\n that._renderPreviews(data);\n })\n .done(function () {\n data.context.find('.edit,.start').prop('disabled', false);\n if (\n that._trigger('added', e, data) !== false &&\n (options.autoUpload || data.autoUpload) &&\n data.autoUpload !== false\n ) {\n data.submit();\n }\n })\n .fail(function () {\n if (data.files.error) {\n data.context.each(function (index) {\n var error = data.files[index].error;\n if (error) {\n $(this).find('.error').text(error);\n }\n });\n }\n });\n },\n // Callback for the start of each file upload request:\n send: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var that =\n $(this).data('blueimp-fileupload') || $(this).data('fileupload');\n if (\n data.context &&\n data.dataType &&\n data.dataType.substr(0, 6) === 'iframe'\n ) {\n // Iframe Transport does not support progress events.\n // In lack of an indeterminate progress bar, we set\n // the progress to 100%, showing the full animated bar:\n data.context\n .find('.progress')\n .addClass(!$.support.transition && 'progress-animated')\n .attr('aria-valuenow', 100)\n .children()\n .first()\n .css('width', '100%');\n }\n return that._trigger('sent', e, data);\n },\n // Callback for successful uploads:\n done: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var that =\n $(this).data('blueimp-fileupload') || $(this).data('fileupload'),\n getFilesFromResponse =\n data.getFilesFromResponse || that.options.getFilesFromResponse,\n files = getFilesFromResponse(data),\n template,\n deferred;\n if (data.context) {\n data.context.each(function (index) {\n var file = files[index] || { error: 'Empty file upload result' };\n deferred = that._addFinishedDeferreds();\n that._transition($(this)).done(function () {\n var node = $(this);\n template = that._renderDownload([file]).replaceAll(node);\n that._forceReflow(template);\n that._transition(template).done(function () {\n data.context = $(this);\n that._trigger('completed', e, data);\n that._trigger('finished', e, data);\n deferred.resolve();\n });\n });\n });\n } else {\n template = that\n ._renderDownload(files)\n [that.options.prependFiles ? 'prependTo' : 'appendTo'](\n that.options.filesContainer\n );\n that._forceReflow(template);\n deferred = that._addFinishedDeferreds();\n that._transition(template).done(function () {\n data.context = $(this);\n that._trigger('completed', e, data);\n that._trigger('finished', e, data);\n deferred.resolve();\n });\n }\n },\n // Callback for failed (abort or error) uploads:\n fail: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var that =\n $(this).data('blueimp-fileupload') || $(this).data('fileupload'),\n template,\n deferred;\n if (data.context) {\n data.context.each(function (index) {\n if (data.errorThrown !== 'abort') {\n var file = data.files[index];\n file.error =\n file.error || data.errorThrown || data.i18n('unknownError');\n deferred = that._addFinishedDeferreds();\n that._transition($(this)).done(function () {\n var node = $(this);\n template = that._renderDownload([file]).replaceAll(node);\n that._forceReflow(template);\n that._transition(template).done(function () {\n data.context = $(this);\n that._trigger('failed', e, data);\n that._trigger('finished', e, data);\n deferred.resolve();\n });\n });\n } else {\n deferred = that._addFinishedDeferreds();\n that._transition($(this)).done(function () {\n $(this).remove();\n that._trigger('failed', e, data);\n that._trigger('finished', e, data);\n deferred.resolve();\n });\n }\n });\n } else if (data.errorThrown !== 'abort') {\n data.context = that\n ._renderUpload(data.files)\n [that.options.prependFiles ? 'prependTo' : 'appendTo'](\n that.options.filesContainer\n )\n .data('data', data);\n that._forceReflow(data.context);\n deferred = that._addFinishedDeferreds();\n that._transition(data.context).done(function () {\n data.context = $(this);\n that._trigger('failed', e, data);\n that._trigger('finished', e, data);\n deferred.resolve();\n });\n } else {\n that._trigger('failed', e, data);\n that._trigger('finished', e, data);\n that._addFinishedDeferreds().resolve();\n }\n },\n // Callback for upload progress events:\n progress: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var progress = Math.floor((data.loaded / data.total) * 100);\n if (data.context) {\n data.context.each(function () {\n $(this)\n .find('.progress')\n .attr('aria-valuenow', progress)\n .children()\n .first()\n .css('width', progress + '%');\n });\n }\n },\n // Callback for global upload progress events:\n progressall: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var $this = $(this),\n progress = Math.floor((data.loaded / data.total) * 100),\n globalProgressNode = $this.find('.fileupload-progress'),\n extendedProgressNode = globalProgressNode.find('.progress-extended');\n if (extendedProgressNode.length) {\n extendedProgressNode.html(\n (\n $this.data('blueimp-fileupload') || $this.data('fileupload')\n )._renderExtendedProgress(data)\n );\n }\n globalProgressNode\n .find('.progress')\n .attr('aria-valuenow', progress)\n .children()\n .first()\n .css('width', progress + '%');\n },\n // Callback for uploads start, equivalent to the global ajaxStart event:\n start: function (e) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var that =\n $(this).data('blueimp-fileupload') || $(this).data('fileupload');\n that._resetFinishedDeferreds();\n that\n ._transition($(this).find('.fileupload-progress'))\n .done(function () {\n that._trigger('started', e);\n });\n },\n // Callback for uploads stop, equivalent to the global ajaxStop event:\n stop: function (e) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var that =\n $(this).data('blueimp-fileupload') || $(this).data('fileupload'),\n deferred = that._addFinishedDeferreds();\n $.when.apply($, that._getFinishedDeferreds()).done(function () {\n that._trigger('stopped', e);\n });\n that\n ._transition($(this).find('.fileupload-progress'))\n .done(function () {\n $(this)\n .find('.progress')\n .attr('aria-valuenow', '0')\n .children()\n .first()\n .css('width', '0%');\n $(this).find('.progress-extended').html(' ');\n deferred.resolve();\n });\n },\n processstart: function (e) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n $(this).addClass('fileupload-processing');\n },\n processstop: function (e) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n $(this).removeClass('fileupload-processing');\n },\n // Callback for file deletion:\n destroy: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n var that =\n $(this).data('blueimp-fileupload') || $(this).data('fileupload'),\n removeNode = function () {\n that._transition(data.context).done(function () {\n $(this).remove();\n that._trigger('destroyed', e, data);\n });\n };\n if (data.url) {\n data.dataType = data.dataType || that.options.dataType;\n $.ajax(data)\n .done(removeNode)\n .fail(function () {\n that._trigger('destroyfailed', e, data);\n });\n } else {\n removeNode();\n }\n }\n },\n\n _resetFinishedDeferreds: function () {\n this._finishedUploads = [];\n },\n\n _addFinishedDeferreds: function (deferred) {\n // eslint-disable-next-line new-cap\n var promise = deferred || $.Deferred();\n this._finishedUploads.push(promise);\n return promise;\n },\n\n _getFinishedDeferreds: function () {\n return this._finishedUploads;\n },\n\n // Link handler, that allows to download files\n // by drag & drop of the links to the desktop:\n _enableDragToDesktop: function () {\n var link = $(this),\n url = link.prop('href'),\n name = link.prop('download'),\n type = 'application/octet-stream';\n link.on('dragstart', function (e) {\n try {\n e.originalEvent.dataTransfer.setData(\n 'DownloadURL',\n [type, name, url].join(':')\n );\n } catch (ignore) {\n // Ignore exceptions\n }\n });\n },\n\n _formatFileSize: function (bytes) {\n if (typeof bytes !== 'number') {\n return '';\n }\n if (bytes >= 1000000000) {\n return (bytes / 1000000000).toFixed(2) + ' GB';\n }\n if (bytes >= 1000000) {\n return (bytes / 1000000).toFixed(2) + ' MB';\n }\n return (bytes / 1000).toFixed(2) + ' KB';\n },\n\n _formatBitrate: function (bits) {\n if (typeof bits !== 'number') {\n return '';\n }\n if (bits >= 1000000000) {\n return (bits / 1000000000).toFixed(2) + ' Gbit/s';\n }\n if (bits >= 1000000) {\n return (bits / 1000000).toFixed(2) + ' Mbit/s';\n }\n if (bits >= 1000) {\n return (bits / 1000).toFixed(2) + ' kbit/s';\n }\n return bits.toFixed(2) + ' bit/s';\n },\n\n _formatTime: function (seconds) {\n var date = new Date(seconds * 1000),\n days = Math.floor(seconds / 86400);\n days = days ? days + 'd ' : '';\n return (\n days +\n ('0' + date.getUTCHours()).slice(-2) +\n ':' +\n ('0' + date.getUTCMinutes()).slice(-2) +\n ':' +\n ('0' + date.getUTCSeconds()).slice(-2)\n );\n },\n\n _formatPercentage: function (floatValue) {\n return (floatValue * 100).toFixed(2) + ' %';\n },\n\n _renderExtendedProgress: function (data) {\n return (\n this._formatBitrate(data.bitrate) +\n ' | ' +\n this._formatTime(((data.total - data.loaded) * 8) / data.bitrate) +\n ' | ' +\n this._formatPercentage(data.loaded / data.total) +\n ' | ' +\n this._formatFileSize(data.loaded) +\n ' / ' +\n this._formatFileSize(data.total)\n );\n },\n\n _renderTemplate: function (func, files) {\n if (!func) {\n return $();\n }\n var result = func({\n files: files,\n formatFileSize: this._formatFileSize,\n options: this.options\n });\n if (result instanceof $) {\n return result;\n }\n return $(this.options.templatesContainer).html(result).children();\n },\n\n _renderPreviews: function (data) {\n data.context.find('.preview').each(function (index, elm) {\n $(elm).empty().append(data.files[index].preview);\n });\n },\n\n _renderUpload: function (files) {\n return this._renderTemplate(this.options.uploadTemplate, files);\n },\n\n _renderDownload: function (files) {\n return this._renderTemplate(this.options.downloadTemplate, files)\n .find('a[download]')\n .each(this._enableDragToDesktop)\n .end();\n },\n\n _editHandler: function (e) {\n e.preventDefault();\n if (!this.options.edit) return;\n var that = this,\n button = $(e.currentTarget),\n template = button.closest('.template-upload'),\n data = template.data('data'),\n index = button.data().index;\n this.options.edit(data.files[index]).then(function (file) {\n if (!file) return;\n data.files[index] = file;\n data.context.addClass('processing');\n template.find('.edit,.start').prop('disabled', true);\n $(that.element)\n .fileupload('process', data)\n .always(function () {\n template\n .find('.size')\n .text(that._formatFileSize(data.files[index].size));\n data.context.removeClass('processing');\n that._renderPreviews(data);\n })\n .done(function () {\n template.find('.edit,.start').prop('disabled', false);\n })\n .fail(function () {\n template.find('.edit').prop('disabled', false);\n var error = data.files[index].error;\n if (error) {\n template.find('.error').text(error);\n }\n });\n });\n },\n\n _startHandler: function (e) {\n e.preventDefault();\n var button = $(e.currentTarget),\n template = button.closest('.template-upload'),\n data = template.data('data');\n button.prop('disabled', true);\n if (data && data.submit) {\n data.submit();\n }\n },\n\n _cancelHandler: function (e) {\n e.preventDefault();\n var template = $(e.currentTarget).closest(\n '.template-upload,.template-download'\n ),\n data = template.data('data') || {};\n data.context = data.context || template;\n if (data.abort) {\n data.abort();\n } else {\n data.errorThrown = 'abort';\n this._trigger('fail', e, data);\n }\n },\n\n _deleteHandler: function (e) {\n e.preventDefault();\n var button = $(e.currentTarget);\n this._trigger(\n 'destroy',\n e,\n $.extend(\n {\n context: button.closest('.template-download'),\n type: 'DELETE'\n },\n button.data()\n )\n );\n },\n\n _forceReflow: function (node) {\n return $.support.transition && node.length && node[0].offsetWidth;\n },\n\n _transition: function (node) {\n // eslint-disable-next-line new-cap\n var dfd = $.Deferred();\n if (\n $.support.transition &&\n node.hasClass('fade') &&\n node.is(':visible')\n ) {\n var transitionEndHandler = function (e) {\n // Make sure we don't respond to other transition events\n // in the container element, e.g. from button elements:\n if (e.target === node[0]) {\n node.off($.support.transition.end, transitionEndHandler);\n dfd.resolveWith(node);\n }\n };\n node\n .on($.support.transition.end, transitionEndHandler)\n .toggleClass(this.options.showElementClass);\n } else {\n node.toggleClass(this.options.showElementClass);\n dfd.resolveWith(node);\n }\n return dfd;\n },\n\n _initButtonBarEventHandlers: function () {\n var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),\n filesList = this.options.filesContainer;\n this._on(fileUploadButtonBar.find('.start'), {\n click: function (e) {\n e.preventDefault();\n filesList.find('.start').trigger('click');\n }\n });\n this._on(fileUploadButtonBar.find('.cancel'), {\n click: function (e) {\n e.preventDefault();\n filesList.find('.cancel').trigger('click');\n }\n });\n this._on(fileUploadButtonBar.find('.delete'), {\n click: function (e) {\n e.preventDefault();\n filesList\n .find('.toggle:checked')\n .closest('.template-download')\n .find('.delete')\n .trigger('click');\n fileUploadButtonBar.find('.toggle').prop('checked', false);\n }\n });\n this._on(fileUploadButtonBar.find('.toggle'), {\n change: function (e) {\n filesList\n .find('.toggle')\n .prop('checked', $(e.currentTarget).is(':checked'));\n }\n });\n },\n\n _destroyButtonBarEventHandlers: function () {\n this._off(\n this.element\n .find('.fileupload-buttonbar')\n .find('.start, .cancel, .delete'),\n 'click'\n );\n this._off(this.element.find('.fileupload-buttonbar .toggle'), 'change.');\n },\n\n _initEventHandlers: function () {\n this._super();\n this._on(this.options.filesContainer, {\n 'click .edit': this._editHandler,\n 'click .start': this._startHandler,\n 'click .cancel': this._cancelHandler,\n 'click .delete': this._deleteHandler\n });\n this._initButtonBarEventHandlers();\n },\n\n _destroyEventHandlers: function () {\n this._destroyButtonBarEventHandlers();\n this._off(this.options.filesContainer, 'click');\n this._super();\n },\n\n _enableFileInputButton: function () {\n this.element\n .find('.fileinput-button input')\n .prop('disabled', false)\n .parent()\n .removeClass('disabled');\n },\n\n _disableFileInputButton: function () {\n this.element\n .find('.fileinput-button input')\n .prop('disabled', true)\n .parent()\n .addClass('disabled');\n },\n\n _initTemplates: function () {\n var options = this.options;\n options.templatesContainer = this.document[0].createElement(\n options.filesContainer.prop('nodeName')\n );\n if (tmpl) {\n if (options.uploadTemplateId) {\n options.uploadTemplate = tmpl(options.uploadTemplateId);\n }\n if (options.downloadTemplateId) {\n options.downloadTemplate = tmpl(options.downloadTemplateId);\n }\n }\n },\n\n _initFilesContainer: function () {\n var options = this.options;\n if (options.filesContainer === undefined) {\n options.filesContainer = this.element.find('.files');\n } else if (!(options.filesContainer instanceof $)) {\n options.filesContainer = $(options.filesContainer);\n }\n },\n\n _initSpecialOptions: function () {\n this._super();\n this._initFilesContainer();\n // this._initTemplates();\n },\n\n _create: function () {\n this._super();\n this._resetFinishedDeferreds();\n if (!$.support.fileInput) {\n this._disableFileInputButton();\n }\n },\n\n enable: function () {\n var wasDisabled = false;\n if (this.options.disabled) {\n wasDisabled = true;\n }\n this._super();\n if (wasDisabled) {\n this.element.find('input, button').prop('disabled', false);\n this._enableFileInputButton();\n }\n },\n\n disable: function () {\n if (!this.options.disabled) {\n this.element.find('input, button').prop('disabled', true);\n this._disableFileInputButton();\n }\n this._super();\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/jquery.fileupload.js":"/*\n * jQuery File Upload Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2010, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n/* eslint-disable new-cap */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery', 'Mageplaza_Core/lib/fileUploader/vendor/jquery.ui.widget'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(require('jquery'), require('Mageplaza_Core/lib/fileUploader/vendor/jquery.ui.widget'));\n } else {\n // Browser globals:\n factory(window.jQuery);\n }\n})(function ($) {\n 'use strict';\n\n // Detect file input support, based on\n // https://viljamis.com/2012/file-upload-support-on-mobile/\n $.support.fileInput = !(\n new RegExp(\n // Handle devices which give false positives for the feature detection:\n '(Android (1\\\\.[0156]|2\\\\.[01]))' +\n '|(Windows Phone (OS 7|8\\\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +\n '|(w(eb)?OSBrowser)|(webOS)' +\n '|(Kindle/(1\\\\.0|2\\\\.[05]|3\\\\.0))'\n ).test(window.navigator.userAgent) ||\n // Feature detection for all other devices:\n $('<input type=\"file\"/>').prop('disabled')\n );\n\n // The FileReader API is not actually used, but works as feature detection,\n // as some Safari versions (5?) support XHR file uploads via the FormData API,\n // but not non-multipart XHR file uploads.\n // window.XMLHttpRequestUpload is not available on IE10, so we check for\n // window.ProgressEvent instead to detect XHR2 file upload capability:\n $.support.xhrFileUpload = !!(window.ProgressEvent && window.FileReader);\n $.support.xhrFormDataFileUpload = !!window.FormData;\n\n // Detect support for Blob slicing (required for chunked uploads):\n $.support.blobSlice =\n window.Blob &&\n (Blob.prototype.slice ||\n Blob.prototype.webkitSlice ||\n Blob.prototype.mozSlice);\n\n /**\n * Helper function to create drag handlers for dragover/dragenter/dragleave\n *\n * @param {string} type Event type\n * @returns {Function} Drag handler\n */\n function getDragHandler(type) {\n var isDragOver = type === 'dragover';\n return function (e) {\n e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;\n var dataTransfer = e.dataTransfer;\n if (\n dataTransfer &&\n $.inArray('Files', dataTransfer.types) !== -1 &&\n this._trigger(type, $.Event(type, { delegatedEvent: e })) !== false\n ) {\n e.preventDefault();\n if (isDragOver) {\n dataTransfer.dropEffect = 'copy';\n }\n }\n };\n }\n\n // The fileupload widget listens for change events on file input fields defined\n // via fileInput setting and paste or drop events of the given dropZone.\n // In addition to the default jQuery Widget methods, the fileupload widget\n // exposes the \"add\" and \"send\" methods, to add or directly send files using\n // the fileupload API.\n // By default, files added via file input selection, paste, drag & drop or\n // \"add\" method are uploaded immediately, but it is possible to override\n // the \"add\" callback option to queue file uploads.\n $.widget('blueimp.fileupload', {\n options: {\n // The drop target element(s), by the default the complete document.\n // Set to null to disable drag & drop support:\n dropZone: $(document),\n // The paste target element(s), by the default undefined.\n // Set to a DOM node or jQuery object to enable file pasting:\n pasteZone: undefined,\n // The file input field(s), that are listened to for change events.\n // If undefined, it is set to the file input fields inside\n // of the widget element on plugin initialization.\n // Set to null to disable the change listener.\n fileInput: undefined,\n // By default, the file input field is replaced with a clone after\n // each input field change event. This is required for iframe transport\n // queues and allows change events to be fired for the same file\n // selection, but can be disabled by setting the following option to false:\n replaceFileInput: true,\n // The parameter name for the file form data (the request argument name).\n // If undefined or empty, the name property of the file input field is\n // used, or \"files[]\" if the file input name property is also empty,\n // can be a string or an array of strings:\n paramName: undefined,\n // By default, each file of a selection is uploaded using an individual\n // request for XHR type uploads. Set to false to upload file\n // selections in one request each:\n singleFileUploads: true,\n // To limit the number of files uploaded with one XHR request,\n // set the following option to an integer greater than 0:\n limitMultiFileUploads: undefined,\n // The following option limits the number of files uploaded with one\n // XHR request to keep the request size under or equal to the defined\n // limit in bytes:\n limitMultiFileUploadSize: undefined,\n // Multipart file uploads add a number of bytes to each uploaded file,\n // therefore the following option adds an overhead for each file used\n // in the limitMultiFileUploadSize configuration:\n limitMultiFileUploadSizeOverhead: 512,\n // Set the following option to true to issue all file upload requests\n // in a sequential order:\n sequentialUploads: false,\n // To limit the number of concurrent uploads,\n // set the following option to an integer greater than 0:\n limitConcurrentUploads: undefined,\n // Set the following option to true to force iframe transport uploads:\n forceIframeTransport: false,\n // Set the following option to the location of a redirect url on the\n // origin server, for cross-domain iframe transport uploads:\n redirect: undefined,\n // The parameter name for the redirect url, sent as part of the form\n // data and set to 'redirect' if this option is empty:\n redirectParamName: undefined,\n // Set the following option to the location of a postMessage window,\n // to enable postMessage transport uploads:\n postMessage: undefined,\n // By default, XHR file uploads are sent as multipart/form-data.\n // The iframe transport is always using multipart/form-data.\n // Set to false to enable non-multipart XHR uploads:\n multipart: true,\n // To upload large files in smaller chunks, set the following option\n // to a preferred maximum chunk size. If set to 0, null or undefined,\n // or the browser does not support the required Blob API, files will\n // be uploaded as a whole.\n maxChunkSize: undefined,\n // When a non-multipart upload or a chunked multipart upload has been\n // aborted, this option can be used to resume the upload by setting\n // it to the size of the already uploaded bytes. This option is most\n // useful when modifying the options object inside of the \"add\" or\n // \"send\" callbacks, as the options are cloned for each file upload.\n uploadedBytes: undefined,\n // By default, failed (abort or error) file uploads are removed from the\n // global progress calculation. Set the following option to false to\n // prevent recalculating the global progress data:\n recalculateProgress: true,\n // Interval in milliseconds to calculate and trigger progress events:\n progressInterval: 100,\n // Interval in milliseconds to calculate progress bitrate:\n bitrateInterval: 500,\n // By default, uploads are started automatically when adding files:\n autoUpload: true,\n // By default, duplicate file names are expected to be handled on\n // the server-side. If this is not possible (e.g. when uploading\n // files directly to Amazon S3), the following option can be set to\n // an empty object or an object mapping existing filenames, e.g.:\n // { \"image.jpg\": true, \"image (1).jpg\": true }\n // If it is set, all files will be uploaded with unique filenames,\n // adding increasing number suffixes if necessary, e.g.:\n // \"image (2).jpg\"\n uniqueFilenames: undefined,\n\n // Error and info messages:\n messages: {\n uploadedBytes: 'Uploaded bytes exceed file size'\n },\n\n // Translation function, gets the message key to be translated\n // and an object with context specific data as arguments:\n i18n: function (message, context) {\n // eslint-disable-next-line no-param-reassign\n message = this.messages[message] || message.toString();\n if (context) {\n $.each(context, function (key, value) {\n // eslint-disable-next-line no-param-reassign\n message = message.replace('{' + key + '}', value);\n });\n }\n return message;\n },\n\n // Additional form data to be sent along with the file uploads can be set\n // using this option, which accepts an array of objects with name and\n // value properties, a function returning such an array, a FormData\n // object (for XHR file uploads), or a simple object.\n // The form of the first fileInput is given as parameter to the function:\n formData: function (form) {\n return form.serializeArray();\n },\n\n // The add callback is invoked as soon as files are added to the fileupload\n // widget (via file input selection, drag & drop, paste or add API call).\n // If the singleFileUploads option is enabled, this callback will be\n // called once for each file in the selection for XHR file uploads, else\n // once for each file selection.\n //\n // The upload starts when the submit method is invoked on the data parameter.\n // The data object contains a files property holding the added files\n // and allows you to override plugin options as well as define ajax settings.\n //\n // Listeners for this callback can also be bound the following way:\n // .on('fileuploadadd', func);\n //\n // data.submit() returns a Promise object and allows to attach additional\n // handlers using jQuery's Deferred callbacks:\n // data.submit().done(func).fail(func).always(func);\n add: function (e, data) {\n if (e.isDefaultPrevented()) {\n return false;\n }\n if (\n data.autoUpload ||\n (data.autoUpload !== false &&\n $(this).fileupload('option', 'autoUpload'))\n ) {\n data.process().done(function () {\n data.submit();\n });\n }\n },\n\n // Other callbacks:\n\n // Callback for the submit event of each file upload:\n // submit: function (e, data) {}, // .on('fileuploadsubmit', func);\n\n // Callback for the start of each file upload request:\n // send: function (e, data) {}, // .on('fileuploadsend', func);\n\n // Callback for successful uploads:\n // done: function (e, data) {}, // .on('fileuploaddone', func);\n\n // Callback for failed (abort or error) uploads:\n // fail: function (e, data) {}, // .on('fileuploadfail', func);\n\n // Callback for completed (success, abort or error) requests:\n // always: function (e, data) {}, // .on('fileuploadalways', func);\n\n // Callback for upload progress events:\n // progress: function (e, data) {}, // .on('fileuploadprogress', func);\n\n // Callback for global upload progress events:\n // progressall: function (e, data) {}, // .on('fileuploadprogressall', func);\n\n // Callback for uploads start, equivalent to the global ajaxStart event:\n // start: function (e) {}, // .on('fileuploadstart', func);\n\n // Callback for uploads stop, equivalent to the global ajaxStop event:\n // stop: function (e) {}, // .on('fileuploadstop', func);\n\n // Callback for change events of the fileInput(s):\n // change: function (e, data) {}, // .on('fileuploadchange', func);\n\n // Callback for paste events to the pasteZone(s):\n // paste: function (e, data) {}, // .on('fileuploadpaste', func);\n\n // Callback for drop events of the dropZone(s):\n // drop: function (e, data) {}, // .on('fileuploaddrop', func);\n\n // Callback for dragover events of the dropZone(s):\n // dragover: function (e) {}, // .on('fileuploaddragover', func);\n\n // Callback before the start of each chunk upload request (before form data initialization):\n // chunkbeforesend: function (e, data) {}, // .on('fileuploadchunkbeforesend', func);\n\n // Callback for the start of each chunk upload request:\n // chunksend: function (e, data) {}, // .on('fileuploadchunksend', func);\n\n // Callback for successful chunk uploads:\n // chunkdone: function (e, data) {}, // .on('fileuploadchunkdone', func);\n\n // Callback for failed (abort or error) chunk uploads:\n // chunkfail: function (e, data) {}, // .on('fileuploadchunkfail', func);\n\n // Callback for completed (success, abort or error) chunk upload requests:\n // chunkalways: function (e, data) {}, // .on('fileuploadchunkalways', func);\n\n // The plugin options are used as settings object for the ajax calls.\n // The following are jQuery ajax settings required for the file uploads:\n processData: false,\n contentType: false,\n cache: false,\n timeout: 0\n },\n\n // jQuery versions before 1.8 require promise.pipe if the return value is\n // used, as promise.then in older versions has a different behavior, see:\n // https://blog.jquery.com/2012/08/09/jquery-1-8-released/\n // https://bugs.jquery.com/ticket/11010\n // https://github.com/blueimp/jQuery-File-Upload/pull/3435\n _promisePipe: (function () {\n var parts = $.fn.jquery.split('.');\n return Number(parts[0]) > 1 || Number(parts[1]) > 7 ? 'then' : 'pipe';\n })(),\n\n // A list of options that require reinitializing event listeners and/or\n // special initialization code:\n _specialOptions: [\n 'fileInput',\n 'dropZone',\n 'pasteZone',\n 'multipart',\n 'forceIframeTransport'\n ],\n\n _blobSlice:\n $.support.blobSlice &&\n function () {\n var slice = this.slice || this.webkitSlice || this.mozSlice;\n return slice.apply(this, arguments);\n },\n\n _BitrateTimer: function () {\n this.timestamp = Date.now ? Date.now() : new Date().getTime();\n this.loaded = 0;\n this.bitrate = 0;\n this.getBitrate = function (now, loaded, interval) {\n var timeDiff = now - this.timestamp;\n if (!this.bitrate || !interval || timeDiff > interval) {\n this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;\n this.loaded = loaded;\n this.timestamp = now;\n }\n return this.bitrate;\n };\n },\n\n _isXHRUpload: function (options) {\n return (\n !options.forceIframeTransport &&\n ((!options.multipart && $.support.xhrFileUpload) ||\n $.support.xhrFormDataFileUpload)\n );\n },\n\n _getFormData: function (options) {\n var formData;\n if ($.type(options.formData) === 'function') {\n return options.formData(options.form);\n }\n if ($.isArray(options.formData)) {\n return options.formData;\n }\n if ($.type(options.formData) === 'object') {\n formData = [];\n $.each(options.formData, function (name, value) {\n formData.push({ name: name, value: value });\n });\n return formData;\n }\n return [];\n },\n\n _getTotal: function (files) {\n var total = 0;\n $.each(files, function (index, file) {\n total += file.size || 1;\n });\n return total;\n },\n\n _initProgressObject: function (obj) {\n var progress = {\n loaded: 0,\n total: 0,\n bitrate: 0\n };\n if (obj._progress) {\n $.extend(obj._progress, progress);\n } else {\n obj._progress = progress;\n }\n },\n\n _initResponseObject: function (obj) {\n var prop;\n if (obj._response) {\n for (prop in obj._response) {\n if (Object.prototype.hasOwnProperty.call(obj._response, prop)) {\n delete obj._response[prop];\n }\n }\n } else {\n obj._response = {};\n }\n },\n\n _onProgress: function (e, data) {\n if (e.lengthComputable) {\n var now = Date.now ? Date.now() : new Date().getTime(),\n loaded;\n if (\n data._time &&\n data.progressInterval &&\n now - data._time < data.progressInterval &&\n e.loaded !== e.total\n ) {\n return;\n }\n data._time = now;\n loaded =\n Math.floor(\n (e.loaded / e.total) * (data.chunkSize || data._progress.total)\n ) + (data.uploadedBytes || 0);\n // Add the difference from the previously loaded state\n // to the global loaded counter:\n this._progress.loaded += loaded - data._progress.loaded;\n this._progress.bitrate = this._bitrateTimer.getBitrate(\n now,\n this._progress.loaded,\n data.bitrateInterval\n );\n data._progress.loaded = data.loaded = loaded;\n data._progress.bitrate = data.bitrate = data._bitrateTimer.getBitrate(\n now,\n loaded,\n data.bitrateInterval\n );\n // Trigger a custom progress event with a total data property set\n // to the file size(s) of the current upload and a loaded data\n // property calculated accordingly:\n this._trigger(\n 'progress',\n $.Event('progress', { delegatedEvent: e }),\n data\n );\n // Trigger a global progress event for all current file uploads,\n // including ajax calls queued for sequential file uploads:\n this._trigger(\n 'progressall',\n $.Event('progressall', { delegatedEvent: e }),\n this._progress\n );\n }\n },\n\n _initProgressListener: function (options) {\n var that = this,\n xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();\n // Access to the native XHR object is required to add event listeners\n // for the upload progress event:\n if (xhr.upload) {\n $(xhr.upload).on('progress', function (e) {\n var oe = e.originalEvent;\n // Make sure the progress event properties get copied over:\n e.lengthComputable = oe.lengthComputable;\n e.loaded = oe.loaded;\n e.total = oe.total;\n that._onProgress(e, options);\n });\n options.xhr = function () {\n return xhr;\n };\n }\n },\n\n _deinitProgressListener: function (options) {\n var xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();\n if (xhr.upload) {\n $(xhr.upload).off('progress');\n }\n },\n\n _isInstanceOf: function (type, obj) {\n // Cross-frame instanceof check\n return Object.prototype.toString.call(obj) === '[object ' + type + ']';\n },\n\n _getUniqueFilename: function (name, map) {\n // eslint-disable-next-line no-param-reassign\n name = String(name);\n if (map[name]) {\n // eslint-disable-next-line no-param-reassign\n name = name.replace(\n /(?: \\(([\\d]+)\\))?(\\.[^.]+)?$/,\n function (_, p1, p2) {\n var index = p1 ? Number(p1) + 1 : 1;\n var ext = p2 || '';\n return ' (' + index + ')' + ext;\n }\n );\n return this._getUniqueFilename(name, map);\n }\n map[name] = true;\n return name;\n },\n\n _initXHRData: function (options) {\n var that = this,\n formData,\n file = options.files[0],\n // Ignore non-multipart setting if not supported:\n multipart = options.multipart || !$.support.xhrFileUpload,\n paramName =\n $.type(options.paramName) === 'array'\n ? options.paramName[0]\n : options.paramName;\n options.headers = $.extend({}, options.headers);\n if (options.contentRange) {\n options.headers['Content-Range'] = options.contentRange;\n }\n if (!multipart || options.blob || !this._isInstanceOf('File', file)) {\n options.headers['Content-Disposition'] =\n 'attachment; filename=\"' +\n encodeURI(file.uploadName || file.name) +\n '\"';\n }\n if (!multipart) {\n options.contentType = file.type || 'application/octet-stream';\n options.data = options.blob || file;\n } else if ($.support.xhrFormDataFileUpload) {\n if (options.postMessage) {\n // window.postMessage does not allow sending FormData\n // objects, so we just add the File/Blob objects to\n // the formData array and let the postMessage window\n // create the FormData object out of this array:\n formData = this._getFormData(options);\n if (options.blob) {\n formData.push({\n name: paramName,\n value: options.blob\n });\n } else {\n $.each(options.files, function (index, file) {\n formData.push({\n name:\n ($.type(options.paramName) === 'array' &&\n options.paramName[index]) ||\n paramName,\n value: file\n });\n });\n }\n } else {\n if (that._isInstanceOf('FormData', options.formData)) {\n formData = options.formData;\n } else {\n formData = new FormData();\n $.each(this._getFormData(options), function (index, field) {\n formData.append(field.name, field.value);\n });\n }\n if (options.blob) {\n formData.append(\n paramName,\n options.blob,\n file.uploadName || file.name\n );\n } else {\n $.each(options.files, function (index, file) {\n // This check allows the tests to run with\n // dummy objects:\n if (\n that._isInstanceOf('File', file) ||\n that._isInstanceOf('Blob', file)\n ) {\n var fileName = file.uploadName || file.name;\n if (options.uniqueFilenames) {\n fileName = that._getUniqueFilename(\n fileName,\n options.uniqueFilenames\n );\n }\n formData.append(\n ($.type(options.paramName) === 'array' &&\n options.paramName[index]) ||\n paramName,\n file,\n fileName\n );\n }\n });\n }\n }\n options.data = formData;\n }\n // Blob reference is not needed anymore, free memory:\n options.blob = null;\n },\n\n _initIframeSettings: function (options) {\n var targetHost = $('<a></a>').prop('href', options.url).prop('host');\n // Setting the dataType to iframe enables the iframe transport:\n options.dataType = 'iframe ' + (options.dataType || '');\n // The iframe transport accepts a serialized array as form data:\n options.formData = this._getFormData(options);\n // Add redirect url to form data on cross-domain uploads:\n if (options.redirect && targetHost && targetHost !== location.host) {\n options.formData.push({\n name: options.redirectParamName || 'redirect',\n value: options.redirect\n });\n }\n },\n\n _initDataSettings: function (options) {\n if (this._isXHRUpload(options)) {\n if (!this._chunkedUpload(options, true)) {\n if (!options.data) {\n this._initXHRData(options);\n }\n this._initProgressListener(options);\n }\n if (options.postMessage) {\n // Setting the dataType to postmessage enables the\n // postMessage transport:\n options.dataType = 'postmessage ' + (options.dataType || '');\n }\n } else {\n this._initIframeSettings(options);\n }\n },\n\n _getParamName: function (options) {\n var fileInput = $(options.fileInput),\n paramName = options.paramName;\n if (!paramName) {\n paramName = [];\n fileInput.each(function () {\n var input = $(this),\n name = input.prop('name') || 'files[]',\n i = (input.prop('files') || [1]).length;\n while (i) {\n paramName.push(name);\n i -= 1;\n }\n });\n if (!paramName.length) {\n paramName = [fileInput.prop('name') || 'files[]'];\n }\n } else if (!$.isArray(paramName)) {\n paramName = [paramName];\n }\n return paramName;\n },\n\n _initFormSettings: function (options) {\n // Retrieve missing options from the input field and the\n // associated form, if available:\n if (!options.form || !options.form.length) {\n options.form = $(options.fileInput.prop('form'));\n // If the given file input doesn't have an associated form,\n // use the default widget file input's form:\n if (!options.form.length) {\n options.form = $(this.options.fileInput.prop('form'));\n }\n }\n options.paramName = this._getParamName(options);\n if (!options.url) {\n options.url = options.form.prop('action') || location.href;\n }\n // The HTTP request method must be \"POST\" or \"PUT\":\n options.type = (\n options.type ||\n ($.type(options.form.prop('method')) === 'string' &&\n options.form.prop('method')) ||\n ''\n ).toUpperCase();\n if (\n options.type !== 'POST' &&\n options.type !== 'PUT' &&\n options.type !== 'PATCH'\n ) {\n options.type = 'POST';\n }\n if (!options.formAcceptCharset) {\n options.formAcceptCharset = options.form.attr('accept-charset');\n }\n },\n\n _getAJAXSettings: function (data) {\n var options = $.extend({}, this.options, data);\n this._initFormSettings(options);\n this._initDataSettings(options);\n return options;\n },\n\n // jQuery 1.6 doesn't provide .state(),\n // while jQuery 1.8+ removed .isRejected() and .isResolved():\n _getDeferredState: function (deferred) {\n if (deferred.state) {\n return deferred.state();\n }\n if (deferred.isResolved()) {\n return 'resolved';\n }\n if (deferred.isRejected()) {\n return 'rejected';\n }\n return 'pending';\n },\n\n // Maps jqXHR callbacks to the equivalent\n // methods of the given Promise object:\n _enhancePromise: function (promise) {\n promise.success = promise.done;\n promise.error = promise.fail;\n promise.complete = promise.always;\n return promise;\n },\n\n // Creates and returns a Promise object enhanced with\n // the jqXHR methods abort, success, error and complete:\n _getXHRPromise: function (resolveOrReject, context, args) {\n var dfd = $.Deferred(),\n promise = dfd.promise();\n // eslint-disable-next-line no-param-reassign\n context = context || this.options.context || promise;\n if (resolveOrReject === true) {\n dfd.resolveWith(context, args);\n } else if (resolveOrReject === false) {\n dfd.rejectWith(context, args);\n }\n promise.abort = dfd.promise;\n return this._enhancePromise(promise);\n },\n\n // Adds convenience methods to the data callback argument:\n _addConvenienceMethods: function (e, data) {\n var that = this,\n getPromise = function (args) {\n return $.Deferred().resolveWith(that, args).promise();\n };\n data.process = function (resolveFunc, rejectFunc) {\n if (resolveFunc || rejectFunc) {\n data._processQueue = this._processQueue = (this._processQueue ||\n getPromise([this]))\n [that._promisePipe](function () {\n if (data.errorThrown) {\n return $.Deferred().rejectWith(that, [data]).promise();\n }\n return getPromise(arguments);\n })\n [that._promisePipe](resolveFunc, rejectFunc);\n }\n return this._processQueue || getPromise([this]);\n };\n data.submit = function () {\n if (this.state() !== 'pending') {\n data.jqXHR = this.jqXHR =\n that._trigger(\n 'submit',\n $.Event('submit', { delegatedEvent: e }),\n this\n ) !== false && that._onSend(e, this);\n }\n return this.jqXHR || that._getXHRPromise();\n };\n data.abort = function () {\n if (this.jqXHR) {\n return this.jqXHR.abort();\n }\n this.errorThrown = 'abort';\n that._trigger('fail', null, this);\n return that._getXHRPromise(false);\n };\n data.state = function () {\n if (this.jqXHR) {\n return that._getDeferredState(this.jqXHR);\n }\n if (this._processQueue) {\n return that._getDeferredState(this._processQueue);\n }\n };\n data.processing = function () {\n return (\n !this.jqXHR &&\n this._processQueue &&\n that._getDeferredState(this._processQueue) === 'pending'\n );\n };\n data.progress = function () {\n return this._progress;\n };\n data.response = function () {\n return this._response;\n };\n },\n\n // Parses the Range header from the server response\n // and returns the uploaded bytes:\n _getUploadedBytes: function (jqXHR) {\n var range = jqXHR.getResponseHeader('Range'),\n parts = range && range.split('-'),\n upperBytesPos = parts && parts.length > 1 && parseInt(parts[1], 10);\n return upperBytesPos && upperBytesPos + 1;\n },\n\n // Uploads a file in multiple, sequential requests\n // by splitting the file up in multiple blob chunks.\n // If the second parameter is true, only tests if the file\n // should be uploaded in chunks, but does not invoke any\n // upload requests:\n _chunkedUpload: function (options, testOnly) {\n options.uploadedBytes = options.uploadedBytes || 0;\n var that = this,\n file = options.files[0],\n fs = file.size,\n ub = options.uploadedBytes,\n mcs = options.maxChunkSize || fs,\n slice = this._blobSlice,\n dfd = $.Deferred(),\n promise = dfd.promise(),\n jqXHR,\n upload;\n if (\n !(\n this._isXHRUpload(options) &&\n slice &&\n (ub || ($.type(mcs) === 'function' ? mcs(options) : mcs) < fs)\n ) ||\n options.data\n ) {\n return false;\n }\n if (testOnly) {\n return true;\n }\n if (ub >= fs) {\n file.error = options.i18n('uploadedBytes');\n return this._getXHRPromise(false, options.context, [\n null,\n 'error',\n file.error\n ]);\n }\n // The chunk upload method:\n upload = function () {\n // Clone the options object for each chunk upload:\n var o = $.extend({}, options),\n currentLoaded = o._progress.loaded;\n o.blob = slice.call(\n file,\n ub,\n ub + ($.type(mcs) === 'function' ? mcs(o) : mcs),\n file.type\n );\n // Store the current chunk size, as the blob itself\n // will be dereferenced after data processing:\n o.chunkSize = o.blob.size;\n // Expose the chunk bytes position range:\n o.contentRange =\n 'bytes ' + ub + '-' + (ub + o.chunkSize - 1) + '/' + fs;\n // Trigger chunkbeforesend to allow form data to be updated for this chunk\n that._trigger('chunkbeforesend', null, o);\n // Process the upload data (the blob and potential form data):\n that._initXHRData(o);\n // Add progress listeners for this chunk upload:\n that._initProgressListener(o);\n jqXHR = (\n (that._trigger('chunksend', null, o) !== false && $.ajax(o)) ||\n that._getXHRPromise(false, o.context)\n )\n .done(function (result, textStatus, jqXHR) {\n ub = that._getUploadedBytes(jqXHR) || ub + o.chunkSize;\n // Create a progress event if no final progress event\n // with loaded equaling total has been triggered\n // for this chunk:\n if (currentLoaded + o.chunkSize - o._progress.loaded) {\n that._onProgress(\n $.Event('progress', {\n lengthComputable: true,\n loaded: ub - o.uploadedBytes,\n total: ub - o.uploadedBytes\n }),\n o\n );\n }\n options.uploadedBytes = o.uploadedBytes = ub;\n o.result = result;\n o.textStatus = textStatus;\n o.jqXHR = jqXHR;\n that._trigger('chunkdone', null, o);\n that._trigger('chunkalways', null, o);\n if (ub < fs) {\n // File upload not yet complete,\n // continue with the next chunk:\n upload();\n } else {\n dfd.resolveWith(o.context, [result, textStatus, jqXHR]);\n }\n })\n .fail(function (jqXHR, textStatus, errorThrown) {\n o.jqXHR = jqXHR;\n o.textStatus = textStatus;\n o.errorThrown = errorThrown;\n that._trigger('chunkfail', null, o);\n that._trigger('chunkalways', null, o);\n dfd.rejectWith(o.context, [jqXHR, textStatus, errorThrown]);\n })\n .always(function () {\n that._deinitProgressListener(o);\n });\n };\n this._enhancePromise(promise);\n promise.abort = function () {\n return jqXHR.abort();\n };\n upload();\n return promise;\n },\n\n _beforeSend: function (e, data) {\n if (this._active === 0) {\n // the start callback is triggered when an upload starts\n // and no other uploads are currently running,\n // equivalent to the global ajaxStart event:\n this._trigger('start');\n // Set timer for global bitrate progress calculation:\n this._bitrateTimer = new this._BitrateTimer();\n // Reset the global progress values:\n this._progress.loaded = this._progress.total = 0;\n this._progress.bitrate = 0;\n }\n // Make sure the container objects for the .response() and\n // .progress() methods on the data object are available\n // and reset to their initial state:\n this._initResponseObject(data);\n this._initProgressObject(data);\n data._progress.loaded = data.loaded = data.uploadedBytes || 0;\n data._progress.total = data.total = this._getTotal(data.files) || 1;\n data._progress.bitrate = data.bitrate = 0;\n this._active += 1;\n // Initialize the global progress values:\n this._progress.loaded += data.loaded;\n this._progress.total += data.total;\n },\n\n _onDone: function (result, textStatus, jqXHR, options) {\n var total = options._progress.total,\n response = options._response;\n if (options._progress.loaded < total) {\n // Create a progress event if no final progress event\n // with loaded equaling total has been triggered:\n this._onProgress(\n $.Event('progress', {\n lengthComputable: true,\n loaded: total,\n total: total\n }),\n options\n );\n }\n response.result = options.result = result;\n response.textStatus = options.textStatus = textStatus;\n response.jqXHR = options.jqXHR = jqXHR;\n this._trigger('done', null, options);\n },\n\n _onFail: function (jqXHR, textStatus, errorThrown, options) {\n var response = options._response;\n if (options.recalculateProgress) {\n // Remove the failed (error or abort) file upload from\n // the global progress calculation:\n this._progress.loaded -= options._progress.loaded;\n this._progress.total -= options._progress.total;\n }\n response.jqXHR = options.jqXHR = jqXHR;\n response.textStatus = options.textStatus = textStatus;\n response.errorThrown = options.errorThrown = errorThrown;\n this._trigger('fail', null, options);\n },\n\n _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {\n // jqXHRorResult, textStatus and jqXHRorError are added to the\n // options object via done and fail callbacks\n this._trigger('always', null, options);\n },\n\n _onSend: function (e, data) {\n if (!data.submit) {\n this._addConvenienceMethods(e, data);\n }\n var that = this,\n jqXHR,\n aborted,\n slot,\n pipe,\n options = that._getAJAXSettings(data),\n send = function () {\n that._sending += 1;\n // Set timer for bitrate progress calculation:\n options._bitrateTimer = new that._BitrateTimer();\n jqXHR =\n jqXHR ||\n (\n ((aborted ||\n that._trigger(\n 'send',\n $.Event('send', { delegatedEvent: e }),\n options\n ) === false) &&\n that._getXHRPromise(false, options.context, aborted)) ||\n that._chunkedUpload(options) ||\n $.ajax(options)\n )\n .done(function (result, textStatus, jqXHR) {\n that._onDone(result, textStatus, jqXHR, options);\n })\n .fail(function (jqXHR, textStatus, errorThrown) {\n that._onFail(jqXHR, textStatus, errorThrown, options);\n })\n .always(function (jqXHRorResult, textStatus, jqXHRorError) {\n that._deinitProgressListener(options);\n that._onAlways(\n jqXHRorResult,\n textStatus,\n jqXHRorError,\n options\n );\n that._sending -= 1;\n that._active -= 1;\n if (\n options.limitConcurrentUploads &&\n options.limitConcurrentUploads > that._sending\n ) {\n // Start the next queued upload,\n // that has not been aborted:\n var nextSlot = that._slots.shift();\n while (nextSlot) {\n if (that._getDeferredState(nextSlot) === 'pending') {\n nextSlot.resolve();\n break;\n }\n nextSlot = that._slots.shift();\n }\n }\n if (that._active === 0) {\n // The stop callback is triggered when all uploads have\n // been completed, equivalent to the global ajaxStop event:\n that._trigger('stop');\n }\n });\n return jqXHR;\n };\n this._beforeSend(e, options);\n if (\n this.options.sequentialUploads ||\n (this.options.limitConcurrentUploads &&\n this.options.limitConcurrentUploads <= this._sending)\n ) {\n if (this.options.limitConcurrentUploads > 1) {\n slot = $.Deferred();\n this._slots.push(slot);\n pipe = slot[that._promisePipe](send);\n } else {\n this._sequence = this._sequence[that._promisePipe](send, send);\n pipe = this._sequence;\n }\n // Return the piped Promise object, enhanced with an abort method,\n // which is delegated to the jqXHR object of the current upload,\n // and jqXHR callbacks mapped to the equivalent Promise methods:\n pipe.abort = function () {\n aborted = [undefined, 'abort', 'abort'];\n if (!jqXHR) {\n if (slot) {\n slot.rejectWith(options.context, aborted);\n }\n return send();\n }\n return jqXHR.abort();\n };\n return this._enhancePromise(pipe);\n }\n return send();\n },\n\n _onAdd: function (e, data) {\n var that = this,\n result = true,\n options = $.extend({}, this.options, data),\n files = data.files,\n filesLength = files.length,\n limit = options.limitMultiFileUploads,\n limitSize = options.limitMultiFileUploadSize,\n overhead = options.limitMultiFileUploadSizeOverhead,\n batchSize = 0,\n paramName = this._getParamName(options),\n paramNameSet,\n paramNameSlice,\n fileSet,\n i,\n j = 0;\n if (!filesLength) {\n return false;\n }\n if (limitSize && files[0].size === undefined) {\n limitSize = undefined;\n }\n if (\n !(options.singleFileUploads || limit || limitSize) ||\n !this._isXHRUpload(options)\n ) {\n fileSet = [files];\n paramNameSet = [paramName];\n } else if (!(options.singleFileUploads || limitSize) && limit) {\n fileSet = [];\n paramNameSet = [];\n for (i = 0; i < filesLength; i += limit) {\n fileSet.push(files.slice(i, i + limit));\n paramNameSlice = paramName.slice(i, i + limit);\n if (!paramNameSlice.length) {\n paramNameSlice = paramName;\n }\n paramNameSet.push(paramNameSlice);\n }\n } else if (!options.singleFileUploads && limitSize) {\n fileSet = [];\n paramNameSet = [];\n for (i = 0; i < filesLength; i = i + 1) {\n batchSize += files[i].size + overhead;\n if (\n i + 1 === filesLength ||\n batchSize + files[i + 1].size + overhead > limitSize ||\n (limit && i + 1 - j >= limit)\n ) {\n fileSet.push(files.slice(j, i + 1));\n paramNameSlice = paramName.slice(j, i + 1);\n if (!paramNameSlice.length) {\n paramNameSlice = paramName;\n }\n paramNameSet.push(paramNameSlice);\n j = i + 1;\n batchSize = 0;\n }\n }\n } else {\n paramNameSet = paramName;\n }\n data.originalFiles = files;\n $.each(fileSet || files, function (index, element) {\n var newData = $.extend({}, data);\n newData.files = fileSet ? element : [element];\n newData.paramName = paramNameSet[index];\n that._initResponseObject(newData);\n that._initProgressObject(newData);\n that._addConvenienceMethods(e, newData);\n result = that._trigger(\n 'add',\n $.Event('add', { delegatedEvent: e }),\n newData\n );\n return result;\n });\n return result;\n },\n\n _replaceFileInput: function (data) {\n var input = data.fileInput,\n inputClone = input.clone(true),\n restoreFocus = input.is(document.activeElement);\n // Add a reference for the new cloned file input to the data argument:\n data.fileInputClone = inputClone;\n $('<form></form>').append(inputClone)[0].reset();\n // Detaching allows to insert the fileInput on another form\n // without losing the file input value:\n input.after(inputClone).detach();\n // If the fileInput had focus before it was detached,\n // restore focus to the inputClone.\n if (restoreFocus) {\n inputClone.trigger('focus');\n }\n // Avoid memory leaks with the detached file input:\n $.cleanData(input.off('remove'));\n // Replace the original file input element in the fileInput\n // elements set with the clone, which has been copied including\n // event handlers:\n this.options.fileInput = this.options.fileInput.map(function (i, el) {\n if (el === input[0]) {\n return inputClone[0];\n }\n return el;\n });\n // If the widget has been initialized on the file input itself,\n // override this.element with the file input clone:\n if (input[0] === this.element[0]) {\n this.element = inputClone;\n }\n },\n\n _handleFileTreeEntry: function (entry, path) {\n var that = this,\n dfd = $.Deferred(),\n entries = [],\n dirReader,\n errorHandler = function (e) {\n if (e && !e.entry) {\n e.entry = entry;\n }\n // Since $.when returns immediately if one\n // Deferred is rejected, we use resolve instead.\n // This allows valid files and invalid items\n // to be returned together in one set:\n dfd.resolve([e]);\n },\n successHandler = function (entries) {\n that\n ._handleFileTreeEntries(entries, path + entry.name + '/')\n .done(function (files) {\n dfd.resolve(files);\n })\n .fail(errorHandler);\n },\n readEntries = function () {\n dirReader.readEntries(function (results) {\n if (!results.length) {\n successHandler(entries);\n } else {\n entries = entries.concat(results);\n readEntries();\n }\n }, errorHandler);\n };\n // eslint-disable-next-line no-param-reassign\n path = path || '';\n if (entry.isFile) {\n if (entry._file) {\n // Workaround for Chrome bug #149735\n entry._file.relativePath = path;\n dfd.resolve(entry._file);\n } else {\n entry.file(function (file) {\n file.relativePath = path;\n dfd.resolve(file);\n }, errorHandler);\n }\n } else if (entry.isDirectory) {\n dirReader = entry.createReader();\n readEntries();\n } else {\n // Return an empty list for file system items\n // other than files or directories:\n dfd.resolve([]);\n }\n return dfd.promise();\n },\n\n _handleFileTreeEntries: function (entries, path) {\n var that = this;\n return $.when\n .apply(\n $,\n $.map(entries, function (entry) {\n return that._handleFileTreeEntry(entry, path);\n })\n )\n [this._promisePipe](function () {\n return Array.prototype.concat.apply([], arguments);\n });\n },\n\n _getDroppedFiles: function (dataTransfer) {\n // eslint-disable-next-line no-param-reassign\n dataTransfer = dataTransfer || {};\n var items = dataTransfer.items;\n if (\n items &&\n items.length &&\n (items[0].webkitGetAsEntry || items[0].getAsEntry)\n ) {\n return this._handleFileTreeEntries(\n $.map(items, function (item) {\n var entry;\n if (item.webkitGetAsEntry) {\n entry = item.webkitGetAsEntry();\n if (entry) {\n // Workaround for Chrome bug #149735:\n entry._file = item.getAsFile();\n }\n return entry;\n }\n return item.getAsEntry();\n })\n );\n }\n return $.Deferred().resolve($.makeArray(dataTransfer.files)).promise();\n },\n\n _getSingleFileInputFiles: function (fileInput) {\n // eslint-disable-next-line no-param-reassign\n fileInput = $(fileInput);\n var entries = fileInput.prop('entries'),\n files,\n value;\n if (entries && entries.length) {\n return this._handleFileTreeEntries(entries);\n }\n files = $.makeArray(fileInput.prop('files'));\n if (!files.length) {\n value = fileInput.prop('value');\n if (!value) {\n return $.Deferred().resolve([]).promise();\n }\n // If the files property is not available, the browser does not\n // support the File API and we add a pseudo File object with\n // the input value as name with path information removed:\n files = [{ name: value.replace(/^.*\\\\/, '') }];\n } else if (files[0].name === undefined && files[0].fileName) {\n // File normalization for Safari 4 and Firefox 3:\n $.each(files, function (index, file) {\n file.name = file.fileName;\n file.size = file.fileSize;\n });\n }\n return $.Deferred().resolve(files).promise();\n },\n\n _getFileInputFiles: function (fileInput) {\n if (!(fileInput instanceof $) || fileInput.length === 1) {\n return this._getSingleFileInputFiles(fileInput);\n }\n return $.when\n .apply($, $.map(fileInput, this._getSingleFileInputFiles))\n [this._promisePipe](function () {\n return Array.prototype.concat.apply([], arguments);\n });\n },\n\n _onChange: function (e) {\n var that = this,\n data = {\n fileInput: $(e.target),\n form: $(e.target.form)\n };\n this._getFileInputFiles(data.fileInput).always(function (files) {\n data.files = files;\n if (that.options.replaceFileInput) {\n that._replaceFileInput(data);\n }\n if (\n that._trigger(\n 'change',\n $.Event('change', { delegatedEvent: e }),\n data\n ) !== false\n ) {\n that._onAdd(e, data);\n }\n });\n },\n\n _onPaste: function (e) {\n var items =\n e.originalEvent &&\n e.originalEvent.clipboardData &&\n e.originalEvent.clipboardData.items,\n data = { files: [] };\n if (items && items.length) {\n $.each(items, function (index, item) {\n var file = item.getAsFile && item.getAsFile();\n if (file) {\n data.files.push(file);\n }\n });\n if (\n this._trigger(\n 'paste',\n $.Event('paste', { delegatedEvent: e }),\n data\n ) !== false\n ) {\n this._onAdd(e, data);\n }\n }\n },\n\n _onDrop: function (e) {\n e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer;\n var that = this,\n dataTransfer = e.dataTransfer,\n data = {};\n if (dataTransfer && dataTransfer.files && dataTransfer.files.length) {\n e.preventDefault();\n this._getDroppedFiles(dataTransfer).always(function (files) {\n data.files = files;\n if (\n that._trigger(\n 'drop',\n $.Event('drop', { delegatedEvent: e }),\n data\n ) !== false\n ) {\n that._onAdd(e, data);\n }\n });\n }\n },\n\n _onDragOver: getDragHandler('dragover'),\n\n _onDragEnter: getDragHandler('dragenter'),\n\n _onDragLeave: getDragHandler('dragleave'),\n\n _initEventHandlers: function () {\n if (this._isXHRUpload(this.options)) {\n this._on(this.options.dropZone, {\n dragover: this._onDragOver,\n drop: this._onDrop,\n // event.preventDefault() on dragenter is required for IE10+:\n dragenter: this._onDragEnter,\n // dragleave is not required, but added for completeness:\n dragleave: this._onDragLeave\n });\n this._on(this.options.pasteZone, {\n paste: this._onPaste\n });\n }\n if ($.support.fileInput) {\n this._on(this.options.fileInput, {\n change: this._onChange\n });\n }\n },\n\n _destroyEventHandlers: function () {\n this._off(this.options.dropZone, 'dragenter dragleave dragover drop');\n this._off(this.options.pasteZone, 'paste');\n this._off(this.options.fileInput, 'change');\n },\n\n _destroy: function () {\n this._destroyEventHandlers();\n },\n\n _setOption: function (key, value) {\n var reinit = $.inArray(key, this._specialOptions) !== -1;\n if (reinit) {\n this._destroyEventHandlers();\n }\n this._super(key, value);\n if (reinit) {\n this._initSpecialOptions();\n this._initEventHandlers();\n }\n },\n\n _initSpecialOptions: function () {\n var options = this.options;\n if (options.fileInput === undefined) {\n options.fileInput = this.element.is('input[type=\"file\"]')\n ? this.element\n : this.element.find('input[type=\"file\"]');\n } else if (!(options.fileInput instanceof $)) {\n options.fileInput = $(options.fileInput);\n }\n if (!(options.dropZone instanceof $)) {\n options.dropZone = $(options.dropZone);\n }\n if (!(options.pasteZone instanceof $)) {\n options.pasteZone = $(options.pasteZone);\n }\n },\n\n _getRegExp: function (str) {\n var parts = str.split('/'),\n modifiers = parts.pop();\n parts.shift();\n return new RegExp(parts.join('/'), modifiers);\n },\n\n _isRegExpOption: function (key, value) {\n return (\n key !== 'url' &&\n $.type(value) === 'string' &&\n /^\\/.*\\/[igm]{0,3}$/.test(value)\n );\n },\n\n _initDataAttributes: function () {\n var that = this,\n options = this.options,\n data = this.element.data();\n // Initialize options set via HTML5 data-attributes:\n $.each(this.element[0].attributes, function (index, attr) {\n var key = attr.name.toLowerCase(),\n value;\n if (/^data-/.test(key)) {\n // Convert hyphen-ated key to camelCase:\n key = key.slice(5).replace(/-[a-z]/g, function (str) {\n return str.charAt(1).toUpperCase();\n });\n value = data[key];\n if (that._isRegExpOption(key, value)) {\n value = that._getRegExp(value);\n }\n options[key] = value;\n }\n });\n },\n\n _create: function () {\n this._initDataAttributes();\n this._initSpecialOptions();\n this._slots = [];\n this._sequence = this._getXHRPromise(true);\n this._sending = this._active = 0;\n this._initProgressObject(this);\n this._initEventHandlers();\n },\n\n // This method is exposed to the widget API and allows to query\n // the number of active uploads:\n active: function () {\n return this._active;\n },\n\n // This method is exposed to the widget API and allows to query\n // the widget upload progress.\n // It returns an object with loaded, total and bitrate properties\n // for the running uploads:\n progress: function () {\n return this._progress;\n },\n\n // This method is exposed to the widget API and allows adding files\n // using the fileupload API. The data parameter accepts an object which\n // must have a files property and can contain additional options:\n // .fileupload('add', {files: filesList});\n add: function (data) {\n var that = this;\n if (!data || this.options.disabled) {\n return;\n }\n if (data.fileInput && !data.files) {\n this._getFileInputFiles(data.fileInput).always(function (files) {\n data.files = files;\n that._onAdd(null, data);\n });\n } else {\n data.files = $.makeArray(data.files);\n this._onAdd(null, data);\n }\n },\n\n // This method is exposed to the widget API and allows sending files\n // using the fileupload API. The data parameter accepts an object which\n // must have a files or fileInput property and can contain additional options:\n // .fileupload('send', {files: filesList});\n // The method returns a Promise object for the file upload call.\n send: function (data) {\n if (data && !this.options.disabled) {\n if (data.fileInput && !data.files) {\n var that = this,\n dfd = $.Deferred(),\n promise = dfd.promise(),\n jqXHR,\n aborted;\n promise.abort = function () {\n aborted = true;\n if (jqXHR) {\n return jqXHR.abort();\n }\n dfd.reject(null, 'abort', 'abort');\n return promise;\n };\n this._getFileInputFiles(data.fileInput).always(function (files) {\n if (aborted) {\n return;\n }\n if (!files.length) {\n dfd.reject();\n return;\n }\n data.files = files;\n jqXHR = that._onSend(null, data);\n jqXHR.then(\n function (result, textStatus, jqXHR) {\n dfd.resolve(result, textStatus, jqXHR);\n },\n function (jqXHR, textStatus, errorThrown) {\n dfd.reject(jqXHR, textStatus, errorThrown);\n }\n );\n });\n return this._enhancePromise(promise);\n }\n data.files = $.makeArray(data.files);\n if (data.files.length) {\n return this._onSend(null, data);\n }\n }\n return this._getXHRPromise(false, data && data.context);\n }\n });\n});\n","Mageplaza_Core/lib/fileUploader/vendor/jquery.ui.widget.js":"/*! jQuery UI - v1.12.1+0b7246b6eeadfa9e2696e22f3230f6452f8129dc - 2020-02-20\n * http://jqueryui.com\n * Includes: widget.js\n * Copyright jQuery Foundation and other contributors; Licensed MIT */\n\n/* global define, require */\n/* eslint-disable no-param-reassign, new-cap, jsdoc/require-jsdoc */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS\n factory(require('jquery'));\n } else {\n // Browser globals\n factory(window.jQuery);\n }\n})(function ($) {\n ('use strict');\n\n $.ui = $.ui || {};\n\n $.ui.version = '1.12.1';\n\n /*!\n * jQuery UI Widget 1.12.1\n * http://jqueryui.com\n *\n * Copyright jQuery Foundation and other contributors\n * Released under the MIT license.\n * http://jquery.org/license\n */\n\n //>>label: Widget\n //>>group: Core\n //>>description: Provides a factory for creating stateful widgets with a common API.\n //>>docs: http://api.jqueryui.com/jQuery.widget/\n //>>demos: http://jqueryui.com/widget/\n\n // Support: jQuery 1.9.x or older\n // $.expr[ \":\" ] is deprecated.\n if (!$.expr.pseudos) {\n $.expr.pseudos = $.expr[':'];\n }\n\n // Support: jQuery 1.11.x or older\n // $.unique has been renamed to $.uniqueSort\n if (!$.uniqueSort) {\n $.uniqueSort = $.unique;\n }\n\n var widgetUuid = 0;\n var widgetHasOwnProperty = Array.prototype.hasOwnProperty;\n var widgetSlice = Array.prototype.slice;\n\n $.cleanData = (function (orig) {\n return function (elems) {\n var events, elem, i;\n // eslint-disable-next-line eqeqeq\n for (i = 0; (elem = elems[i]) != null; i++) {\n // Only trigger remove when necessary to save time\n events = $._data(elem, 'events');\n if (events && events.remove) {\n $(elem).triggerHandler('remove');\n }\n }\n orig(elems);\n };\n })($.cleanData);\n\n $.widget = function (name, base, prototype) {\n var existingConstructor, constructor, basePrototype;\n\n // ProxiedPrototype allows the provided prototype to remain unmodified\n // so that it can be used as a mixin for multiple widgets (#8876)\n var proxiedPrototype = {};\n\n var namespace = name.split('.')[0];\n name = name.split('.')[1];\n var fullName = namespace + '-' + name;\n\n if (!prototype) {\n prototype = base;\n base = $.Widget;\n }\n\n if ($.isArray(prototype)) {\n prototype = $.extend.apply(null, [{}].concat(prototype));\n }\n\n // Create selector for plugin\n $.expr.pseudos[fullName.toLowerCase()] = function (elem) {\n return !!$.data(elem, fullName);\n };\n\n $[namespace] = $[namespace] || {};\n existingConstructor = $[namespace][name];\n constructor = $[namespace][name] = function (options, element) {\n // Allow instantiation without \"new\" keyword\n if (!this._createWidget) {\n return new constructor(options, element);\n }\n\n // Allow instantiation without initializing for simple inheritance\n // must use \"new\" keyword (the code above always passes args)\n if (arguments.length) {\n this._createWidget(options, element);\n }\n };\n\n // Extend with the existing constructor to carry over any static properties\n $.extend(constructor, existingConstructor, {\n version: prototype.version,\n\n // Copy the object used to create the prototype in case we need to\n // redefine the widget later\n _proto: $.extend({}, prototype),\n\n // Track widgets that inherit from this widget in case this widget is\n // redefined after a widget inherits from it\n _childConstructors: []\n });\n\n basePrototype = new base();\n\n // We need to make the options hash a property directly on the new instance\n // otherwise we'll modify the options hash on the prototype that we're\n // inheriting from\n basePrototype.options = $.widget.extend({}, basePrototype.options);\n $.each(prototype, function (prop, value) {\n if (!$.isFunction(value)) {\n proxiedPrototype[prop] = value;\n return;\n }\n proxiedPrototype[prop] = (function () {\n function _super() {\n return base.prototype[prop].apply(this, arguments);\n }\n\n function _superApply(args) {\n return base.prototype[prop].apply(this, args);\n }\n\n return function () {\n var __super = this._super;\n var __superApply = this._superApply;\n var returnValue;\n\n this._super = _super;\n this._superApply = _superApply;\n\n returnValue = value.apply(this, arguments);\n\n this._super = __super;\n this._superApply = __superApply;\n\n return returnValue;\n };\n })();\n });\n constructor.prototype = $.widget.extend(\n basePrototype,\n {\n // TODO: remove support for widgetEventPrefix\n // always use the name + a colon as the prefix, e.g., draggable:start\n // don't prefix for widgets that aren't DOM-based\n widgetEventPrefix: existingConstructor\n ? basePrototype.widgetEventPrefix || name\n : name\n },\n proxiedPrototype,\n {\n constructor: constructor,\n namespace: namespace,\n widgetName: name,\n widgetFullName: fullName\n }\n );\n\n // If this widget is being redefined then we need to find all widgets that\n // are inheriting from it and redefine all of them so that they inherit from\n // the new version of this widget. We're essentially trying to replace one\n // level in the prototype chain.\n if (existingConstructor) {\n $.each(existingConstructor._childConstructors, function (i, child) {\n var childPrototype = child.prototype;\n\n // Redefine the child widget using the same prototype that was\n // originally used, but inherit from the new version of the base\n $.widget(\n childPrototype.namespace + '.' + childPrototype.widgetName,\n constructor,\n child._proto\n );\n });\n\n // Remove the list of existing child constructors from the old constructor\n // so the old child constructors can be garbage collected\n delete existingConstructor._childConstructors;\n } else {\n base._childConstructors.push(constructor);\n }\n\n $.widget.bridge(name, constructor);\n\n return constructor;\n };\n\n $.widget.extend = function (target) {\n var input = widgetSlice.call(arguments, 1);\n var inputIndex = 0;\n var inputLength = input.length;\n var key;\n var value;\n\n for (; inputIndex < inputLength; inputIndex++) {\n for (key in input[inputIndex]) {\n value = input[inputIndex][key];\n if (\n widgetHasOwnProperty.call(input[inputIndex], key) &&\n value !== undefined\n ) {\n // Clone objects\n if ($.isPlainObject(value)) {\n target[key] = $.isPlainObject(target[key])\n ? $.widget.extend({}, target[key], value)\n : // Don't extend strings, arrays, etc. with objects\n $.widget.extend({}, value);\n\n // Copy everything else by reference\n } else {\n target[key] = value;\n }\n }\n }\n }\n return target;\n };\n\n $.widget.bridge = function (name, object) {\n var fullName = object.prototype.widgetFullName || name;\n $.fn[name] = function (options) {\n var isMethodCall = typeof options === 'string';\n var args = widgetSlice.call(arguments, 1);\n var returnValue = this;\n\n if (isMethodCall) {\n // If this is an empty collection, we need to have the instance method\n // return undefined instead of the jQuery instance\n if (!this.length && options === 'instance') {\n returnValue = undefined;\n } else {\n this.each(function () {\n var methodValue;\n var instance = $.data(this, fullName);\n\n if (options === 'instance') {\n returnValue = instance;\n return false;\n }\n\n if (!instance) {\n return $.error(\n 'cannot call methods on ' +\n name +\n ' prior to initialization; ' +\n \"attempted to call method '\" +\n options +\n \"'\"\n );\n }\n\n if (!$.isFunction(instance[options]) || options.charAt(0) === '_') {\n return $.error(\n \"no such method '\" +\n options +\n \"' for \" +\n name +\n ' widget instance'\n );\n }\n\n methodValue = instance[options].apply(instance, args);\n\n if (methodValue !== instance && methodValue !== undefined) {\n returnValue =\n methodValue && methodValue.jquery\n ? returnValue.pushStack(methodValue.get())\n : methodValue;\n return false;\n }\n });\n }\n } else {\n // Allow multiple hashes to be passed on init\n if (args.length) {\n options = $.widget.extend.apply(null, [options].concat(args));\n }\n\n this.each(function () {\n var instance = $.data(this, fullName);\n if (instance) {\n instance.option(options || {});\n if (instance._init) {\n instance._init();\n }\n } else {\n $.data(this, fullName, new object(options, this));\n }\n });\n }\n\n return returnValue;\n };\n };\n\n $.Widget = function (/* options, element */) {};\n $.Widget._childConstructors = [];\n\n $.Widget.prototype = {\n widgetName: 'widget',\n widgetEventPrefix: '',\n defaultElement: '<div>',\n\n options: {\n classes: {},\n disabled: false,\n\n // Callbacks\n create: null\n },\n\n _createWidget: function (options, element) {\n element = $(element || this.defaultElement || this)[0];\n this.element = $(element);\n this.uuid = widgetUuid++;\n this.eventNamespace = '.' + this.widgetName + this.uuid;\n\n this.bindings = $();\n this.hoverable = $();\n this.focusable = $();\n this.classesElementLookup = {};\n\n if (element !== this) {\n $.data(element, this.widgetFullName, this);\n this._on(true, this.element, {\n remove: function (event) {\n if (event.target === element) {\n this.destroy();\n }\n }\n });\n this.document = $(\n element.style\n ? // Element within the document\n element.ownerDocument\n : // Element is window or document\n element.document || element\n );\n this.window = $(\n this.document[0].defaultView || this.document[0].parentWindow\n );\n }\n\n this.options = $.widget.extend(\n {},\n this.options,\n this._getCreateOptions(),\n options\n );\n\n this._create();\n\n if (this.options.disabled) {\n this._setOptionDisabled(this.options.disabled);\n }\n\n this._trigger('create', null, this._getCreateEventData());\n this._init();\n },\n\n _getCreateOptions: function () {\n return {};\n },\n\n _getCreateEventData: $.noop,\n\n _create: $.noop,\n\n _init: $.noop,\n\n destroy: function () {\n var that = this;\n\n this._destroy();\n $.each(this.classesElementLookup, function (key, value) {\n that._removeClass(value, key);\n });\n\n // We can probably remove the unbind calls in 2.0\n // all event bindings should go through this._on()\n this.element.off(this.eventNamespace).removeData(this.widgetFullName);\n this.widget().off(this.eventNamespace).removeAttr('aria-disabled');\n\n // Clean up events and states\n this.bindings.off(this.eventNamespace);\n },\n\n _destroy: $.noop,\n\n widget: function () {\n return this.element;\n },\n\n option: function (key, value) {\n var options = key;\n var parts;\n var curOption;\n var i;\n\n if (arguments.length === 0) {\n // Don't return a reference to the internal hash\n return $.widget.extend({}, this.options);\n }\n\n if (typeof key === 'string') {\n // Handle nested keys, e.g., \"foo.bar\" => { foo: { bar: ___ } }\n options = {};\n parts = key.split('.');\n key = parts.shift();\n if (parts.length) {\n curOption = options[key] = $.widget.extend({}, this.options[key]);\n for (i = 0; i < parts.length - 1; i++) {\n curOption[parts[i]] = curOption[parts[i]] || {};\n curOption = curOption[parts[i]];\n }\n key = parts.pop();\n if (arguments.length === 1) {\n return curOption[key] === undefined ? null : curOption[key];\n }\n curOption[key] = value;\n } else {\n if (arguments.length === 1) {\n return this.options[key] === undefined ? null : this.options[key];\n }\n options[key] = value;\n }\n }\n\n this._setOptions(options);\n\n return this;\n },\n\n _setOptions: function (options) {\n var key;\n\n for (key in options) {\n this._setOption(key, options[key]);\n }\n\n return this;\n },\n\n _setOption: function (key, value) {\n if (key === 'classes') {\n this._setOptionClasses(value);\n }\n\n this.options[key] = value;\n\n if (key === 'disabled') {\n this._setOptionDisabled(value);\n }\n\n return this;\n },\n\n _setOptionClasses: function (value) {\n var classKey, elements, currentElements;\n\n for (classKey in value) {\n currentElements = this.classesElementLookup[classKey];\n if (\n value[classKey] === this.options.classes[classKey] ||\n !currentElements ||\n !currentElements.length\n ) {\n continue;\n }\n\n // We are doing this to create a new jQuery object because the _removeClass() call\n // on the next line is going to destroy the reference to the current elements being\n // tracked. We need to save a copy of this collection so that we can add the new classes\n // below.\n elements = $(currentElements.get());\n this._removeClass(currentElements, classKey);\n\n // We don't use _addClass() here, because that uses this.options.classes\n // for generating the string of classes. We want to use the value passed in from\n // _setOption(), this is the new value of the classes option which was passed to\n // _setOption(). We pass this value directly to _classes().\n elements.addClass(\n this._classes({\n element: elements,\n keys: classKey,\n classes: value,\n add: true\n })\n );\n }\n },\n\n _setOptionDisabled: function (value) {\n this._toggleClass(\n this.widget(),\n this.widgetFullName + '-disabled',\n null,\n !!value\n );\n\n // If the widget is becoming disabled, then nothing is interactive\n if (value) {\n this._removeClass(this.hoverable, null, 'ui-state-hover');\n this._removeClass(this.focusable, null, 'ui-state-focus');\n }\n },\n\n enable: function () {\n return this._setOptions({ disabled: false });\n },\n\n disable: function () {\n return this._setOptions({ disabled: true });\n },\n\n _classes: function (options) {\n var full = [];\n var that = this;\n\n options = $.extend(\n {\n element: this.element,\n classes: this.options.classes || {}\n },\n options\n );\n\n function bindRemoveEvent() {\n options.element.each(function (_, element) {\n var isTracked = $.map(that.classesElementLookup, function (elements) {\n return elements;\n }).some(function (elements) {\n return elements.is(element);\n });\n\n if (!isTracked) {\n that._on($(element), {\n remove: '_untrackClassesElement'\n });\n }\n });\n }\n\n function processClassString(classes, checkOption) {\n var current, i;\n for (i = 0; i < classes.length; i++) {\n current = that.classesElementLookup[classes[i]] || $();\n if (options.add) {\n bindRemoveEvent();\n current = $(\n $.uniqueSort(current.get().concat(options.element.get()))\n );\n } else {\n current = $(current.not(options.element).get());\n }\n that.classesElementLookup[classes[i]] = current;\n full.push(classes[i]);\n if (checkOption && options.classes[classes[i]]) {\n full.push(options.classes[classes[i]]);\n }\n }\n }\n\n if (options.keys) {\n processClassString(options.keys.match(/\\S+/g) || [], true);\n }\n if (options.extra) {\n processClassString(options.extra.match(/\\S+/g) || []);\n }\n\n return full.join(' ');\n },\n\n _untrackClassesElement: function (event) {\n var that = this;\n $.each(that.classesElementLookup, function (key, value) {\n if ($.inArray(event.target, value) !== -1) {\n that.classesElementLookup[key] = $(value.not(event.target).get());\n }\n });\n\n this._off($(event.target));\n },\n\n _removeClass: function (element, keys, extra) {\n return this._toggleClass(element, keys, extra, false);\n },\n\n _addClass: function (element, keys, extra) {\n return this._toggleClass(element, keys, extra, true);\n },\n\n _toggleClass: function (element, keys, extra, add) {\n add = typeof add === 'boolean' ? add : extra;\n var shift = typeof element === 'string' || element === null,\n options = {\n extra: shift ? keys : extra,\n keys: shift ? element : keys,\n element: shift ? this.element : element,\n add: add\n };\n options.element.toggleClass(this._classes(options), add);\n return this;\n },\n\n _on: function (suppressDisabledCheck, element, handlers) {\n var delegateElement;\n var instance = this;\n\n // No suppressDisabledCheck flag, shuffle arguments\n if (typeof suppressDisabledCheck !== 'boolean') {\n handlers = element;\n element = suppressDisabledCheck;\n suppressDisabledCheck = false;\n }\n\n // No element argument, shuffle and use this.element\n if (!handlers) {\n handlers = element;\n element = this.element;\n delegateElement = this.widget();\n } else {\n element = delegateElement = $(element);\n this.bindings = this.bindings.add(element);\n }\n\n $.each(handlers, function (event, handler) {\n function handlerProxy() {\n // Allow widgets to customize the disabled handling\n // - disabled as an array instead of boolean\n // - disabled class as method for disabling individual parts\n if (\n !suppressDisabledCheck &&\n (instance.options.disabled === true ||\n $(this).hasClass('ui-state-disabled'))\n ) {\n return;\n }\n return (\n typeof handler === 'string' ? instance[handler] : handler\n ).apply(instance, arguments);\n }\n\n // Copy the guid so direct unbinding works\n if (typeof handler !== 'string') {\n handlerProxy.guid = handler.guid =\n handler.guid || handlerProxy.guid || $.guid++;\n }\n\n var match = event.match(/^([\\w:-]*)\\s*(.*)$/);\n var eventName = match[1] + instance.eventNamespace;\n var selector = match[2];\n\n if (selector) {\n delegateElement.on(eventName, selector, handlerProxy);\n } else {\n element.on(eventName, handlerProxy);\n }\n });\n },\n\n _off: function (element, eventName) {\n eventName =\n (eventName || '').split(' ').join(this.eventNamespace + ' ') +\n this.eventNamespace;\n element.off(eventName);\n\n // Clear the stack to avoid memory leaks (#10056)\n this.bindings = $(this.bindings.not(element).get());\n this.focusable = $(this.focusable.not(element).get());\n this.hoverable = $(this.hoverable.not(element).get());\n },\n\n _delay: function (handler, delay) {\n var instance = this;\n function handlerProxy() {\n return (\n typeof handler === 'string' ? instance[handler] : handler\n ).apply(instance, arguments);\n }\n return setTimeout(handlerProxy, delay || 0);\n },\n\n _hoverable: function (element) {\n this.hoverable = this.hoverable.add(element);\n this._on(element, {\n mouseenter: function (event) {\n this._addClass($(event.currentTarget), null, 'ui-state-hover');\n },\n mouseleave: function (event) {\n this._removeClass($(event.currentTarget), null, 'ui-state-hover');\n }\n });\n },\n\n _focusable: function (element) {\n this.focusable = this.focusable.add(element);\n this._on(element, {\n focusin: function (event) {\n this._addClass($(event.currentTarget), null, 'ui-state-focus');\n },\n focusout: function (event) {\n this._removeClass($(event.currentTarget), null, 'ui-state-focus');\n }\n });\n },\n\n _trigger: function (type, event, data) {\n var prop, orig;\n var callback = this.options[type];\n\n data = data || {};\n event = $.Event(event);\n event.type = (\n type === this.widgetEventPrefix ? type : this.widgetEventPrefix + type\n ).toLowerCase();\n\n // The original event may come from any element\n // so we need to reset the target on the new event\n event.target = this.element[0];\n\n // Copy original event properties over to the new event\n orig = event.originalEvent;\n if (orig) {\n for (prop in orig) {\n if (!(prop in event)) {\n event[prop] = orig[prop];\n }\n }\n }\n\n this.element.trigger(event, data);\n return !(\n ($.isFunction(callback) &&\n callback.apply(this.element[0], [event].concat(data)) === false) ||\n event.isDefaultPrevented()\n );\n }\n };\n\n $.each({ show: 'fadeIn', hide: 'fadeOut' }, function (method, defaultEffect) {\n $.Widget.prototype['_' + method] = function (element, options, callback) {\n if (typeof options === 'string') {\n options = { effect: options };\n }\n\n var hasOptions;\n var effectName = !options\n ? method\n : options === true || typeof options === 'number'\n ? defaultEffect\n : options.effect || defaultEffect;\n\n options = options || {};\n if (typeof options === 'number') {\n options = { duration: options };\n }\n\n hasOptions = !$.isEmptyObject(options);\n options.complete = callback;\n\n if (options.delay) {\n element.delay(options.delay);\n }\n\n if (hasOptions && $.effects && $.effects.effect[effectName]) {\n element[method](options);\n } else if (effectName !== method && element[effectName]) {\n element[effectName](options.duration, options.easing, callback);\n } else {\n element.queue(function (next) {\n $(this)[method]();\n if (callback) {\n callback.call(element[0]);\n }\n next();\n });\n }\n };\n });\n});\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-tmpl/js/compile.js":"#!/usr/bin/env node\n/*\n * JavaScript Templates Compiler\n * https://github.com/blueimp/JavaScript-Templates\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* eslint-disable strict */\n/* eslint-disable no-console */\n\n;(function () {\n 'use strict'\n var path = require('path')\n var tmpl = require(path.join(__dirname, 'tmpl.js'))\n var fs = require('fs')\n // Retrieve the content of the minimal runtime:\n var runtime = fs.readFileSync(path.join(__dirname, 'runtime.js'), 'utf8')\n // A regular expression to parse templates from script tags in a HTML page:\n var regexp = /<script( id=\"([\\w-]+)\")? type=\"text\\/x-tmpl\"( id=\"([\\w-]+)\")?>([\\s\\S]+?)<\\/script>/gi\n // A regular expression to match the helper function names:\n var helperRegexp = new RegExp(\n tmpl.helper.match(/\\w+(?=\\s*=\\s*function\\s*\\()/g).join('\\\\s*\\\\(|') +\n '\\\\s*\\\\('\n )\n // A list to store the function bodies:\n var list = []\n var code\n // Extend the Templating engine with a print method for the generated functions:\n tmpl.print = function (str) {\n // Only add helper functions if they are used inside of the template:\n var helper = helperRegexp.test(str) ? tmpl.helper : ''\n var body = str.replace(tmpl.regexp, tmpl.func)\n if (helper || /_e\\s*\\(/.test(body)) {\n helper = '_e=tmpl.encode' + helper + ','\n }\n return (\n 'function(' +\n tmpl.arg +\n ',tmpl){' +\n ('var ' + helper + \"_s='\" + body + \"';return _s;\")\n .split(\"_s+='';\")\n .join('') +\n '}'\n )\n }\n // Loop through the command line arguments:\n process.argv.forEach(function (file, index) {\n var listLength = list.length\n var stats\n var content\n var result\n var id\n // Skip the first two arguments, which are \"node\" and the script:\n if (index > 1) {\n stats = fs.statSync(file)\n if (!stats.isFile()) {\n console.error(file + ' is not a file.')\n return\n }\n content = fs.readFileSync(file, 'utf8')\n // eslint-disable-next-line no-constant-condition\n while (true) {\n // Find templates in script tags:\n result = regexp.exec(content)\n if (!result) {\n break\n }\n id = result[2] || result[4]\n list.push(\"'\" + id + \"':\" + tmpl.print(result[5]))\n }\n if (listLength === list.length) {\n // No template script tags found, use the complete content:\n id = path.basename(file, path.extname(file))\n list.push(\"'\" + id + \"':\" + tmpl.print(content))\n }\n }\n })\n if (!list.length) {\n console.error('Missing input file.')\n return\n }\n // Combine the generated functions as cache of the minimal runtime:\n code = runtime.replace('{}', '{' + list.join(',') + '}')\n // Print the resulting code to the console output:\n console.log(code)\n})()\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-tmpl/js/tmpl.js":"/*\n * JavaScript Templates\n * https://github.com/blueimp/JavaScript-Templates\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Inspired by John Resig's JavaScript Micro-Templating:\n * http://ejohn.org/blog/javascript-micro-templating/\n */\n\n/* global define */\n\n/* eslint-disable strict */\n\n;(function ($) {\n 'use strict'\n var tmpl = function (str, data) {\n var f = !/[^\\w\\-.:]/.test(str)\n ? (tmpl.cache[str] = tmpl.cache[str] || tmpl(tmpl.load(str)))\n : new Function( // eslint-disable-line no-new-func\n tmpl.arg + ',tmpl',\n 'var _e=tmpl.encode' +\n tmpl.helper +\n \",_s='\" +\n str.replace(tmpl.regexp, tmpl.func) +\n \"';return _s;\"\n )\n return data\n ? f(data, tmpl)\n : function (data) {\n return f(data, tmpl)\n }\n }\n tmpl.cache = {}\n tmpl.load = function (id) {\n return document.getElementById(id).innerHTML\n }\n tmpl.regexp = /([\\s'\\\\])(?!(?:[^{]|\\{(?!%))*%\\})|(?:\\{%(=|#)([\\s\\S]+?)%\\})|(\\{%)|(%\\})/g\n tmpl.func = function (s, p1, p2, p3, p4, p5) {\n if (p1) {\n // whitespace, quote and backspace in HTML context\n return (\n {\n '\\n': '\\\\n',\n '\\r': '\\\\r',\n '\\t': '\\\\t',\n ' ': ' '\n }[p1] || '\\\\' + p1\n )\n }\n if (p2) {\n // interpolation: {%=prop%}, or unescaped: {%#prop%}\n if (p2 === '=') {\n return \"'+_e(\" + p3 + \")+'\"\n }\n return \"'+(\" + p3 + \"==null?'':\" + p3 + \")+'\"\n }\n if (p4) {\n // evaluation start tag: {%\n return \"';\"\n }\n if (p5) {\n // evaluation end tag: %}\n return \"_s+='\"\n }\n }\n tmpl.encReg = /[<>&\"'\\x00]/g // eslint-disable-line no-control-regex\n tmpl.encMap = {\n '<': '<',\n '>': '>',\n '&': '&',\n '\"': '"',\n \"'\": '''\n }\n tmpl.encode = function (s) {\n // eslint-disable-next-line eqeqeq\n return (s == null ? '' : '' + s).replace(tmpl.encReg, function (c) {\n return tmpl.encMap[c] || ''\n })\n }\n tmpl.arg = 'o'\n tmpl.helper =\n \",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}\" +\n ',include=function(s,d){_s+=tmpl(s,d);}'\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return tmpl\n })\n } else if (typeof module === 'object' && module.exports) {\n module.exports = tmpl\n } else {\n $.tmpl = tmpl\n }\n})(this)\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-tmpl/js/runtime.js":"/*\n * JavaScript Templates Runtime\n * https://github.com/blueimp/JavaScript-Templates\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define */\n\n/* eslint-disable strict */\n\n;(function ($) {\n 'use strict'\n var tmpl = function (id, data) {\n var f = tmpl.cache[id]\n return data\n ? f(data, tmpl)\n : function (data) {\n return f(data, tmpl)\n }\n }\n tmpl.cache = {}\n tmpl.encReg = /[<>&\"'\\x00]/g // eslint-disable-line no-control-regex\n tmpl.encMap = {\n '<': '<',\n '>': '>',\n '&': '&',\n '\"': '"',\n \"'\": '''\n }\n tmpl.encode = function (s) {\n // eslint-disable-next-line eqeqeq\n return (s == null ? '' : '' + s).replace(tmpl.encReg, function (c) {\n return tmpl.encMap[c] || ''\n })\n }\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return tmpl\n })\n } else if (typeof module === 'object' && module.exports) {\n module.exports = tmpl\n } else {\n $.tmpl = tmpl\n }\n})(this)\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-canvas-to-blob/js/canvas-to-blob.js":"/*\n * JavaScript Canvas to Blob\n * https://github.com/blueimp/JavaScript-Canvas-to-Blob\n *\n * Copyright 2012, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on stackoverflow user Stoive's code snippet:\n * http://stackoverflow.com/q/4998908\n */\n\n/* global define, Uint8Array, ArrayBuffer, module */\n\n;(function (window) {\n 'use strict'\n\n var CanvasPrototype =\n window.HTMLCanvasElement && window.HTMLCanvasElement.prototype\n var hasBlobConstructor =\n window.Blob &&\n (function () {\n try {\n return Boolean(new Blob())\n } catch (e) {\n return false\n }\n })()\n var hasArrayBufferViewSupport =\n hasBlobConstructor &&\n window.Uint8Array &&\n (function () {\n try {\n return new Blob([new Uint8Array(100)]).size === 100\n } catch (e) {\n return false\n }\n })()\n var BlobBuilder =\n window.BlobBuilder ||\n window.WebKitBlobBuilder ||\n window.MozBlobBuilder ||\n window.MSBlobBuilder\n var dataURIPattern = /^data:((.*?)(;charset=.*?)?)(;base64)?,/\n var dataURLtoBlob =\n (hasBlobConstructor || BlobBuilder) &&\n window.atob &&\n window.ArrayBuffer &&\n window.Uint8Array &&\n function (dataURI) {\n var matches,\n mediaType,\n isBase64,\n dataString,\n byteString,\n arrayBuffer,\n intArray,\n i,\n bb\n // Parse the dataURI components as per RFC 2397\n matches = dataURI.match(dataURIPattern)\n if (!matches) {\n throw new Error('invalid data URI')\n }\n // Default to text/plain;charset=US-ASCII\n mediaType = matches[2]\n ? matches[1]\n : 'text/plain' + (matches[3] || ';charset=US-ASCII')\n isBase64 = !!matches[4]\n dataString = dataURI.slice(matches[0].length)\n if (isBase64) {\n // Convert base64 to raw binary data held in a string:\n byteString = atob(dataString)\n } else {\n // Convert base64/URLEncoded data component to raw binary:\n byteString = decodeURIComponent(dataString)\n }\n // Write the bytes of the string to an ArrayBuffer:\n arrayBuffer = new ArrayBuffer(byteString.length)\n intArray = new Uint8Array(arrayBuffer)\n for (i = 0; i < byteString.length; i += 1) {\n intArray[i] = byteString.charCodeAt(i)\n }\n // Write the ArrayBuffer (or ArrayBufferView) to a blob:\n if (hasBlobConstructor) {\n return new Blob([hasArrayBufferViewSupport ? intArray : arrayBuffer], {\n type: mediaType\n })\n }\n bb = new BlobBuilder()\n bb.append(arrayBuffer)\n return bb.getBlob(mediaType)\n }\n if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {\n if (CanvasPrototype.mozGetAsFile) {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this\n setTimeout(function () {\n if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) {\n callback(dataURLtoBlob(self.toDataURL(type, quality)))\n } else {\n callback(self.mozGetAsFile('blob', type))\n }\n })\n }\n } else if (CanvasPrototype.toDataURL && dataURLtoBlob) {\n if (CanvasPrototype.msToBlob) {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this\n setTimeout(function () {\n if (\n ((type && type !== 'image/png') || quality) &&\n CanvasPrototype.toDataURL &&\n dataURLtoBlob\n ) {\n callback(dataURLtoBlob(self.toDataURL(type, quality)))\n } else {\n callback(self.msToBlob(type))\n }\n })\n }\n } else {\n CanvasPrototype.toBlob = function (callback, type, quality) {\n var self = this\n setTimeout(function () {\n callback(dataURLtoBlob(self.toDataURL(type, quality)))\n })\n }\n }\n }\n }\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return dataURLtoBlob\n })\n } else if (typeof module === 'object' && module.exports) {\n module.exports = dataURLtoBlob\n } else {\n window.dataURLtoBlob = dataURLtoBlob\n }\n})(window)\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-iptc.js":"/*\n * JavaScript Load Image IPTC Parser\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2013, Sebastian Tschan\n * Copyright 2018, Dave Bevan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, require, DataView */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'), require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta'))\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n /**\n * IPTC tag map\n *\n * @name IptcMap\n * @class\n */\n function IptcMap() {}\n\n IptcMap.prototype.map = {\n ObjectName: 5\n }\n\n IptcMap.prototype.types = {\n 0: 'Uint16', // ApplicationRecordVersion\n 200: 'Uint16', // ObjectPreviewFileFormat\n 201: 'Uint16', // ObjectPreviewFileVersion\n 202: 'binary' // ObjectPreviewData\n }\n\n /**\n * Retrieves IPTC tag value\n *\n * @param {number|string} id IPTC tag code or name\n * @returns {object} IPTC tag value\n */\n IptcMap.prototype.get = function (id) {\n return this[id] || this[this.map[id]]\n }\n\n /**\n * Retrieves string for the given DataView and range\n *\n * @param {DataView} dataView Data view interface\n * @param {number} offset Offset start\n * @param {number} length Offset length\n * @returns {string} String value\n */\n function getStringValue(dataView, offset, length) {\n var outstr = ''\n var end = offset + length\n for (var n = offset; n < end; n += 1) {\n outstr += String.fromCharCode(dataView.getUint8(n))\n }\n return outstr\n }\n\n /**\n * Retrieves tag value for the given DataView and range\n *\n * @param {number} tagCode tag code\n * @param {IptcMap} map IPTC tag map\n * @param {DataView} dataView Data view interface\n * @param {number} offset Range start\n * @param {number} length Range length\n * @returns {object} Tag value\n */\n function getTagValue(tagCode, map, dataView, offset, length) {\n if (map.types[tagCode] === 'binary') {\n return new Blob([dataView.buffer.slice(offset, offset + length)])\n }\n if (map.types[tagCode] === 'Uint16') {\n return dataView.getUint16(offset)\n }\n return getStringValue(dataView, offset, length)\n }\n\n /**\n * Combines IPTC value with existing ones.\n *\n * @param {object} value Existing IPTC field value\n * @param {object} newValue New IPTC field value\n * @returns {object} Resulting IPTC field value\n */\n function combineTagValues(value, newValue) {\n if (value === undefined) return newValue\n if (value instanceof Array) {\n value.push(newValue)\n return value\n }\n return [value, newValue]\n }\n\n /**\n * Parses IPTC tags.\n *\n * @param {DataView} dataView Data view interface\n * @param {number} segmentOffset Segment offset\n * @param {number} segmentLength Segment length\n * @param {object} data Data export object\n * @param {object} includeTags Map of tags to include\n * @param {object} excludeTags Map of tags to exclude\n */\n function parseIptcTags(\n dataView,\n segmentOffset,\n segmentLength,\n data,\n includeTags,\n excludeTags\n ) {\n var value, tagSize, tagCode\n var segmentEnd = segmentOffset + segmentLength\n var offset = segmentOffset\n while (offset < segmentEnd) {\n if (\n dataView.getUint8(offset) === 0x1c && // tag marker\n dataView.getUint8(offset + 1) === 0x02 // record number, only handles v2\n ) {\n tagCode = dataView.getUint8(offset + 2)\n if (\n (!includeTags || includeTags[tagCode]) &&\n (!excludeTags || !excludeTags[tagCode])\n ) {\n tagSize = dataView.getInt16(offset + 3)\n value = getTagValue(tagCode, data.iptc, dataView, offset + 5, tagSize)\n data.iptc[tagCode] = combineTagValues(data.iptc[tagCode], value)\n if (data.iptcOffsets) {\n data.iptcOffsets[tagCode] = offset\n }\n }\n }\n offset += 1\n }\n }\n\n /**\n * Tests if field segment starts at offset.\n *\n * @param {DataView} dataView Data view interface\n * @param {number} offset Segment offset\n * @returns {boolean} True if '8BIM<EOT><EOT>' exists at offset\n */\n function isSegmentStart(dataView, offset) {\n return (\n dataView.getUint32(offset) === 0x3842494d && // Photoshop segment start\n dataView.getUint16(offset + 4) === 0x0404 // IPTC segment start\n )\n }\n\n /**\n * Returns header length.\n *\n * @param {DataView} dataView Data view interface\n * @param {number} offset Segment offset\n * @returns {number} Header length\n */\n function getHeaderLength(dataView, offset) {\n var length = dataView.getUint8(offset + 7)\n if (length % 2 !== 0) length += 1\n // Check for pre photoshop 6 format\n if (length === 0) {\n // Always 4\n length = 4\n }\n return length\n }\n\n loadImage.parseIptcData = function (dataView, offset, length, data, options) {\n if (options.disableIptc) {\n return\n }\n var markerLength = offset + length\n while (offset + 8 < markerLength) {\n if (isSegmentStart(dataView, offset)) {\n var headerLength = getHeaderLength(dataView, offset)\n var segmentOffset = offset + 8 + headerLength\n if (segmentOffset > markerLength) {\n // eslint-disable-next-line no-console\n console.log('Invalid IPTC data: Invalid segment offset.')\n break\n }\n var segmentLength = dataView.getUint16(offset + 6 + headerLength)\n if (offset + segmentLength > markerLength) {\n // eslint-disable-next-line no-console\n console.log('Invalid IPTC data: Invalid segment size.')\n break\n }\n // Create the iptc object to store the tags:\n data.iptc = new IptcMap()\n if (!options.disableIptcOffsets) {\n data.iptcOffsets = new IptcMap()\n }\n parseIptcTags(\n dataView,\n segmentOffset,\n segmentLength,\n data,\n options.includeIptcTags,\n options.excludeIptcTags || { 202: true } // ObjectPreviewData\n )\n return\n }\n // eslint-disable-next-line no-param-reassign\n offset += 1\n }\n }\n\n // Registers this IPTC parser for the APP13 JPEG metadata segment:\n loadImage.metaDataParsers.jpeg[0xffed].push(loadImage.parseIptcData)\n\n loadImage.IptcMap = IptcMap\n\n // Adds the following properties to the parseMetaData callback data:\n // - iptc: The iptc tags, parsed by the parseIptcData method\n\n // Adds the following options to the parseMetaData method:\n // - disableIptc: Disables IPTC parsing when true.\n // - disableIptcOffsets: Disables storing IPTC tag offsets when true.\n // - includeIptcTags: A map of IPTC tags to include for parsing.\n // - excludeIptcTags: A map of IPTC tags to exclude from parsing.\n})\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-scale.js":"/*\n * JavaScript Load Image Scaling\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, require */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'))\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n var originalTransform = loadImage.transform\n\n loadImage.createCanvas = function (width, height, offscreen) {\n if (offscreen && loadImage.global.OffscreenCanvas) {\n return new OffscreenCanvas(width, height)\n }\n var canvas = document.createElement('canvas')\n canvas.width = width\n canvas.height = height\n return canvas\n }\n\n loadImage.transform = function (img, options, callback, file, data) {\n originalTransform.call(\n loadImage,\n loadImage.scale(img, options, data),\n options,\n callback,\n file,\n data\n )\n }\n\n // Transform image coordinates, allows to override e.g.\n // the canvas orientation based on the orientation option,\n // gets canvas, options and data passed as arguments:\n loadImage.transformCoordinates = function () {}\n\n // Returns transformed options, allows to override e.g.\n // maxWidth, maxHeight and crop options based on the aspectRatio.\n // gets img, options, data passed as arguments:\n loadImage.getTransformedOptions = function (img, options) {\n var aspectRatio = options.aspectRatio\n var newOptions\n var i\n var width\n var height\n if (!aspectRatio) {\n return options\n }\n newOptions = {}\n for (i in options) {\n if (Object.prototype.hasOwnProperty.call(options, i)) {\n newOptions[i] = options[i]\n }\n }\n newOptions.crop = true\n width = img.naturalWidth || img.width\n height = img.naturalHeight || img.height\n if (width / height > aspectRatio) {\n newOptions.maxWidth = height * aspectRatio\n newOptions.maxHeight = height\n } else {\n newOptions.maxWidth = width\n newOptions.maxHeight = width / aspectRatio\n }\n return newOptions\n }\n\n // Canvas render method, allows to implement a different rendering algorithm:\n loadImage.drawImage = function (\n img,\n canvas,\n sourceX,\n sourceY,\n sourceWidth,\n sourceHeight,\n destWidth,\n destHeight,\n options\n ) {\n var ctx = canvas.getContext('2d')\n if (options.imageSmoothingEnabled === false) {\n ctx.msImageSmoothingEnabled = false\n ctx.imageSmoothingEnabled = false\n } else if (options.imageSmoothingQuality) {\n ctx.imageSmoothingQuality = options.imageSmoothingQuality\n }\n ctx.drawImage(\n img,\n sourceX,\n sourceY,\n sourceWidth,\n sourceHeight,\n 0,\n 0,\n destWidth,\n destHeight\n )\n return ctx\n }\n\n // Determines if the target image should be a canvas element:\n loadImage.requiresCanvas = function (options) {\n return options.canvas || options.crop || !!options.aspectRatio\n }\n\n // Scales and/or crops the given image (img or canvas HTML element)\n // using the given options:\n loadImage.scale = function (img, options, data) {\n // eslint-disable-next-line no-param-reassign\n options = options || {}\n // eslint-disable-next-line no-param-reassign\n data = data || {}\n var useCanvas =\n img.getContext ||\n (loadImage.requiresCanvas(options) &&\n !!loadImage.global.HTMLCanvasElement)\n var width = img.naturalWidth || img.width\n var height = img.naturalHeight || img.height\n var destWidth = width\n var destHeight = height\n var maxWidth\n var maxHeight\n var minWidth\n var minHeight\n var sourceWidth\n var sourceHeight\n var sourceX\n var sourceY\n var pixelRatio\n var downsamplingRatio\n var tmp\n var canvas\n /**\n * Scales up image dimensions\n */\n function scaleUp() {\n var scale = Math.max(\n (minWidth || destWidth) / destWidth,\n (minHeight || destHeight) / destHeight\n )\n if (scale > 1) {\n destWidth *= scale\n destHeight *= scale\n }\n }\n /**\n * Scales down image dimensions\n */\n function scaleDown() {\n var scale = Math.min(\n (maxWidth || destWidth) / destWidth,\n (maxHeight || destHeight) / destHeight\n )\n if (scale < 1) {\n destWidth *= scale\n destHeight *= scale\n }\n }\n if (useCanvas) {\n // eslint-disable-next-line no-param-reassign\n options = loadImage.getTransformedOptions(img, options, data)\n sourceX = options.left || 0\n sourceY = options.top || 0\n if (options.sourceWidth) {\n sourceWidth = options.sourceWidth\n if (options.right !== undefined && options.left === undefined) {\n sourceX = width - sourceWidth - options.right\n }\n } else {\n sourceWidth = width - sourceX - (options.right || 0)\n }\n if (options.sourceHeight) {\n sourceHeight = options.sourceHeight\n if (options.bottom !== undefined && options.top === undefined) {\n sourceY = height - sourceHeight - options.bottom\n }\n } else {\n sourceHeight = height - sourceY - (options.bottom || 0)\n }\n destWidth = sourceWidth\n destHeight = sourceHeight\n }\n maxWidth = options.maxWidth\n maxHeight = options.maxHeight\n minWidth = options.minWidth\n minHeight = options.minHeight\n if (useCanvas && maxWidth && maxHeight && options.crop) {\n destWidth = maxWidth\n destHeight = maxHeight\n tmp = sourceWidth / sourceHeight - maxWidth / maxHeight\n if (tmp < 0) {\n sourceHeight = (maxHeight * sourceWidth) / maxWidth\n if (options.top === undefined && options.bottom === undefined) {\n sourceY = (height - sourceHeight) / 2\n }\n } else if (tmp > 0) {\n sourceWidth = (maxWidth * sourceHeight) / maxHeight\n if (options.left === undefined && options.right === undefined) {\n sourceX = (width - sourceWidth) / 2\n }\n }\n } else {\n if (options.contain || options.cover) {\n minWidth = maxWidth = maxWidth || minWidth\n minHeight = maxHeight = maxHeight || minHeight\n }\n if (options.cover) {\n scaleDown()\n scaleUp()\n } else {\n scaleUp()\n scaleDown()\n }\n }\n if (useCanvas) {\n pixelRatio = options.pixelRatio\n if (\n pixelRatio > 1 &&\n // Check if the image has not yet had the device pixel ratio applied:\n !(\n img.style.width &&\n Math.floor(parseFloat(img.style.width, 10)) ===\n Math.floor(width / pixelRatio)\n )\n ) {\n destWidth *= pixelRatio\n destHeight *= pixelRatio\n }\n // Check if workaround for Chromium orientation crop bug is required:\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1074354\n if (\n loadImage.orientationCropBug &&\n !img.getContext &&\n (sourceX || sourceY || sourceWidth !== width || sourceHeight !== height)\n ) {\n // Write the complete source image to an intermediate canvas first:\n tmp = img\n // eslint-disable-next-line no-param-reassign\n img = loadImage.createCanvas(width, height, true)\n loadImage.drawImage(\n tmp,\n img,\n 0,\n 0,\n width,\n height,\n width,\n height,\n options\n )\n }\n downsamplingRatio = options.downsamplingRatio\n if (\n downsamplingRatio > 0 &&\n downsamplingRatio < 1 &&\n destWidth < sourceWidth &&\n destHeight < sourceHeight\n ) {\n while (sourceWidth * downsamplingRatio > destWidth) {\n canvas = loadImage.createCanvas(\n sourceWidth * downsamplingRatio,\n sourceHeight * downsamplingRatio,\n true\n )\n loadImage.drawImage(\n img,\n canvas,\n sourceX,\n sourceY,\n sourceWidth,\n sourceHeight,\n canvas.width,\n canvas.height,\n options\n )\n sourceX = 0\n sourceY = 0\n sourceWidth = canvas.width\n sourceHeight = canvas.height\n // eslint-disable-next-line no-param-reassign\n img = canvas\n }\n }\n canvas = loadImage.createCanvas(destWidth, destHeight)\n loadImage.transformCoordinates(canvas, options, data)\n if (pixelRatio > 1) {\n canvas.style.width = canvas.width / pixelRatio + 'px'\n }\n loadImage\n .drawImage(\n img,\n canvas,\n sourceX,\n sourceY,\n sourceWidth,\n sourceHeight,\n destWidth,\n destHeight,\n options\n )\n .setTransform(1, 0, 0, 1, 0, 0) // reset to the identity matrix\n return canvas\n }\n img.width = destWidth\n img.height = destHeight\n return img\n }\n})\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-orientation.js":"/*\n * JavaScript Load Image Orientation\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/*\nExif orientation values to correctly display the letter F:\n\n 1 2\n \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\n \u2588\u2588 \u2588\u2588\n \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\n \u2588\u2588 \u2588\u2588\n \u2588\u2588 \u2588\u2588\n\n 3 4\n \u2588\u2588 \u2588\u2588\n \u2588\u2588 \u2588\u2588\n \u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\n \u2588\u2588 \u2588\u2588\n \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\n\n 5 6\n\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\n\u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\n\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\n 7 8\n \u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n \u2588\u2588 \u2588\u2588 \u2588\u2588 \u2588\u2588\n\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\n\n*/\n\n/* global define, module, require */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-scale', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-scale'),\n require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta')\n )\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n var originalTransform = loadImage.transform\n var originalRequiresCanvas = loadImage.requiresCanvas\n var originalRequiresMetaData = loadImage.requiresMetaData\n var originalTransformCoordinates = loadImage.transformCoordinates\n var originalGetTransformedOptions = loadImage.getTransformedOptions\n\n ;(function ($) {\n // Guard for non-browser environments (e.g. server-side rendering):\n if (!$.global.document) return\n // black+white 3x2 JPEG, with the following meta information set:\n // - EXIF Orientation: 6 (Rotated 90\u00b0 CCW)\n // Image data layout (B=black, F=white):\n // BFF\n // BBB\n var testImageURL =\n 'data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAA' +\n 'AAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBA' +\n 'QEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQE' +\n 'BAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAIAAwMBEQACEQEDEQH/x' +\n 'ABRAAEAAAAAAAAAAAAAAAAAAAAKEAEBAQADAQEAAAAAAAAAAAAGBQQDCAkCBwEBAAAAAAA' +\n 'AAAAAAAAAAAAAABEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8AG8T9NfSMEVMhQ' +\n 'voP3fFiRZ+MTHDifa/95OFSZU5OzRzxkyejv8ciEfhSceSXGjS8eSdLnZc2HDm4M3BxcXw' +\n 'H/9k='\n var img = document.createElement('img')\n img.onload = function () {\n // Check if the browser supports automatic image orientation:\n $.orientation = img.width === 2 && img.height === 3\n if ($.orientation) {\n var canvas = $.createCanvas(1, 1, true)\n var ctx = canvas.getContext('2d')\n ctx.drawImage(img, 1, 1, 1, 1, 0, 0, 1, 1)\n // Check if the source image coordinates (sX, sY, sWidth, sHeight) are\n // correctly applied to the auto-orientated image, which should result\n // in a white opaque pixel (e.g. in Safari).\n // Browsers that show a transparent pixel (e.g. Chromium) fail to crop\n // auto-oriented images correctly and require a workaround, e.g.\n // drawing the complete source image to an intermediate canvas first.\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=1074354\n $.orientationCropBug =\n ctx.getImageData(0, 0, 1, 1).data.toString() !== '255,255,255,255'\n }\n }\n img.src = testImageURL\n })(loadImage)\n\n /**\n * Determines if the orientation requires a canvas element.\n *\n * @param {object} [options] Options object\n * @param {boolean} [withMetaData] Is metadata required for orientation\n * @returns {boolean} Returns true if orientation requires canvas/meta\n */\n function requiresCanvasOrientation(options, withMetaData) {\n var orientation = options && options.orientation\n return (\n // Exif orientation for browsers without automatic image orientation:\n (orientation === true && !loadImage.orientation) ||\n // Orientation reset for browsers with automatic image orientation:\n (orientation === 1 && loadImage.orientation) ||\n // Orientation to defined value, requires meta for orientation reset only:\n ((!withMetaData || loadImage.orientation) &&\n orientation > 1 &&\n orientation < 9)\n )\n }\n\n /**\n * Determines if the image requires an orientation change.\n *\n * @param {number} [orientation] Defined orientation value\n * @param {number} [autoOrientation] Auto-orientation based on Exif data\n * @returns {boolean} Returns true if an orientation change is required\n */\n function requiresOrientationChange(orientation, autoOrientation) {\n return (\n orientation !== autoOrientation &&\n ((orientation === 1 && autoOrientation > 1 && autoOrientation < 9) ||\n (orientation > 1 && orientation < 9))\n )\n }\n\n /**\n * Determines orientation combinations that require a rotation by 180\u00b0.\n *\n * The following is a list of combinations that return true:\n *\n * 2 (flip) => 5 (rot90,flip), 7 (rot90,flip), 6 (rot90), 8 (rot90)\n * 4 (flip) => 5 (rot90,flip), 7 (rot90,flip), 6 (rot90), 8 (rot90)\n *\n * 5 (rot90,flip) => 2 (flip), 4 (flip), 6 (rot90), 8 (rot90)\n * 7 (rot90,flip) => 2 (flip), 4 (flip), 6 (rot90), 8 (rot90)\n *\n * 6 (rot90) => 2 (flip), 4 (flip), 5 (rot90,flip), 7 (rot90,flip)\n * 8 (rot90) => 2 (flip), 4 (flip), 5 (rot90,flip), 7 (rot90,flip)\n *\n * @param {number} [orientation] Defined orientation value\n * @param {number} [autoOrientation] Auto-orientation based on Exif data\n * @returns {boolean} Returns true if rotation by 180\u00b0 is required\n */\n function requiresRot180(orientation, autoOrientation) {\n if (autoOrientation > 1 && autoOrientation < 9) {\n switch (orientation) {\n case 2:\n case 4:\n return autoOrientation > 4\n case 5:\n case 7:\n return autoOrientation % 2 === 0\n case 6:\n case 8:\n return (\n autoOrientation === 2 ||\n autoOrientation === 4 ||\n autoOrientation === 5 ||\n autoOrientation === 7\n )\n }\n }\n return false\n }\n\n // Determines if the target image should be a canvas element:\n loadImage.requiresCanvas = function (options) {\n return (\n requiresCanvasOrientation(options) ||\n originalRequiresCanvas.call(loadImage, options)\n )\n }\n\n // Determines if metadata should be loaded automatically:\n loadImage.requiresMetaData = function (options) {\n return (\n requiresCanvasOrientation(options, true) ||\n originalRequiresMetaData.call(loadImage, options)\n )\n }\n\n loadImage.transform = function (img, options, callback, file, data) {\n originalTransform.call(\n loadImage,\n img,\n options,\n function (img, data) {\n if (data) {\n var autoOrientation =\n loadImage.orientation && data.exif && data.exif.get('Orientation')\n if (autoOrientation > 4 && autoOrientation < 9) {\n // Automatic image orientation switched image dimensions\n var originalWidth = data.originalWidth\n var originalHeight = data.originalHeight\n data.originalWidth = originalHeight\n data.originalHeight = originalWidth\n }\n }\n callback(img, data)\n },\n file,\n data\n )\n }\n\n // Transforms coordinate and dimension options\n // based on the given orientation option:\n loadImage.getTransformedOptions = function (img, opts, data) {\n var options = originalGetTransformedOptions.call(loadImage, img, opts)\n var exifOrientation = data.exif && data.exif.get('Orientation')\n var orientation = options.orientation\n var autoOrientation = loadImage.orientation && exifOrientation\n if (orientation === true) orientation = exifOrientation\n if (!requiresOrientationChange(orientation, autoOrientation)) {\n return options\n }\n var top = options.top\n var right = options.right\n var bottom = options.bottom\n var left = options.left\n var newOptions = {}\n for (var i in options) {\n if (Object.prototype.hasOwnProperty.call(options, i)) {\n newOptions[i] = options[i]\n }\n }\n newOptions.orientation = orientation\n if (\n (orientation > 4 && !(autoOrientation > 4)) ||\n (orientation < 5 && autoOrientation > 4)\n ) {\n // Image dimensions and target dimensions are switched\n newOptions.maxWidth = options.maxHeight\n newOptions.maxHeight = options.maxWidth\n newOptions.minWidth = options.minHeight\n newOptions.minHeight = options.minWidth\n newOptions.sourceWidth = options.sourceHeight\n newOptions.sourceHeight = options.sourceWidth\n }\n if (autoOrientation > 1) {\n // Browsers which correctly apply source image coordinates to\n // auto-oriented images\n switch (autoOrientation) {\n case 2:\n // Horizontal flip\n right = options.left\n left = options.right\n break\n case 3:\n // 180\u00b0 Rotate CCW\n top = options.bottom\n right = options.left\n bottom = options.top\n left = options.right\n break\n case 4:\n // Vertical flip\n top = options.bottom\n bottom = options.top\n break\n case 5:\n // Horizontal flip + 90\u00b0 Rotate CCW\n top = options.left\n right = options.bottom\n bottom = options.right\n left = options.top\n break\n case 6:\n // 90\u00b0 Rotate CCW\n top = options.left\n right = options.top\n bottom = options.right\n left = options.bottom\n break\n case 7:\n // Vertical flip + 90\u00b0 Rotate CCW\n top = options.right\n right = options.top\n bottom = options.left\n left = options.bottom\n break\n case 8:\n // 90\u00b0 Rotate CW\n top = options.right\n right = options.bottom\n bottom = options.left\n left = options.top\n break\n }\n // Some orientation combinations require additional rotation by 180\u00b0:\n if (requiresRot180(orientation, autoOrientation)) {\n var tmpTop = top\n var tmpRight = right\n top = bottom\n right = left\n bottom = tmpTop\n left = tmpRight\n }\n }\n newOptions.top = top\n newOptions.right = right\n newOptions.bottom = bottom\n newOptions.left = left\n // Account for defined browser orientation:\n switch (orientation) {\n case 2:\n // Horizontal flip\n newOptions.right = left\n newOptions.left = right\n break\n case 3:\n // 180\u00b0 Rotate CCW\n newOptions.top = bottom\n newOptions.right = left\n newOptions.bottom = top\n newOptions.left = right\n break\n case 4:\n // Vertical flip\n newOptions.top = bottom\n newOptions.bottom = top\n break\n case 5:\n // Vertical flip + 90\u00b0 Rotate CW\n newOptions.top = left\n newOptions.right = bottom\n newOptions.bottom = right\n newOptions.left = top\n break\n case 6:\n // 90\u00b0 Rotate CW\n newOptions.top = right\n newOptions.right = bottom\n newOptions.bottom = left\n newOptions.left = top\n break\n case 7:\n // Horizontal flip + 90\u00b0 Rotate CW\n newOptions.top = right\n newOptions.right = top\n newOptions.bottom = left\n newOptions.left = bottom\n break\n case 8:\n // 90\u00b0 Rotate CCW\n newOptions.top = left\n newOptions.right = top\n newOptions.bottom = right\n newOptions.left = bottom\n break\n }\n return newOptions\n }\n\n // Transform image orientation based on the given EXIF orientation option:\n loadImage.transformCoordinates = function (canvas, options, data) {\n originalTransformCoordinates.call(loadImage, canvas, options, data)\n var orientation = options.orientation\n var autoOrientation =\n loadImage.orientation && data.exif && data.exif.get('Orientation')\n if (!requiresOrientationChange(orientation, autoOrientation)) {\n return\n }\n var ctx = canvas.getContext('2d')\n var width = canvas.width\n var height = canvas.height\n var sourceWidth = width\n var sourceHeight = height\n if (\n (orientation > 4 && !(autoOrientation > 4)) ||\n (orientation < 5 && autoOrientation > 4)\n ) {\n // Image dimensions and target dimensions are switched\n canvas.width = height\n canvas.height = width\n }\n if (orientation > 4) {\n // Destination and source dimensions are switched\n sourceWidth = height\n sourceHeight = width\n }\n // Reset automatic browser orientation:\n switch (autoOrientation) {\n case 2:\n // Horizontal flip\n ctx.translate(sourceWidth, 0)\n ctx.scale(-1, 1)\n break\n case 3:\n // 180\u00b0 Rotate CCW\n ctx.translate(sourceWidth, sourceHeight)\n ctx.rotate(Math.PI)\n break\n case 4:\n // Vertical flip\n ctx.translate(0, sourceHeight)\n ctx.scale(1, -1)\n break\n case 5:\n // Horizontal flip + 90\u00b0 Rotate CCW\n ctx.rotate(-0.5 * Math.PI)\n ctx.scale(-1, 1)\n break\n case 6:\n // 90\u00b0 Rotate CCW\n ctx.rotate(-0.5 * Math.PI)\n ctx.translate(-sourceWidth, 0)\n break\n case 7:\n // Vertical flip + 90\u00b0 Rotate CCW\n ctx.rotate(-0.5 * Math.PI)\n ctx.translate(-sourceWidth, sourceHeight)\n ctx.scale(1, -1)\n break\n case 8:\n // 90\u00b0 Rotate CW\n ctx.rotate(0.5 * Math.PI)\n ctx.translate(0, -sourceHeight)\n break\n }\n // Some orientation combinations require additional rotation by 180\u00b0:\n if (requiresRot180(orientation, autoOrientation)) {\n ctx.translate(sourceWidth, sourceHeight)\n ctx.rotate(Math.PI)\n }\n switch (orientation) {\n case 2:\n // Horizontal flip\n ctx.translate(width, 0)\n ctx.scale(-1, 1)\n break\n case 3:\n // 180\u00b0 Rotate CCW\n ctx.translate(width, height)\n ctx.rotate(Math.PI)\n break\n case 4:\n // Vertical flip\n ctx.translate(0, height)\n ctx.scale(1, -1)\n break\n case 5:\n // Vertical flip + 90\u00b0 Rotate CW\n ctx.rotate(0.5 * Math.PI)\n ctx.scale(1, -1)\n break\n case 6:\n // 90\u00b0 Rotate CW\n ctx.rotate(0.5 * Math.PI)\n ctx.translate(0, -height)\n break\n case 7:\n // Horizontal flip + 90\u00b0 Rotate CW\n ctx.rotate(0.5 * Math.PI)\n ctx.translate(width, -height)\n ctx.scale(-1, 1)\n break\n case 8:\n // 90\u00b0 Rotate CCW\n ctx.rotate(-0.5 * Math.PI)\n ctx.translate(-width, 0)\n break\n }\n }\n})\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-iptc-map.js":"/*\n * JavaScript Load Image IPTC Map\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2013, Sebastian Tschan\n * Copyright 2018, Dave Bevan\n *\n * IPTC tags mapping based on\n * https://iptc.org/standards/photo-metadata\n * https://exiftool.org/TagNames/IPTC.html\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, require */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-iptc'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'), require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-iptc'))\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n var IptcMapProto = loadImage.IptcMap.prototype\n\n IptcMapProto.tags = {\n 0: 'ApplicationRecordVersion',\n 3: 'ObjectTypeReference',\n 4: 'ObjectAttributeReference',\n 5: 'ObjectName',\n 7: 'EditStatus',\n 8: 'EditorialUpdate',\n 10: 'Urgency',\n 12: 'SubjectReference',\n 15: 'Category',\n 20: 'SupplementalCategories',\n 22: 'FixtureIdentifier',\n 25: 'Keywords',\n 26: 'ContentLocationCode',\n 27: 'ContentLocationName',\n 30: 'ReleaseDate',\n 35: 'ReleaseTime',\n 37: 'ExpirationDate',\n 38: 'ExpirationTime',\n 40: 'SpecialInstructions',\n 42: 'ActionAdvised',\n 45: 'ReferenceService',\n 47: 'ReferenceDate',\n 50: 'ReferenceNumber',\n 55: 'DateCreated',\n 60: 'TimeCreated',\n 62: 'DigitalCreationDate',\n 63: 'DigitalCreationTime',\n 65: 'OriginatingProgram',\n 70: 'ProgramVersion',\n 75: 'ObjectCycle',\n 80: 'Byline',\n 85: 'BylineTitle',\n 90: 'City',\n 92: 'Sublocation',\n 95: 'State',\n 100: 'CountryCode',\n 101: 'Country',\n 103: 'OriginalTransmissionReference',\n 105: 'Headline',\n 110: 'Credit',\n 115: 'Source',\n 116: 'CopyrightNotice',\n 118: 'Contact',\n 120: 'Caption',\n 121: 'LocalCaption',\n 122: 'Writer',\n 125: 'RasterizedCaption',\n 130: 'ImageType',\n 131: 'ImageOrientation',\n 135: 'LanguageIdentifier',\n 150: 'AudioType',\n 151: 'AudioSamplingRate',\n 152: 'AudioSamplingResolution',\n 153: 'AudioDuration',\n 154: 'AudioOutcue',\n 184: 'JobID',\n 185: 'MasterDocumentID',\n 186: 'ShortDocumentID',\n 187: 'UniqueDocumentID',\n 188: 'OwnerID',\n 200: 'ObjectPreviewFileFormat',\n 201: 'ObjectPreviewFileVersion',\n 202: 'ObjectPreviewData',\n 221: 'Prefs',\n 225: 'ClassifyState',\n 228: 'SimilarityIndex',\n 230: 'DocumentNotes',\n 231: 'DocumentHistory',\n 232: 'ExifCameraInfo',\n 255: 'CatalogSets'\n }\n\n IptcMapProto.stringValues = {\n 10: {\n 0: '0 (reserved)',\n 1: '1 (most urgent)',\n 2: '2',\n 3: '3',\n 4: '4',\n 5: '5 (normal urgency)',\n 6: '6',\n 7: '7',\n 8: '8 (least urgent)',\n 9: '9 (user-defined priority)'\n },\n 75: {\n a: 'Morning',\n b: 'Both Morning and Evening',\n p: 'Evening'\n },\n 131: {\n L: 'Landscape',\n P: 'Portrait',\n S: 'Square'\n }\n }\n\n IptcMapProto.getText = function (id) {\n var value = this.get(id)\n var tagCode = this.map[id]\n var stringValue = this.stringValues[tagCode]\n if (stringValue) return stringValue[value]\n return String(value)\n }\n\n IptcMapProto.getAll = function () {\n var map = {}\n var prop\n var name\n for (prop in this) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n name = this.tags[prop]\n if (name) map[name] = this.getText(name)\n }\n }\n return map\n }\n\n IptcMapProto.getName = function (tagCode) {\n return this.tags[tagCode]\n }\n\n // Extend the map of tag names to tag codes:\n ;(function () {\n var tags = IptcMapProto.tags\n var map = IptcMapProto.map || {}\n var prop\n // Map the tag names to tags:\n for (prop in tags) {\n if (Object.prototype.hasOwnProperty.call(tags, prop)) {\n map[tags[prop]] = Number(prop)\n }\n }\n })()\n})\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image.js":"/*\n * JavaScript Load Image\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, Promise */\n\n;(function ($) {\n 'use strict'\n\n var urlAPI = $.URL || $.webkitURL\n\n /**\n * Creates an object URL for a given File object.\n *\n * @param {Blob} blob Blob object\n * @returns {string|boolean} Returns object URL if API exists, else false.\n */\n function createObjectURL(blob) {\n return urlAPI ? urlAPI.createObjectURL(blob) : false\n }\n\n /**\n * Revokes a given object URL.\n *\n * @param {string} url Blob object URL\n * @returns {undefined|boolean} Returns undefined if API exists, else false.\n */\n function revokeObjectURL(url) {\n return urlAPI ? urlAPI.revokeObjectURL(url) : false\n }\n\n /**\n * Helper function to revoke an object URL\n *\n * @param {string} url Blob Object URL\n * @param {object} [options] Options object\n */\n function revokeHelper(url, options) {\n if (url && url.slice(0, 5) === 'blob:' && !(options && options.noRevoke)) {\n revokeObjectURL(url)\n }\n }\n\n /**\n * Loads a given File object via FileReader interface.\n *\n * @param {Blob} file Blob object\n * @param {Function} onload Load event callback\n * @param {Function} [onerror] Error/Abort event callback\n * @param {string} [method=readAsDataURL] FileReader method\n * @returns {FileReader|boolean} Returns FileReader if API exists, else false.\n */\n function readFile(file, onload, onerror, method) {\n if (!$.FileReader) return false\n var reader = new FileReader()\n reader.onload = function () {\n onload.call(reader, this.result)\n }\n if (onerror) {\n reader.onabort = reader.onerror = function () {\n onerror.call(reader, this.error)\n }\n }\n var readerMethod = reader[method || 'readAsDataURL']\n if (readerMethod) {\n readerMethod.call(reader, file)\n return reader\n }\n }\n\n /**\n * Cross-frame instanceof check.\n *\n * @param {string} type Instance type\n * @param {object} obj Object instance\n * @returns {boolean} Returns true if the object is of the given instance.\n */\n function isInstanceOf(type, obj) {\n // Cross-frame instanceof check\n return Object.prototype.toString.call(obj) === '[object ' + type + ']'\n }\n\n /**\n * @typedef { HTMLImageElement|HTMLCanvasElement } Result\n */\n\n /**\n * Loads an image for a given File object.\n *\n * @param {Blob|string} file Blob object or image URL\n * @param {Function|object} [callback] Image load event callback or options\n * @param {object} [options] Options object\n * @returns {HTMLImageElement|FileReader|Promise<Result>} Object\n */\n function loadImage(file, callback, options) {\n /**\n * Promise executor\n *\n * @param {Function} resolve Resolution function\n * @param {Function} reject Rejection function\n * @returns {HTMLImageElement|FileReader} Object\n */\n function executor(resolve, reject) {\n var img = document.createElement('img')\n var url\n /**\n * Callback for the fetchBlob call.\n *\n * @param {HTMLImageElement|HTMLCanvasElement} img Error object\n * @param {object} data Data object\n * @returns {undefined} Undefined\n */\n function resolveWrapper(img, data) {\n if (resolve === reject) {\n // Not using Promises\n if (resolve) resolve(img, data)\n return\n } else if (img instanceof Error) {\n reject(img)\n return\n }\n data = data || {} // eslint-disable-line no-param-reassign\n data.image = img\n resolve(data)\n }\n /**\n * Callback for the fetchBlob call.\n *\n * @param {Blob} blob Blob object\n * @param {Error} err Error object\n */\n function fetchBlobCallback(blob, err) {\n if (err && $.console) console.log(err) // eslint-disable-line no-console\n if (blob && isInstanceOf('Blob', blob)) {\n file = blob // eslint-disable-line no-param-reassign\n url = createObjectURL(file)\n } else {\n url = file\n if (options && options.crossOrigin) {\n img.crossOrigin = options.crossOrigin\n }\n }\n img.src = url\n }\n img.onerror = function (event) {\n revokeHelper(url, options)\n if (reject) reject.call(img, event)\n }\n img.onload = function () {\n revokeHelper(url, options)\n var data = {\n originalWidth: img.naturalWidth || img.width,\n originalHeight: img.naturalHeight || img.height\n }\n try {\n loadImage.transform(img, options, resolveWrapper, file, data)\n } catch (error) {\n if (reject) reject(error)\n }\n }\n if (typeof file === 'string') {\n if (loadImage.requiresMetaData(options)) {\n loadImage.fetchBlob(file, fetchBlobCallback, options)\n } else {\n fetchBlobCallback()\n }\n return img\n } else if (isInstanceOf('Blob', file) || isInstanceOf('File', file)) {\n url = createObjectURL(file)\n if (url) {\n img.src = url\n return img\n }\n return readFile(\n file,\n function (url) {\n img.src = url\n },\n reject\n )\n }\n }\n if ($.Promise && typeof callback !== 'function') {\n options = callback // eslint-disable-line no-param-reassign\n return new Promise(executor)\n }\n return executor(callback, callback)\n }\n\n // Determines if metadata should be loaded automatically.\n // Requires the load image meta extension to load metadata.\n loadImage.requiresMetaData = function (options) {\n return options && options.meta\n }\n\n // If the callback given to this function returns a blob, it is used as image\n // source instead of the original url and overrides the file argument used in\n // the onload and onerror event callbacks:\n loadImage.fetchBlob = function (url, callback) {\n callback()\n }\n\n loadImage.transform = function (img, options, callback, file, data) {\n callback(img, data)\n }\n\n loadImage.global = $\n loadImage.readFile = readFile\n loadImage.isInstanceOf = isInstanceOf\n loadImage.createObjectURL = createObjectURL\n loadImage.revokeObjectURL = revokeObjectURL\n\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return loadImage\n })\n } else if (typeof module === 'object' && module.exports) {\n module.exports = loadImage\n } else {\n $.loadImage = loadImage\n }\n})((typeof window !== 'undefined' && window) || this)\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif-map.js":"/*\n * JavaScript Load Image Exif Map\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Exif tags mapping based on\n * https://github.com/jseidelin/exif-js\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, require */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'), require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif'))\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n var ExifMapProto = loadImage.ExifMap.prototype\n\n ExifMapProto.tags = {\n // =================\n // TIFF tags (IFD0):\n // =================\n 0x0100: 'ImageWidth',\n 0x0101: 'ImageHeight',\n 0x0102: 'BitsPerSample',\n 0x0103: 'Compression',\n 0x0106: 'PhotometricInterpretation',\n 0x0112: 'Orientation',\n 0x0115: 'SamplesPerPixel',\n 0x011c: 'PlanarConfiguration',\n 0x0212: 'YCbCrSubSampling',\n 0x0213: 'YCbCrPositioning',\n 0x011a: 'XResolution',\n 0x011b: 'YResolution',\n 0x0128: 'ResolutionUnit',\n 0x0111: 'StripOffsets',\n 0x0116: 'RowsPerStrip',\n 0x0117: 'StripByteCounts',\n 0x0201: 'JPEGInterchangeFormat',\n 0x0202: 'JPEGInterchangeFormatLength',\n 0x012d: 'TransferFunction',\n 0x013e: 'WhitePoint',\n 0x013f: 'PrimaryChromaticities',\n 0x0211: 'YCbCrCoefficients',\n 0x0214: 'ReferenceBlackWhite',\n 0x0132: 'DateTime',\n 0x010e: 'ImageDescription',\n 0x010f: 'Make',\n 0x0110: 'Model',\n 0x0131: 'Software',\n 0x013b: 'Artist',\n 0x8298: 'Copyright',\n 0x8769: {\n // ExifIFDPointer\n 0x9000: 'ExifVersion', // EXIF version\n 0xa000: 'FlashpixVersion', // Flashpix format version\n 0xa001: 'ColorSpace', // Color space information tag\n 0xa002: 'PixelXDimension', // Valid width of meaningful image\n 0xa003: 'PixelYDimension', // Valid height of meaningful image\n 0xa500: 'Gamma',\n 0x9101: 'ComponentsConfiguration', // Information about channels\n 0x9102: 'CompressedBitsPerPixel', // Compressed bits per pixel\n 0x927c: 'MakerNote', // Any desired information written by the manufacturer\n 0x9286: 'UserComment', // Comments by user\n 0xa004: 'RelatedSoundFile', // Name of related sound file\n 0x9003: 'DateTimeOriginal', // Date and time when the original image was generated\n 0x9004: 'DateTimeDigitized', // Date and time when the image was stored digitally\n 0x9010: 'OffsetTime', // Time zone when the image file was last changed\n 0x9011: 'OffsetTimeOriginal', // Time zone when the image was stored digitally\n 0x9012: 'OffsetTimeDigitized', // Time zone when the image was stored digitally\n 0x9290: 'SubSecTime', // Fractions of seconds for DateTime\n 0x9291: 'SubSecTimeOriginal', // Fractions of seconds for DateTimeOriginal\n 0x9292: 'SubSecTimeDigitized', // Fractions of seconds for DateTimeDigitized\n 0x829a: 'ExposureTime', // Exposure time (in seconds)\n 0x829d: 'FNumber',\n 0x8822: 'ExposureProgram', // Exposure program\n 0x8824: 'SpectralSensitivity', // Spectral sensitivity\n 0x8827: 'PhotographicSensitivity', // EXIF 2.3, ISOSpeedRatings in EXIF 2.2\n 0x8828: 'OECF', // Optoelectric conversion factor\n 0x8830: 'SensitivityType',\n 0x8831: 'StandardOutputSensitivity',\n 0x8832: 'RecommendedExposureIndex',\n 0x8833: 'ISOSpeed',\n 0x8834: 'ISOSpeedLatitudeyyy',\n 0x8835: 'ISOSpeedLatitudezzz',\n 0x9201: 'ShutterSpeedValue', // Shutter speed\n 0x9202: 'ApertureValue', // Lens aperture\n 0x9203: 'BrightnessValue', // Value of brightness\n 0x9204: 'ExposureBias', // Exposure bias\n 0x9205: 'MaxApertureValue', // Smallest F number of lens\n 0x9206: 'SubjectDistance', // Distance to subject in meters\n 0x9207: 'MeteringMode', // Metering mode\n 0x9208: 'LightSource', // Kind of light source\n 0x9209: 'Flash', // Flash status\n 0x9214: 'SubjectArea', // Location and area of main subject\n 0x920a: 'FocalLength', // Focal length of the lens in mm\n 0xa20b: 'FlashEnergy', // Strobe energy in BCPS\n 0xa20c: 'SpatialFrequencyResponse',\n 0xa20e: 'FocalPlaneXResolution', // Number of pixels in width direction per FPRUnit\n 0xa20f: 'FocalPlaneYResolution', // Number of pixels in height direction per FPRUnit\n 0xa210: 'FocalPlaneResolutionUnit', // Unit for measuring the focal plane resolution\n 0xa214: 'SubjectLocation', // Location of subject in image\n 0xa215: 'ExposureIndex', // Exposure index selected on camera\n 0xa217: 'SensingMethod', // Image sensor type\n 0xa300: 'FileSource', // Image source (3 == DSC)\n 0xa301: 'SceneType', // Scene type (1 == directly photographed)\n 0xa302: 'CFAPattern', // Color filter array geometric pattern\n 0xa401: 'CustomRendered', // Special processing\n 0xa402: 'ExposureMode', // Exposure mode\n 0xa403: 'WhiteBalance', // 1 = auto white balance, 2 = manual\n 0xa404: 'DigitalZoomRatio', // Digital zoom ratio\n 0xa405: 'FocalLengthIn35mmFilm',\n 0xa406: 'SceneCaptureType', // Type of scene\n 0xa407: 'GainControl', // Degree of overall image gain adjustment\n 0xa408: 'Contrast', // Direction of contrast processing applied by camera\n 0xa409: 'Saturation', // Direction of saturation processing applied by camera\n 0xa40a: 'Sharpness', // Direction of sharpness processing applied by camera\n 0xa40b: 'DeviceSettingDescription',\n 0xa40c: 'SubjectDistanceRange', // Distance to subject\n 0xa420: 'ImageUniqueID', // Identifier assigned uniquely to each image\n 0xa430: 'CameraOwnerName',\n 0xa431: 'BodySerialNumber',\n 0xa432: 'LensSpecification',\n 0xa433: 'LensMake',\n 0xa434: 'LensModel',\n 0xa435: 'LensSerialNumber'\n },\n 0x8825: {\n // GPSInfoIFDPointer\n 0x0000: 'GPSVersionID',\n 0x0001: 'GPSLatitudeRef',\n 0x0002: 'GPSLatitude',\n 0x0003: 'GPSLongitudeRef',\n 0x0004: 'GPSLongitude',\n 0x0005: 'GPSAltitudeRef',\n 0x0006: 'GPSAltitude',\n 0x0007: 'GPSTimeStamp',\n 0x0008: 'GPSSatellites',\n 0x0009: 'GPSStatus',\n 0x000a: 'GPSMeasureMode',\n 0x000b: 'GPSDOP',\n 0x000c: 'GPSSpeedRef',\n 0x000d: 'GPSSpeed',\n 0x000e: 'GPSTrackRef',\n 0x000f: 'GPSTrack',\n 0x0010: 'GPSImgDirectionRef',\n 0x0011: 'GPSImgDirection',\n 0x0012: 'GPSMapDatum',\n 0x0013: 'GPSDestLatitudeRef',\n 0x0014: 'GPSDestLatitude',\n 0x0015: 'GPSDestLongitudeRef',\n 0x0016: 'GPSDestLongitude',\n 0x0017: 'GPSDestBearingRef',\n 0x0018: 'GPSDestBearing',\n 0x0019: 'GPSDestDistanceRef',\n 0x001a: 'GPSDestDistance',\n 0x001b: 'GPSProcessingMethod',\n 0x001c: 'GPSAreaInformation',\n 0x001d: 'GPSDateStamp',\n 0x001e: 'GPSDifferential',\n 0x001f: 'GPSHPositioningError'\n },\n 0xa005: {\n // InteroperabilityIFDPointer\n 0x0001: 'InteroperabilityIndex'\n }\n }\n\n // IFD1 directory can contain any IFD0 tags:\n ExifMapProto.tags.ifd1 = ExifMapProto.tags\n\n ExifMapProto.stringValues = {\n ExposureProgram: {\n 0: 'Undefined',\n 1: 'Manual',\n 2: 'Normal program',\n 3: 'Aperture priority',\n 4: 'Shutter priority',\n 5: 'Creative program',\n 6: 'Action program',\n 7: 'Portrait mode',\n 8: 'Landscape mode'\n },\n MeteringMode: {\n 0: 'Unknown',\n 1: 'Average',\n 2: 'CenterWeightedAverage',\n 3: 'Spot',\n 4: 'MultiSpot',\n 5: 'Pattern',\n 6: 'Partial',\n 255: 'Other'\n },\n LightSource: {\n 0: 'Unknown',\n 1: 'Daylight',\n 2: 'Fluorescent',\n 3: 'Tungsten (incandescent light)',\n 4: 'Flash',\n 9: 'Fine weather',\n 10: 'Cloudy weather',\n 11: 'Shade',\n 12: 'Daylight fluorescent (D 5700 - 7100K)',\n 13: 'Day white fluorescent (N 4600 - 5400K)',\n 14: 'Cool white fluorescent (W 3900 - 4500K)',\n 15: 'White fluorescent (WW 3200 - 3700K)',\n 17: 'Standard light A',\n 18: 'Standard light B',\n 19: 'Standard light C',\n 20: 'D55',\n 21: 'D65',\n 22: 'D75',\n 23: 'D50',\n 24: 'ISO studio tungsten',\n 255: 'Other'\n },\n Flash: {\n 0x0000: 'Flash did not fire',\n 0x0001: 'Flash fired',\n 0x0005: 'Strobe return light not detected',\n 0x0007: 'Strobe return light detected',\n 0x0009: 'Flash fired, compulsory flash mode',\n 0x000d: 'Flash fired, compulsory flash mode, return light not detected',\n 0x000f: 'Flash fired, compulsory flash mode, return light detected',\n 0x0010: 'Flash did not fire, compulsory flash mode',\n 0x0018: 'Flash did not fire, auto mode',\n 0x0019: 'Flash fired, auto mode',\n 0x001d: 'Flash fired, auto mode, return light not detected',\n 0x001f: 'Flash fired, auto mode, return light detected',\n 0x0020: 'No flash function',\n 0x0041: 'Flash fired, red-eye reduction mode',\n 0x0045: 'Flash fired, red-eye reduction mode, return light not detected',\n 0x0047: 'Flash fired, red-eye reduction mode, return light detected',\n 0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode',\n 0x004d: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',\n 0x004f: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',\n 0x0059: 'Flash fired, auto mode, red-eye reduction mode',\n 0x005d: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',\n 0x005f: 'Flash fired, auto mode, return light detected, red-eye reduction mode'\n },\n SensingMethod: {\n 1: 'Undefined',\n 2: 'One-chip color area sensor',\n 3: 'Two-chip color area sensor',\n 4: 'Three-chip color area sensor',\n 5: 'Color sequential area sensor',\n 7: 'Trilinear sensor',\n 8: 'Color sequential linear sensor'\n },\n SceneCaptureType: {\n 0: 'Standard',\n 1: 'Landscape',\n 2: 'Portrait',\n 3: 'Night scene'\n },\n SceneType: {\n 1: 'Directly photographed'\n },\n CustomRendered: {\n 0: 'Normal process',\n 1: 'Custom process'\n },\n WhiteBalance: {\n 0: 'Auto white balance',\n 1: 'Manual white balance'\n },\n GainControl: {\n 0: 'None',\n 1: 'Low gain up',\n 2: 'High gain up',\n 3: 'Low gain down',\n 4: 'High gain down'\n },\n Contrast: {\n 0: 'Normal',\n 1: 'Soft',\n 2: 'Hard'\n },\n Saturation: {\n 0: 'Normal',\n 1: 'Low saturation',\n 2: 'High saturation'\n },\n Sharpness: {\n 0: 'Normal',\n 1: 'Soft',\n 2: 'Hard'\n },\n SubjectDistanceRange: {\n 0: 'Unknown',\n 1: 'Macro',\n 2: 'Close view',\n 3: 'Distant view'\n },\n FileSource: {\n 3: 'DSC'\n },\n ComponentsConfiguration: {\n 0: '',\n 1: 'Y',\n 2: 'Cb',\n 3: 'Cr',\n 4: 'R',\n 5: 'G',\n 6: 'B'\n },\n Orientation: {\n 1: 'Original',\n 2: 'Horizontal flip',\n 3: 'Rotate 180\u00b0 CCW',\n 4: 'Vertical flip',\n 5: 'Vertical flip + Rotate 90\u00b0 CW',\n 6: 'Rotate 90\u00b0 CW',\n 7: 'Horizontal flip + Rotate 90\u00b0 CW',\n 8: 'Rotate 90\u00b0 CCW'\n }\n }\n\n ExifMapProto.getText = function (name) {\n var value = this.get(name)\n switch (name) {\n case 'LightSource':\n case 'Flash':\n case 'MeteringMode':\n case 'ExposureProgram':\n case 'SensingMethod':\n case 'SceneCaptureType':\n case 'SceneType':\n case 'CustomRendered':\n case 'WhiteBalance':\n case 'GainControl':\n case 'Contrast':\n case 'Saturation':\n case 'Sharpness':\n case 'SubjectDistanceRange':\n case 'FileSource':\n case 'Orientation':\n return this.stringValues[name][value]\n case 'ExifVersion':\n case 'FlashpixVersion':\n if (!value) return\n return String.fromCharCode(value[0], value[1], value[2], value[3])\n case 'ComponentsConfiguration':\n if (!value) return\n return (\n this.stringValues[name][value[0]] +\n this.stringValues[name][value[1]] +\n this.stringValues[name][value[2]] +\n this.stringValues[name][value[3]]\n )\n case 'GPSVersionID':\n if (!value) return\n return value[0] + '.' + value[1] + '.' + value[2] + '.' + value[3]\n }\n return String(value)\n }\n\n ExifMapProto.getAll = function () {\n var map = {}\n var prop\n var obj\n var name\n for (prop in this) {\n if (Object.prototype.hasOwnProperty.call(this, prop)) {\n obj = this[prop]\n if (obj && obj.getAll) {\n map[this.ifds[prop].name] = obj.getAll()\n } else {\n name = this.tags[prop]\n if (name) map[name] = this.getText(name)\n }\n }\n }\n return map\n }\n\n ExifMapProto.getName = function (tagCode) {\n var name = this.tags[tagCode]\n if (typeof name === 'object') return this.ifds[tagCode].name\n return name\n }\n\n // Extend the map of tag names to tag codes:\n ;(function () {\n var tags = ExifMapProto.tags\n var prop\n var ifd\n var subTags\n // Map the tag names to tags:\n for (prop in tags) {\n if (Object.prototype.hasOwnProperty.call(tags, prop)) {\n ifd = ExifMapProto.ifds[prop]\n if (ifd) {\n subTags = tags[prop]\n for (prop in subTags) {\n if (Object.prototype.hasOwnProperty.call(subTags, prop)) {\n ifd.map[subTags[prop]] = Number(prop)\n }\n }\n } else {\n ExifMapProto.map[tags[prop]] = Number(prop)\n }\n }\n }\n })()\n})\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/index.js":"/* global module, require */\n\nmodule.exports = require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image')\n\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-scale')\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta')\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-fetch')\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif')\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif-map')\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-iptc')\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-iptc-map')\nrequire('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-orientation')\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-fetch.js":"/*\n * JavaScript Load Image Fetch\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2017, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, require, Promise */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'))\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n var global = loadImage.global\n\n if (\n global.fetch &&\n global.Request &&\n global.Response &&\n global.Response.prototype.blob\n ) {\n loadImage.fetchBlob = function (url, callback, options) {\n /**\n * Fetch response handler.\n *\n * @param {Response} response Fetch response\n * @returns {Blob} Fetched Blob.\n */\n function responseHandler(response) {\n return response.blob()\n }\n if (global.Promise && typeof callback !== 'function') {\n return fetch(new Request(url, callback)).then(responseHandler)\n }\n fetch(new Request(url, options))\n .then(responseHandler)\n .then(callback)\n [\n // Avoid parsing error in IE<9, where catch is a reserved word.\n // eslint-disable-next-line dot-notation\n 'catch'\n ](function (err) {\n callback(null, err)\n })\n }\n } else if (\n global.XMLHttpRequest &&\n // https://xhr.spec.whatwg.org/#the-responsetype-attribute\n new XMLHttpRequest().responseType === ''\n ) {\n loadImage.fetchBlob = function (url, callback, options) {\n /**\n * Promise executor\n *\n * @param {Function} resolve Resolution function\n * @param {Function} reject Rejection function\n */\n function executor(resolve, reject) {\n options = options || {} // eslint-disable-line no-param-reassign\n var req = new XMLHttpRequest()\n req.open(options.method || 'GET', url)\n if (options.headers) {\n Object.keys(options.headers).forEach(function (key) {\n req.setRequestHeader(key, options.headers[key])\n })\n }\n req.withCredentials = options.credentials === 'include'\n req.responseType = 'blob'\n req.onload = function () {\n resolve(req.response)\n }\n req.onerror = req.onabort = req.ontimeout = function (err) {\n if (resolve === reject) {\n // Not using Promises\n reject(null, err)\n } else {\n reject(err)\n }\n }\n req.send(options.body)\n }\n if (global.Promise && typeof callback !== 'function') {\n options = callback // eslint-disable-line no-param-reassign\n return new Promise(executor)\n }\n return executor(callback, callback)\n }\n }\n})\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-exif.js":"/*\n * JavaScript Load Image Exif Parser\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, require, DataView */\n\n/* eslint-disable no-console */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image', 'Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'), require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta'))\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n /**\n * Exif tag map\n *\n * @name ExifMap\n * @class\n * @param {number|string} tagCode IFD tag code\n */\n function ExifMap(tagCode) {\n if (tagCode) {\n Object.defineProperty(this, 'map', {\n value: this.ifds[tagCode].map\n })\n Object.defineProperty(this, 'tags', {\n value: (this.tags && this.tags[tagCode]) || {}\n })\n }\n }\n\n ExifMap.prototype.map = {\n Orientation: 0x0112,\n Thumbnail: 'ifd1',\n Blob: 0x0201, // Alias for JPEGInterchangeFormat\n Exif: 0x8769,\n GPSInfo: 0x8825,\n Interoperability: 0xa005\n }\n\n ExifMap.prototype.ifds = {\n ifd1: { name: 'Thumbnail', map: ExifMap.prototype.map },\n 0x8769: { name: 'Exif', map: {} },\n 0x8825: { name: 'GPSInfo', map: {} },\n 0xa005: { name: 'Interoperability', map: {} }\n }\n\n /**\n * Retrieves exif tag value\n *\n * @param {number|string} id Exif tag code or name\n * @returns {object} Exif tag value\n */\n ExifMap.prototype.get = function (id) {\n return this[id] || this[this.map[id]]\n }\n\n /**\n * Returns the Exif Thumbnail data as Blob.\n *\n * @param {DataView} dataView Data view interface\n * @param {number} offset Thumbnail data offset\n * @param {number} length Thumbnail data length\n * @returns {undefined|Blob} Returns the Thumbnail Blob or undefined\n */\n function getExifThumbnail(dataView, offset, length) {\n if (!length) return\n if (offset + length > dataView.byteLength) {\n console.log('Invalid Exif data: Invalid thumbnail data.')\n return\n }\n return new Blob(\n [loadImage.bufferSlice.call(dataView.buffer, offset, offset + length)],\n {\n type: 'image/jpeg'\n }\n )\n }\n\n var ExifTagTypes = {\n // byte, 8-bit unsigned int:\n 1: {\n getValue: function (dataView, dataOffset) {\n return dataView.getUint8(dataOffset)\n },\n size: 1\n },\n // ascii, 8-bit byte:\n 2: {\n getValue: function (dataView, dataOffset) {\n return String.fromCharCode(dataView.getUint8(dataOffset))\n },\n size: 1,\n ascii: true\n },\n // short, 16 bit int:\n 3: {\n getValue: function (dataView, dataOffset, littleEndian) {\n return dataView.getUint16(dataOffset, littleEndian)\n },\n size: 2\n },\n // long, 32 bit int:\n 4: {\n getValue: function (dataView, dataOffset, littleEndian) {\n return dataView.getUint32(dataOffset, littleEndian)\n },\n size: 4\n },\n // rational = two long values, first is numerator, second is denominator:\n 5: {\n getValue: function (dataView, dataOffset, littleEndian) {\n return (\n dataView.getUint32(dataOffset, littleEndian) /\n dataView.getUint32(dataOffset + 4, littleEndian)\n )\n },\n size: 8\n },\n // slong, 32 bit signed int:\n 9: {\n getValue: function (dataView, dataOffset, littleEndian) {\n return dataView.getInt32(dataOffset, littleEndian)\n },\n size: 4\n },\n // srational, two slongs, first is numerator, second is denominator:\n 10: {\n getValue: function (dataView, dataOffset, littleEndian) {\n return (\n dataView.getInt32(dataOffset, littleEndian) /\n dataView.getInt32(dataOffset + 4, littleEndian)\n )\n },\n size: 8\n }\n }\n // undefined, 8-bit byte, value depending on field:\n ExifTagTypes[7] = ExifTagTypes[1]\n\n /**\n * Returns Exif tag value.\n *\n * @param {DataView} dataView Data view interface\n * @param {number} tiffOffset TIFF offset\n * @param {number} offset Tag offset\n * @param {number} type Tag type\n * @param {number} length Tag length\n * @param {boolean} littleEndian Little endian encoding\n * @returns {object} Tag value\n */\n function getExifValue(\n dataView,\n tiffOffset,\n offset,\n type,\n length,\n littleEndian\n ) {\n var tagType = ExifTagTypes[type]\n var tagSize\n var dataOffset\n var values\n var i\n var str\n var c\n if (!tagType) {\n console.log('Invalid Exif data: Invalid tag type.')\n return\n }\n tagSize = tagType.size * length\n // Determine if the value is contained in the dataOffset bytes,\n // or if the value at the dataOffset is a pointer to the actual data:\n dataOffset =\n tagSize > 4\n ? tiffOffset + dataView.getUint32(offset + 8, littleEndian)\n : offset + 8\n if (dataOffset + tagSize > dataView.byteLength) {\n console.log('Invalid Exif data: Invalid data offset.')\n return\n }\n if (length === 1) {\n return tagType.getValue(dataView, dataOffset, littleEndian)\n }\n values = []\n for (i = 0; i < length; i += 1) {\n values[i] = tagType.getValue(\n dataView,\n dataOffset + i * tagType.size,\n littleEndian\n )\n }\n if (tagType.ascii) {\n str = ''\n // Concatenate the chars:\n for (i = 0; i < values.length; i += 1) {\n c = values[i]\n // Ignore the terminating NULL byte(s):\n if (c === '\\u0000') {\n break\n }\n str += c\n }\n return str\n }\n return values\n }\n\n /**\n * Determines if the given tag should be included.\n *\n * @param {object} includeTags Map of tags to include\n * @param {object} excludeTags Map of tags to exclude\n * @param {number|string} tagCode Tag code to check\n * @returns {boolean} True if the tag should be included\n */\n function shouldIncludeTag(includeTags, excludeTags, tagCode) {\n return (\n (!includeTags || includeTags[tagCode]) &&\n (!excludeTags || excludeTags[tagCode] !== true)\n )\n }\n\n /**\n * Parses Exif tags.\n *\n * @param {DataView} dataView Data view interface\n * @param {number} tiffOffset TIFF offset\n * @param {number} dirOffset Directory offset\n * @param {boolean} littleEndian Little endian encoding\n * @param {ExifMap} tags Map to store parsed exif tags\n * @param {ExifMap} tagOffsets Map to store parsed exif tag offsets\n * @param {object} includeTags Map of tags to include\n * @param {object} excludeTags Map of tags to exclude\n * @returns {number} Next directory offset\n */\n function parseExifTags(\n dataView,\n tiffOffset,\n dirOffset,\n littleEndian,\n tags,\n tagOffsets,\n includeTags,\n excludeTags\n ) {\n var tagsNumber, dirEndOffset, i, tagOffset, tagNumber, tagValue\n if (dirOffset + 6 > dataView.byteLength) {\n console.log('Invalid Exif data: Invalid directory offset.')\n return\n }\n tagsNumber = dataView.getUint16(dirOffset, littleEndian)\n dirEndOffset = dirOffset + 2 + 12 * tagsNumber\n if (dirEndOffset + 4 > dataView.byteLength) {\n console.log('Invalid Exif data: Invalid directory size.')\n return\n }\n for (i = 0; i < tagsNumber; i += 1) {\n tagOffset = dirOffset + 2 + 12 * i\n tagNumber = dataView.getUint16(tagOffset, littleEndian)\n if (!shouldIncludeTag(includeTags, excludeTags, tagNumber)) continue\n tagValue = getExifValue(\n dataView,\n tiffOffset,\n tagOffset,\n dataView.getUint16(tagOffset + 2, littleEndian), // tag type\n dataView.getUint32(tagOffset + 4, littleEndian), // tag length\n littleEndian\n )\n tags[tagNumber] = tagValue\n if (tagOffsets) {\n tagOffsets[tagNumber] = tagOffset\n }\n }\n // Return the offset to the next directory:\n return dataView.getUint32(dirEndOffset, littleEndian)\n }\n\n /**\n * Parses tags in a given IFD (Image File Directory).\n *\n * @param {object} data Data object to store exif tags and offsets\n * @param {number|string} tagCode IFD tag code\n * @param {DataView} dataView Data view interface\n * @param {number} tiffOffset TIFF offset\n * @param {boolean} littleEndian Little endian encoding\n * @param {object} includeTags Map of tags to include\n * @param {object} excludeTags Map of tags to exclude\n */\n function parseExifIFD(\n data,\n tagCode,\n dataView,\n tiffOffset,\n littleEndian,\n includeTags,\n excludeTags\n ) {\n var dirOffset = data.exif[tagCode]\n if (dirOffset) {\n data.exif[tagCode] = new ExifMap(tagCode)\n if (data.exifOffsets) {\n data.exifOffsets[tagCode] = new ExifMap(tagCode)\n }\n parseExifTags(\n dataView,\n tiffOffset,\n tiffOffset + dirOffset,\n littleEndian,\n data.exif[tagCode],\n data.exifOffsets && data.exifOffsets[tagCode],\n includeTags && includeTags[tagCode],\n excludeTags && excludeTags[tagCode]\n )\n }\n }\n\n loadImage.parseExifData = function (dataView, offset, length, data, options) {\n if (options.disableExif) {\n return\n }\n var includeTags = options.includeExifTags\n var excludeTags = options.excludeExifTags || {\n 0x8769: {\n // ExifIFDPointer\n 0x927c: true // MakerNote\n }\n }\n var tiffOffset = offset + 10\n var littleEndian\n var dirOffset\n var thumbnailIFD\n // Check for the ASCII code for \"Exif\" (0x45786966):\n if (dataView.getUint32(offset + 4) !== 0x45786966) {\n // No Exif data, might be XMP data instead\n return\n }\n if (tiffOffset + 8 > dataView.byteLength) {\n console.log('Invalid Exif data: Invalid segment size.')\n return\n }\n // Check for the two null bytes:\n if (dataView.getUint16(offset + 8) !== 0x0000) {\n console.log('Invalid Exif data: Missing byte alignment offset.')\n return\n }\n // Check the byte alignment:\n switch (dataView.getUint16(tiffOffset)) {\n case 0x4949:\n littleEndian = true\n break\n case 0x4d4d:\n littleEndian = false\n break\n default:\n console.log('Invalid Exif data: Invalid byte alignment marker.')\n return\n }\n // Check for the TIFF tag marker (0x002A):\n if (dataView.getUint16(tiffOffset + 2, littleEndian) !== 0x002a) {\n console.log('Invalid Exif data: Missing TIFF marker.')\n return\n }\n // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal:\n dirOffset = dataView.getUint32(tiffOffset + 4, littleEndian)\n // Create the exif object to store the tags:\n data.exif = new ExifMap()\n if (!options.disableExifOffsets) {\n data.exifOffsets = new ExifMap()\n data.exifTiffOffset = tiffOffset\n data.exifLittleEndian = littleEndian\n }\n // Parse the tags of the main image directory (IFD0) and retrieve the\n // offset to the next directory (IFD1), usually the thumbnail directory:\n dirOffset = parseExifTags(\n dataView,\n tiffOffset,\n tiffOffset + dirOffset,\n littleEndian,\n data.exif,\n data.exifOffsets,\n includeTags,\n excludeTags\n )\n if (dirOffset && shouldIncludeTag(includeTags, excludeTags, 'ifd1')) {\n data.exif.ifd1 = dirOffset\n if (data.exifOffsets) {\n data.exifOffsets.ifd1 = tiffOffset + dirOffset\n }\n }\n Object.keys(data.exif.ifds).forEach(function (tagCode) {\n parseExifIFD(\n data,\n tagCode,\n dataView,\n tiffOffset,\n littleEndian,\n includeTags,\n excludeTags\n )\n })\n thumbnailIFD = data.exif.ifd1\n // Check for JPEG Thumbnail offset and data length:\n if (thumbnailIFD && thumbnailIFD[0x0201]) {\n thumbnailIFD[0x0201] = getExifThumbnail(\n dataView,\n tiffOffset + thumbnailIFD[0x0201],\n thumbnailIFD[0x0202] // Thumbnail data length\n )\n }\n }\n\n // Registers the Exif parser for the APP1 JPEG metadata segment:\n loadImage.metaDataParsers.jpeg[0xffe1].push(loadImage.parseExifData)\n\n loadImage.exifWriters = {\n // Orientation writer:\n 0x0112: function (buffer, data, value) {\n var orientationOffset = data.exifOffsets[0x0112]\n if (!orientationOffset) return buffer\n var view = new DataView(buffer, orientationOffset + 8, 2)\n view.setUint16(0, value, data.exifLittleEndian)\n return buffer\n }\n }\n\n loadImage.writeExifData = function (buffer, data, id, value) {\n loadImage.exifWriters[data.exif.map[id]](buffer, data, value)\n }\n\n loadImage.ExifMap = ExifMap\n\n // Adds the following properties to the parseMetaData callback data:\n // - exif: The parsed Exif tags\n // - exifOffsets: The parsed Exif tag offsets\n // - exifTiffOffset: TIFF header offset (used for offset pointers)\n // - exifLittleEndian: little endian order if true, big endian if false\n\n // Adds the following options to the parseMetaData method:\n // - disableExif: Disables Exif parsing when true.\n // - disableExifOffsets: Disables storing Exif tag offsets when true.\n // - includeExifTags: A map of Exif tags to include for parsing.\n // - excludeExifTags: A map of Exif tags to exclude from parsing.\n})\n","Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image-meta.js":"/*\n * JavaScript Load Image Meta\n * https://github.com/blueimp/JavaScript-Load-Image\n *\n * Copyright 2013, Sebastian Tschan\n * https://blueimp.net\n *\n * Image metadata handling implementation\n * based on the help and contribution of\n * Achim St\u00f6hr.\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, module, require, Promise, DataView, Uint8Array, ArrayBuffer */\n\n;(function (factory) {\n 'use strict'\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'], factory)\n } else if (typeof module === 'object' && module.exports) {\n factory(require('Mageplaza_Core/lib/fileUploader/vendor/blueimp-load-image/js/load-image'))\n } else {\n // Browser globals:\n factory(window.loadImage)\n }\n})(function (loadImage) {\n 'use strict'\n\n var global = loadImage.global\n var originalTransform = loadImage.transform\n\n var blobSlice =\n global.Blob &&\n (Blob.prototype.slice ||\n Blob.prototype.webkitSlice ||\n Blob.prototype.mozSlice)\n\n var bufferSlice =\n (global.ArrayBuffer && ArrayBuffer.prototype.slice) ||\n function (begin, end) {\n // Polyfill for IE10, which does not support ArrayBuffer.slice\n // eslint-disable-next-line no-param-reassign\n end = end || this.byteLength - begin\n var arr1 = new Uint8Array(this, begin, end)\n var arr2 = new Uint8Array(end)\n arr2.set(arr1)\n return arr2.buffer\n }\n\n var metaDataParsers = {\n jpeg: {\n 0xffe1: [], // APP1 marker\n 0xffed: [] // APP13 marker\n }\n }\n\n /**\n * Parses image metadata and calls the callback with an object argument\n * with the following property:\n * - imageHead: The complete image head as ArrayBuffer\n * The options argument accepts an object and supports the following\n * properties:\n * - maxMetaDataSize: Defines the maximum number of bytes to parse.\n * - disableImageHead: Disables creating the imageHead property.\n *\n * @param {Blob} file Blob object\n * @param {Function} [callback] Callback function\n * @param {object} [options] Parsing options\n * @param {object} [data] Result data object\n * @returns {Promise<object>|undefined} Returns Promise if no callback given.\n */\n function parseMetaData(file, callback, options, data) {\n var that = this\n /**\n * Promise executor\n *\n * @param {Function} resolve Resolution function\n * @param {Function} reject Rejection function\n * @returns {undefined} Undefined\n */\n function executor(resolve, reject) {\n if (\n !(\n global.DataView &&\n blobSlice &&\n file &&\n file.size >= 12 &&\n file.type === 'image/jpeg'\n )\n ) {\n // Nothing to parse\n return resolve(data)\n }\n // 256 KiB should contain all EXIF/ICC/IPTC segments:\n var maxMetaDataSize = options.maxMetaDataSize || 262144\n if (\n !loadImage.readFile(\n blobSlice.call(file, 0, maxMetaDataSize),\n function (buffer) {\n // Note on endianness:\n // Since the marker and length bytes in JPEG files are always\n // stored in big endian order, we can leave the endian parameter\n // of the DataView methods undefined, defaulting to big endian.\n var dataView = new DataView(buffer)\n // Check for the JPEG marker (0xffd8):\n if (dataView.getUint16(0) !== 0xffd8) {\n return reject(\n new Error('Invalid JPEG file: Missing JPEG marker.')\n )\n }\n var offset = 2\n var maxOffset = dataView.byteLength - 4\n var headLength = offset\n var markerBytes\n var markerLength\n var parsers\n var i\n while (offset < maxOffset) {\n markerBytes = dataView.getUint16(offset)\n // Search for APPn (0xffeN) and COM (0xfffe) markers,\n // which contain application-specific metadata like\n // Exif, ICC and IPTC data and text comments:\n if (\n (markerBytes >= 0xffe0 && markerBytes <= 0xffef) ||\n markerBytes === 0xfffe\n ) {\n // The marker bytes (2) are always followed by\n // the length bytes (2), indicating the length of the\n // marker segment, which includes the length bytes,\n // but not the marker bytes, so we add 2:\n markerLength = dataView.getUint16(offset + 2) + 2\n if (offset + markerLength > dataView.byteLength) {\n // eslint-disable-next-line no-console\n console.log('Invalid JPEG metadata: Invalid segment size.')\n break\n }\n parsers = metaDataParsers.jpeg[markerBytes]\n if (parsers && !options.disableMetaDataParsers) {\n for (i = 0; i < parsers.length; i += 1) {\n parsers[i].call(\n that,\n dataView,\n offset,\n markerLength,\n data,\n options\n )\n }\n }\n offset += markerLength\n headLength = offset\n } else {\n // Not an APPn or COM marker, probably safe to\n // assume that this is the end of the metadata\n break\n }\n }\n // Meta length must be longer than JPEG marker (2)\n // plus APPn marker (2), followed by length bytes (2):\n if (!options.disableImageHead && headLength > 6) {\n data.imageHead = bufferSlice.call(buffer, 0, headLength)\n }\n resolve(data)\n },\n reject,\n 'readAsArrayBuffer'\n )\n ) {\n // No support for the FileReader interface, nothing to parse\n resolve(data)\n }\n }\n options = options || {} // eslint-disable-line no-param-reassign\n if (global.Promise && typeof callback !== 'function') {\n options = callback || {} // eslint-disable-line no-param-reassign\n data = options // eslint-disable-line no-param-reassign\n return new Promise(executor)\n }\n data = data || {} // eslint-disable-line no-param-reassign\n return executor(callback, callback)\n }\n\n /**\n * Replaces the head of a JPEG Blob\n *\n * @param {Blob} blob Blob object\n * @param {ArrayBuffer} oldHead Old JPEG head\n * @param {ArrayBuffer} newHead New JPEG head\n * @returns {Blob} Combined Blob\n */\n function replaceJPEGHead(blob, oldHead, newHead) {\n if (!blob || !oldHead || !newHead) return null\n return new Blob([newHead, blobSlice.call(blob, oldHead.byteLength)], {\n type: 'image/jpeg'\n })\n }\n\n /**\n * Replaces the image head of a JPEG blob with the given one.\n * Returns a Promise or calls the callback with the new Blob.\n *\n * @param {Blob} blob Blob object\n * @param {ArrayBuffer} head New JPEG head\n * @param {Function} [callback] Callback function\n * @returns {Promise<Blob|null>|undefined} Combined Blob\n */\n function replaceHead(blob, head, callback) {\n var options = { maxMetaDataSize: 256, disableMetaDataParsers: true }\n if (!callback && global.Promise) {\n return parseMetaData(blob, options).then(function (data) {\n return replaceJPEGHead(blob, data.imageHead, head)\n })\n }\n parseMetaData(\n blob,\n function (data) {\n callback(replaceJPEGHead(blob, data.imageHead, head))\n },\n options\n )\n }\n\n loadImage.transform = function (img, options, callback, file, data) {\n if (loadImage.requiresMetaData(options)) {\n data = data || {} // eslint-disable-line no-param-reassign\n parseMetaData(\n file,\n function (result) {\n if (result !== data) {\n // eslint-disable-next-line no-console\n if (global.console) console.log(result)\n result = data // eslint-disable-line no-param-reassign\n }\n originalTransform.call(\n loadImage,\n img,\n options,\n callback,\n file,\n result\n )\n },\n options,\n data\n )\n } else {\n originalTransform.apply(loadImage, arguments)\n }\n }\n\n loadImage.blobSlice = blobSlice\n loadImage.bufferSlice = bufferSlice\n loadImage.replaceHead = replaceHead\n loadImage.parseMetaData = parseMetaData\n loadImage.metaDataParsers = metaDataParsers\n})\n","Mageplaza_Core/lib/fileUploader/cors/jquery.xdr-transport.js":"/*\n * jQuery XDomainRequest Transport Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on Julian Aubourg's ajaxHooks xdr.js:\n * https://github.com/jaubourg/ajaxHooks/\n */\n\n/* global define, require, XDomainRequest */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(require('jquery'));\n } else {\n // Browser globals:\n factory(window.jQuery);\n }\n})(function ($) {\n 'use strict';\n if (window.XDomainRequest && !$.support.cors) {\n $.ajaxTransport(function (s) {\n if (s.crossDomain && s.async) {\n if (s.timeout) {\n s.xdrTimeout = s.timeout;\n delete s.timeout;\n }\n var xdr;\n return {\n send: function (headers, completeCallback) {\n var addParamChar = /\\?/.test(s.url) ? '&' : '?';\n /**\n * Callback wrapper function\n *\n * @param {number} status HTTP status code\n * @param {string} statusText HTTP status text\n * @param {object} [responses] Content-type specific responses\n * @param {string} [responseHeaders] Response headers string\n */\n function callback(status, statusText, responses, responseHeaders) {\n xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;\n xdr = null;\n completeCallback(status, statusText, responses, responseHeaders);\n }\n xdr = new XDomainRequest();\n // XDomainRequest only supports GET and POST:\n if (s.type === 'DELETE') {\n s.url = s.url + addParamChar + '_method=DELETE';\n s.type = 'POST';\n } else if (s.type === 'PUT') {\n s.url = s.url + addParamChar + '_method=PUT';\n s.type = 'POST';\n } else if (s.type === 'PATCH') {\n s.url = s.url + addParamChar + '_method=PATCH';\n s.type = 'POST';\n }\n xdr.open(s.type, s.url);\n xdr.onload = function () {\n callback(\n 200,\n 'OK',\n { text: xdr.responseText },\n 'Content-Type: ' + xdr.contentType\n );\n };\n xdr.onerror = function () {\n callback(404, 'Not Found');\n };\n if (s.xdrTimeout) {\n xdr.ontimeout = function () {\n callback(0, 'timeout');\n };\n xdr.timeout = s.xdrTimeout;\n }\n xdr.send((s.hasContent && s.data) || null);\n },\n abort: function () {\n if (xdr) {\n xdr.onerror = $.noop();\n xdr.abort();\n }\n }\n };\n }\n });\n }\n});\n","Mageplaza_Core/lib/fileUploader/cors/jquery.postmessage-transport.js":"/*\n * jQuery postMessage Transport Plugin\n * https://github.com/blueimp/jQuery-File-Upload\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n */\n\n/* global define, require */\n\n(function (factory) {\n 'use strict';\n if (typeof define === 'function' && define.amd) {\n // Register as an anonymous AMD module:\n define(['jquery'], factory);\n } else if (typeof exports === 'object') {\n // Node/CommonJS:\n factory(require('jquery'));\n } else {\n // Browser globals:\n factory(window.jQuery);\n }\n})(function ($) {\n 'use strict';\n\n var counter = 0,\n names = [\n 'accepts',\n 'cache',\n 'contents',\n 'contentType',\n 'crossDomain',\n 'data',\n 'dataType',\n 'headers',\n 'ifModified',\n 'mimeType',\n 'password',\n 'processData',\n 'timeout',\n 'traditional',\n 'type',\n 'url',\n 'username'\n ],\n convert = function (p) {\n return p;\n };\n\n $.ajaxSetup({\n converters: {\n 'postmessage text': convert,\n 'postmessage json': convert,\n 'postmessage html': convert\n }\n });\n\n $.ajaxTransport('postmessage', function (options) {\n if (options.postMessage && window.postMessage) {\n var iframe,\n loc = $('<a></a>').prop('href', options.postMessage)[0],\n target = loc.protocol + '//' + loc.host,\n xhrUpload = options.xhr().upload;\n // IE always includes the port for the host property of a link\n // element, but not in the location.host or origin property for the\n // default http port 80 and https port 443, so we strip it:\n if (/^(http:\\/\\/.+:80)|(https:\\/\\/.+:443)$/.test(target)) {\n target = target.replace(/:(80|443)$/, '');\n }\n return {\n send: function (_, completeCallback) {\n counter += 1;\n var message = {\n id: 'postmessage-transport-' + counter\n },\n eventName = 'message.' + message.id;\n iframe = $(\n '<iframe style=\"display:none;\" src=\"' +\n options.postMessage +\n '\" name=\"' +\n message.id +\n '\"></iframe>'\n )\n .on('load', function () {\n $.each(names, function (i, name) {\n message[name] = options[name];\n });\n message.dataType = message.dataType.replace('postmessage ', '');\n $(window).on(eventName, function (event) {\n var e = event.originalEvent;\n var data = e.data;\n var ev;\n if (e.origin === target && data.id === message.id) {\n if (data.type === 'progress') {\n ev = document.createEvent('Event');\n ev.initEvent(data.type, false, true);\n $.extend(ev, data);\n xhrUpload.dispatchEvent(ev);\n } else {\n completeCallback(\n data.status,\n data.statusText,\n { postmessage: data.result },\n data.headers\n );\n iframe.remove();\n $(window).off(eventName);\n }\n }\n });\n iframe[0].contentWindow.postMessage(message, target);\n })\n .appendTo(document.body);\n },\n abort: function () {\n if (iframe) {\n iframe.remove();\n }\n }\n };\n }\n });\n});\n","Mageplaza_Core/js/jquery.ui.touch-punch.min.js":"/*!\n * jQuery UI Touch Punch 0.2.3\n *\n * Copyright 2011\u20132014, Dave Furfero\n * Dual licensed under the MIT or GPL Version 2 licenses.\n *\n * Depends:\n * jquery.ui.widget.js\n * jquery.ui.mouse.js\n */\n!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent(\"MouseEvents\");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch=\"ontouchend\"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,\"mouseover\"),f(a,\"mousemove\"),f(a,\"mousedown\"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,\"mousemove\"))},b._touchEnd=function(a){e&&(f(a,\"mouseup\"),f(a,\"mouseout\"),this._touchMoved||f(a,\"click\"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,\"_touchStart\"),touchmove:a.proxy(b,\"_touchMove\"),touchend:a.proxy(b,\"_touchEnd\")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,\"_touchStart\"),touchmove:a.proxy(b,\"_touchMove\"),touchend:a.proxy(b,\"_touchEnd\")}),d.call(b)}}}(jQuery);\n","Mageplaza_Core/js/jquery.magnific-popup.min.js":"// Magnific Popup v1.1.0 by Dmitry Semenov\n// http://bit.ly/magnific-popup#build=inline+image+ajax+iframe+gallery+retina+imagezoom\n(function(a){typeof define==\"function\"&&define.amd?define([\"jquery\"],a):typeof exports==\"object\"?a(require(\"jquery\")):a(window.jQuery||window.Zepto)})(function(a){var b=\"Close\",c=\"BeforeClose\",d=\"AfterClose\",e=\"BeforeAppend\",f=\"MarkupParse\",g=\"Open\",h=\"Change\",i=\"mfp\",j=\".\"+i,k=\"mfp-ready\",l=\"mfp-removing\",m=\"mfp-prevent-close\",n,o=function(){},p=!!window.jQuery,q,r=a(window),s,t,u,v,w=function(a,b){n.ev.on(i+a+j,b)},x=function(b,c,d,e){var f=document.createElement(\"div\");return f.className=\"mfp-\"+b,d&&(f.innerHTML=d),e?c&&c.appendChild(f):(f=a(f),c&&f.appendTo(c)),f},y=function(b,c){n.ev.triggerHandler(i+b,c),n.st.callbacks&&(b=b.charAt(0).toLowerCase()+b.slice(1),n.st.callbacks[b]&&n.st.callbacks[b].apply(n,a.isArray(c)?c:[c]))},z=function(b){if(b!==v||!n.currTemplate.closeBtn)n.currTemplate.closeBtn=a(n.st.closeMarkup.replace(\"%title%\",n.st.tClose)),v=b;return n.currTemplate.closeBtn},A=function(){a.magnificPopup.instance||(n=new o,n.init(),a.magnificPopup.instance=n)},B=function(){var a=document.createElement(\"p\").style,b=[\"ms\",\"O\",\"Moz\",\"Webkit\"];if(a.transition!==undefined)return!0;while(b.length)if(b.pop()+\"Transition\"in a)return!0;return!1};o.prototype={constructor:o,init:function(){var b=navigator.appVersion;n.isLowIE=n.isIE8=document.all&&!document.addEventListener,n.isAndroid=/android/gi.test(b),n.isIOS=/iphone|ipad|ipod/gi.test(b),n.supportsTransition=B(),n.probablyMobile=n.isAndroid||n.isIOS||/(Opera Mini)|Kindle|webOS|BlackBerry|(Opera Mobi)|(Windows Phone)|IEMobile/i.test(navigator.userAgent),s=a(document),n.popupsCache={}},open:function(b){var c;if(b.isObj===!1){n.items=b.items.toArray(),n.index=0;var d=b.items,e;for(c=0;c<d.length;c++){e=d[c],e.parsed&&(e=e.el[0]);if(e===b.el[0]){n.index=c;break}}}else n.items=a.isArray(b.items)?b.items:[b.items],n.index=b.index||0;if(n.isOpen){n.updateItemHTML();return}n.types=[],u=\"\",b.mainEl&&b.mainEl.length?n.ev=b.mainEl.eq(0):n.ev=s,b.key?(n.popupsCache[b.key]||(n.popupsCache[b.key]={}),n.currTemplate=n.popupsCache[b.key]):n.currTemplate={},n.st=a.extend(!0,{},a.magnificPopup.defaults,b),n.fixedContentPos=n.st.fixedContentPos===\"auto\"?!n.probablyMobile:n.st.fixedContentPos,n.st.modal&&(n.st.closeOnContentClick=!1,n.st.closeOnBgClick=!1,n.st.showCloseBtn=!1,n.st.enableEscapeKey=!1),n.bgOverlay||(n.bgOverlay=x(\"bg\").on(\"click\"+j,function(){n.close()}),n.wrap=x(\"wrap\").attr(\"tabindex\",-1).on(\"click\"+j,function(a){n._checkIfClose(a.target)&&n.close()}),n.container=x(\"container\",n.wrap)),n.contentContainer=x(\"content\"),n.st.preloader&&(n.preloader=x(\"preloader\",n.container,n.st.tLoading));var h=a.magnificPopup.modules;for(c=0;c<h.length;c++){var i=h[c];i=i.charAt(0).toUpperCase()+i.slice(1),n[\"init\"+i].call(n)}y(\"BeforeOpen\"),n.st.showCloseBtn&&(n.st.closeBtnInside?(w(f,function(a,b,c,d){c.close_replaceWith=z(d.type)}),u+=\" mfp-close-btn-in\"):n.wrap.append(z())),n.st.alignTop&&(u+=\" mfp-align-top\"),n.fixedContentPos?n.wrap.css({overflow:n.st.overflowY,overflowX:\"hidden\",overflowY:n.st.overflowY}):n.wrap.css({top:r.scrollTop(),position:\"absolute\"}),(n.st.fixedBgPos===!1||n.st.fixedBgPos===\"auto\"&&!n.fixedContentPos)&&n.bgOverlay.css({height:s.height(),position:\"absolute\"}),n.st.enableEscapeKey&&s.on(\"keyup\"+j,function(a){a.keyCode===27&&n.close()}),r.on(\"resize\"+j,function(){n.updateSize()}),n.st.closeOnContentClick||(u+=\" mfp-auto-cursor\"),u&&n.wrap.addClass(u);var l=n.wH=r.height(),m={};if(n.fixedContentPos&&n._hasScrollBar(l)){var o=n._getScrollbarSize();o&&(m.marginRight=o)}n.fixedContentPos&&(n.isIE7?a(\"body, html\").css(\"overflow\",\"hidden\"):m.overflow=\"hidden\");var p=n.st.mainClass;return n.isIE7&&(p+=\" mfp-ie7\"),p&&n._addClassToMFP(p),n.updateItemHTML(),y(\"BuildControls\"),a(\"html\").css(m),n.bgOverlay.add(n.wrap).prependTo(n.st.prependTo||a(document.body)),n._lastFocusedEl=document.activeElement,setTimeout(function(){n.content?(n._addClassToMFP(k),n._setFocus()):n.bgOverlay.addClass(k),s.on(\"focusin\"+j,n._onFocusIn)},16),n.isOpen=!0,n.updateSize(l),y(g),b},close:function(){if(!n.isOpen)return;y(c),n.isOpen=!1,n.st.removalDelay&&!n.isLowIE&&n.supportsTransition?(n._addClassToMFP(l),setTimeout(function(){n._close()},n.st.removalDelay)):n._close()},_close:function(){y(b);var c=l+\" \"+k+\" \";n.bgOverlay.detach(),n.wrap.detach(),n.container.empty(),n.st.mainClass&&(c+=n.st.mainClass+\" \"),n._removeClassFromMFP(c);if(n.fixedContentPos){var e={marginRight:\"\"};n.isIE7?a(\"body, html\").css(\"overflow\",\"\"):e.overflow=\"\",a(\"html\").css(e)}s.off(\"keyup\"+j+\" focusin\"+j),n.ev.off(j),n.wrap.attr(\"class\",\"mfp-wrap\").removeAttr(\"style\"),n.bgOverlay.attr(\"class\",\"mfp-bg\"),n.container.attr(\"class\",\"mfp-container\"),n.st.showCloseBtn&&(!n.st.closeBtnInside||n.currTemplate[n.currItem.type]===!0)&&n.currTemplate.closeBtn&&n.currTemplate.closeBtn.detach(),n.st.autoFocusLast&&n._lastFocusedEl&&a(n._lastFocusedEl).focus(),n.currItem=null,n.content=null,n.currTemplate=null,n.prevHeight=0,y(d)},updateSize:function(a){if(n.isIOS){var b=document.documentElement.clientWidth/window.innerWidth,c=window.innerHeight*b;n.wrap.css(\"height\",c),n.wH=c}else n.wH=a||r.height();n.fixedContentPos||n.wrap.css(\"height\",n.wH),y(\"Resize\")},updateItemHTML:function(){var b=n.items[n.index];n.contentContainer.detach(),n.content&&n.content.detach(),b.parsed||(b=n.parseEl(n.index));var c=b.type;y(\"BeforeChange\",[n.currItem?n.currItem.type:\"\",c]),n.currItem=b;if(!n.currTemplate[c]){var d=n.st[c]?n.st[c].markup:!1;y(\"FirstMarkupParse\",d),d?n.currTemplate[c]=a(d):n.currTemplate[c]=!0}t&&t!==b.type&&n.container.removeClass(\"mfp-\"+t+\"-holder\");var e=n[\"get\"+c.charAt(0).toUpperCase()+c.slice(1)](b,n.currTemplate[c]);n.appendContent(e,c),b.preloaded=!0,y(h,b),t=b.type,n.container.prepend(n.contentContainer),y(\"AfterChange\")},appendContent:function(a,b){n.content=a,a?n.st.showCloseBtn&&n.st.closeBtnInside&&n.currTemplate[b]===!0?n.content.find(\".mfp-close\").length||n.content.append(z()):n.content=a:n.content=\"\",y(e),n.container.addClass(\"mfp-\"+b+\"-holder\"),n.contentContainer.append(n.content)},parseEl:function(b){var c=n.items[b],d;c.tagName?c={el:a(c)}:(d=c.type,c={data:c,src:c.src});if(c.el){var e=n.types;for(var f=0;f<e.length;f++)if(c.el.hasClass(\"mfp-\"+e[f])){d=e[f];break}c.src=c.el.attr(\"data-mfp-src\"),c.src||(c.src=c.el.attr(\"href\"))}return c.type=d||n.st.type||\"inline\",c.index=b,c.parsed=!0,n.items[b]=c,y(\"ElementParse\",c),n.items[b]},addGroup:function(a,b){var c=function(c){c.mfpEl=this,n._openClick(c,a,b)};b||(b={});var d=\"click.magnificPopup\";b.mainEl=a,b.items?(b.isObj=!0,a.off(d).on(d,c)):(b.isObj=!1,b.delegate?a.off(d).on(d,b.delegate,c):(b.items=a,a.off(d).on(d,c)))},_openClick:function(b,c,d){var e=d.midClick!==undefined?d.midClick:a.magnificPopup.defaults.midClick;if(!e&&(b.which===2||b.ctrlKey||b.metaKey||b.altKey||b.shiftKey))return;var f=d.disableOn!==undefined?d.disableOn:a.magnificPopup.defaults.disableOn;if(f)if(a.isFunction(f)){if(!f.call(n))return!0}else if(r.width()<f)return!0;b.type&&(b.preventDefault(),n.isOpen&&b.stopPropagation()),d.el=a(b.mfpEl),d.delegate&&(d.items=c.find(d.delegate)),n.open(d)},updateStatus:function(a,b){if(n.preloader){q!==a&&n.container.removeClass(\"mfp-s-\"+q),!b&&a===\"loading\"&&(b=n.st.tLoading);var c={status:a,text:b};y(\"UpdateStatus\",c),a=c.status,b=c.text,n.preloader.html(b),n.preloader.find(\"a\").on(\"click\",function(a){a.stopImmediatePropagation()}),n.container.addClass(\"mfp-s-\"+a),q=a}},_checkIfClose:function(b){if(a(b).hasClass(m))return;var c=n.st.closeOnContentClick,d=n.st.closeOnBgClick;if(c&&d)return!0;if(!n.content||a(b).hasClass(\"mfp-close\")||n.preloader&&b===n.preloader[0])return!0;if(b!==n.content[0]&&!a.contains(n.content[0],b)){if(d&&a.contains(document,b))return!0}else if(c)return!0;return!1},_addClassToMFP:function(a){n.bgOverlay.addClass(a),n.wrap.addClass(a)},_removeClassFromMFP:function(a){this.bgOverlay.removeClass(a),n.wrap.removeClass(a)},_hasScrollBar:function(a){return(n.isIE7?s.height():document.body.scrollHeight)>(a||r.height())},_setFocus:function(){(n.st.focus?n.content.find(n.st.focus).eq(0):n.wrap).focus()},_onFocusIn:function(b){if(b.target!==n.wrap[0]&&!a.contains(n.wrap[0],b.target))return n._setFocus(),!1},_parseMarkup:function(b,c,d){var e;d.data&&(c=a.extend(d.data,c)),y(f,[b,c,d]),a.each(c,function(c,d){if(d===undefined||d===!1)return!0;e=c.split(\"_\");if(e.length>1){var f=b.find(j+\"-\"+e[0]);if(f.length>0){var g=e[1];g===\"replaceWith\"?f[0]!==d[0]&&f.replaceWith(d):g===\"img\"?f.is(\"img\")?f.attr(\"src\",d):f.replaceWith(a(\"<img>\").attr(\"src\",d).attr(\"class\",f.attr(\"class\"))):f.attr(e[1],d)}}else b.find(j+\"-\"+c).html(d)})},_getScrollbarSize:function(){if(n.scrollbarSize===undefined){var a=document.createElement(\"div\");a.style.cssText=\"width: 99px; height: 99px; overflow: scroll; position: absolute; top: -9999px;\",document.body.appendChild(a),n.scrollbarSize=a.offsetWidth-a.clientWidth,document.body.removeChild(a)}return n.scrollbarSize}},a.magnificPopup={instance:null,proto:o.prototype,modules:[],open:function(b,c){return A(),b?b=a.extend(!0,{},b):b={},b.isObj=!0,b.index=c||0,this.instance.open(b)},close:function(){return a.magnificPopup.instance&&a.magnificPopup.instance.close()},registerModule:function(b,c){c.options&&(a.magnificPopup.defaults[b]=c.options),a.extend(this.proto,c.proto),this.modules.push(b)},defaults:{disableOn:0,key:null,midClick:!1,mainClass:\"\",preloader:!0,focus:\"\",closeOnContentClick:!1,closeOnBgClick:!0,closeBtnInside:!0,showCloseBtn:!0,enableEscapeKey:!0,modal:!1,alignTop:!1,removalDelay:0,prependTo:null,fixedContentPos:\"auto\",fixedBgPos:\"auto\",overflowY:\"auto\",closeMarkup:'<button title=\"%title%\" type=\"button\" class=\"mfp-close\">×</button>',tClose:\"Close (Esc)\",tLoading:\"Loading...\",autoFocusLast:!0}},a.fn.magnificPopup=function(b){A();var c=a(this);if(typeof b==\"string\")if(b===\"open\"){var d,e=p?c.data(\"magnificPopup\"):c[0].magnificPopup,f=parseInt(arguments[1],10)||0;e.items?d=e.items[f]:(d=c,e.delegate&&(d=d.find(e.delegate)),d=d.eq(f)),n._openClick({mfpEl:d},c,e)}else n.isOpen&&n[b].apply(n,Array.prototype.slice.call(arguments,1));else b=a.extend(!0,{},b),p?c.data(\"magnificPopup\",b):c[0].magnificPopup=b,n.addGroup(c,b);return c};var C=\"inline\",D,E,F,G=function(){F&&(E.after(F.addClass(D)).detach(),F=null)};a.magnificPopup.registerModule(C,{options:{hiddenClass:\"hide\",markup:\"\",tNotFound:\"Content not found\"},proto:{initInline:function(){n.types.push(C),w(b+\".\"+C,function(){G()})},getInline:function(b,c){G();if(b.src){var d=n.st.inline,e=a(b.src);if(e.length){var f=e[0].parentNode;f&&f.tagName&&(E||(D=d.hiddenClass,E=x(D),D=\"mfp-\"+D),F=e.after(E).detach().removeClass(D)),n.updateStatus(\"ready\")}else n.updateStatus(\"error\",d.tNotFound),e=a(\"<div>\");return b.inlineElement=e,e}return n.updateStatus(\"ready\"),n._parseMarkup(c,{},b),c}}});var H=\"ajax\",I,J=function(){I&&a(document.body).removeClass(I)},K=function(){J(),n.req&&n.req.abort()};a.magnificPopup.registerModule(H,{options:{settings:null,cursor:\"mfp-ajax-cur\",tError:'<a href=\"%url%\">The content</a> could not be loaded.'},proto:{initAjax:function(){n.types.push(H),I=n.st.ajax.cursor,w(b+\".\"+H,K),w(\"BeforeChange.\"+H,K)},getAjax:function(b){I&&a(document.body).addClass(I),n.updateStatus(\"loading\");var c=a.extend({url:b.src,success:function(c,d,e){var f={data:c,xhr:e};y(\"ParseAjax\",f),n.appendContent(a(f.data),H),b.finished=!0,J(),n._setFocus(),setTimeout(function(){n.wrap.addClass(k)},16),n.updateStatus(\"ready\"),y(\"AjaxContentAdded\")},error:function(){J(),b.finished=b.loadError=!0,n.updateStatus(\"error\",n.st.ajax.tError.replace(\"%url%\",b.src))}},n.st.ajax.settings);return n.req=a.ajax(c),\"\"}}});var L,M=function(b){if(b.data&&b.data.title!==undefined)return b.data.title;var c=n.st.image.titleSrc;if(c){if(a.isFunction(c))return c.call(n,b);if(b.el)return b.el.attr(c)||\"\"}return\"\"};a.magnificPopup.registerModule(\"image\",{options:{markup:'<div class=\"mfp-figure\"><div class=\"mfp-close\"></div><figure><div class=\"mfp-img\"></div><figcaption><div class=\"mfp-bottom-bar\"><div class=\"mfp-title\"></div><div class=\"mfp-counter\"></div></div></figcaption></figure></div>',cursor:\"mfp-zoom-out-cur\",titleSrc:\"title\",verticalFit:!0,tError:'<a href=\"%url%\">The image</a> could not be loaded.'},proto:{initImage:function(){var c=n.st.image,d=\".image\";n.types.push(\"image\"),w(g+d,function(){n.currItem.type===\"image\"&&c.cursor&&a(document.body).addClass(c.cursor)}),w(b+d,function(){c.cursor&&a(document.body).removeClass(c.cursor),r.off(\"resize\"+j)}),w(\"Resize\"+d,n.resizeImage),n.isLowIE&&w(\"AfterChange\",n.resizeImage)},resizeImage:function(){var a=n.currItem;if(!a||!a.img)return;if(n.st.image.verticalFit){var b=0;n.isLowIE&&(b=parseInt(a.img.css(\"padding-top\"),10)+parseInt(a.img.css(\"padding-bottom\"),10)),a.img.css(\"max-height\",n.wH-b)}},_onImageHasSize:function(a){a.img&&(a.hasSize=!0,L&&clearInterval(L),a.isCheckingImgSize=!1,y(\"ImageHasSize\",a),a.imgHidden&&(n.content&&n.content.removeClass(\"mfp-loading\"),a.imgHidden=!1))},findImageSize:function(a){var b=0,c=a.img[0],d=function(e){L&&clearInterval(L),L=setInterval(function(){if(c.naturalWidth>0){n._onImageHasSize(a);return}b>200&&clearInterval(L),b++,b===3?d(10):b===40?d(50):b===100&&d(500)},e)};d(1)},getImage:function(b,c){var d=0,e=function(){b&&(b.img[0].complete?(b.img.off(\".mfploader\"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus(\"ready\")),b.hasSize=!0,b.loaded=!0,y(\"ImageLoadComplete\")):(d++,d<200?setTimeout(e,100):f()))},f=function(){b&&(b.img.off(\".mfploader\"),b===n.currItem&&(n._onImageHasSize(b),n.updateStatus(\"error\",g.tError.replace(\"%url%\",b.src))),b.hasSize=!0,b.loaded=!0,b.loadError=!0)},g=n.st.image,h=c.find(\".mfp-img\");if(h.length){var i=document.createElement(\"img\");i.className=\"mfp-img\",b.el&&b.el.find(\"img\").length&&(i.alt=b.el.find(\"img\").attr(\"alt\")),b.img=a(i).on(\"load.mfploader\",e).on(\"error.mfploader\",f),i.src=b.src,h.is(\"img\")&&(b.img=b.img.clone()),i=b.img[0],i.naturalWidth>0?b.hasSize=!0:i.width||(b.hasSize=!1)}return n._parseMarkup(c,{title:M(b),img_replaceWith:b.img},b),n.resizeImage(),b.hasSize?(L&&clearInterval(L),b.loadError?(c.addClass(\"mfp-loading\"),n.updateStatus(\"error\",g.tError.replace(\"%url%\",b.src))):(c.removeClass(\"mfp-loading\"),n.updateStatus(\"ready\")),c):(n.updateStatus(\"loading\"),b.loading=!0,b.hasSize||(b.imgHidden=!0,c.addClass(\"mfp-loading\"),n.findImageSize(b)),c)}}});var N,O=function(){return N===undefined&&(N=document.createElement(\"p\").style.MozTransform!==undefined),N};a.magnificPopup.registerModule(\"zoom\",{options:{enabled:!1,easing:\"ease-in-out\",duration:300,opener:function(a){return a.is(\"img\")?a:a.find(\"img\")}},proto:{initZoom:function(){var a=n.st.zoom,d=\".zoom\",e;if(!a.enabled||!n.supportsTransition)return;var f=a.duration,g=function(b){var c=b.clone().removeAttr(\"style\").removeAttr(\"class\").addClass(\"mfp-animated-image\"),d=\"all \"+a.duration/1e3+\"s \"+a.easing,e={position:\"fixed\",zIndex:9999,left:0,top:0,\"-webkit-backface-visibility\":\"hidden\"},f=\"transition\";return e[\"-webkit-\"+f]=e[\"-moz-\"+f]=e[\"-o-\"+f]=e[f]=d,c.css(e),c},h=function(){n.content.css(\"visibility\",\"visible\")},i,j;w(\"BuildControls\"+d,function(){if(n._allowZoom()){clearTimeout(i),n.content.css(\"visibility\",\"hidden\"),e=n._getItemToZoom();if(!e){h();return}j=g(e),j.css(n._getOffset()),n.wrap.append(j),i=setTimeout(function(){j.css(n._getOffset(!0)),i=setTimeout(function(){h(),setTimeout(function(){j.remove(),e=j=null,y(\"ZoomAnimationEnded\")},16)},f)},16)}}),w(c+d,function(){if(n._allowZoom()){clearTimeout(i),n.st.removalDelay=f;if(!e){e=n._getItemToZoom();if(!e)return;j=g(e)}j.css(n._getOffset(!0)),n.wrap.append(j),n.content.css(\"visibility\",\"hidden\"),setTimeout(function(){j.css(n._getOffset())},16)}}),w(b+d,function(){n._allowZoom()&&(h(),j&&j.remove(),e=null)})},_allowZoom:function(){return n.currItem.type===\"image\"},_getItemToZoom:function(){return n.currItem.hasSize?n.currItem.img:!1},_getOffset:function(b){var c;b?c=n.currItem.img:c=n.st.zoom.opener(n.currItem.el||n.currItem);var d=c.offset(),e=parseInt(c.css(\"padding-top\"),10),f=parseInt(c.css(\"padding-bottom\"),10);d.top-=a(window).scrollTop()-e;var g={width:c.width(),height:(p?c.innerHeight():c[0].offsetHeight)-f-e};return O()?g[\"-moz-transform\"]=g.transform=\"translate(\"+d.left+\"px,\"+d.top+\"px)\":(g.left=d.left,g.top=d.top),g}}});var P=\"iframe\",Q=\"//about:blank\",R=function(a){if(n.currTemplate[P]){var b=n.currTemplate[P].find(\"iframe\");b.length&&(a||(b[0].src=Q),n.isIE8&&b.css(\"display\",a?\"block\":\"none\"))}};a.magnificPopup.registerModule(P,{options:{markup:'<div class=\"mfp-iframe-scaler\"><div class=\"mfp-close\"></div><iframe class=\"mfp-iframe\" src=\"//about:blank\" frameborder=\"0\" allowfullscreen></iframe></div>',srcAction:\"iframe_src\",patterns:{youtube:{index:\"youtube.com\",id:\"v=\",src:\"//www.youtube.com/embed/%id%?autoplay=1\"},vimeo:{index:\"vimeo.com/\",id:\"/\",src:\"//player.vimeo.com/video/%id%?autoplay=1\"},gmaps:{index:\"//maps.google.\",src:\"%id%&output=embed\"}}},proto:{initIframe:function(){n.types.push(P),w(\"BeforeChange\",function(a,b,c){b!==c&&(b===P?R():c===P&&R(!0))}),w(b+\".\"+P,function(){R()})},getIframe:function(b,c){var d=b.src,e=n.st.iframe;a.each(e.patterns,function(){if(d.indexOf(this.index)>-1)return this.id&&(typeof this.id==\"string\"?d=d.substr(d.lastIndexOf(this.id)+this.id.length,d.length):d=this.id.call(this,d)),d=this.src.replace(\"%id%\",d),!1});var f={};return e.srcAction&&(f[e.srcAction]=d),n._parseMarkup(c,f,b),n.updateStatus(\"ready\"),c}}});var S=function(a){var b=n.items.length;return a>b-1?a-b:a<0?b+a:a},T=function(a,b,c){return a.replace(/%curr%/gi,b+1).replace(/%total%/gi,c)};a.magnificPopup.registerModule(\"gallery\",{options:{enabled:!1,arrowMarkup:'<button title=\"%title%\" type=\"button\" class=\"mfp-arrow mfp-arrow-%dir%\"></button>',preload:[0,2],navigateByImgClick:!0,arrows:!0,tPrev:\"Previous (Left arrow key)\",tNext:\"Next (Right arrow key)\",tCounter:\"%curr% of %total%\"},proto:{initGallery:function(){var c=n.st.gallery,d=\".mfp-gallery\";n.direction=!0;if(!c||!c.enabled)return!1;u+=\" mfp-gallery\",w(g+d,function(){c.navigateByImgClick&&n.wrap.on(\"click\"+d,\".mfp-img\",function(){if(n.items.length>1)return n.next(),!1}),s.on(\"keydown\"+d,function(a){a.keyCode===37?n.prev():a.keyCode===39&&n.next()})}),w(\"UpdateStatus\"+d,function(a,b){b.text&&(b.text=T(b.text,n.currItem.index,n.items.length))}),w(f+d,function(a,b,d,e){var f=n.items.length;d.counter=f>1?T(c.tCounter,e.index,f):\"\"}),w(\"BuildControls\"+d,function(){if(n.items.length>1&&c.arrows&&!n.arrowLeft){var b=c.arrowMarkup,d=n.arrowLeft=a(b.replace(/%title%/gi,c.tPrev).replace(/%dir%/gi,\"left\")).addClass(m),e=n.arrowRight=a(b.replace(/%title%/gi,c.tNext).replace(/%dir%/gi,\"right\")).addClass(m);d.click(function(){n.prev()}),e.click(function(){n.next()}),n.container.append(d.add(e))}}),w(h+d,function(){n._preloadTimeout&&clearTimeout(n._preloadTimeout),n._preloadTimeout=setTimeout(function(){n.preloadNearbyImages(),n._preloadTimeout=null},16)}),w(b+d,function(){s.off(d),n.wrap.off(\"click\"+d),n.arrowRight=n.arrowLeft=null})},next:function(){n.direction=!0,n.index=S(n.index+1),n.updateItemHTML()},prev:function(){n.direction=!1,n.index=S(n.index-1),n.updateItemHTML()},goTo:function(a){n.direction=a>=n.index,n.index=a,n.updateItemHTML()},preloadNearbyImages:function(){var a=n.st.gallery.preload,b=Math.min(a[0],n.items.length),c=Math.min(a[1],n.items.length),d;for(d=1;d<=(n.direction?c:b);d++)n._preloadItem(n.index+d);for(d=1;d<=(n.direction?b:c);d++)n._preloadItem(n.index-d)},_preloadItem:function(b){b=S(b);if(n.items[b].preloaded)return;var c=n.items[b];c.parsed||(c=n.parseEl(b)),y(\"LazyLoad\",c),c.type===\"image\"&&(c.img=a('<img class=\"mfp-img\" />').on(\"load.mfploader\",function(){c.hasSize=!0}).on(\"error.mfploader\",function(){c.hasSize=!0,c.loadError=!0,y(\"LazyLoadError\",c)}).attr(\"src\",c.src)),c.preloaded=!0}}});var U=\"retina\";a.magnificPopup.registerModule(U,{options:{replaceSrc:function(a){return a.src.replace(/\\.\\w+$/,function(a){return\"@2x\"+a})},ratio:1},proto:{initRetina:function(){if(window.devicePixelRatio>1){var a=n.st.retina,b=a.ratio;b=isNaN(b)?b():b,b>1&&(w(\"ImageHasSize.\"+U,function(a,c){c.img.css({\"max-width\":c.img[0].naturalWidth/b,width:\"100%\"})}),w(\"ElementParse.\"+U,function(c,d){d.src=a.replaceSrc(d,b)}))}}}}),A()})","Mageplaza_Core/js/owl.carousel.min.js":"!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this.drag=a.extend({},m),this.state=a.extend({},n),this.e=a.extend({},o),this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._invalidated={},this._pipe=[],a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a[0].toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Pipe,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}function f(a){if(a.touches!==d)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(a.touches===d){if(a.pageX!==d)return{x:a.pageX,y:a.pageY};if(a.pageX===d)return{x:a.clientX,y:a.clientY}}}function g(a){var b,d,e=c.createElement(\"div\"),f=a;for(b in f)if(d=f[b],\"undefined\"!=typeof e.style[d])return e=null,[d,b];return[!1]}function h(){return g([\"transition\",\"WebkitTransition\",\"MozTransition\",\"OTransition\"])[1]}function i(){return g([\"transform\",\"WebkitTransform\",\"MozTransform\",\"OTransform\",\"msTransform\"])[0]}function j(){return g([\"perspective\",\"webkitPerspective\",\"MozPerspective\",\"OPerspective\",\"MsPerspective\"])[0]}function k(){return\"ontouchstart\"in b||!!navigator.msMaxTouchPoints}function l(){return b.navigator.msPointerEnabled}var m,n,o;m={start:0,startX:0,startY:0,current:0,currentX:0,currentY:0,offsetX:0,offsetY:0,distance:null,startTime:0,endTime:0,updatedX:0,targetEl:null},n={isTouch:!1,isScrolling:!1,isSwiping:!1,direction:!1,inMotion:!1},o={_onDragStart:null,_onDragMove:null,_onDragEnd:null,_transitionEnd:null,_resizer:null,_responsiveCall:null,_goToLoop:null,_checkVisibile:null},e.Defaults={items:3,loop:!1,center:!1,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,responsiveClass:!1,fallbackEasing:\"swing\",info:!1,nestedItemSelector:!1,itemElement:\"div\",stageElement:\"div\",themeClass:\"owl-theme\",baseClass:\"owl-carousel\",itemClass:\"owl-item\",centerClass:\"center\",activeClass:\"active\"},e.Width={Default:\"default\",Inner:\"inner\",Outer:\"outer\"},e.Plugins={},e.Pipe=[{filter:[\"width\",\"items\",\"settings\"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:[\"items\",\"settings\"],run:function(){var a=this._clones,b=this.$stage.children(\".cloned\");(b.length!==a.length||!this.settings.loop&&a.length>0)&&(this.$stage.children(\".cloned\").remove(),this._clones=[])}},{filter:[\"items\",\"settings\"],run:function(){var a,b,c=this._clones,d=this._items,e=this.settings.loop?c.length-Math.max(2*this.settings.items,4):0;for(a=0,b=Math.abs(e/2);b>a;a++)e>0?(this.$stage.children().eq(d.length+c.length-1).remove(),c.pop(),this.$stage.children().eq(0).remove(),c.pop()):(c.push(c.length/2),this.$stage.append(d[c[c.length-1]].clone().addClass(\"cloned\")),c.push(d.length-1-(c.length-1)/2),this.$stage.prepend(d[c[c.length-1]].clone().addClass(\"cloned\")))}},{filter:[\"width\",\"items\",\"settings\"],run:function(){var a,b,c,d=this.settings.rtl?1:-1,e=(this.width()/this.settings.items).toFixed(3),f=0;for(this._coordinates=[],b=0,c=this._clones.length+this._items.length;c>b;b++)a=this._mergers[this.relative(b)],a=this.settings.mergeFit&&Math.min(a,this.settings.items)||a,f+=(this.settings.autoWidth?this._items[this.relative(b)].width()+this.settings.margin:e*a)*d,this._coordinates.push(f)}},{filter:[\"width\",\"items\",\"settings\"],run:function(){var b,c,d=(this.width()/this.settings.items).toFixed(3),e={width:Math.abs(this._coordinates[this._coordinates.length-1])+2*this.settings.stagePadding,\"padding-left\":this.settings.stagePadding||\"\",\"padding-right\":this.settings.stagePadding||\"\"};if(this.$stage.css(e),e={width:this.settings.autoWidth?\"auto\":d-this.settings.margin},e[this.settings.rtl?\"margin-left\":\"margin-right\"]=this.settings.margin,!this.settings.autoWidth&&a.grep(this._mergers,function(a){return a>1}).length>0)for(b=0,c=this._coordinates.length;c>b;b++)e.width=Math.abs(this._coordinates[b])-Math.abs(this._coordinates[b-1]||0)-this.settings.margin,this.$stage.children().eq(b).css(e);else this.$stage.children().css(e)}},{filter:[\"width\",\"items\",\"settings\"],run:function(a){a.current&&this.reset(this.$stage.children().index(a.current))}},{filter:[\"position\"],run:function(){this.animate(this.coordinates(this._current))}},{filter:[\"width\",\"position\",\"items\",\"settings\"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;d>c;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,\"<=\",g)&&this.op(a,\">\",h)||this.op(b,\"<\",g)&&this.op(b,\">\",h))&&i.push(c);this.$stage.children(\".\"+this.settings.activeClass).removeClass(this.settings.activeClass),this.$stage.children(\":eq(\"+i.join(\"), :eq(\")+\")\").addClass(this.settings.activeClass),this.settings.center&&(this.$stage.children(\".\"+this.settings.centerClass).removeClass(this.settings.centerClass),this.$stage.children().eq(this.current()).addClass(this.settings.centerClass))}}],e.prototype.initialize=function(){if(this.trigger(\"initialize\"),this.$element.addClass(this.settings.baseClass).addClass(this.settings.themeClass).toggleClass(\"owl-rtl\",this.settings.rtl),this.browserSupport(),this.settings.autoWidth&&this.state.imagesLoaded!==!0){var b,c,e;if(b=this.$element.find(\"img\"),c=this.settings.nestedItemSelector?\".\"+this.settings.nestedItemSelector:d,e=this.$element.children(c).width(),b.length&&0>=e)return this.preloadAutoWidthImages(b),!1}this.$element.addClass(\"owl-loading\"),this.$stage=a(\"<\"+this.settings.stageElement+' class=\"owl-stage\"/>').wrap('<div class=\"owl-stage-outer\">'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this._width=this.$element.width(),this.refresh(),this.$element.removeClass(\"owl-loading\").addClass(\"owl-loaded\"),this.eventsCall(),this.internalEvents(),this.addTriggerableEvents(),this.trigger(\"initialized\")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){b>=a&&a>d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),delete e.responsive,e.responsiveClass&&this.$element.attr(\"class\",function(a,b){return b.replace(/\\b owl-responsive-\\S+/g,\"\")}).addClass(\"owl-responsive-\"+d)):e=a.extend({},this.options),(null===this.settings||this._breakpoint!==d)&&(this.trigger(\"change\",{property:{name:\"settings\",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate(\"settings\"),this.trigger(\"changed\",{property:{name:\"settings\",value:this.settings}}))},e.prototype.optionsLogic=function(){this.$element.toggleClass(\"owl-center\",this.settings.center),this.settings.loop&&this._items.length<this.settings.items&&(this.settings.loop=!1),this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger(\"prepare\",{content:b});return c.data||(c.data=a(\"<\"+this.settings.itemElement+\"/>\").addClass(this.settings.itemClass).append(b)),this.trigger(\"prepared\",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};c>b;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={}},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){if(0===this._items.length)return!1;(new Date).getTime();this.trigger(\"refresh\"),this.setup(),this.optionsLogic(),this.$stage.addClass(\"owl-refresh\"),this.update(),this.$stage.removeClass(\"owl-refresh\"),this.state.orientation=b.orientation,this.watchVisibility(),this.trigger(\"refreshed\")},e.prototype.eventsCall=function(){this.e._onDragStart=a.proxy(function(a){this.onDragStart(a)},this),this.e._onDragMove=a.proxy(function(a){this.onDragMove(a)},this),this.e._onDragEnd=a.proxy(function(a){this.onDragEnd(a)},this),this.e._onResize=a.proxy(function(a){this.onResize(a)},this),this.e._transitionEnd=a.proxy(function(a){this.transitionEnd(a)},this),this.e._preventClick=a.proxy(function(a){this.preventClick(a)},this)},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this.e._onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return this._items.length?this._width===this.$element.width()?!1:this.trigger(\"resize\").isDefaultPrevented()?!1:(this._width=this.$element.width(),this.invalidate(\"width\"),this.refresh(),void this.trigger(\"resized\")):!1},e.prototype.eventsRouter=function(a){var b=a.type;\"mousedown\"===b||\"touchstart\"===b?this.onDragStart(a):\"mousemove\"===b||\"touchmove\"===b?this.onDragMove(a):\"mouseup\"===b||\"touchend\"===b?this.onDragEnd(a):\"touchcancel\"===b&&this.onDragEnd(a)},e.prototype.internalEvents=function(){var c=(k(),l());this.settings.mouseDrag?(this.$stage.on(\"mousedown\",a.proxy(function(a){this.eventsRouter(a)},this)),this.$stage.on(\"dragstart\",function(){return!1}),this.$stage.get(0).onselectstart=function(){return!1}):this.$element.addClass(\"owl-text-select-on\"),this.settings.touchDrag&&!c&&this.$stage.on(\"touchstart touchcancel\",a.proxy(function(a){this.eventsRouter(a)},this)),this.transitionEndVendor&&this.on(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd,!1),this.settings.responsive!==!1&&this.on(b,\"resize\",a.proxy(this.onThrottledResize,this))},e.prototype.onDragStart=function(d){var e,g,h,i;if(e=d.originalEvent||d||b.event,3===e.which||this.state.isTouch)return!1;if(\"mousedown\"===e.type&&this.$stage.addClass(\"owl-grab\"),this.trigger(\"drag\"),this.drag.startTime=(new Date).getTime(),this.speed(0),this.state.isTouch=!0,this.state.isScrolling=!1,this.state.isSwiping=!1,this.drag.distance=0,g=f(e).x,h=f(e).y,this.drag.offsetX=this.$stage.position().left,this.drag.offsetY=this.$stage.position().top,this.settings.rtl&&(this.drag.offsetX=this.$stage.position().left+this.$stage.width()-this.width()+this.settings.margin),this.state.inMotion&&this.support3d)i=this.getTransformProperty(),this.drag.offsetX=i,this.animate(i),this.state.inMotion=!0;else if(this.state.inMotion&&!this.support3d)return this.state.inMotion=!1,!1;this.drag.startX=g-this.drag.offsetX,this.drag.startY=h-this.drag.offsetY,this.drag.start=g-this.drag.startX,this.drag.targetEl=e.target||e.srcElement,this.drag.updatedX=this.drag.start,(\"IMG\"===this.drag.targetEl.tagName||\"A\"===this.drag.targetEl.tagName)&&(this.drag.targetEl.draggable=!1),a(c).on(\"mousemove.owl.dragEvents mouseup.owl.dragEvents touchmove.owl.dragEvents touchend.owl.dragEvents\",a.proxy(function(a){this.eventsRouter(a)},this))},e.prototype.onDragMove=function(a){var c,e,g,h,i,j;this.state.isTouch&&(this.state.isScrolling||(c=a.originalEvent||a||b.event,e=f(c).x,g=f(c).y,this.drag.currentX=e-this.drag.startX,this.drag.currentY=g-this.drag.startY,this.drag.distance=this.drag.currentX-this.drag.offsetX,this.drag.distance<0?this.state.direction=this.settings.rtl?\"right\":\"left\":this.drag.distance>0&&(this.state.direction=this.settings.rtl?\"left\":\"right\"),this.settings.loop?this.op(this.drag.currentX,\">\",this.coordinates(this.minimum()))&&\"right\"===this.state.direction?this.drag.currentX-=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length):this.op(this.drag.currentX,\"<\",this.coordinates(this.maximum()))&&\"left\"===this.state.direction&&(this.drag.currentX+=(this.settings.center&&this.coordinates(0))-this.coordinates(this._items.length)):(h=this.coordinates(this.settings.rtl?this.maximum():this.minimum()),i=this.coordinates(this.settings.rtl?this.minimum():this.maximum()),j=this.settings.pullDrag?this.drag.distance/5:0,this.drag.currentX=Math.max(Math.min(this.drag.currentX,h+j),i+j)),(this.drag.distance>8||this.drag.distance<-8)&&(c.preventDefault!==d?c.preventDefault():c.returnValue=!1,this.state.isSwiping=!0),this.drag.updatedX=this.drag.currentX,(this.drag.currentY>16||this.drag.currentY<-16)&&this.state.isSwiping===!1&&(this.state.isScrolling=!0,this.drag.updatedX=this.drag.start),this.animate(this.drag.updatedX)))},e.prototype.onDragEnd=function(b){var d,e,f;if(this.state.isTouch){if(\"mouseup\"===b.type&&this.$stage.removeClass(\"owl-grab\"),this.trigger(\"dragged\"),this.drag.targetEl.removeAttribute(\"draggable\"),this.state.isTouch=!1,this.state.isScrolling=!1,this.state.isSwiping=!1,0===this.drag.distance&&this.state.inMotion!==!0)return this.state.inMotion=!1,!1;this.drag.endTime=(new Date).getTime(),d=this.drag.endTime-this.drag.startTime,e=Math.abs(this.drag.distance),(e>3||d>300)&&this.removeClick(this.drag.targetEl),f=this.closest(this.drag.updatedX),this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(f),this.invalidate(\"position\"),this.update(),this.settings.pullDrag||this.drag.updatedX!==this.coordinates(f)||this.transitionEnd(),this.drag.distance=0,a(c).off(\".owl.dragEvents\")}},e.prototype.removeClick=function(c){this.drag.targetEl=c,a(c).on(\"click.preventClick\",this.e._preventClick),b.setTimeout(function(){a(c).off(\"click.preventClick\")},300)},e.prototype.preventClick=function(b){b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation&&b.stopPropagation(),a(b.target).off(\"click.preventClick\")},e.prototype.getTransformProperty=function(){var a,c;return a=b.getComputedStyle(this.$stage.get(0),null).getPropertyValue(this.vendorName+\"transform\"),a=a.replace(/matrix(3d)?\\(|\\)/g,\"\").split(\",\"),c=16===a.length,c!==!0?a[4]:a[12]},e.prototype.closest=function(b){var c=-1,d=30,e=this.width(),f=this.coordinates();return this.settings.freeDrag||a.each(f,a.proxy(function(a,g){return b>g-d&&g+d>b?c=a:this.op(b,\"<\",g)&&this.op(b,\">\",f[a+1]||g-e)&&(c=\"left\"===this.state.direction?a+1:a),-1===c},this)),this.settings.loop||(this.op(b,\">\",f[this.minimum()])?c=b=this.minimum():this.op(b,\"<\",f[this.maximum()])&&(c=b=this.maximum())),c},e.prototype.animate=function(b){this.trigger(\"translate\"),this.state.inMotion=this.speed()>0,this.support3d?this.$stage.css({transform:\"translate3d(\"+b+\"px,0px, 0px)\",transition:this.speed()/1e3+\"s\"}):this.state.isTouch?this.$stage.css({left:b+\"px\"}):this.$stage.animate({left:b},this.speed()/1e3,this.settings.fallbackEasing,a.proxy(function(){this.state.inMotion&&this.transitionEnd()},this))},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger(\"change\",{property:{name:\"position\",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate(\"position\"),this.trigger(\"changed\",{property:{name:\"position\",value:this._current}})}return this._current},e.prototype.invalidate=function(a){this._invalidated[a]=!0},e.prototype.reset=function(a){a=this.normalize(a),a!==d&&(this._speed=0,this._current=a,this.suppress([\"translate\",\"translated\"]),this.animate(this.coordinates(a)),this.release([\"translate\",\"translated\"]))},e.prototype.normalize=function(b,c){var e=c?this._items.length:this._items.length+this._clones.length;return!a.isNumeric(b)||1>e?d:b=this._clones.length?(b%e+e)%e:Math.max(this.minimum(c),Math.min(this.maximum(c),b))},e.prototype.relative=function(a){return a=this.normalize(a),a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c,d,e=0,f=this.settings;if(a)return this._items.length-1;if(!f.loop&&f.center)b=this._items.length-1;else if(f.loop||f.center)if(f.loop||f.center)b=this._items.length+f.items;else{if(!f.autoWidth&&!f.merge)throw\"Can not detect maximum absolute position.\";for(revert=f.rtl?1:-1,c=this.$stage.width()-this.$element.width();(d=this.coordinates(e))&&!(d*revert>=c);)b=++e}else b=this._items.length-f.items;return b},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2===0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c=null;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[b-1]||0))/2*(this.settings.rtl?-1:1)):c=this._coordinates[b-1]||0,c)},e.prototype.duration=function(a,b,c){return Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(c,d){if(this.settings.loop){var e=c-this.relative(this.current()),f=this.current(),g=this.current(),h=this.current()+e,i=0>g-h?!0:!1,j=this._clones.length+this._items.length;h<this.settings.items&&i===!1?(f=g+this._items.length,this.reset(f)):h>=j-this.settings.items&&i===!0&&(f=g-this._items.length,this.reset(f)),b.clearTimeout(this.e._goToLoop),this.e._goToLoop=b.setTimeout(a.proxy(function(){this.speed(this.duration(this.current(),f+e,d)),this.current(f+e),this.update()},this),30)}else this.speed(this.duration(this.current(),c,d)),this.current(c),this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.transitionEnd=function(a){return a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0))?!1:(this.state.inMotion=!1,void this.trigger(\"translated\"))},e.prototype.viewport=function(){var d;if(this.options.responsiveBaseElement!==b)d=a(this.options.responsiveBaseElement).width();else if(b.innerWidth)d=b.innerWidth;else{if(!c.documentElement||!c.documentElement.clientWidth)throw\"Can not detect viewport width.\";d=c.documentElement.clientWidth}return d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find(\".\"+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find(\"[data-merge]\").andSelf(\"[data-merge]\").attr(\"data-merge\")||1)},this)),this.reset(a.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate(\"items\")},e.prototype.add=function(a,b){b=b===d?this._items.length:this.normalize(b,!0),this.trigger(\"add\",{content:a,position:b}),0===this._items.length||b===this._items.length?(this.$stage.append(a),this._items.push(a),this._mergers.push(1*a.find(\"[data-merge]\").andSelf(\"[data-merge]\").attr(\"data-merge\")||1)):(this._items[b].before(a),this._items.splice(b,0,a),this._mergers.splice(b,0,1*a.find(\"[data-merge]\").andSelf(\"[data-merge]\").attr(\"data-merge\")||1)),this.invalidate(\"items\"),this.trigger(\"added\",{content:a,position:b})},e.prototype.remove=function(a){a=this.normalize(a,!0),a!==d&&(this.trigger(\"remove\",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate(\"items\"),this.trigger(\"removed\",{content:null,position:a}))},e.prototype.addTriggerableEvents=function(){var b=a.proxy(function(b,c){return a.proxy(function(a){a.relatedTarget!==this&&(this.suppress([c]),b.apply(this,[].slice.call(arguments,1)),this.release([c]))},this)},this);a.each({next:this.next,prev:this.prev,to:this.to,destroy:this.destroy,refresh:this.refresh,replace:this.replace,add:this.add,remove:this.remove},a.proxy(function(a,c){this.$element.on(a+\".owl.carousel\",b(c,a+\".owl.carousel\"))},this))},e.prototype.watchVisibility=function(){function c(a){return a.offsetWidth>0&&a.offsetHeight>0}function d(){c(this.$element.get(0))&&(this.$element.removeClass(\"owl-hidden\"),this.refresh(),b.clearInterval(this.e._checkVisibile))}c(this.$element.get(0))||(this.$element.addClass(\"owl-hidden\"),b.clearInterval(this.e._checkVisibile),this.e._checkVisibile=b.setInterval(a.proxy(d,this),500))},e.prototype.preloadAutoWidthImages=function(b){var c,d,e,f;c=0,d=this,b.each(function(g,h){e=a(h),f=new Image,f.onload=function(){c++,e.attr(\"src\",f.src),e.css(\"opacity\",1),c>=b.length&&(d.state.imagesLoaded=!0,d.initialize())},f.src=e.attr(\"src\")||e.attr(\"data-src\")||e.attr(\"data-src-retina\")})},e.prototype.destroy=function(){this.$element.hasClass(this.settings.themeClass)&&this.$element.removeClass(this.settings.themeClass),this.settings.responsive!==!1&&a(b).off(\"resize.owl.carousel\"),this.transitionEndVendor&&this.off(this.$stage.get(0),this.transitionEndVendor,this.e._transitionEnd);for(var d in this._plugins)this._plugins[d].destroy();(this.settings.mouseDrag||this.settings.touchDrag)&&(this.$stage.off(\"mousedown touchstart touchcancel\"),a(c).off(\".owl.dragEvents\"),this.$stage.get(0).onselectstart=function(){},this.$stage.off(\"dragstart\",function(){return!1})),this.$element.off(\".owl\"),this.$stage.children(\".cloned\").remove(),this.e=null,this.$element.removeData(\"owlCarousel\"),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$stage.unwrap()},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case\"<\":return d?a>c:c>a;case\">\":return d?c>a:a>c;case\">=\":return d?c>=a:a>=c;case\"<=\":return d?a>=c:c>=a}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent(\"on\"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent(\"on\"+b,c)},e.prototype.trigger=function(b,c,d){var e={item:{count:this._items.length,index:this.current()}},f=a.camelCase(a.grep([\"on\",b,d],function(a){return a}).join(\"-\").toLowerCase()),g=a.Event([b,\"owl\",d||\"carousel\"].join(\".\").toLowerCase(),a.extend({relatedTarget:this},e,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(g)}),this.$element.trigger(g),this.settings&&\"function\"==typeof this.settings[f]&&this.settings[f].apply(this,g)),g},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.browserSupport=function(){if(this.support3d=j(),this.support3d){this.transformVendor=i();var a=[\"transitionend\",\"webkitTransitionEnd\",\"transitionend\",\"oTransitionEnd\"];this.transitionEndVendor=a[h()],this.vendorName=this.transformVendor.replace(/Transform/i,\"\"),this.vendorName=\"\"!==this.vendorName?\"-\"+this.vendorName.toLowerCase()+\"-\":\"\"}this.state.orientation=b.orientation},a.fn.owlCarousel=function(b){return this.each(function(){a(this).data(\"owlCarousel\")||a(this).data(\"owlCarousel\",new e(this,b))})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b){var c=function(b){this._core=b,this._loaded=[],this._handlers={\"initialized.owl.carousel change.owl.carousel\":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&\"position\"==b.property.name||\"initialized\"==b.type))for(var c=this._core.settings,d=c.center&&Math.ceil(c.items/2)||c.items,e=c.center&&-1*d||0,f=(b.property&&b.property.value||this._core.current())+e,g=this._core.clones().length,h=a.proxy(function(a,b){this.load(b)},this);e++<d;)this.load(g/2+this._core.relative(f)),g&&a.each(this._core.clones(this._core.relative(f++)),h)},this)},this._core.options=a.extend({},c.Defaults,this._core.options),this._core.$element.on(this._handlers)};c.Defaults={lazyLoad:!1},c.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(\".owl-lazy\");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr(\"data-src-retina\")||f.attr(\"data-src\");this._core.trigger(\"load\",{element:f,url:g},\"lazy\"),f.is(\"img\")?f.one(\"load.owl.lazy\",a.proxy(function(){f.css(\"opacity\",1),this._core.trigger(\"loaded\",{element:f,url:g},\"lazy\")},this)).attr(\"src\",g):(e=new Image,e.onload=a.proxy(function(){f.css({\"background-image\":\"url(\"+g+\")\",opacity:\"1\"}),this._core.trigger(\"loaded\",{element:f,url:g},\"lazy\")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},c.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=c}(window.Zepto||window.jQuery,window,document),function(a){var b=function(c){this._core=c,this._handlers={\"initialized.owl.carousel\":a.proxy(function(){this._core.settings.autoHeight&&this.update()},this),\"changed.owl.carousel\":a.proxy(function(a){this._core.settings.autoHeight&&\"position\"==a.property.name&&this.update()},this),\"loaded.owl.lazy\":a.proxy(function(a){this._core.settings.autoHeight&&a.element.closest(\".\"+this._core.settings.itemClass)===this._core.$stage.children().eq(this._core.current())&&this.update()},this)},this._core.options=a.extend({},b.Defaults,this._core.options),this._core.$element.on(this._handlers)};b.Defaults={autoHeight:!1,autoHeightClass:\"owl-height\"},b.prototype.update=function(){this._core.$stage.parent().height(this._core.$stage.children().eq(this._core.current()).height()).addClass(this._core.settings.autoHeightClass)},b.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=b}(window.Zepto||window.jQuery,window,document),function(a,b,c){var d=function(b){this._core=b,this._videos={},this._playing=null,this._fullscreen=!1,this._handlers={\"resize.owl.carousel\":a.proxy(function(a){this._core.settings.video&&!this.isInFullScreen()&&a.preventDefault()},this),\"refresh.owl.carousel changed.owl.carousel\":a.proxy(function(){this._playing&&this.stop()},this),\"prepared.owl.carousel\":a.proxy(function(b){var c=a(b.content).find(\".owl-video\");c.length&&(c.css(\"display\",\"none\"),this.fetch(c,a(b.content)))},this)},this._core.options=a.extend({},d.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on(\"click.owl.video\",\".owl-video-play-icon\",a.proxy(function(a){this.play(a)},this))};d.Defaults={video:!1,videoHeight:!1,videoWidth:!1},d.prototype.fetch=function(a,b){var c=a.attr(\"data-vimeo-id\")?\"vimeo\":\"youtube\",d=a.attr(\"data-vimeo-id\")||a.attr(\"data-youtube-id\"),e=a.attr(\"data-width\")||this._core.settings.videoWidth,f=a.attr(\"data-height\")||this._core.settings.videoHeight,g=a.attr(\"href\");if(!g)throw new Error(\"Missing video URL.\");if(d=g.match(/(http:|https:|)\\/\\/(player.|www.)?(vimeo\\.com|youtu(be\\.com|\\.be|be\\.googleapis\\.com))\\/(video\\/|embed\\/|watch\\?v=|v\\/)?([A-Za-z0-9._%-]*)(\\&\\S+)?/),d[3].indexOf(\"youtu\")>-1)c=\"youtube\";else{if(!(d[3].indexOf(\"vimeo\")>-1))throw new Error(\"Video URL not supported.\");c=\"vimeo\"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr(\"data-video\",g),this.thumbnail(a,this._videos[g])},d.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?'style=\"width:'+c.width+\"px;height:\"+c.height+'px;\"':\"\",h=b.find(\"img\"),i=\"src\",j=\"\",k=this._core.settings,l=function(a){e='<div class=\"owl-video-play-icon\"></div>',d=k.lazyLoad?'<div class=\"owl-video-tn '+j+'\" '+i+'=\"'+a+'\"></div>':'<div class=\"owl-video-tn\" style=\"opacity:1;background-image:url('+a+')\"></div>',b.after(d),b.after(e)};return b.wrap('<div class=\"owl-video-wrapper\"'+g+\"></div>\"),this._core.settings.lazyLoad&&(i=\"data-src\",j=\"owl-lazy\"),h.length?(l(h.attr(i)),h.remove(),!1):void(\"youtube\"===c.type?(f=\"http://img.youtube.com/vi/\"+c.id+\"/hqdefault.jpg\",l(f)):\"vimeo\"===c.type&&a.ajax({type:\"GET\",url:\"http://vimeo.com/api/v2/video/\"+c.id+\".json\",jsonp:\"callback\",dataType:\"jsonp\",success:function(a){f=a[0].thumbnail_large,l(f)}}))},d.prototype.stop=function(){this._core.trigger(\"stop\",null,\"video\"),this._playing.find(\".owl-video-frame\").remove(),this._playing.removeClass(\"owl-video-playing\"),this._playing=null},d.prototype.play=function(b){this._core.trigger(\"play\",null,\"video\"),this._playing&&this.stop();var c,d,e=a(b.target||b.srcElement),f=e.closest(\".\"+this._core.settings.itemClass),g=this._videos[f.attr(\"data-video\")],h=g.width||\"100%\",i=g.height||this._core.$stage.height();\"youtube\"===g.type?c='<iframe width=\"'+h+'\" height=\"'+i+'\" src=\"http://www.youtube.com/embed/'+g.id+\"?autoplay=1&v=\"+g.id+'\" frameborder=\"0\" allowfullscreen></iframe>':\"vimeo\"===g.type&&(c='<iframe src=\"http://player.vimeo.com/video/'+g.id+'?autoplay=1\" width=\"'+h+'\" height=\"'+i+'\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'),f.addClass(\"owl-video-playing\"),this._playing=f,d=a('<div style=\"height:'+i+\"px; width:\"+h+'px\" class=\"owl-video-frame\">'+c+\"</div>\"),e.after(d)},d.prototype.isInFullScreen=function(){var d=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return d&&a(d).parent().hasClass(\"owl-video-frame\")&&(this._core.speed(0),this._fullscreen=!0),d&&this._fullscreen&&this._playing?!1:this._fullscreen?(this._fullscreen=!1,!1):this._playing&&this._core.state.orientation!==b.orientation?(this._core.state.orientation=b.orientation,!1):!0},d.prototype.destroy=function(){var a,b;this._core.$element.off(\"click.owl.video\");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=d}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={\"change.owl.carousel\":a.proxy(function(a){\"position\"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),\"drag.owl.carousel dragged.owl.carousel translated.owl.carousel\":a.proxy(function(a){this.swapping=\"translated\"==a.type},this),\"translate.owl.carousel\":a.proxy(function(){this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&this.core.support3d){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.css({left:b+\"px\"}).addClass(\"animated owl-animated-out\").addClass(g).one(\"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend\",c)),f&&e.addClass(\"animated owl-animated-in\").addClass(f).one(\"webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend\",c))}},e.prototype.clear=function(b){a(b.target).css({left:\"\"}).removeClass(\"animated owl-animated-out owl-animated-in\").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.transitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))\"function\"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c){var d=function(b){this.core=b,this.core.options=a.extend({},d.Defaults,this.core.options),this.handlers={\"translated.owl.carousel refreshed.owl.carousel\":a.proxy(function(){this.autoplay()\n},this),\"play.owl.autoplay\":a.proxy(function(a,b,c){this.play(b,c)},this),\"stop.owl.autoplay\":a.proxy(function(){this.stop()},this),\"mouseover.owl.autoplay\":a.proxy(function(){this.core.settings.autoplayHoverPause&&this.pause()},this),\"mouseleave.owl.autoplay\":a.proxy(function(){this.core.settings.autoplayHoverPause&&this.autoplay()},this)},this.core.$element.on(this.handlers)};d.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},d.prototype.autoplay=function(){this.core.settings.autoplay&&!this.core.state.videoPlay?(b.clearInterval(this.interval),this.interval=b.setInterval(a.proxy(function(){this.play()},this),this.core.settings.autoplayTimeout)):b.clearInterval(this.interval)},d.prototype.play=function(){return c.hidden===!0||this.core.state.isTouch||this.core.state.isScrolling||this.core.state.isSwiping||this.core.state.inMotion?void 0:this.core.settings.autoplay===!1?void b.clearInterval(this.interval):void this.core.next(this.core.settings.autoplaySpeed)},d.prototype.stop=function(){b.clearInterval(this.interval)},d.prototype.pause=function(){b.clearInterval(this.interval)},d.prototype.destroy=function(){var a,c;b.clearInterval(this.interval);for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(c in Object.getOwnPropertyNames(this))\"function\"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=d}(window.Zepto||window.jQuery,window,document),function(a){\"use strict\";var b=function(c){this._core=c,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={\"prepared.owl.carousel\":a.proxy(function(b){this._core.settings.dotsData&&this._templates.push(a(b.content).find(\"[data-dot]\").andSelf(\"[data-dot]\").attr(\"data-dot\"))},this),\"add.owl.carousel\":a.proxy(function(b){this._core.settings.dotsData&&this._templates.splice(b.position,0,a(b.content).find(\"[data-dot]\").andSelf(\"[data-dot]\").attr(\"data-dot\"))},this),\"remove.owl.carousel prepared.owl.carousel\":a.proxy(function(a){this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),\"change.owl.carousel\":a.proxy(function(a){if(\"position\"==a.property.name&&!this._core.state.revert&&!this._core.settings.loop&&this._core.settings.navRewind){var b=this._core.current(),c=this._core.maximum(),d=this._core.minimum();a.data=a.property.value>c?b>=c?d:c:a.property.value<d?c:a.property.value}},this),\"changed.owl.carousel\":a.proxy(function(a){\"position\"==a.property.name&&this.draw()},this),\"refreshed.owl.carousel\":a.proxy(function(){this._initialized||(this.initialize(),this._initialized=!0),this._core.trigger(\"refresh\",null,\"navigation\"),this.update(),this.draw(),this._core.trigger(\"refreshed\",null,\"navigation\")},this)},this._core.options=a.extend({},b.Defaults,this._core.options),this.$element.on(this._handlers)};b.Defaults={nav:!1,navRewind:!0,navText:[\"prev\",\"next\"],navSpeed:!1,navElement:\"div\",navContainer:!1,navContainerClass:\"owl-nav\",navClass:[\"owl-prev\",\"owl-next\"],slideBy:1,dotClass:\"owl-dot\",dotsClass:\"owl-dots\",dots:!0,dotsEach:!1,dotData:!1,dotsSpeed:!1,dotsContainer:!1,controlsClass:\"owl-controls\"},b.prototype.initialize=function(){var b,c,d=this._core.settings;d.dotsData||(this._templates=[a(\"<div>\").addClass(d.dotClass).append(a(\"<span>\")).prop(\"outerHTML\")]),d.navContainer&&d.dotsContainer||(this._controls.$container=a(\"<div>\").addClass(d.controlsClass).appendTo(this.$element)),this._controls.$indicators=d.dotsContainer?a(d.dotsContainer):a(\"<div>\").hide().addClass(d.dotsClass).appendTo(this._controls.$container),this._controls.$indicators.on(\"click\",\"div\",a.proxy(function(b){var c=a(b.target).parent().is(this._controls.$indicators)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(c,d.dotsSpeed)},this)),b=d.navContainer?a(d.navContainer):a(\"<div>\").addClass(d.navContainerClass).prependTo(this._controls.$container),this._controls.$next=a(\"<\"+d.navElement+\">\"),this._controls.$previous=this._controls.$next.clone(),this._controls.$previous.addClass(d.navClass[0]).html(d.navText[0]).hide().prependTo(b).on(\"click\",a.proxy(function(){this.prev(d.navSpeed)},this)),this._controls.$next.addClass(d.navClass[1]).html(d.navText[1]).hide().appendTo(b).on(\"click\",a.proxy(function(){this.next(d.navSpeed)},this));for(c in this._overrides)this._core[c]=a.proxy(this[c],this)},b.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))\"function\"!=typeof this[c]&&(this[c]=null)},b.prototype.update=function(){var a,b,c,d=this._core.settings,e=this._core.clones().length/2,f=e+this._core.items().length,g=d.center||d.autoWidth||d.dotData?1:d.dotsEach||d.items;if(\"page\"!==d.slideBy&&(d.slideBy=Math.min(d.slideBy,d.items)),d.dots||\"page\"==d.slideBy)for(this._pages=[],a=e,b=0,c=0;f>a;a++)(b>=g||0===b)&&(this._pages.push({start:a-e,end:a-e+g-1}),b=0,++c),b+=this._core.mergers(this._core.relative(a))},b.prototype.draw=function(){var b,c,d=\"\",e=this._core.settings,f=(this._core.$stage.children(),this._core.relative(this._core.current()));if(!e.nav||e.loop||e.navRewind||(this._controls.$previous.toggleClass(\"disabled\",0>=f),this._controls.$next.toggleClass(\"disabled\",f>=this._core.maximum())),this._controls.$previous.toggle(e.nav),this._controls.$next.toggle(e.nav),e.dots){if(b=this._pages.length-this._controls.$indicators.children().length,e.dotData&&0!==b){for(c=0;c<this._controls.$indicators.children().length;c++)d+=this._templates[this._core.relative(c)];this._controls.$indicators.html(d)}else b>0?(d=new Array(b+1).join(this._templates[0]),this._controls.$indicators.append(d)):0>b&&this._controls.$indicators.children().slice(b).remove();this._controls.$indicators.find(\".active\").removeClass(\"active\"),this._controls.$indicators.children().eq(a.inArray(this.current(),this._pages)).addClass(\"active\")}this._controls.$indicators.toggle(e.dots)},b.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotData?1:c.dotsEach||c.items)}},b.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,function(a){return a.start<=b&&a.end>=b}).pop()},b.prototype.getPosition=function(b){var c,d,e=this._core.settings;return\"page\"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},b.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},b.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},b.prototype.to=function(b,c,d){var e;d?a.proxy(this._overrides.to,this._core)(b,c):(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c))},a.fn.owlCarousel.Constructor.Plugins.Navigation=b}(window.Zepto||window.jQuery,window,document),function(a,b){\"use strict\";var c=function(d){this._core=d,this._hashes={},this.$element=this._core.$element,this._handlers={\"initialized.owl.carousel\":a.proxy(function(){\"URLHash\"==this._core.settings.startPosition&&a(b).trigger(\"hashchange.owl.navigation\")},this),\"prepared.owl.carousel\":a.proxy(function(b){var c=a(b.content).find(\"[data-hash]\").andSelf(\"[data-hash]\").attr(\"data-hash\");this._hashes[c]=b.content},this)},this._core.options=a.extend({},c.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on(\"hashchange.owl.navigation\",a.proxy(function(){var a=b.location.hash.substring(1),c=this._core.$stage.children(),d=this._hashes[a]&&c.index(this._hashes[a])||0;return a?void this._core.to(d,!1,!0):!1},this))};c.Defaults={URLhashListener:!1},c.prototype.destroy=function(){var c,d;a(b).off(\"hashchange.owl.navigation\");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))\"function\"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=c}(window.Zepto||window.jQuery,window,document);","Mageplaza_Core/js/ion.rangeSlider.min.js":"// Ion.RangeSlider | version 2.1.6 | https://github.com/IonDen/ion.rangeSlider\n;(function(f){\"function\"===typeof define&&define.amd?define([\"jquery\"],function(p){return f(p,document,window,navigator)}):\"object\"===typeof exports?f(require(\"jquery\"),document,window,navigator):f(jQuery,document,window,navigator)})(function(f,p,h,t,q){var u=0,m=function(){var a=t.userAgent,b=/msie\\s\\d+/i;return 0<a.search(b)&&(a=b.exec(a).toString(),a=a.split(\" \")[1],9>a)?(f(\"html\").addClass(\"lt-ie9\"),!0):!1}();Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=[].slice;if(\"function\"!=\n typeof b)throw new TypeError;var c=d.call(arguments,1),e=function(){if(this instanceof e){var g=function(){};g.prototype=b.prototype;var g=new g,l=b.apply(g,c.concat(d.call(arguments)));return Object(l)===l?l:g}return b.apply(a,c.concat(d.call(arguments)))};return e});Array.prototype.indexOf||(Array.prototype.indexOf=function(a,b){var d;if(null==this)throw new TypeError('\"this\" is null or not defined');var c=Object(this),e=c.length>>>0;if(0===e)return-1;d=+b||0;Infinity===Math.abs(d)&&(d=0);if(d>=\n e)return-1;for(d=Math.max(0<=d?d:e-Math.abs(d),0);d<e;){if(d in c&&c[d]===a)return d;d++}return-1});var r=function(a,b,d){this.VERSION=\"2.1.6\";this.input=a;this.plugin_count=d;this.old_to=this.old_from=this.update_tm=this.calc_count=this.current_plugin=0;this.raf_id=this.old_min_interval=null;this.is_update=this.is_key=this.no_diapason=this.force_redraw=this.dragging=!1;this.is_start=this.is_first_update=!0;this.is_click=this.is_resize=this.is_active=this.is_finish=!1;b=b||{};this.$cache={win:f(h),\n body:f(p.body),input:f(a),cont:null,rs:null,min:null,max:null,from:null,to:null,single:null,bar:null,line:null,s_single:null,s_from:null,s_to:null,shad_single:null,shad_from:null,shad_to:null,edge:null,grid:null,grid_labels:[]};this.coords={x_gap:0,x_pointer:0,w_rs:0,w_rs_old:0,w_handle:0,p_gap:0,p_gap_left:0,p_gap_right:0,p_step:0,p_pointer:0,p_handle:0,p_single_fake:0,p_single_real:0,p_from_fake:0,p_from_real:0,p_to_fake:0,p_to_real:0,p_bar_x:0,p_bar_w:0,grid_gap:0,big_num:0,big:[],big_w:[],big_p:[],\n big_x:[]};this.labels={w_min:0,w_max:0,w_from:0,w_to:0,w_single:0,p_min:0,p_max:0,p_from_fake:0,p_from_left:0,p_to_fake:0,p_to_left:0,p_single_fake:0,p_single_left:0};var c=this.$cache.input;a=c.prop(\"value\");var e;d={type:\"single\",min:10,max:100,from:null,to:null,step:1,min_interval:0,max_interval:0,drag_interval:!1,values:[],p_values:[],from_fixed:!1,from_min:null,from_max:null,from_shadow:!1,to_fixed:!1,to_min:null,to_max:null,to_shadow:!1,prettify_enabled:!0,prettify_separator:\" \",prettify:null,\n force_edges:!1,keyboard:!1,keyboard_step:5,grid:!1,grid_margin:!0,grid_num:4,grid_snap:!1,hide_min_max:!1,hide_from_to:!1,prefix:\"\",postfix:\"\",max_postfix:\"\",decorate_both:!0,values_separator:\" \\u2014 \",input_values_separator:\";\",disable:!1,onStart:null,onChange:null,onFinish:null,onUpdate:null};\"INPUT\"!==c[0].nodeName&&console&&console.warn&&console.warn(\"Base element should be <input>!\",c[0]);c={type:c.data(\"type\"),min:c.data(\"min\"),max:c.data(\"max\"),from:c.data(\"from\"),to:c.data(\"to\"),step:c.data(\"step\"),\n min_interval:c.data(\"minInterval\"),max_interval:c.data(\"maxInterval\"),drag_interval:c.data(\"dragInterval\"),values:c.data(\"values\"),from_fixed:c.data(\"fromFixed\"),from_min:c.data(\"fromMin\"),from_max:c.data(\"fromMax\"),from_shadow:c.data(\"fromShadow\"),to_fixed:c.data(\"toFixed\"),to_min:c.data(\"toMin\"),to_max:c.data(\"toMax\"),to_shadow:c.data(\"toShadow\"),prettify_enabled:c.data(\"prettifyEnabled\"),prettify_separator:c.data(\"prettifySeparator\"),force_edges:c.data(\"forceEdges\"),keyboard:c.data(\"keyboard\"),\n keyboard_step:c.data(\"keyboardStep\"),grid:c.data(\"grid\"),grid_margin:c.data(\"gridMargin\"),grid_num:c.data(\"gridNum\"),grid_snap:c.data(\"gridSnap\"),hide_min_max:c.data(\"hideMinMax\"),hide_from_to:c.data(\"hideFromTo\"),prefix:c.data(\"prefix\"),postfix:c.data(\"postfix\"),max_postfix:c.data(\"maxPostfix\"),decorate_both:c.data(\"decorateBoth\"),values_separator:c.data(\"valuesSeparator\"),input_values_separator:c.data(\"inputValuesSeparator\"),disable:c.data(\"disable\")};c.values=c.values&&c.values.split(\",\");for(e in c)c.hasOwnProperty(e)&&\n(c[e]!==q&&\"\"!==c[e]||delete c[e]);a!==q&&\"\"!==a&&(a=a.split(c.input_values_separator||b.input_values_separator||\";\"),a[0]&&a[0]==+a[0]&&(a[0]=+a[0]),a[1]&&a[1]==+a[1]&&(a[1]=+a[1]),b&&b.values&&b.values.length?(d.from=a[0]&&b.values.indexOf(a[0]),d.to=a[1]&&b.values.indexOf(a[1])):(d.from=a[0]&&+a[0],d.to=a[1]&&+a[1]));f.extend(d,b);f.extend(d,c);this.options=d;this.update_check={};this.validate();this.result={input:this.$cache.input,slider:null,min:this.options.min,max:this.options.max,from:this.options.from,\n from_percent:0,from_value:null,to:this.options.to,to_percent:0,to_value:null};this.init()};r.prototype={init:function(a){this.no_diapason=!1;this.coords.p_step=this.convertToPercent(this.options.step,!0);this.target=\"base\";this.toggleInput();this.append();this.setMinMax();a?(this.force_redraw=!0,this.calc(!0),this.callOnUpdate()):(this.force_redraw=!0,this.calc(!0),this.callOnStart());this.updateScene()},append:function(){this.$cache.input.before('<span class=\"irs js-irs-'+this.plugin_count+'\"></span>');\n this.$cache.input.prop(\"readonly\",!0);this.$cache.cont=this.$cache.input.prev();this.result.slider=this.$cache.cont;this.$cache.cont.html('<span class=\"irs\"><span class=\"irs-line\" tabindex=\"-1\"><span class=\"irs-line-left\"></span><span class=\"irs-line-mid\"></span><span class=\"irs-line-right\"></span></span><span class=\"irs-min\">0</span><span class=\"irs-max\">1</span><span class=\"irs-from\">0</span><span class=\"irs-to\">0</span><span class=\"irs-single\">0</span></span><span class=\"irs-grid\"></span><span class=\"irs-bar\"></span>');\n this.$cache.rs=this.$cache.cont.find(\".irs\");this.$cache.min=this.$cache.cont.find(\".irs-min\");this.$cache.max=this.$cache.cont.find(\".irs-max\");this.$cache.from=this.$cache.cont.find(\".irs-from\");this.$cache.to=this.$cache.cont.find(\".irs-to\");this.$cache.single=this.$cache.cont.find(\".irs-single\");this.$cache.bar=this.$cache.cont.find(\".irs-bar\");this.$cache.line=this.$cache.cont.find(\".irs-line\");this.$cache.grid=this.$cache.cont.find(\".irs-grid\");\"single\"===this.options.type?(this.$cache.cont.append('<span class=\"irs-bar-edge\"></span><span class=\"irs-shadow shadow-single\"></span><span class=\"irs-slider single\"></span>'),\n this.$cache.edge=this.$cache.cont.find(\".irs-bar-edge\"),this.$cache.s_single=this.$cache.cont.find(\".single\"),this.$cache.from[0].style.visibility=\"hidden\",this.$cache.to[0].style.visibility=\"hidden\",this.$cache.shad_single=this.$cache.cont.find(\".shadow-single\")):(this.$cache.cont.append('<span class=\"irs-shadow shadow-from\"></span><span class=\"irs-shadow shadow-to\"></span><span class=\"irs-slider from\"></span><span class=\"irs-slider to\"></span>'),this.$cache.s_from=this.$cache.cont.find(\".from\"),\n this.$cache.s_to=this.$cache.cont.find(\".to\"),this.$cache.shad_from=this.$cache.cont.find(\".shadow-from\"),this.$cache.shad_to=this.$cache.cont.find(\".shadow-to\"),this.setTopHandler());this.options.hide_from_to&&(this.$cache.from[0].style.display=\"none\",this.$cache.to[0].style.display=\"none\",this.$cache.single[0].style.display=\"none\");this.appendGrid();this.options.disable?(this.appendDisableMask(),this.$cache.input[0].disabled=!0):(this.$cache.cont.removeClass(\"irs-disabled\"),this.$cache.input[0].disabled=\n !1,this.bindEvents());this.options.drag_interval&&(this.$cache.bar[0].style.cursor=\"ew-resize\")},setTopHandler:function(){var a=this.options.max,b=this.options.to;this.options.from>this.options.min&&b===a?this.$cache.s_from.addClass(\"type_last\"):b<a&&this.$cache.s_to.addClass(\"type_last\")},changeLevel:function(a){switch(a){case \"single\":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_single_fake);break;case \"from\":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake);\n this.$cache.s_from.addClass(\"state_hover\");this.$cache.s_from.addClass(\"type_last\");this.$cache.s_to.removeClass(\"type_last\");break;case \"to\":this.coords.p_gap=this.toFixed(this.coords.p_pointer-this.coords.p_to_fake);this.$cache.s_to.addClass(\"state_hover\");this.$cache.s_to.addClass(\"type_last\");this.$cache.s_from.removeClass(\"type_last\");break;case \"both\":this.coords.p_gap_left=this.toFixed(this.coords.p_pointer-this.coords.p_from_fake),this.coords.p_gap_right=this.toFixed(this.coords.p_to_fake-\n this.coords.p_pointer),this.$cache.s_to.removeClass(\"type_last\"),this.$cache.s_from.removeClass(\"type_last\")}},appendDisableMask:function(){this.$cache.cont.append('<span class=\"irs-disable-mask\"></span>');this.$cache.cont.addClass(\"irs-disabled\")},remove:function(){this.$cache.cont.remove();this.$cache.cont=null;this.$cache.line.off(\"keydown.irs_\"+this.plugin_count);this.$cache.body.off(\"touchmove.irs_\"+this.plugin_count);this.$cache.body.off(\"mousemove.irs_\"+this.plugin_count);this.$cache.win.off(\"touchend.irs_\"+\n this.plugin_count);this.$cache.win.off(\"mouseup.irs_\"+this.plugin_count);m&&(this.$cache.body.off(\"mouseup.irs_\"+this.plugin_count),this.$cache.body.off(\"mouseleave.irs_\"+this.plugin_count));this.$cache.grid_labels=[];this.coords.big=[];this.coords.big_w=[];this.coords.big_p=[];this.coords.big_x=[];cancelAnimationFrame(this.raf_id)},bindEvents:function(){if(!this.no_diapason){this.$cache.body.on(\"touchmove.irs_\"+this.plugin_count,this.pointerMove.bind(this));this.$cache.body.on(\"mousemove.irs_\"+this.plugin_count,\n this.pointerMove.bind(this));this.$cache.win.on(\"touchend.irs_\"+this.plugin_count,this.pointerUp.bind(this));this.$cache.win.on(\"mouseup.irs_\"+this.plugin_count,this.pointerUp.bind(this));this.$cache.line.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\"));this.$cache.line.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\"));this.options.drag_interval&&\"double\"===this.options.type?(this.$cache.bar.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\n \"both\")),this.$cache.bar.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"both\"))):(this.$cache.bar.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.bar.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")));\"single\"===this.options.type?(this.$cache.single.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),this.$cache.s_single.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),\n this.$cache.shad_single.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),this.$cache.s_single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"single\")),this.$cache.edge.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.shad_single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\"))):(this.$cache.single.on(\"touchstart.irs_\"+\n this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.single.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,null)),this.$cache.from.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.s_from.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.to.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"to\")),this.$cache.s_to.on(\"touchstart.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"to\")),\n this.$cache.shad_from.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.shad_to.on(\"touchstart.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.from.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.s_from.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"from\")),this.$cache.to.on(\"mousedown.irs_\"+this.plugin_count,this.pointerDown.bind(this,\"to\")),this.$cache.s_to.on(\"mousedown.irs_\"+\n this.plugin_count,this.pointerDown.bind(this,\"to\")),this.$cache.shad_from.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")),this.$cache.shad_to.on(\"mousedown.irs_\"+this.plugin_count,this.pointerClick.bind(this,\"click\")));if(this.options.keyboard)this.$cache.line.on(\"keydown.irs_\"+this.plugin_count,this.key.bind(this,\"keyboard\"));m&&(this.$cache.body.on(\"mouseup.irs_\"+this.plugin_count,this.pointerUp.bind(this)),this.$cache.body.on(\"mouseleave.irs_\"+this.plugin_count,this.pointerUp.bind(this)))}},\n pointerMove:function(a){this.dragging&&(this.coords.x_pointer=(a.pageX||a.originalEvent.touches&&a.originalEvent.touches[0].pageX)-this.coords.x_gap,this.calc())},pointerUp:function(a){this.current_plugin===this.plugin_count&&this.is_active&&(this.is_active=!1,this.$cache.cont.find(\".state_hover\").removeClass(\"state_hover\"),this.force_redraw=!0,m&&f(\"*\").prop(\"unselectable\",!1),this.updateScene(),this.restoreOriginalMinInterval(),(f.contains(this.$cache.cont[0],a.target)||this.dragging)&&this.callOnFinish(),\n this.dragging=!1)},pointerDown:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(\"both\"===a&&this.setTempMinInterval(),a||(a=this.target||\"from\"),this.current_plugin=this.plugin_count,this.target=a,this.dragging=this.is_active=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=d-this.coords.x_gap,this.calcPointerPercent(),this.changeLevel(a),m&&f(\"*\").prop(\"unselectable\",!0),this.$cache.line.trigger(\"focus\"),\n this.updateScene())},pointerClick:function(a,b){b.preventDefault();var d=b.pageX||b.originalEvent.touches&&b.originalEvent.touches[0].pageX;2!==b.button&&(this.current_plugin=this.plugin_count,this.target=a,this.is_click=!0,this.coords.x_gap=this.$cache.rs.offset().left,this.coords.x_pointer=+(d-this.coords.x_gap).toFixed(),this.force_redraw=!0,this.calc(),this.$cache.line.trigger(\"focus\"))},key:function(a,b){if(!(this.current_plugin!==this.plugin_count||b.altKey||b.ctrlKey||b.shiftKey||b.metaKey)){switch(b.which){case 83:case 65:case 40:case 37:b.preventDefault();\n this.moveByKey(!1);break;case 87:case 68:case 38:case 39:b.preventDefault(),this.moveByKey(!0)}return!0}},moveByKey:function(a){var b=this.coords.p_pointer,b=a?b+this.options.keyboard_step:b-this.options.keyboard_step;this.coords.x_pointer=this.toFixed(this.coords.w_rs/100*b);this.is_key=!0;this.calc()},setMinMax:function(){this.options&&(this.options.hide_min_max?(this.$cache.min[0].style.display=\"none\",this.$cache.max[0].style.display=\"none\"):(this.options.values.length?(this.$cache.min.html(this.decorate(this.options.p_values[this.options.min])),\n this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]))):(this.$cache.min.html(this.decorate(this._prettify(this.options.min),this.options.min)),this.$cache.max.html(this.decorate(this._prettify(this.options.max),this.options.max))),this.labels.w_min=this.$cache.min.outerWidth(!1),this.labels.w_max=this.$cache.max.outerWidth(!1)))},setTempMinInterval:function(){var a=this.result.to-this.result.from;null===this.old_min_interval&&(this.old_min_interval=this.options.min_interval);\n this.options.min_interval=a},restoreOriginalMinInterval:function(){null!==this.old_min_interval&&(this.options.min_interval=this.old_min_interval,this.old_min_interval=null)},calc:function(a){if(this.options){this.calc_count++;if(10===this.calc_count||a)this.calc_count=0,this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.calcHandlePercent();if(this.coords.w_rs){this.calcPointerPercent();a=this.getHandleX();\"both\"===this.target&&(this.coords.p_gap=0,a=this.getHandleX());\"click\"===this.target&&(this.coords.p_gap=\n this.coords.p_handle/2,a=this.getHandleX(),this.target=this.options.drag_interval?\"both_one\":this.chooseHandle(a));switch(this.target){case \"base\":var b=(this.options.max-this.options.min)/100;a=(this.result.from-this.options.min)/b;b=(this.result.to-this.options.min)/b;this.coords.p_single_real=this.toFixed(a);this.coords.p_from_real=this.toFixed(a);this.coords.p_to_real=this.toFixed(b);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);\n this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);this.target=null;break;case \"single\":if(this.options.from_fixed)break;\n this.coords.p_single_real=this.convertToRealPercent(a);this.coords.p_single_real=this.calcWithStep(this.coords.p_single_real);this.coords.p_single_real=this.checkDiapason(this.coords.p_single_real,this.options.from_min,this.options.from_max);this.coords.p_single_fake=this.convertToFakePercent(this.coords.p_single_real);break;case \"from\":if(this.options.from_fixed)break;this.coords.p_from_real=this.convertToRealPercent(a);this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real>\n this.coords.p_to_real&&(this.coords.p_from_real=this.coords.p_to_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,this.coords.p_to_real,\"from\");this.coords.p_from_real=this.checkMaxInterval(this.coords.p_from_real,this.coords.p_to_real,\"from\");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);break;case \"to\":if(this.options.to_fixed)break;\n this.coords.p_to_real=this.convertToRealPercent(a);this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real<this.coords.p_from_real&&(this.coords.p_to_real=this.coords.p_from_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,\"to\");this.coords.p_to_real=this.checkMaxInterval(this.coords.p_to_real,this.coords.p_from_real,\"to\");\n this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);break;case \"both\":if(this.options.from_fixed||this.options.to_fixed)break;a=this.toFixed(a+.001*this.coords.p_handle);this.coords.p_from_real=this.convertToRealPercent(a)-this.coords.p_gap_left;this.coords.p_from_real=this.calcWithStep(this.coords.p_from_real);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_real=this.checkMinInterval(this.coords.p_from_real,\n this.coords.p_to_real,\"from\");this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.convertToRealPercent(a)+this.coords.p_gap_right;this.coords.p_to_real=this.calcWithStep(this.coords.p_to_real);this.coords.p_to_real=this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_real=this.checkMinInterval(this.coords.p_to_real,this.coords.p_from_real,\"to\");this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real);\n break;case \"both_one\":if(!this.options.from_fixed&&!this.options.to_fixed){var d=this.convertToRealPercent(a);a=this.result.to_percent-this.result.from_percent;var c=a/2,b=d-c,d=d+c;0>b&&(b=0,d=b+a);100<d&&(d=100,b=d-a);this.coords.p_from_real=this.calcWithStep(b);this.coords.p_from_real=this.checkDiapason(this.coords.p_from_real,this.options.from_min,this.options.from_max);this.coords.p_from_fake=this.convertToFakePercent(this.coords.p_from_real);this.coords.p_to_real=this.calcWithStep(d);this.coords.p_to_real=\n this.checkDiapason(this.coords.p_to_real,this.options.to_min,this.options.to_max);this.coords.p_to_fake=this.convertToFakePercent(this.coords.p_to_real)}}\"single\"===this.options.type?(this.coords.p_bar_x=this.coords.p_handle/2,this.coords.p_bar_w=this.coords.p_single_fake,this.result.from_percent=this.coords.p_single_real,this.result.from=this.convertToValue(this.coords.p_single_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from])):(this.coords.p_bar_x=\n this.toFixed(this.coords.p_from_fake+this.coords.p_handle/2),this.coords.p_bar_w=this.toFixed(this.coords.p_to_fake-this.coords.p_from_fake),this.result.from_percent=this.coords.p_from_real,this.result.from=this.convertToValue(this.coords.p_from_real),this.result.to_percent=this.coords.p_to_real,this.result.to=this.convertToValue(this.coords.p_to_real),this.options.values.length&&(this.result.from_value=this.options.values[this.result.from],this.result.to_value=this.options.values[this.result.to]));\n this.calcMinMax();this.calcLabels()}}},calcPointerPercent:function(){this.coords.w_rs?(0>this.coords.x_pointer||isNaN(this.coords.x_pointer)?this.coords.x_pointer=0:this.coords.x_pointer>this.coords.w_rs&&(this.coords.x_pointer=this.coords.w_rs),this.coords.p_pointer=this.toFixed(this.coords.x_pointer/this.coords.w_rs*100)):this.coords.p_pointer=0},convertToRealPercent:function(a){return a/(100-this.coords.p_handle)*100},convertToFakePercent:function(a){return a/100*(100-this.coords.p_handle)},getHandleX:function(){var a=\n 100-this.coords.p_handle,b=this.toFixed(this.coords.p_pointer-this.coords.p_gap);0>b?b=0:b>a&&(b=a);return b},calcHandlePercent:function(){this.coords.w_handle=\"single\"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1);this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100)},chooseHandle:function(a){return\"single\"===this.options.type?\"single\":a>=this.coords.p_from_real+(this.coords.p_to_real-this.coords.p_from_real)/2?this.options.to_fixed?\n \"from\":\"to\":this.options.from_fixed?\"to\":\"from\"},calcMinMax:function(){this.coords.w_rs&&(this.labels.p_min=this.labels.w_min/this.coords.w_rs*100,this.labels.p_max=this.labels.w_max/this.coords.w_rs*100)},calcLabels:function(){this.coords.w_rs&&!this.options.hide_from_to&&(\"single\"===this.options.type?(this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=this.coords.p_single_fake+this.coords.p_handle/\n 2-this.labels.p_single_fake/2):(this.labels.w_from=this.$cache.from.outerWidth(!1),this.labels.p_from_fake=this.labels.w_from/this.coords.w_rs*100,this.labels.p_from_left=this.coords.p_from_fake+this.coords.p_handle/2-this.labels.p_from_fake/2,this.labels.p_from_left=this.toFixed(this.labels.p_from_left),this.labels.p_from_left=this.checkEdges(this.labels.p_from_left,this.labels.p_from_fake),this.labels.w_to=this.$cache.to.outerWidth(!1),this.labels.p_to_fake=this.labels.w_to/this.coords.w_rs*100,\n this.labels.p_to_left=this.coords.p_to_fake+this.coords.p_handle/2-this.labels.p_to_fake/2,this.labels.p_to_left=this.toFixed(this.labels.p_to_left),this.labels.p_to_left=this.checkEdges(this.labels.p_to_left,this.labels.p_to_fake),this.labels.w_single=this.$cache.single.outerWidth(!1),this.labels.p_single_fake=this.labels.w_single/this.coords.w_rs*100,this.labels.p_single_left=(this.labels.p_from_left+this.labels.p_to_left+this.labels.p_to_fake)/2-this.labels.p_single_fake/2,this.labels.p_single_left=\n this.toFixed(this.labels.p_single_left)),this.labels.p_single_left=this.checkEdges(this.labels.p_single_left,this.labels.p_single_fake))},updateScene:function(){this.raf_id&&(cancelAnimationFrame(this.raf_id),this.raf_id=null);clearTimeout(this.update_tm);this.update_tm=null;this.options&&(this.drawHandles(),this.is_active?this.raf_id=requestAnimationFrame(this.updateScene.bind(this)):this.update_tm=setTimeout(this.updateScene.bind(this),300))},drawHandles:function(){this.coords.w_rs=this.$cache.rs.outerWidth(!1);\n if(this.coords.w_rs){this.coords.w_rs!==this.coords.w_rs_old&&(this.target=\"base\",this.is_resize=!0);if(this.coords.w_rs!==this.coords.w_rs_old||this.force_redraw)this.setMinMax(),this.calc(!0),this.drawLabels(),this.options.grid&&(this.calcGridMargin(),this.calcGridLabels()),this.force_redraw=!0,this.coords.w_rs_old=this.coords.w_rs,this.drawShadow();if(this.coords.w_rs&&(this.dragging||this.force_redraw||this.is_key)){if(this.old_from!==this.result.from||this.old_to!==this.result.to||this.force_redraw||\n this.is_key){this.drawLabels();this.$cache.bar[0].style.left=this.coords.p_bar_x+\"%\";this.$cache.bar[0].style.width=this.coords.p_bar_w+\"%\";if(\"single\"===this.options.type)this.$cache.s_single[0].style.left=this.coords.p_single_fake+\"%\";else{this.$cache.s_from[0].style.left=this.coords.p_from_fake+\"%\";this.$cache.s_to[0].style.left=this.coords.p_to_fake+\"%\";if(this.old_from!==this.result.from||this.force_redraw)this.$cache.from[0].style.left=this.labels.p_from_left+\"%\";if(this.old_to!==this.result.to||\n this.force_redraw)this.$cache.to[0].style.left=this.labels.p_to_left+\"%\"}this.$cache.single[0].style.left=this.labels.p_single_left+\"%\";this.writeToInput();this.old_from===this.result.from&&this.old_to===this.result.to||this.is_start||(this.$cache.input.trigger(\"change\"),this.$cache.input.trigger(\"input\"));this.old_from=this.result.from;this.old_to=this.result.to;this.is_resize||this.is_update||this.is_start||this.is_finish||this.callOnChange();if(this.is_key||this.is_click||this.is_first_update)this.is_first_update=\n this.is_click=this.is_key=!1,this.callOnFinish();this.is_finish=this.is_resize=this.is_update=!1}this.force_redraw=this.is_click=this.is_key=this.is_start=!1}}},drawLabels:function(){if(this.options){var a=this.options.values.length,b=this.options.p_values,d;if(!this.options.hide_from_to)if(\"single\"===this.options.type)a=a?this.decorate(b[this.result.from]):this.decorate(this._prettify(this.result.from),this.result.from),this.$cache.single.html(a),this.calcLabels(),this.$cache.min[0].style.visibility=\n this.labels.p_single_left<this.labels.p_min+1?\"hidden\":\"visible\",this.$cache.max[0].style.visibility=this.labels.p_single_left+this.labels.p_single_fake>100-this.labels.p_max-1?\"hidden\":\"visible\";else{a?(this.options.decorate_both?(a=this.decorate(b[this.result.from]),a+=this.options.values_separator,a+=this.decorate(b[this.result.to])):a=this.decorate(b[this.result.from]+this.options.values_separator+b[this.result.to]),d=this.decorate(b[this.result.from]),b=this.decorate(b[this.result.to])):(this.options.decorate_both?\n (a=this.decorate(this._prettify(this.result.from),this.result.from),a+=this.options.values_separator,a+=this.decorate(this._prettify(this.result.to),this.result.to)):a=this.decorate(this._prettify(this.result.from)+this.options.values_separator+this._prettify(this.result.to),this.result.to),d=this.decorate(this._prettify(this.result.from),this.result.from),b=this.decorate(this._prettify(this.result.to),this.result.to));this.$cache.single.html(a);this.$cache.from.html(d);this.$cache.to.html(b);this.calcLabels();\n b=Math.min(this.labels.p_single_left,this.labels.p_from_left);a=this.labels.p_single_left+this.labels.p_single_fake;d=this.labels.p_to_left+this.labels.p_to_fake;var c=Math.max(a,d);this.labels.p_from_left+this.labels.p_from_fake>=this.labels.p_to_left?(this.$cache.from[0].style.visibility=\"hidden\",this.$cache.to[0].style.visibility=\"hidden\",this.$cache.single[0].style.visibility=\"visible\",this.result.from===this.result.to?(\"from\"===this.target?this.$cache.from[0].style.visibility=\"visible\":\"to\"===\n this.target?this.$cache.to[0].style.visibility=\"visible\":this.target||(this.$cache.from[0].style.visibility=\"visible\"),this.$cache.single[0].style.visibility=\"hidden\",c=d):(this.$cache.from[0].style.visibility=\"hidden\",this.$cache.to[0].style.visibility=\"hidden\",this.$cache.single[0].style.visibility=\"visible\",c=Math.max(a,d))):(this.$cache.from[0].style.visibility=\"visible\",this.$cache.to[0].style.visibility=\"visible\",this.$cache.single[0].style.visibility=\"hidden\");this.$cache.min[0].style.visibility=\n b<this.labels.p_min+1?\"hidden\":\"visible\";this.$cache.max[0].style.visibility=c>100-this.labels.p_max-1?\"hidden\":\"visible\"}}},drawShadow:function(){var a=this.options,b=this.$cache,d=\"number\"===typeof a.from_min&&!isNaN(a.from_min),c=\"number\"===typeof a.from_max&&!isNaN(a.from_max),e=\"number\"===typeof a.to_min&&!isNaN(a.to_min),g=\"number\"===typeof a.to_max&&!isNaN(a.to_max);\"single\"===a.type?a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-\n d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_single[0].style.display=\"block\",b.shad_single[0].style.left=d+\"%\",b.shad_single[0].style.width=c+\"%\"):b.shad_single[0].style.display=\"none\":(a.from_shadow&&(d||c)?(d=this.convertToPercent(d?a.from_min:a.min),c=this.convertToPercent(c?a.from_max:a.max)-d,d=this.toFixed(d-this.coords.p_handle/100*d),c=this.toFixed(c-this.coords.p_handle/100*c),d+=this.coords.p_handle/2,b.shad_from[0].style.display=\n \"block\",b.shad_from[0].style.left=d+\"%\",b.shad_from[0].style.width=c+\"%\"):b.shad_from[0].style.display=\"none\",a.to_shadow&&(e||g)?(e=this.convertToPercent(e?a.to_min:a.min),a=this.convertToPercent(g?a.to_max:a.max)-e,e=this.toFixed(e-this.coords.p_handle/100*e),a=this.toFixed(a-this.coords.p_handle/100*a),e+=this.coords.p_handle/2,b.shad_to[0].style.display=\"block\",b.shad_to[0].style.left=e+\"%\",b.shad_to[0].style.width=a+\"%\"):b.shad_to[0].style.display=\"none\")},writeToInput:function(){\"single\"===\n this.options.type?(this.options.values.length?this.$cache.input.prop(\"value\",this.result.from_value):this.$cache.input.prop(\"value\",this.result.from),this.$cache.input.data(\"from\",this.result.from)):(this.options.values.length?this.$cache.input.prop(\"value\",this.result.from_value+this.options.input_values_separator+this.result.to_value):this.$cache.input.prop(\"value\",this.result.from+this.options.input_values_separator+this.result.to),this.$cache.input.data(\"from\",this.result.from),this.$cache.input.data(\"to\",\n this.result.to))},callOnStart:function(){this.writeToInput();if(this.options.onStart&&\"function\"===typeof this.options.onStart)this.options.onStart(this.result)},callOnChange:function(){this.writeToInput();if(this.options.onChange&&\"function\"===typeof this.options.onChange)this.options.onChange(this.result)},callOnFinish:function(){this.writeToInput();if(this.options.onFinish&&\"function\"===typeof this.options.onFinish)this.options.onFinish(this.result)},callOnUpdate:function(){this.writeToInput();\n if(this.options.onUpdate&&\"function\"===typeof this.options.onUpdate)this.options.onUpdate(this.result)},toggleInput:function(){this.$cache.input.toggleClass(\"irs-hidden-input\")},convertToPercent:function(a,b){var d=this.options.max-this.options.min;return d?this.toFixed((b?a:a-this.options.min)/(d/100)):(this.no_diapason=!0,0)},convertToValue:function(a){var b=this.options.min,d=this.options.max,c=b.toString().split(\".\")[1],e=d.toString().split(\".\")[1],g,l,f=0,k=0;if(0===a)return this.options.min;\n if(100===a)return this.options.max;c&&(f=g=c.length);e&&(f=l=e.length);g&&l&&(f=g>=l?g:l);0>b&&(k=Math.abs(b),b=+(b+k).toFixed(f),d=+(d+k).toFixed(f));a=(d-b)/100*a+b;(b=this.options.step.toString().split(\".\")[1])?a=+a.toFixed(b.length):(a/=this.options.step,a*=this.options.step,a=+a.toFixed(0));k&&(a-=k);k=b?+a.toFixed(b.length):this.toFixed(a);k<this.options.min?k=this.options.min:k>this.options.max&&(k=this.options.max);return k},calcWithStep:function(a){var b=Math.round(a/this.coords.p_step)*\n this.coords.p_step;100<b&&(b=100);100===a&&(b=100);return this.toFixed(b)},checkMinInterval:function(a,b,d){var c=this.options;if(!c.min_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);\"from\"===d?b-a<c.min_interval&&(a=b-c.min_interval):a-b<c.min_interval&&(a=b+c.min_interval);return this.convertToPercent(a)},checkMaxInterval:function(a,b,d){var c=this.options;if(!c.max_interval)return a;a=this.convertToValue(a);b=this.convertToValue(b);\"from\"===d?b-a>c.max_interval&&(a=b-c.max_interval):\n a-b>c.max_interval&&(a=b+c.max_interval);return this.convertToPercent(a)},checkDiapason:function(a,b,d){a=this.convertToValue(a);var c=this.options;\"number\"!==typeof b&&(b=c.min);\"number\"!==typeof d&&(d=c.max);a<b&&(a=b);a>d&&(a=d);return this.convertToPercent(a)},toFixed:function(a){a=a.toFixed(20);return+a},_prettify:function(a){return this.options.prettify_enabled?this.options.prettify&&\"function\"===typeof this.options.prettify?this.options.prettify(a):this.prettify(a):a},prettify:function(a){return a.toString().replace(/(\\d{1,3}(?=(?:\\d\\d\\d)+(?!\\d)))/g,\n \"$1\"+this.options.prettify_separator)},checkEdges:function(a,b){if(!this.options.force_edges)return this.toFixed(a);0>a?a=0:a>100-b&&(a=100-b);return this.toFixed(a)},validate:function(){var a=this.options,b=this.result,d=a.values,c=d.length,e,g;\"string\"===typeof a.min&&(a.min=+a.min);\"string\"===typeof a.max&&(a.max=+a.max);\"string\"===typeof a.from&&(a.from=+a.from);\"string\"===typeof a.to&&(a.to=+a.to);\"string\"===typeof a.step&&(a.step=+a.step);\"string\"===typeof a.from_min&&(a.from_min=+a.from_min);\n \"string\"===typeof a.from_max&&(a.from_max=+a.from_max);\"string\"===typeof a.to_min&&(a.to_min=+a.to_min);\"string\"===typeof a.to_max&&(a.to_max=+a.to_max);\"string\"===typeof a.keyboard_step&&(a.keyboard_step=+a.keyboard_step);\"string\"===typeof a.grid_num&&(a.grid_num=+a.grid_num);a.max<a.min&&(a.max=a.min);if(c)for(a.p_values=[],a.min=0,a.max=c-1,a.step=1,a.grid_num=a.max,a.grid_snap=!0,g=0;g<c;g++)e=+d[g],isNaN(e)?e=d[g]:(d[g]=e,e=this._prettify(e)),a.p_values.push(e);if(\"number\"!==typeof a.from||isNaN(a.from))a.from=\n a.min;if(\"number\"!==typeof a.to||isNaN(a.to))a.to=a.max;\"single\"===a.type?(a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max)):(a.from<a.min&&(a.from=a.min),a.from>a.max&&(a.from=a.max),a.to<a.min&&(a.to=a.min),a.to>a.max&&(a.to=a.max),this.update_check.from&&(this.update_check.from!==a.from&&a.from>a.to&&(a.from=a.to),this.update_check.to!==a.to&&a.to<a.from&&(a.to=a.from)),a.from>a.to&&(a.from=a.to),a.to<a.from&&(a.to=a.from));if(\"number\"!==typeof a.step||isNaN(a.step)||!a.step||0>a.step)a.step=\n 1;if(\"number\"!==typeof a.keyboard_step||isNaN(a.keyboard_step)||!a.keyboard_step||0>a.keyboard_step)a.keyboard_step=5;\"number\"===typeof a.from_min&&a.from<a.from_min&&(a.from=a.from_min);\"number\"===typeof a.from_max&&a.from>a.from_max&&(a.from=a.from_max);\"number\"===typeof a.to_min&&a.to<a.to_min&&(a.to=a.to_min);\"number\"===typeof a.to_max&&a.from>a.to_max&&(a.to=a.to_max);if(b){b.min!==a.min&&(b.min=a.min);b.max!==a.max&&(b.max=a.max);if(b.from<b.min||b.from>b.max)b.from=a.from;if(b.to<b.min||b.to>\n b.max)b.to=a.to}if(\"number\"!==typeof a.min_interval||isNaN(a.min_interval)||!a.min_interval||0>a.min_interval)a.min_interval=0;if(\"number\"!==typeof a.max_interval||isNaN(a.max_interval)||!a.max_interval||0>a.max_interval)a.max_interval=0;a.min_interval&&a.min_interval>a.max-a.min&&(a.min_interval=a.max-a.min);a.max_interval&&a.max_interval>a.max-a.min&&(a.max_interval=a.max-a.min)},decorate:function(a,b){var d=\"\",c=this.options;c.prefix&&(d+=c.prefix);d+=a;c.max_postfix&&(c.values.length&&a===c.p_values[c.max]?\n (d+=c.max_postfix,c.postfix&&(d+=\" \")):b===c.max&&(d+=c.max_postfix,c.postfix&&(d+=\" \")));c.postfix&&(d+=c.postfix);return d},updateFrom:function(){this.result.from=this.options.from;this.result.from_percent=this.convertToPercent(this.result.from);this.options.values&&(this.result.from_value=this.options.values[this.result.from])},updateTo:function(){this.result.to=this.options.to;this.result.to_percent=this.convertToPercent(this.result.to);this.options.values&&(this.result.to_value=this.options.values[this.result.to])},\n updateResult:function(){this.result.min=this.options.min;this.result.max=this.options.max;this.updateFrom();this.updateTo()},appendGrid:function(){if(this.options.grid){var a=this.options,b,d;b=a.max-a.min;var c=a.grid_num,e,g,f=4,h,k,m,n=\"\";this.calcGridMargin();a.grid_snap?(c=b/a.step,e=this.toFixed(a.step/(b/100))):e=this.toFixed(100/c);4<c&&(f=3);7<c&&(f=2);14<c&&(f=1);28<c&&(f=0);for(b=0;b<c+1;b++){h=f;g=this.toFixed(e*b);100<g&&(g=100,h-=2,0>h&&(h=0));this.coords.big[b]=g;k=(g-e*(b-1))/(h+1);\n for(d=1;d<=h&&0!==g;d++)m=this.toFixed(g-k*d),n+='<span class=\"irs-grid-pol small\" style=\"left: '+m+'%\"></span>';n+='<span class=\"irs-grid-pol\" style=\"left: '+g+'%\"></span>';d=this.convertToValue(g);d=a.values.length?a.p_values[d]:this._prettify(d);n+='<span class=\"irs-grid-text js-grid-text-'+b+'\" style=\"left: '+g+'%\">'+d+\"</span>\"}this.coords.big_num=Math.ceil(c+1);this.$cache.cont.addClass(\"irs-with-grid\");this.$cache.grid.html(n);this.cacheGridLabels()}},cacheGridLabels:function(){var a,b,d=this.coords.big_num;\n for(b=0;b<d;b++)a=this.$cache.grid.find(\".js-grid-text-\"+b),this.$cache.grid_labels.push(a);this.calcGridLabels()},calcGridLabels:function(){var a,b;b=[];var d=[],c=this.coords.big_num;for(a=0;a<c;a++)this.coords.big_w[a]=this.$cache.grid_labels[a].outerWidth(!1),this.coords.big_p[a]=this.toFixed(this.coords.big_w[a]/this.coords.w_rs*100),this.coords.big_x[a]=this.toFixed(this.coords.big_p[a]/2),b[a]=this.toFixed(this.coords.big[a]-this.coords.big_x[a]),d[a]=this.toFixed(b[a]+this.coords.big_p[a]);\n this.options.force_edges&&(b[0]<-this.coords.grid_gap&&(b[0]=-this.coords.grid_gap,d[0]=this.toFixed(b[0]+this.coords.big_p[0]),this.coords.big_x[0]=this.coords.grid_gap),d[c-1]>100+this.coords.grid_gap&&(d[c-1]=100+this.coords.grid_gap,b[c-1]=this.toFixed(d[c-1]-this.coords.big_p[c-1]),this.coords.big_x[c-1]=this.toFixed(this.coords.big_p[c-1]-this.coords.grid_gap)));this.calcGridCollision(2,b,d);this.calcGridCollision(4,b,d);for(a=0;a<c;a++)b=this.$cache.grid_labels[a][0],this.coords.big_x[a]!==\n Number.POSITIVE_INFINITY&&(b.style.marginLeft=-this.coords.big_x[a]+\"%\")},calcGridCollision:function(a,b,d){var c,e,g,f=this.coords.big_num;for(c=0;c<f;c+=a){e=c+a/2;if(e>=f)break;g=this.$cache.grid_labels[e][0];g.style.visibility=d[c]<=b[e]?\"visible\":\"hidden\"}},calcGridMargin:function(){this.options.grid_margin&&(this.coords.w_rs=this.$cache.rs.outerWidth(!1),this.coords.w_rs&&(this.coords.w_handle=\"single\"===this.options.type?this.$cache.s_single.outerWidth(!1):this.$cache.s_from.outerWidth(!1),\n this.coords.p_handle=this.toFixed(this.coords.w_handle/this.coords.w_rs*100),this.coords.grid_gap=this.toFixed(this.coords.p_handle/2-.1),this.$cache.grid[0].style.width=this.toFixed(100-this.coords.p_handle)+\"%\",this.$cache.grid[0].style.left=this.coords.grid_gap+\"%\"))},update:function(a){this.input&&(this.is_update=!0,this.options.from=this.result.from,this.options.to=this.result.to,this.update_check.from=this.result.from,this.update_check.to=this.result.to,this.options=f.extend(this.options,a),\n this.validate(),this.updateResult(a),this.toggleInput(),this.remove(),this.init(!0))},reset:function(){this.input&&(this.updateResult(),this.update())},destroy:function(){this.input&&(this.toggleInput(),this.$cache.input.prop(\"readonly\",!1),f.data(this.input,\"ionRangeSlider\",null),this.remove(),this.options=this.input=null)}};f.fn.ionRangeSlider=function(a){return this.each(function(){f.data(this,\"ionRangeSlider\")||f.data(this,\"ionRangeSlider\",new r(this,a,u++))})};(function(){for(var a=0,b=[\"ms\",\n \"moz\",\"webkit\",\"o\"],d=0;d<b.length&&!h.requestAnimationFrame;++d)h.requestAnimationFrame=h[b[d]+\"RequestAnimationFrame\"],h.cancelAnimationFrame=h[b[d]+\"CancelAnimationFrame\"]||h[b[d]+\"CancelRequestAnimationFrame\"];h.requestAnimationFrame||(h.requestAnimationFrame=function(b,d){var c=(new Date).getTime(),e=Math.max(0,16-(c-a)),f=h.setTimeout(function(){b(c+e)},e);a=c+e;return f});h.cancelAnimationFrame||(h.cancelAnimationFrame=function(a){clearTimeout(a)})})()});\n","Mageplaza_Core/js/jquery.autocomplete.min.js":"/**\n * Ajax Autocomplete for jQuery, version 1.3.0\n * (c) 2017 Tomas Kirda\n *\n * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license.\n * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete\n */\n!function(a){\"use strict\";\"function\"==typeof define&&define.amd?define([\"jquery\"],a):a(\"object\"==typeof exports&&\"function\"==typeof require?require(\"jquery\"):jQuery)}(function(a){\"use strict\";function b(c,d){var e=a.noop,f=this,g={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,width:\"auto\",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:b.formatResult,formatGroup:b.formatGroup,delimiter:null,zIndex:9999,type:\"GET\",noCache:!1,onSearchStart:e,onSearchComplete:e,onSearchError:e,preserveInput:!1,containerClass:\"autocomplete-suggestions\",tabDisabled:!1,dataType:\"text\",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(a,b,c){return-1!==a.value.toLowerCase().indexOf(c)},paramName:\"query\",transformResult:function(b){return\"string\"==typeof b?a.parseJSON(b):b},showNoSuggestionNotice:!1,noSuggestionNotice:\"No results\",orientation:\"bottom\",forceFixPosition:!1};f.element=c,f.el=a(c),f.suggestions=[],f.badQueries=[],f.selectedIndex=-1,f.currentValue=f.element.value,f.intervalId=0,f.cachedResponse={},f.onChangeInterval=null,f.onChange=null,f.isLocal=!1,f.suggestionsContainer=null,f.noSuggestionsContainer=null,f.options=a.extend({},g,d),f.classes={selected:\"autocomplete-selected\",suggestion:\"autocomplete-suggestion\"},f.hint=null,f.hintValue=\"\",f.selection=null,f.initialize(),f.setOptions(d)}var c=function(){return{escapeRegExChars:function(a){return a.replace(/[|\\\\{}()[\\]^$+*?.]/g,\"\\\\$&\")},createNode:function(a){var b=document.createElement(\"div\");return b.className=a,b.style.position=\"absolute\",b.style.display=\"none\",b}}}(),d={ESC:27,TAB:9,RETURN:13,LEFT:37,UP:38,RIGHT:39,DOWN:40};b.utils=c,a.Autocomplete=b,b.formatResult=function(a,b){if(!b)return a.value;var d=\"(\"+c.escapeRegExChars(b)+\")\";return a.value.replace(new RegExp(d,\"gi\"),\"<strong>$1</strong>\").replace(/&/g,\"&\").replace(/</g,\"<\").replace(/>/g,\">\").replace(/\"/g,\""\").replace(/<(\\/?strong)>/g,\"<$1>\")},b.formatGroup=function(a,b){return'<div class=\"autocomplete-group\"><strong>'+b+\"</strong></div>\"},b.prototype={killerFn:null,initialize:function(){var c,d=this,e=\".\"+d.classes.suggestion,f=d.classes.selected,g=d.options;d.element.setAttribute(\"autocomplete\",\"off\"),d.killerFn=function(b){a(b.target).closest(\".\"+d.options.containerClass).length||(d.killSuggestions(),d.disableKillerFn())},d.noSuggestionsContainer=a('<div class=\"autocomplete-no-suggestion\"></div>').html(this.options.noSuggestionNotice).get(0),d.suggestionsContainer=b.utils.createNode(g.containerClass),c=a(d.suggestionsContainer),c.appendTo(g.appendTo),\"auto\"!==g.width&&c.css(\"width\",g.width),c.on(\"mouseover.autocomplete\",e,function(){d.activate(a(this).data(\"index\"))}),c.on(\"mouseout.autocomplete\",function(){d.selectedIndex=-1,c.children(\".\"+f).removeClass(f)}),c.on(\"click.autocomplete\",e,function(){return d.select(a(this).data(\"index\")),!1}),d.fixPositionCapture=function(){d.visible&&d.fixPosition()},a(window).on(\"resize.autocomplete\",d.fixPositionCapture),d.el.on(\"keydown.autocomplete\",function(a){d.onKeyPress(a)}),d.el.on(\"keyup.autocomplete\",function(a){d.onKeyUp(a)}),d.el.on(\"blur.autocomplete\",function(){d.onBlur()}),d.el.on(\"focus.autocomplete\",function(){d.onFocus()}),d.el.on(\"change.autocomplete\",function(a){d.onKeyUp(a)}),d.el.on(\"input.autocomplete\",function(a){d.onKeyUp(a)})},onFocus:function(){var a=this;a.fixPosition(),a.el.val().length>=a.options.minChars&&a.onValueChange()},onBlur:function(){this.enableKillerFn()},abortAjax:function(){var a=this;a.currentRequest&&(a.currentRequest.abort(),a.currentRequest=null)},setOptions:function(b){var c=this,d=c.options;a.extend(d,b),c.isLocal=a.isArray(d.lookup),c.isLocal&&(d.lookup=c.verifySuggestionsFormat(d.lookup)),d.orientation=c.validateOrientation(d.orientation,\"bottom\"),a(c.suggestionsContainer).css({\"max-height\":d.maxHeight+\"px\",width:d.width+\"px\",\"z-index\":d.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue=\"\",this.suggestions=[]},disable:function(){var a=this;a.disabled=!0,clearInterval(a.onChangeInterval),a.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var b=this,c=a(b.suggestionsContainer),d=c.parent().get(0);if(d===document.body||b.options.forceFixPosition){var e=b.options.orientation,f=c.outerHeight(),g=b.el.outerHeight(),h=b.el.offset(),i={top:h.top,left:h.left};if(\"auto\"===e){var j=a(window).height(),k=a(window).scrollTop(),l=-k+h.top-f,m=k+j-(h.top+g+f);e=Math.max(l,m)===l?\"top\":\"bottom\"}if(\"top\"===e?i.top+=-f:i.top+=g,d!==document.body){var n,o=c.css(\"opacity\");b.visible||c.css(\"opacity\",0).show(),n=c.offsetParent().offset(),i.top-=n.top,i.left-=n.left,b.visible||c.css(\"opacity\",o).hide()}\"auto\"===b.options.width&&(i.width=b.el.outerWidth()+\"px\"),c.css(i)}},enableKillerFn:function(){var b=this;a(document).on(\"click.autocomplete\",b.killerFn)},disableKillerFn:function(){var b=this;a(document).off(\"click.autocomplete\",b.killerFn)},killSuggestions:function(){var a=this;a.stopKillSuggestions(),a.intervalId=window.setInterval(function(){a.visible&&(a.options.preserveInput||a.el.val(a.currentValue),a.hide()),a.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var a,b=this,c=b.el.val().length,d=b.element.selectionStart;return\"number\"==typeof d?d===c:document.selection?(a=document.selection.createRange(),a.moveStart(\"character\",-c),c===a.text.length):!0},onKeyPress:function(a){var b=this;if(!b.disabled&&!b.visible&&a.which===d.DOWN&&b.currentValue)return void b.suggest();if(!b.disabled&&b.visible){switch(a.which){case d.ESC:b.el.val(b.currentValue),b.hide();break;case d.RIGHT:if(b.hint&&b.options.onHint&&b.isCursorAtEnd()){b.selectHint();break}return;case d.TAB:if(b.hint&&b.options.onHint)return void b.selectHint();if(-1===b.selectedIndex)return void b.hide();if(b.select(b.selectedIndex),b.options.tabDisabled===!1)return;break;case d.RETURN:if(-1===b.selectedIndex)return void b.hide();b.select(b.selectedIndex);break;case d.UP:b.moveUp();break;case d.DOWN:b.moveDown();break;default:return}a.stopImmediatePropagation(),a.preventDefault()}},onKeyUp:function(a){var b=this;if(!b.disabled){switch(a.which){case d.UP:case d.DOWN:return}clearInterval(b.onChangeInterval),b.currentValue!==b.el.val()&&(b.findBestHint(),b.options.deferRequestBy>0?b.onChangeInterval=setInterval(function(){b.onValueChange()},b.options.deferRequestBy):b.onValueChange())}},onValueChange:function(){var b=this,c=b.options,d=b.el.val(),e=b.getQuery(d);return b.selection&&b.currentValue!==e&&(b.selection=null,(c.onInvalidateSelection||a.noop).call(b.element)),clearInterval(b.onChangeInterval),b.currentValue=d,b.selectedIndex=-1,c.triggerSelectOnValidInput&&b.isExactMatch(e)?void b.select(0):void(e.length<c.minChars?b.hide():b.getSuggestions(e))},isExactMatch:function(a){var b=this.suggestions;return 1===b.length&&b[0].value.toLowerCase()===a.toLowerCase()},getQuery:function(b){var c,d=this.options.delimiter;return d?(c=b.split(d),a.trim(c[c.length-1])):b},getSuggestionsLocal:function(b){var c,d=this,e=d.options,f=b.toLowerCase(),g=e.lookupFilter,h=parseInt(e.lookupLimit,10);return c={suggestions:a.grep(e.lookup,function(a){return g(a,b,f)})},h&&c.suggestions.length>h&&(c.suggestions=c.suggestions.slice(0,h)),c},getSuggestions:function(b){var c,d,e,f,g=this,h=g.options,i=h.serviceUrl;if(h.params[h.paramName]=b,d=h.ignoreParams?null:h.params,h.onSearchStart.call(g.element,h.params)!==!1){if(a.isFunction(h.lookup))return void h.lookup(b,function(a){g.suggestions=a.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,a.suggestions)});g.isLocal?c=g.getSuggestionsLocal(b):(a.isFunction(i)&&(i=i.call(g.element,b)),e=i+\"?\"+a.param(d||{}),c=g.cachedResponse[e]),c&&a.isArray(c.suggestions)?(g.suggestions=c.suggestions,g.suggest(),h.onSearchComplete.call(g.element,b,c.suggestions)):g.isBadQuery(b)?h.onSearchComplete.call(g.element,b,[]):(g.abortAjax(),f={url:i,data:d,type:h.type,dataType:h.dataType},a.extend(f,h.ajaxSettings),g.currentRequest=a.ajax(f).done(function(a){var c;g.currentRequest=null,c=h.transformResult(a,b),g.processResponse(c,b,e),h.onSearchComplete.call(g.element,b,c.suggestions)}).fail(function(a,c,d){h.onSearchError.call(g.element,b,a,c,d)}))}},isBadQuery:function(a){if(!this.options.preventBadQueries)return!1;for(var b=this.badQueries,c=b.length;c--;)if(0===a.indexOf(b[c]))return!0;return!1},hide:function(){var b=this,c=a(b.suggestionsContainer);a.isFunction(b.options.onHide)&&b.visible&&b.options.onHide.call(b.element,c),b.visible=!1,b.selectedIndex=-1,clearInterval(b.onChangeInterval),a(b.suggestionsContainer).hide(),b.signalHint(null)},suggest:function(){if(!this.suggestions.length)return void(this.options.showNoSuggestionNotice?this.noSuggestions():this.hide());var b,c=this,d=c.options,e=d.groupBy,f=d.formatResult,g=c.getQuery(c.currentValue),h=c.classes.suggestion,i=c.classes.selected,j=a(c.suggestionsContainer),k=a(c.noSuggestionsContainer),l=d.beforeRender,m=\"\",n=function(a,c){var f=a.data[e];return b===f?\"\":(b=f,d.formatGroup(a,b))};return d.triggerSelectOnValidInput&&c.isExactMatch(g)?void c.select(0):(a.each(c.suggestions,function(a,b){e&&(m+=n(b,g,a)),m+='<div class=\"'+h+'\" data-index=\"'+a+'\">'+f(b,g,a)+\"</div>\"}),this.adjustContainerWidth(),k.detach(),j.html(m),a.isFunction(l)&&l.call(c.element,j,c.suggestions),c.fixPosition(),j.show(),d.autoSelectFirst&&(c.selectedIndex=0,j.scrollTop(0),j.children(\".\"+h).first().addClass(i)),c.visible=!0,void c.findBestHint())},noSuggestions:function(){var b=this,c=a(b.suggestionsContainer),d=a(b.noSuggestionsContainer);this.adjustContainerWidth(),d.detach(),c.empty(),c.append(d),b.fixPosition(),c.show(),b.visible=!0},adjustContainerWidth:function(){var b,c=this,d=c.options,e=a(c.suggestionsContainer);\"auto\"===d.width?(b=c.el.outerWidth(),e.css(\"width\",b>0?b:300)):\"flex\"===d.width&&e.css(\"width\",\"\")},findBestHint:function(){var b=this,c=b.el.val().toLowerCase(),d=null;c&&(a.each(b.suggestions,function(a,b){var e=0===b.value.toLowerCase().indexOf(c);return e&&(d=b),!e}),b.signalHint(d))},signalHint:function(b){var c=\"\",d=this;b&&(c=d.currentValue+b.value.substr(d.currentValue.length)),d.hintValue!==c&&(d.hintValue=c,d.hint=b,(this.options.onHint||a.noop)(c))},verifySuggestionsFormat:function(b){return b.length&&\"string\"==typeof b[0]?a.map(b,function(a){return{value:a,data:null}}):b},validateOrientation:function(b,c){return b=a.trim(b||\"\").toLowerCase(),-1===a.inArray(b,[\"auto\",\"bottom\",\"top\"])&&(b=c),b},processResponse:function(a,b,c){var d=this,e=d.options;a.suggestions=d.verifySuggestionsFormat(a.suggestions),e.noCache||(d.cachedResponse[c]=a,e.preventBadQueries&&!a.suggestions.length&&d.badQueries.push(b)),b===d.getQuery(d.currentValue)&&(d.suggestions=a.suggestions,d.suggest())},activate:function(b){var c,d=this,e=d.classes.selected,f=a(d.suggestionsContainer),g=f.find(\".\"+d.classes.suggestion);return f.find(\".\"+e).removeClass(e),d.selectedIndex=b,-1!==d.selectedIndex&&g.length>d.selectedIndex?(c=g.get(d.selectedIndex),a(c).addClass(e),c):null},selectHint:function(){var b=this,c=a.inArray(b.hint,b.suggestions);b.select(c)},select:function(a){var b=this;b.hide(),b.onSelect(a),b.disableKillerFn()},moveUp:function(){var b=this;if(-1!==b.selectedIndex)return 0===b.selectedIndex?(a(b.suggestionsContainer).children().first().removeClass(b.classes.selected),b.selectedIndex=-1,b.el.val(b.currentValue),void b.findBestHint()):void b.adjustScroll(b.selectedIndex-1)},moveDown:function(){var a=this;a.selectedIndex!==a.suggestions.length-1&&a.adjustScroll(a.selectedIndex+1)},adjustScroll:function(b){var c=this,d=c.activate(b);if(d){var e,f,g,h=a(d).outerHeight();e=d.offsetTop,f=a(c.suggestionsContainer).scrollTop(),g=f+c.options.maxHeight-h,f>e?a(c.suggestionsContainer).scrollTop(e):e>g&&a(c.suggestionsContainer).scrollTop(e-c.options.maxHeight+h),c.options.preserveInput||c.el.val(c.getValue(c.suggestions[b].value)),c.signalHint(null)}},onSelect:function(b){var c=this,d=c.options.onSelect,e=c.suggestions[b];c.currentValue=c.getValue(e.value),c.currentValue===c.el.val()||c.options.preserveInput||c.el.val(c.currentValue),c.signalHint(null),c.suggestions=[],c.selection=e,a.isFunction(d)&&d.call(c.element,e)},getValue:function(a){var b,c,d=this,e=d.options.delimiter;return e?(b=d.currentValue,c=b.split(e),1===c.length?a:b.substr(0,b.length-c[c.length-1].length)+a):a},dispose:function(){var b=this;b.el.off(\".autocomplete\").removeData(\"autocomplete\"),b.disableKillerFn(),a(window).off(\"resize.autocomplete\",b.fixPositionCapture),a(b.suggestionsContainer).remove()}},a.fn.autocomplete=a.fn.devbridgeAutocomplete=function(c,d){var e=\"autocomplete\";return arguments.length?this.each(function(){var f=a(this),g=f.data(e);\"string\"==typeof c?g&&\"function\"==typeof g[c]&&g[c](d):(g&&g.dispose&&g.dispose(),g=new b(this,c),f.data(e,g))}):this.first().data(e)}});","Mageplaza_Core/js/bootstrap.min.js":"/*!\n * Bootstrap v3.3.6 (http://getbootstrap.com)\n * Copyright 2011-2015 Twitter, Inc.\n * Licensed under the MIT license\n */\nif(\"undefined\"==typeof jQuery)throw new Error(\"Bootstrap's JavaScript requires jQuery\");+function(a){\"use strict\";var b=a.fn.jquery.split(\" \")[0].split(\".\");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1||b[0]>2)throw new Error(\"Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 3\")}(jQuery),+function(a){\"use strict\";function b(){var a=document.createElement(\"bootstrap\"),b={WebkitTransition:\"webkitTransitionEnd\",MozTransition:\"transitionend\",OTransition:\"oTransitionEnd otransitionend\",transition:\"transitionend\"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one(\"bsTransitionEnd\",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var c=a(this),e=c.data(\"bs.alert\");e||c.data(\"bs.alert\",e=new d(this)),\"string\"==typeof b&&e[b].call(c)})}var c='[data-dismiss=\"alert\"]',d=function(b){a(b).on(\"click\",c,this.close)};d.VERSION=\"3.3.6\",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger(\"closed.bs.alert\").remove()}var e=a(this),f=e.attr(\"data-target\");f||(f=e.attr(\"href\"),f=f&&f.replace(/.*(?=#[^\\s]*$)/,\"\"));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(\".alert\")),g.trigger(b=a.Event(\"close.bs.alert\")),b.isDefaultPrevented()||(g.removeClass(\"in\"),a.support.transition&&g.hasClass(\"fade\")?g.one(\"bsTransitionEnd\",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on(\"click.bs.alert.data-api\",c,d.prototype.close)}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.button\"),f=\"object\"==typeof b&&b;e||d.data(\"bs.button\",e=new c(this,f)),\"toggle\"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION=\"3.3.6\",c.DEFAULTS={loadingText:\"loading...\"},c.prototype.setState=function(b){var c=\"disabled\",d=this.$element,e=d.is(\"input\")?\"val\":\"html\",f=d.data();b+=\"Text\",null==f.resetText&&d.data(\"resetText\",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),\"loadingText\"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle=\"buttons\"]');if(b.length){var c=this.$element.find(\"input\");\"radio\"==c.prop(\"type\")?(c.prop(\"checked\")&&(a=!1),b.find(\".active\").removeClass(\"active\"),this.$element.addClass(\"active\")):\"checkbox\"==c.prop(\"type\")&&(c.prop(\"checked\")!==this.$element.hasClass(\"active\")&&(a=!1),this.$element.toggleClass(\"active\")),c.prop(\"checked\",this.$element.hasClass(\"active\")),a&&c.trigger(\"change\")}else this.$element.attr(\"aria-pressed\",!this.$element.hasClass(\"active\")),this.$element.toggleClass(\"active\")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on(\"click.bs.button.data-api\",'[data-toggle^=\"button\"]',function(c){var d=a(c.target);d.hasClass(\"btn\")||(d=d.closest(\".btn\")),b.call(d,\"toggle\"),a(c.target).is('input[type=\"radio\"]')||a(c.target).is('input[type=\"checkbox\"]')||c.preventDefault()}).on(\"focus.bs.button.data-api blur.bs.button.data-api\",'[data-toggle^=\"button\"]',function(b){a(b.target).closest(\".btn\").toggleClass(\"focus\",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.carousel\"),f=a.extend({},c.DEFAULTS,d.data(),\"object\"==typeof b&&b),g=\"string\"==typeof b?b:f.slide;e||d.data(\"bs.carousel\",e=new c(this,f)),\"number\"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(\".carousel-indicators\"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on(\"keydown.bs.carousel\",a.proxy(this.keydown,this)),\"hover\"==this.options.pause&&!(\"ontouchstart\"in document.documentElement)&&this.$element.on(\"mouseenter.bs.carousel\",a.proxy(this.pause,this)).on(\"mouseleave.bs.carousel\",a.proxy(this.cycle,this))};c.VERSION=\"3.3.6\",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:\"hover\",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(\".item\"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d=\"prev\"==a&&0===c||\"next\"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e=\"prev\"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(\".item.active\"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one(\"slid.bs.carousel\",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?\"next\":\"prev\",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(\".next, .prev\").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide(\"next\")},c.prototype.prev=function(){return this.sliding?void 0:this.slide(\"prev\")},c.prototype.slide=function(b,d){var e=this.$element.find(\".item.active\"),f=d||this.getItemForDirection(b,e),g=this.interval,h=\"next\"==b?\"left\":\"right\",i=this;if(f.hasClass(\"active\"))return this.sliding=!1;var j=f[0],k=a.Event(\"slide.bs.carousel\",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(\".active\").removeClass(\"active\");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass(\"active\")}var m=a.Event(\"slid.bs.carousel\",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass(\"slide\")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one(\"bsTransitionEnd\",function(){f.removeClass([b,h].join(\" \")).addClass(\"active\"),e.removeClass([\"active\",h].join(\" \")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass(\"active\"),f.addClass(\"active\"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr(\"data-target\")||(d=e.attr(\"href\"))&&d.replace(/.*(?=#[^\\s]+$)/,\"\"));if(f.hasClass(\"carousel\")){var g=a.extend({},f.data(),e.data()),h=e.attr(\"data-slide-to\");h&&(g.interval=!1),b.call(f,g),h&&f.data(\"bs.carousel\").to(h),c.preventDefault()}};a(document).on(\"click.bs.carousel.data-api\",\"[data-slide]\",e).on(\"click.bs.carousel.data-api\",\"[data-slide-to]\",e),a(window).on(\"load\",function(){a('[data-ride=\"carousel\"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){\"use strict\";function b(b){var c,d=b.attr(\"data-target\")||(c=b.attr(\"href\"))&&c.replace(/.*(?=#[^\\s]+$)/,\"\");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data(\"bs.collapse\"),f=a.extend({},d.DEFAULTS,c.data(),\"object\"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data(\"bs.collapse\",e=new d(this,f)),\"string\"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle=\"collapse\"][href=\"#'+b.id+'\"],[data-toggle=\"collapse\"][data-target=\"#'+b.id+'\"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION=\"3.3.6\",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass(\"width\");return a?\"width\":\"height\"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass(\"in\")){var b,e=this.$parent&&this.$parent.children(\".panel\").children(\".in, .collapsing\");if(!(e&&e.length&&(b=e.data(\"bs.collapse\"),b&&b.transitioning))){var f=a.Event(\"show.bs.collapse\");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,\"hide\"),b||e.data(\"bs.collapse\",null));var g=this.dimension();this.$element.removeClass(\"collapse\").addClass(\"collapsing\")[g](0).attr(\"aria-expanded\",!0),this.$trigger.removeClass(\"collapsed\").attr(\"aria-expanded\",!0),this.transitioning=1;var h=function(){this.$element.removeClass(\"collapsing\").addClass(\"collapse in\")[g](\"\"),this.transitioning=0,this.$element.trigger(\"shown.bs.collapse\")};if(!a.support.transition)return h.call(this);var i=a.camelCase([\"scroll\",g].join(\"-\"));this.$element.one(\"bsTransitionEnd\",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass(\"in\")){var b=a.Event(\"hide.bs.collapse\");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass(\"collapsing\").removeClass(\"collapse in\").attr(\"aria-expanded\",!1),this.$trigger.addClass(\"collapsed\").attr(\"aria-expanded\",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass(\"collapsing\").addClass(\"collapse\").trigger(\"hidden.bs.collapse\")};return a.support.transition?void this.$element[c](0).one(\"bsTransitionEnd\",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass(\"in\")?\"hide\":\"show\"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle=\"collapse\"][data-parent=\"'+this.options.parent+'\"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass(\"in\");a.attr(\"aria-expanded\",c),b.toggleClass(\"collapsed\",!c).attr(\"aria-expanded\",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on(\"click.bs.collapse.data-api\",'[data-toggle=\"collapse\"]',function(d){var e=a(this);e.attr(\"data-target\")||d.preventDefault();var f=b(e),g=f.data(\"bs.collapse\"),h=g?\"toggle\":e.data();c.call(f,h)})}(jQuery),+function(a){\"use strict\";function b(b){var c=b.attr(\"data-target\");c||(c=b.attr(\"href\"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\\s]*$)/,\"\"));var d=c&&a(c);return d&&d.length?d:b.parent()}function c(c){c&&3===c.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=b(d),f={relatedTarget:this};e.hasClass(\"open\")&&(c&&\"click\"==c.type&&/input|textarea/i.test(c.target.tagName)&&a.contains(e[0],c.target)||(e.trigger(c=a.Event(\"hide.bs.dropdown\",f)),c.isDefaultPrevented()||(d.attr(\"aria-expanded\",\"false\"),e.removeClass(\"open\").trigger(a.Event(\"hidden.bs.dropdown\",f)))))}))}function d(b){return this.each(function(){var c=a(this),d=c.data(\"bs.dropdown\");d||c.data(\"bs.dropdown\",d=new g(this)),\"string\"==typeof b&&d[b].call(c)})}var e=\".dropdown-backdrop\",f='[data-toggle=\"dropdown\"]',g=function(b){a(b).on(\"click.bs.dropdown\",this.toggle)};g.VERSION=\"3.3.6\",g.prototype.toggle=function(d){var e=a(this);if(!e.is(\".disabled, :disabled\")){var f=b(e),g=f.hasClass(\"open\");if(c(),!g){\"ontouchstart\"in document.documentElement&&!f.closest(\".navbar-nav\").length&&a(document.createElement(\"div\")).addClass(\"dropdown-backdrop\").insertAfter(a(this)).on(\"click\",c);var h={relatedTarget:this};if(f.trigger(d=a.Event(\"show.bs.dropdown\",h)),d.isDefaultPrevented())return;e.trigger(\"focus\").attr(\"aria-expanded\",\"true\"),f.toggleClass(\"open\").trigger(a.Event(\"shown.bs.dropdown\",h))}return!1}},g.prototype.keydown=function(c){if(/(38|40|27|32)/.test(c.which)&&!/input|textarea/i.test(c.target.tagName)){var d=a(this);if(c.preventDefault(),c.stopPropagation(),!d.is(\".disabled, :disabled\")){var e=b(d),g=e.hasClass(\"open\");if(!g&&27!=c.which||g&&27==c.which)return 27==c.which&&e.find(f).trigger(\"focus\"),d.trigger(\"click\");var h=\" li:not(.disabled):visible a\",i=e.find(\".dropdown-menu\"+h);if(i.length){var j=i.index(c.target);38==c.which&&j>0&&j--,40==c.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger(\"focus\")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on(\"click.bs.dropdown.data-api\",c).on(\"click.bs.dropdown.data-api\",\".dropdown form\",function(a){a.stopPropagation()}).on(\"click.bs.dropdown.data-api\",f,g.prototype.toggle).on(\"keydown.bs.dropdown.data-api\",f,g.prototype.keydown).on(\"keydown.bs.dropdown.data-api\",\".dropdown-menu\",g.prototype.keydown)}(jQuery),+function(a){\"use strict\";function b(b,d){return this.each(function(){var e=a(this),f=e.data(\"bs.modal\"),g=a.extend({},c.DEFAULTS,e.data(),\"object\"==typeof b&&b);f||e.data(\"bs.modal\",f=new c(this,g)),\"string\"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(\".modal-dialog\"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(\".modal-content\").load(this.options.remote,a.proxy(function(){this.$element.trigger(\"loaded.bs.modal\")},this))};c.VERSION=\"3.3.6\",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event(\"show.bs.modal\",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass(\"modal-open\"),this.escape(),this.resize(),this.$element.on(\"click.dismiss.bs.modal\",'[data-dismiss=\"modal\"]',a.proxy(this.hide,this)),this.$dialog.on(\"mousedown.dismiss.bs.modal\",function(){d.$element.one(\"mouseup.dismiss.bs.modal\",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass(\"fade\");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass(\"in\"),d.enforceFocus();var f=a.Event(\"shown.bs.modal\",{relatedTarget:b});e?d.$dialog.one(\"bsTransitionEnd\",function(){d.$element.trigger(\"focus\").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger(\"focus\").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event(\"hide.bs.modal\"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off(\"focusin.bs.modal\"),this.$element.removeClass(\"in\").off(\"click.dismiss.bs.modal\").off(\"mouseup.dismiss.bs.modal\"),this.$dialog.off(\"mousedown.dismiss.bs.modal\"),a.support.transition&&this.$element.hasClass(\"fade\")?this.$element.one(\"bsTransitionEnd\",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off(\"focusin.bs.modal\").on(\"focusin.bs.modal\",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger(\"focus\")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on(\"keydown.dismiss.bs.modal\",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off(\"keydown.dismiss.bs.modal\")},c.prototype.resize=function(){this.isShown?a(window).on(\"resize.bs.modal\",a.proxy(this.handleUpdate,this)):a(window).off(\"resize.bs.modal\")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass(\"modal-open\"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger(\"hidden.bs.modal\")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass(\"fade\")?\"fade\":\"\";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a(document.createElement(\"div\")).addClass(\"modal-backdrop \"+e).appendTo(this.$body),this.$element.on(\"click.dismiss.bs.modal\",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&(\"static\"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass(\"in\"),!b)return;f?this.$backdrop.one(\"bsTransitionEnd\",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass(\"in\");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass(\"fade\")?this.$backdrop.one(\"bsTransitionEnd\",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:\"\",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:\"\"})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:\"\",paddingRight:\"\"})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css(\"padding-right\")||0,10);this.originalBodyPad=document.body.style.paddingRight||\"\",this.bodyIsOverflowing&&this.$body.css(\"padding-right\",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css(\"padding-right\",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement(\"div\");a.className=\"modal-scrollbar-measure\",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on(\"click.bs.modal.data-api\",'[data-toggle=\"modal\"]',function(c){var d=a(this),e=d.attr(\"href\"),f=a(d.attr(\"data-target\")||e&&e.replace(/.*(?=#[^\\s]+$)/,\"\")),g=f.data(\"bs.modal\")?\"toggle\":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is(\"a\")&&c.preventDefault(),f.one(\"show.bs.modal\",function(a){a.isDefaultPrevented()||f.one(\"hidden.bs.modal\",function(){d.is(\":visible\")&&d.trigger(\"focus\")})}),b.call(f,g,this)})}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.tooltip\"),f=\"object\"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data(\"bs.tooltip\",e=new c(this,f)),\"string\"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init(\"tooltip\",a,b)};c.VERSION=\"3.3.6\",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:\"top\",selector:!1,template:'<div class=\"tooltip\" role=\"tooltip\"><div class=\"tooltip-arrow\"></div><div class=\"tooltip-inner\"></div></div>',trigger:\"hover focus\",title:\"\",delay:0,html:!1,container:!1,viewport:{selector:\"body\",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error(\"`selector` option must be specified when initializing \"+this.type+\" on the window.document object!\");for(var e=this.options.trigger.split(\" \"),f=e.length;f--;){var g=e[f];if(\"click\"==g)this.$element.on(\"click.\"+this.type,this.options.selector,a.proxy(this.toggle,this));else if(\"manual\"!=g){var h=\"hover\"==g?\"mouseenter\":\"focusin\",i=\"hover\"==g?\"mouseleave\":\"focusout\";this.$element.on(h+\".\"+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+\".\"+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:\"manual\",selector:\"\"}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&\"number\"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data(\"bs.\"+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data(\"bs.\"+this.type,c)),b instanceof a.Event&&(c.inState[\"focusin\"==b.type?\"focus\":\"hover\"]=!0),c.tip().hasClass(\"in\")||\"in\"==c.hoverState?void(c.hoverState=\"in\"):(clearTimeout(c.timeout),c.hoverState=\"in\",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){\"in\"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data(\"bs.\"+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data(\"bs.\"+this.type,c)),b instanceof a.Event&&(c.inState[\"focusout\"==b.type?\"focus\":\"hover\"]=!1),c.isInStateTrue()?void 0:(clearTimeout(c.timeout),c.hoverState=\"out\",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){\"out\"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide())},c.prototype.show=function(){var b=a.Event(\"show.bs.\"+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr(\"id\",g),this.$element.attr(\"aria-describedby\",g),this.options.animation&&f.addClass(\"fade\");var h=\"function\"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\\s?auto?\\s?/i,j=i.test(h);j&&(h=h.replace(i,\"\")||\"top\"),f.detach().css({top:0,left:0,display:\"block\"}).addClass(h).data(\"bs.\"+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger(\"inserted.bs.\"+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h=\"bottom\"==h&&k.bottom+m>o.bottom?\"top\":\"top\"==h&&k.top-m<o.top?\"bottom\":\"right\"==h&&k.right+l>o.width?\"left\":\"left\"==h&&k.left-l<o.left?\"right\":h,f.removeClass(n).addClass(h)}var p=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(p,h);var q=function(){var a=e.hoverState;e.$element.trigger(\"shown.bs.\"+e.type),e.hoverState=null,\"out\"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass(\"fade\")?f.one(\"bsTransitionEnd\",q).emulateTransitionEnd(c.TRANSITION_DURATION):q()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css(\"margin-top\"),10),h=parseInt(d.css(\"margin-left\"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top+=g,b.left+=h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass(\"in\");var i=d[0].offsetWidth,j=d[0].offsetHeight;\"top\"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?\"offsetWidth\":\"offsetHeight\";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?\"left\":\"top\",50*(1-a/b)+\"%\").css(c?\"top\":\"left\",\"\")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(\".tooltip-inner\")[this.options.html?\"html\":\"text\"](b),a.removeClass(\"fade in top bottom left right\")},c.prototype.hide=function(b){function d(){\"in\"!=e.hoverState&&f.detach(),e.$element.removeAttr(\"aria-describedby\").trigger(\"hidden.bs.\"+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event(\"hide.bs.\"+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass(\"in\"),a.support.transition&&f.hasClass(\"fade\")?f.one(\"bsTransitionEnd\",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr(\"title\")||\"string\"!=typeof a.attr(\"data-original-title\"))&&a.attr(\"data-original-title\",a.attr(\"title\")||\"\").attr(\"title\",\"\")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d=\"BODY\"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return\"bottom\"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:\"top\"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:\"left\"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr(\"data-original-title\")||(\"function\"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+\" `template` option must consist of exactly 1 top-level element!\");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(\".tooltip-arrow\")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data(\"bs.\"+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data(\"bs.\"+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass(\"in\")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off(\".\"+a.type).removeData(\"bs.\"+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.popover\"),f=\"object\"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data(\"bs.popover\",e=new c(this,f)),\"string\"==typeof b&&e[b]())})}var c=function(a,b){this.init(\"popover\",a,b)};if(!a.fn.tooltip)throw new Error(\"Popover requires tooltip.js\");c.VERSION=\"3.3.6\",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:\"right\",trigger:\"click\",content:\"\",template:'<div class=\"popover\" role=\"tooltip\"><div class=\"arrow\"></div><h3 class=\"popover-title\"></h3><div class=\"popover-content\"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(\".popover-title\")[this.options.html?\"html\":\"text\"](b),a.find(\".popover-content\").children().detach().end()[this.options.html?\"string\"==typeof c?\"html\":\"append\":\"text\"](c),a.removeClass(\"fade top bottom left right in\"),a.find(\".popover-title\").html()||a.find(\".popover-title\").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr(\"data-content\")||(\"function\"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(\".arrow\")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){\"use strict\";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||\"\")+\" .nav li > a\",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on(\"scroll.bs.scrollspy\",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data(\"bs.scrollspy\"),f=\"object\"==typeof c&&c;e||d.data(\"bs.scrollspy\",e=new b(this,f)),\"string\"==typeof c&&e[c]()})}b.VERSION=\"3.3.6\",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c=\"offset\",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c=\"position\",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data(\"target\")||b.attr(\"href\"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(\":visible\")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target=\"'+b+'\"],'+this.selector+'[href=\"'+b+'\"]',d=a(c).parents(\"li\").addClass(\"active\");\n d.parent(\".dropdown-menu\").length&&(d=d.closest(\"li.dropdown\").addClass(\"active\")),d.trigger(\"activate.bs.scrollspy\")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,\".active\").removeClass(\"active\")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on(\"load.bs.scrollspy.data-api\",function(){a('[data-spy=\"scroll\"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.tab\");e||d.data(\"bs.tab\",e=new c(this)),\"string\"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION=\"3.3.6\",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest(\"ul:not(.dropdown-menu)\"),d=b.data(\"target\");if(d||(d=b.attr(\"href\"),d=d&&d.replace(/.*(?=#[^\\s]*$)/,\"\")),!b.parent(\"li\").hasClass(\"active\")){var e=c.find(\".active:last a\"),f=a.Event(\"hide.bs.tab\",{relatedTarget:b[0]}),g=a.Event(\"show.bs.tab\",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest(\"li\"),c),this.activate(h,h.parent(),function(){e.trigger({type:\"hidden.bs.tab\",relatedTarget:b[0]}),b.trigger({type:\"shown.bs.tab\",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass(\"active\").find(\"> .dropdown-menu > .active\").removeClass(\"active\").end().find('[data-toggle=\"tab\"]').attr(\"aria-expanded\",!1),b.addClass(\"active\").find('[data-toggle=\"tab\"]').attr(\"aria-expanded\",!0),h?(b[0].offsetWidth,b.addClass(\"in\")):b.removeClass(\"fade\"),b.parent(\".dropdown-menu\").length&&b.closest(\"li.dropdown\").addClass(\"active\").end().find('[data-toggle=\"tab\"]').attr(\"aria-expanded\",!0),e&&e()}var g=d.find(\"> .active\"),h=e&&a.support.transition&&(g.length&&g.hasClass(\"fade\")||!!d.find(\"> .fade\").length);g.length&&h?g.one(\"bsTransitionEnd\",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass(\"in\")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),\"show\")};a(document).on(\"click.bs.tab.data-api\",'[data-toggle=\"tab\"]',e).on(\"click.bs.tab.data-api\",'[data-toggle=\"pill\"]',e)}(jQuery),+function(a){\"use strict\";function b(b){return this.each(function(){var d=a(this),e=d.data(\"bs.affix\"),f=\"object\"==typeof b&&b;e||d.data(\"bs.affix\",e=new c(this,f)),\"string\"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on(\"scroll.bs.affix.data-api\",a.proxy(this.checkPosition,this)).on(\"click.bs.affix.data-api\",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION=\"3.3.6\",c.RESET=\"affix affix-top affix-bottom\",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&\"top\"==this.affixed)return c>e?\"top\":!1;if(\"bottom\"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:\"bottom\":a-d>=e+g?!1:\"bottom\";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?\"top\":null!=d&&i+j>=a-d?\"bottom\":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass(\"affix\");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(\":visible\")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());\"object\"!=typeof d&&(f=e=d),\"function\"==typeof e&&(e=d.top(this.$element)),\"function\"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css(\"top\",\"\");var i=\"affix\"+(h?\"-\"+h:\"\"),j=a.Event(i+\".bs.affix\");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin=\"bottom\"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace(\"affix\",\"affixed\")+\".bs.affix\")}\"bottom\"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on(\"load\",function(){a('[data-spy=\"affix\"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);","StripeIntegration_Payments/js/stripe.js":"// Copyright \u00a9 Stripe, Inc\n//\n// @package StripeIntegration_Payments\n// @version 4.2.0\ndefine(\n [\n 'stripejs'\n ],\n function ()\n {\n 'use strict';\n\n // Warning: This file should be kept lightweight as it is loaded on nearly all pages.\n\n return (window.stripe = {\n\n // Properties\n version: \"4.2.0\",\n stripeJs: null,\n\n initStripe: function(params, callback)\n {\n if (typeof callback == \"undefined\")\n callback = null;\n\n var message = null;\n\n if (!this.stripeJs)\n {\n try\n {\n var options = {};\n if (params.options)\n {\n options = params.options;\n }\n\n this.stripeJs = Stripe(params.apiKey, options);\n }\n catch (e)\n {\n if (typeof e != \"undefined\" && typeof e.message != \"undefined\")\n message = 'Could not initialize Stripe.js: ' + e.message;\n else\n message = 'Could not initialize Stripe.js';\n }\n\n if (this.stripeJs && typeof params.appInfo != \"undefined\")\n {\n try\n {\n this.stripeJs.registerAppInfo(params.appInfo);\n }\n catch (e)\n {\n console.warn(e);\n }\n }\n }\n\n if (callback)\n callback(message);\n else if (message)\n console.error(message);\n },\n\n authenticateCustomer: function(intentId, done) {\n try {\n var isPaymentIntent = intentId.startsWith('pi_');\n var isSetupIntent = intentId.startsWith('seti_');\n\n var handleIntent = function(result) {\n if (result.error)\n return done(result.error);\n\n var intent = result.paymentIntent || result.setupIntent;\n var requiresActionStatuses = [\"requires_action\", \"requires_source_action\"];\n\n if (requiresActionStatuses.includes(intent.status))\n {\n if (intent.next_action && intent.next_action.type === \"verify_with_microdeposits\")\n {\n window.location = intent.next_action.verify_with_microdeposits.hosted_verification_url;\n }\n else\n {\n stripe.stripeJs.handleNextAction({\n clientSecret: intent.client_secret\n })\n .then(function(result)\n {\n if (result && result.error)\n {\n return done(result.error.message);\n }\n\n return done();\n });\n }\n }\n else\n {\n return done();\n }\n };\n\n if (isPaymentIntent) {\n this.stripeJs.retrievePaymentIntent(intentId).then(handleIntent);\n } else if (isSetupIntent) {\n this.stripeJs.retrieveSetupIntent(intentId).then(handleIntent);\n } else {\n throw new Error(\"Invalid intent ID\");\n }\n } catch (e) {\n done(e.message);\n }\n }\n });\n }\n);\n","StripeIntegration_Payments/js/stripe_payments_express.js":"/*global define*/\ndefine(\n [\n 'jquery',\n 'mage/url',\n 'mage/storage',\n 'Magento_Ui/js/modal/alert',\n 'mage/translate',\n 'Magento_Customer/js/customer-data',\n 'StripeIntegration_Payments/js/stripe',\n 'mage/loader'\n ],\n function (\n jQuery,\n urlBuilder,\n storage,\n alert,\n $t,\n customerData,\n stripe\n ) {\n 'use strict';\n\n return {\n shippingAddress: [],\n shippingMethod: null,\n elements: null,\n expressCheckoutElement: null,\n expressCheckoutOptions: null,\n clickResolvePayload: null,\n resolvePayload: null,\n pendingActionsQueue: [],\n isAddToCartPending: false,\n waitingForNewTotals: false,\n lastTotal: null,\n mountElementId: null,\n mode: null,\n isLoading: false,\n debug: false,\n\n getExpressCheckoutElementParams: function(payload, callback)\n {\n var serviceUrl = urlBuilder.build('/rest/V1/stripe/payments/ece_params', {}),\n self = this;\n\n return storage.post(\n serviceUrl,\n JSON.stringify(payload),\n false\n )\n .fail(function (xhr, textStatus, errorThrown)\n {\n console.error(\"Could not retrieve initialization params for Express Checkout\");\n })\n .done(function (response) {\n self.processResponseWithECEParams(response, callback);\n });\n },\n\n processResponseWithECEParams: function(response, callback)\n {\n try\n {\n if (typeof response === 'string') {\n response = JSON.parse(response);\n }\n\n if (response && response.resolvePayload)\n {\n if (response.resolvePayload.allowedShippingCountries)\n {\n // Convert to object map to array\n response.resolvePayload.allowedShippingCountries = Object.keys(response.resolvePayload.allowedShippingCountries).map(function (key) { return response.resolvePayload.allowedShippingCountries[key]; });\n }\n\n callback(null, response);\n }\n else\n {\n callback(null, response);\n }\n }\n catch (e)\n {\n callback(e.message, response);\n }\n },\n\n /**\n * Init Stripe Express\n * @param elementId\n * @param apiKey\n * @param paramsType\n * @param settings\n * @param callback\n */\n initStripeExpress: function (elementId, stripeJsInitParams, locationDetails, expressCheckoutOptions, callback)\n {\n // Only one express element is allowed per page\n if (locationDetails.location == 'minicart')\n {\n if (document.body.classList.contains('catalog-product-view') && // We are on the product page\n locationDetails.activeLocations.indexOf('product_page') >= 0) // ECE is enabled on the product page\n return;\n\n if (document.body.classList.contains('checkout-cart-index') && // We are on the cart page\n locationDetails.activeLocations.indexOf('shopping_cart_page') >= 0) // ECE is enabled on the cart page\n return;\n }\n\n if (this.waitingForNewTotals)\n {\n // This method can be called from cart.subscribe(). In that case, we do not want to re-initialize the widget\n // because we are waiting for the addToCart() to finish. We will update the amounts after the addToCart() is done.\n return;\n }\n\n var self = this;\n this.mountElementId = elementId;\n this.stripeJsInitParams = stripeJsInitParams;\n this.locationDetails = locationDetails;\n this.expressCheckoutOptions = expressCheckoutOptions;\n\n this.getExpressCheckoutElementParams(locationDetails, function(err, result)\n {\n if (err)\n {\n console.warn('Cannot initialize wallets: ' + err);\n return;\n }\n\n if (!result.elementOptions)\n return;\n\n if (result.elementOptions.mode != 'setup')\n {\n // if (!result.elementOptions.amount || result.elementOptions.amount == 0)\n // return;\n }\n\n self.mode = result.elementOptions.mode;\n self.clickResolvePayload = result.resolvePayload;\n\n stripe.initStripe(stripeJsInitParams, function (err)\n {\n if (err)\n {\n self.showError(self.maskError(err));\n return;\n }\n\n self.initElements(result.elementOptions);\n self.initExpressCheckoutElement(elementId, expressCheckoutOptions, callback);\n });\n });\n },\n\n // Accepts unlimited parameters\n log: function()\n {\n if (!this.debug)\n return;\n\n console.log.apply(console, arguments);\n },\n\n initElements: function(elementsOptions)\n {\n if (!this.elements)\n {\n this.log('initElements', elementsOptions);\n this.elements = stripe.stripeJs.elements(elementsOptions);\n }\n else\n {\n this.log('updateElements', elementsOptions);\n this.elements.update(elementsOptions);\n }\n },\n\n maskError: function(err)\n {\n var errLowercase = err.toLowerCase();\n var pos1 = errLowercase.indexOf(\"Invalid API key provided\".toLowerCase());\n var pos2 = errLowercase.indexOf(\"No API key provided\".toLowerCase());\n if (pos1 === 0 || pos2 === 0)\n return 'Invalid Stripe API key provided.';\n\n return err;\n },\n\n initExpressCheckoutElement: function(elementId, expressCheckoutOptions, callback)\n {\n if (this.expressCheckoutElement)\n {\n // ECE was already initialized, no need to update it.\n return;\n }\n\n var DOMElement = jQuery(elementId),\n self = this;\n\n try {\n if (typeof expressCheckoutOptions === 'string')\n expressCheckoutOptions = JSON.parse(expressCheckoutOptions);\n\n this.log('initExpressCheckoutElement', expressCheckoutOptions);\n this.expressCheckoutElement = this.elements.create('expressCheckout', expressCheckoutOptions);\n }\n catch (e)\n {\n console.warn(e.message);\n return;\n }\n\n if (document.getElementById(elementId.substr(1)))\n this.expressCheckoutElement.mount(elementId);\n\n this.expressCheckoutElement.on('ready', function (result)\n {\n self.log(\"on.ready\");\n if (result.availablePaymentMethods)\n {\n callback(self.expressCheckoutElement);\n }\n else\n {\n DOMElement.hide();\n }\n });\n },\n\n getClientSecretFromResponse: function(response)\n {\n if (typeof response != \"string\")\n {\n return null;\n }\n\n if (response.indexOf(\"Authentication Required: \") >= 0)\n {\n return response.substring(\"Authentication Required: \".length);\n }\n\n return null;\n },\n\n /**\n * Place Order\n * @param result\n * @param callback\n */\n placeOrder: function (result, location, callback) {\n var serviceUrl = urlBuilder.build('/rest/V1/stripe/payments/place_order', {}),\n payload = {\n result: result,\n location: location\n },\n self = this;\n\n return storage.post(\n serviceUrl,\n JSON.stringify(payload),\n false\n ).fail(function (xhr, textStatus, errorThrown)\n {\n try\n {\n var response = JSON.parse(xhr.responseText);\n\n var clientSecret = self.getClientSecretFromResponse(response.message);\n\n if (clientSecret)\n {\n return stripe.authenticateCustomer(clientSecret, function(err)\n {\n if (err)\n return callback(err, { message: err }, result);\n\n self.placeOrder(result, location, callback);\n });\n }\n else\n callback(response.message, response, result);\n }\n catch (e)\n {\n return self.showError(xhr.responseText);\n }\n }).done(function (response) { // @todo - this should be success, we dont want to callback() on failure\n if (typeof response === 'string')\n {\n try\n {\n response = JSON.parse(response);\n }\n catch (e)\n {\n return self.showError(response);\n }\n }\n\n callback(null, response, result);\n });\n },\n\n /**\n * Add Item to Cart\n * @param params\n * @param shipping_id\n * @param callback\n */\n addToCart: function(params, shipping_id, callback) {\n var self = this;\n this.isAddToCartPending = this.waitingForNewTotals = true;\n var addToCartPromise = new Promise(function(resolve, reject) {\n var serviceUrl = urlBuilder.build('/rest/V1/stripe/payments/addtocart', {}),\n payload = {params: params, shipping_id: shipping_id};\n\n storage.post(\n serviceUrl,\n JSON.stringify(payload),\n false\n ).fail(function(xhr, textStatus, errorThrown) {\n self.parseFailedResponse.apply(self, [xhr.responseText, callback]);\n self.waitingForNewTotals = false;\n reject(); // Reject the promise\n }).done(function(response) {\n customerData.invalidate(['cart']);\n customerData.reload(['cart'], true);\n callback(null, response);\n resolve(); // Resolve the promise\n });\n });\n\n addToCartPromise.then(function() {\n self.isAddToCartPending = false;\n\n // After the promise is resolved, run the functions in the queue\n while (self.pendingActionsQueue.length) {\n var fn = self.pendingActionsQueue.shift(); // Dequeue the first function\n fn(); // Execute the dequeued function\n }\n\n self.waitingForNewTotals = false;\n\n // Invalidate the minicart and display any errors or warnings. The wait is needed so that the server side finishes processing any cart updates\n setTimeout(function()\n {\n customerData.reload(['cart', 'messages'], true);\n }, 1000);\n });\n\n return addToCartPromise;\n },\n\n getShippingAddressFrom: function(eceShippingAddress)\n {\n if (!eceShippingAddress)\n return null;\n\n // For some countries like Japan, the ECE does not set the City, only the region\n if (eceShippingAddress.city.length == 0 && eceShippingAddress.region.length > 0)\n eceShippingAddress.city = eceShippingAddress.region;\n\n return eceShippingAddress;\n },\n\n getNewShippingRatesFor: function(address, callback) {\n var serviceUrl = urlBuilder.build('/rest/V1/stripe/payments/ece_shipping_address_changed', {}),\n payload = {newAddress: address, location: this.locationDetails.location},\n self = this;\n\n return storage.post(\n serviceUrl,\n JSON.stringify(payload),\n false\n ).fail(function (xhr, textStatus, errorThrown)\n {\n self.parseFailedResponse.apply(self, [ xhr.responseText, callback ]);\n }\n ).done(function (response) {\n self.processResponseWithECEParams(response, callback);\n });\n },\n\n parseFailedResponse: function(responseText, callback)\n {\n try\n {\n var response = JSON.parse(responseText);\n callback(response.message);\n }\n catch (e)\n {\n callback(responseText);\n }\n },\n\n /**\n * Apply Shipping and Return Totals\n * @param address\n * @param shipping_id\n * @param callback\n * @returns {*}\n */\n updateShippingRate: function(address, shipping_id, callback) {\n var serviceUrl = urlBuilder.build('/rest/V1/stripe/payments/ece_shipping_rate_changed', {}),\n payload = {address: address, shipping_id: shipping_id},\n self = this;\n\n return storage.post(\n serviceUrl,\n JSON.stringify(payload),\n false\n ).fail(function (xhr, textStatus, errorThrown)\n {\n self.parseFailedResponse.apply(self, [ xhr.responseText, callback ]);\n }\n ).done(function (response) {\n self.processResponseWithECEParams(response, callback);\n });\n },\n\n onShippingAddressChange: function(event)\n {\n this.log(\"onShippingAddressChange\");\n var executeMethod = this.onShippingAddressChangeAction.bind(this, event);\n\n if (this.isAddToCartPending) {\n this.pendingActionsQueue.push(executeMethod);\n } else {\n executeMethod();\n }\n },\n\n onShippingAddressChangeAction: function(event)\n {\n var self = this;\n this.shippingAddress = this.getShippingAddressFrom(event.address);\n this.waitingForNewTotals = true;\n this.getNewShippingRatesFor(this.shippingAddress, function (err, eceResponseParams)\n {\n if (err)\n {\n event.reject();\n self.waitingForNewTotals = false;\n return self.showError(err);\n }\n\n if (!eceResponseParams.resolvePayload.shippingRates)\n {\n event.reject();\n self.waitingForNewTotals = false;\n return;\n }\n\n self.resolveEvent(event, eceResponseParams.resolvePayload);\n self.waitingForNewTotals = false;\n });\n },\n\n resolveEvent: function(event, resolvePayload)\n {\n if (!event)\n return;\n\n var self = this;\n var total = this.getLineItemsTotal(resolvePayload.lineItems);\n\n if (resolvePayload.lineItems && !event.isClick && this.mode != \"setup\")\n {\n if (total > 0)\n {\n this.log('Updating total to ' + total + ' cents');\n var promise = self.elements.update({amount: total});\n }\n else\n {\n this.log('Will not update total to ' + total + ' cents');\n delete resolvePayload.lineItems;\n }\n\n // We need this until a promise is implemented by Stripe\n setTimeout(function() {\n self.log('Resolving event with delay ', resolvePayload);\n event.resolve(resolvePayload);\n }, 1000);\n }\n else\n {\n if (this.mode == \"setup\" && resolvePayload.lineItems)\n {\n delete resolvePayload.lineItems;\n }\n this.log('Resolving event with no delay ', resolvePayload, this.isAddToCartPending, total);\n event.resolve(resolvePayload);\n }\n },\n\n getLineItemsTotal: function(lineItems)\n {\n var total = 0;\n\n if (!lineItems || !lineItems.length)\n return total;\n\n for (var i = 0; i < lineItems.length; i++) {\n total += lineItems[i].amount;\n }\n\n return total;\n },\n\n onShippingRateChange: function(event)\n {\n this.log(\"onShippingRateChange\");\n var executeMethod = this.onShippingRateChangeAction.bind(this, event);\n\n if (this.isAddToCartPending) {\n this.pendingActionsQueue.push(executeMethod);\n } else {\n executeMethod();\n }\n },\n\n onShippingRateChangeAction: function(event)\n {\n var self = this;\n var shippingMethod = event.shippingRate.hasOwnProperty('id') ? event.shippingRate.id : null;\n this.waitingForNewTotals = true;\n this.updateShippingRate(this.shippingAddress, shippingMethod, function (err, response)\n {\n if (err) {\n event.reject();\n self.waitingForNewTotals = false;\n return self.showError(err);\n }\n\n self.resolveEvent(event, response.resolvePayload);\n self.waitingForNewTotals = false;\n });\n },\n\n startLoader: function()\n {\n if (this.isLoading)\n return;\n\n this.isLoading = true;\n jQuery('body').trigger('processStart');\n },\n\n stopLoader: function()\n {\n if (!this.isLoading)\n return;\n\n this.isLoading = false;\n jQuery('body').trigger('processStop');\n },\n\n onConfirm: function(location, confirmResult)\n {\n this.startLoader();\n\n var onPaymentMethodCreated = this.onPaymentMethodCreated.bind(this, confirmResult, location);\n var showError = this.showError.bind(this);\n\n var paymentMethodData = {\n elements: this.elements,\n params: {\n billing_details: confirmResult.billingDetails\n },\n shipping: confirmResult.shippingAddress\n };\n\n this.elements.submit().then(function()\n {\n stripe.stripeJs.createConfirmationToken(paymentMethodData).then(function(createConfirmationTokenResult)\n {\n if (createConfirmationTokenResult.error)\n {\n return showError(createConfirmationTokenResult.error.message);\n }\n else if (createConfirmationTokenResult.confirmationToken)\n {\n confirmResult.confirmationToken = createConfirmationTokenResult.confirmationToken;\n return onPaymentMethodCreated();\n }\n else\n {\n this.stopLoader();\n throw new Error('Invalid response from Stripe');\n }\n }).catch(function(error) {\n return showError(error.message);\n });\n }).catch(function(error) {\n return showError(error.message);\n });\n\n },\n\n onCancel: function()\n {\n this.log(\"onCancel\");\n this.stopLoader();\n },\n\n initCheckoutWidget: function (checkoutValidator)\n {\n var self = this;\n this.expressCheckoutElement.on('click', function(event)\n {\n if (!checkoutValidator())\n {\n event.preventDefault();\n return;\n }\n\n event.isClick = true;\n self.startLoader();\n self.resolveEvent(event, self.clickResolvePayload);\n });\n this.expressCheckoutElement.on('shippingaddresschange', this.onShippingAddressChange.bind(this));\n this.expressCheckoutElement.on('shippingratechange', this.onShippingRateChange.bind(this));\n this.expressCheckoutElement.on('confirm', this.onConfirm.bind(this, 'checkout'));\n this.expressCheckoutElement.on('cancel', this.onCancel.bind(this));\n },\n\n /**\n * Init Widget for Cart Page\n */\n initCartWidget: function ()\n {\n var self = this;\n this.expressCheckoutElement.on('click', function(event) {\n event.isClick = true;\n self.startLoader();\n self.resolveEvent(event, self.clickResolvePayload);\n });\n this.expressCheckoutElement.on('shippingaddresschange', this.onShippingAddressChange.bind(this));\n this.expressCheckoutElement.on('shippingratechange', this.onShippingRateChange.bind(this));\n this.expressCheckoutElement.on('confirm', this.onConfirm.bind(this, 'cart'));\n this.expressCheckoutElement.on('cancel', this.onCancel.bind(this));\n },\n\n /**\n * Init Widget for Mini cart\n */\n initMiniCartWidget: function ()\n {\n var self = this;\n this.expressCheckoutElement.on('click', function(event) {\n event.isClick = true;\n self.startLoader();\n self.resolveEvent(event, self.clickResolvePayload);\n });\n this.expressCheckoutElement.on('shippingaddresschange', this.onShippingAddressChange.bind(this));\n this.expressCheckoutElement.on('shippingratechange', this.onShippingRateChange.bind(this));\n this.expressCheckoutElement.on('confirm', this.onConfirm.bind(this, 'minicart'));\n this.expressCheckoutElement.on('cancel', this.onCancel.bind(this));\n },\n\n /**\n * Init Widget for Single Product Page\n */\n initProductWidget: function ()\n {\n var self = this;\n this.expressCheckoutElement.on('click', function(event) {\n event.isClick = true;\n self.startLoader();\n self.onClickAtProductPage(event);\n });\n this.expressCheckoutElement.on('shippingaddresschange', this.onShippingAddressChange.bind(this));\n this.expressCheckoutElement.on('shippingratechange', this.onShippingRateChange.bind(this));\n this.expressCheckoutElement.on('confirm', this.onConfirm.bind(this, 'product'));\n this.expressCheckoutElement.on('cancel', this.onCancel.bind(this));\n\n this.bindConfigurableProductOptions();\n },\n\n formToArrayObject: function(data) {\n var obj = {};\n for (var i = 0; i < data.length; i++) {\n obj[data[i].name] = data[i].value;\n }\n return obj;\n },\n\n onClickAtProductPage: function(event)\n {\n this.log(\"onClickAtProductPage\");\n var self = this,\n form = jQuery('#product_addtocart_form'),\n params = [];\n\n var validator = form.validation({radioCheckboxClosest: '.nested'});\n\n if (!validator.valid())\n {\n this.stopLoader();\n return;\n }\n\n // Add to Cart\n params = this.formToArrayObject(form.serializeArray());\n this.addToCart(params, this.shippingMethod, function (err)\n {\n if (err)\n {\n return self.showError(err);\n }\n });\n\n this.resolveEvent(event, this.clickResolvePayload);\n },\n\n showError: function(message)\n {\n this.stopLoader();\n\n alert({\n title: $t('Error'),\n content: message,\n actions: {\n always: function (){}\n }\n });\n },\n\n onPaymentMethodCreated: function(result, location)\n {\n var self = this;\n this.placeOrder(result, location, function (err, response, result)\n {\n if (err)\n {\n self.showError(response.message);\n }\n else if (response.hasOwnProperty('redirect'))\n {\n customerData.invalidate(['cart']);\n window.location = response.redirect;\n }\n else\n {\n self.stopLoader();\n }\n });\n },\n\n bindConfigurableProductOptions: function()\n {\n var self = this;\n var options = jQuery(\"#product-options-wrapper .configurable select.super-attribute-select\");\n\n options.each(function(index)\n {\n var onConfigurableProductChanged = self.onConfigurableProductChanged.bind(self, this);\n jQuery(this).on(\"change\", onConfigurableProductChanged);\n });\n },\n\n onConfigurableProductChanged: function(element)\n {\n var self = this;\n\n if (element.value)\n {\n var locationDetails = {\n location: 'product',\n productId: this.locationDetails.productId,\n attribute: element.value\n };\n this.initStripeExpress(\n this.mountElementId,\n this.stripeJsInitParams,\n locationDetails,\n self.expressCheckoutOptions,\n self.initProductWidget.bind(self)\n );\n }\n }\n };\n }\n);\n","StripeIntegration_Payments/js/view/ui_components/setup_element.js":"define(\n [\n 'ko',\n 'uiComponent',\n 'StripeIntegration_Payments/js/action/list-payment-methods',\n 'StripeIntegration_Payments/js/action/add-payment-method',\n 'StripeIntegration_Payments/js/action/delete-payment-method',\n 'StripeIntegration_Payments/js/stripe',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Customer/js/model/customer',\n 'mage/translate',\n 'jquery',\n 'mage/storage',\n 'Magento_Customer/js/customer-data',\n 'Magento_Ui/js/model/messages',\n 'uiLayout'\n ],\n function (\n ko,\n Component,\n listPaymentMethodsAction,\n addPaymentMethodAction,\n deletePaymentMethodAction,\n stripe,\n globalMessageList,\n customer,\n $t,\n $,\n storage,\n customerData,\n messagesModel,\n layout\n ) {\n 'use strict';\n\n return Component.extend({\n externalRedirectUrl: null,\n defaults: {\n template: 'StripeIntegration_Payments/setup_element',\n },\n elements: null,\n initParams: null,\n\n initObservable: function ()\n {\n this._super()\n .observe([\n 'paymentElement',\n 'isPaymentFormComplete',\n 'isPaymentFormVisible',\n 'isLoading',\n 'stripePaymentsError',\n 'permanentError',\n 'isOrderPlaced',\n 'isInitialized',\n 'savedPaymentMethods',\n 'processingSavedPaymentMethods'\n ]);\n\n var self = this;\n\n this.isPaymentFormVisible(false);\n this.isOrderPlaced(false);\n this.isInitialized(false);\n this.processingSavedPaymentMethods(false);\n\n this.hasPaymentMethods = ko.computed(this.hasPaymentMethodsComputed.bind(this));\n\n this.messageContainer = new messagesModel();\n\n var messagesComponent = {\n parent: this.name,\n name: this.name + '.messages',\n displayArea: 'messages',\n component: 'Magento_Ui/js/view/messages',\n config: {\n messageContainer: this.messageContainer,\n autoHideTimeOut: -1\n }\n };\n\n layout([messagesComponent]);\n\n return this;\n },\n\n getStripeParam: function(param)\n {\n if (typeof window.initParams == \"undefined\")\n return null;\n\n if (typeof window.initParams[param] == \"undefined\")\n return null;\n\n return window.initParams[param];\n },\n\n onPaymentElementContainerRendered: function()\n {\n var self = this;\n this.isLoading(true);\n this.listPaymentMethods();\n var initParams = window.initParams;\n\n stripe.initStripe(initParams, function(err)\n {\n if (err)\n return self.crash(err);\n\n self.initSetupElement(initParams);\n });\n },\n\n onContainerRendered: function()\n {\n this.onPaymentElementContainerRendered();\n },\n\n crash: function(message)\n {\n this.isLoading(false);\n this.permanentError($t(\"Sorry, an error has occurred. Please contact us for assistance.\"));\n console.error(\"Error: \" + message);\n },\n\n softCrash: function(message)\n {\n this.showError($t(\"Sorry, an error has occurred. Please contact us for assistance.\"));\n this.stripePaymentsError(message);\n console.error(\"Error: \" + message);\n },\n\n initSetupElement: function(params)\n {\n if (document.getElementById('stripe-setup-element') === null)\n return this.crash(\"Cannot initialize Payment Element on a DOM that does not contain a div.stripe-setup-element.\");\n\n if (!stripe.stripeJs)\n return this.crash(\"Stripe.js could not be initialized.\");\n\n var elements = this.elements = stripe.stripeJs.elements({\n mode: \"setup\",\n setup_future_usage: \"on_session\",\n locale: params.locale,\n currency: params.currency,\n appearance: this.getStripePaymentElementOptions(),\n paymentMethodCreation: \"manual\"\n });\n\n this.paymentElement = elements.create('payment');\n this.paymentElement.mount('#stripe-setup-element');\n this.paymentElement.on('change', this.onChange.bind(this));\n this.isLoading(false);\n },\n\n onChange: function(event)\n {\n this.isLoading(false);\n this.isPaymentFormComplete(event.complete);\n },\n\n getStripePaymentElementOptions: function()\n {\n return {\n theme: 'stripe',\n variables: {\n colorText: '#32325d',\n fontFamily: '\"Open Sans\",\"Helvetica Neue\", Helvetica, Arial, sans-serif',\n },\n };\n },\n\n getAddressField: function(field)\n {\n var address = [];\n\n if (typeof address[field] == \"undefined\")\n return null;\n\n if (typeof address[field] !== \"string\" && typeof address[field] !== \"object\")\n return null;\n\n if (address[field].length == 0)\n return null;\n\n return address[field];\n },\n\n getBillingDetails: function()\n {\n var details = {};\n var address = {};\n\n if (this.getAddressField('city'))\n address.city = this.getAddressField('city');\n\n if (this.getAddressField('countryId'))\n address.country = this.getAddressField('countryId');\n\n if (this.getAddressField('postcode'))\n address.postal_code = this.getAddressField('postcode');\n\n if (this.getAddressField('region'))\n address.state = this.getAddressField('region');\n\n if (this.getAddressField('street'))\n {\n var street = this.getAddressField('street');\n address.line1 = street[0];\n\n if (street.length > 1)\n address.line2 = street[1];\n }\n\n if (Object.keys(address).length > 0)\n details.address = address;\n\n if (this.getAddressField('telephone'))\n details.phone = this.getAddressField('telephone');\n\n if (this.getAddressField('firstname'))\n details.name = this.getAddressField('firstname') + ' ' + this.getAddressField('lastname');\n\n if (customerData.email)\n details.email = customerData.email;\n\n if (Object.keys(details).length > 0)\n return details;\n\n return null;\n },\n\n config: function()\n {\n return self.initParams;\n },\n\n onClick: function(result, outcome, response)\n {\n if (!this.isPaymentFormComplete())\n return this.showError($t('Please complete the payment method details.'));\n\n this.clearErrors();\n\n this.isLoading(true);\n var onPaymentMethodCreated = this.onPaymentMethodCreated.bind(this);\n var onFail = this.onFail.bind(this);\n\n this.createPaymentMethod(onPaymentMethodCreated, onFail);\n },\n\n createPaymentMethod: function(onPaymentMethodCreated, onFail)\n {\n var paymentMethodData = {\n elements: this.elements,\n params: {}\n };\n\n this.elements.submit().then(function()\n {\n stripe.stripeJs.createPaymentMethod(paymentMethodData).then(onPaymentMethodCreated, onFail);\n }, onFail);\n\n },\n\n setNewPaymentMethods: function(newMethods, isDuplicate)\n {\n this.savedPaymentMethods(newMethods);\n\n if (isDuplicate)\n {\n this.showSuccessMessage($t(\"An existing payment method has been updated.\"));\n }\n else\n {\n this.showSuccessMessage($t(\"The payment method has been saved.\"));\n }\n\n this.clearFormData();\n },\n\n onPaymentMethodCreated: function(result)\n {\n var self = this;\n\n if (result.error)\n {\n this.showError(result.error.message);\n }\n else\n {\n addPaymentMethodAction(result.paymentMethod.id, function(response, status, xhr)\n {\n self.isLoading(false);\n if (status == \"success\")\n {\n try\n {\n var data = JSON.parse(response);\n\n var methods = self.savedPaymentMethods();\n if (!methods)\n {\n methods = [];\n }\n\n var isDuplicate = false;\n var newMethods = [];\n\n for (var i in methods)\n {\n if (methods[i].fingerprint != data.fingerprint)\n {\n newMethods.push(methods[i]);\n }\n else\n {\n isDuplicate = true;\n }\n }\n\n newMethods.push(data);\n\n if (data.client_secret)\n {\n stripe.authenticateCustomer(data.client_secret, function(err)\n {\n if (err)\n {\n self.showError($t(\"Sorry, the payment method could not be saved: \" + err));\n return;\n }\n\n self.setNewPaymentMethods(newMethods, isDuplicate);\n });\n }\n else\n {\n self.setNewPaymentMethods(newMethods, isDuplicate);\n }\n }\n catch (e)\n {\n console.warn(e);\n self.showError($t(\"The payment method could not be saved: %1\").replace(\"%1\", e.message));\n }\n }\n else if (response && response.responseJSON && response.responseJSON.message)\n {\n self.showError(response.responseJSON.message);\n }\n else\n {\n self.showError(\"Sorry, the payment methods could not be added.\");\n console.warn(response);\n }\n });\n }\n },\n\n clearFormData: function()\n {\n this.paymentElement.clear();\n $('html, body').animate({ scrollTop: $(\"#my-saved-payment-methods-table\").offset().top - 100}, 500);\n },\n\n onFail: function(result)\n {\n this.showError(\"Could not set up the payment method. Please try again.\");\n console.error(result);\n },\n\n showError: function(message)\n {\n this.isLoading(false);\n this.messageContainer.addErrorMessage({ \"message\": message });\n },\n\n showSuccessMessage: function(message)\n {\n this.isLoading(false);\n this.messageContainer.addSuccessMessage({ \"message\": message });\n },\n\n validate: function(elm)\n {\n return true;\n },\n\n getCode: function()\n {\n return 'stripe_payments';\n },\n\n clearErrors: function()\n {\n this.messageContainer.clear();\n this.stripePaymentsError(null);\n },\n\n hasPaymentMethodsComputed: function()\n {\n return this.savedPaymentMethods() && this.savedPaymentMethods().length > 0;\n },\n\n removePaymentMethod: function(fingerprint)\n {\n var methods = this.savedPaymentMethods();\n if (!methods)\n {\n methods = [];\n }\n\n var newMethods = [];\n\n for (var i in methods)\n {\n if (methods[i].fingerprint != fingerprint)\n {\n newMethods.push(methods[i]);\n }\n }\n\n return newMethods;\n },\n\n deletePaymentMethod: function(paymentMethod)\n {\n var sure = confirm($t(\"Are you sure you want to delete this payment method?\"));\n\n if (!sure)\n return;\n\n var self = this;\n this.processingSavedPaymentMethods(true);\n deletePaymentMethodAction(paymentMethod.id, paymentMethod.fingerprint, function(response, status, xhr)\n {\n self.processingSavedPaymentMethods(false);\n if (status == \"success\")\n {\n try\n {\n var data = JSON.parse(response);\n self.showSuccessMessage(data);\n\n var newMethods = self.removePaymentMethod(paymentMethod.fingerprint);\n self.savedPaymentMethods(newMethods);\n }\n catch (e)\n {\n self.showError($t(\"The payment methods could not be deleted: %1\").replace(\"%1\", e.message));\n }\n }\n else if (response && response.responseJSON && response.responseJSON.message)\n {\n self.showError(response.responseJSON.message);\n }\n else\n {\n self.showError($t(\"The payment methods could not be deleted: %1\").replace(\"%1\", response));\n }\n });\n },\n\n listPaymentMethods: function()\n {\n var self = this;\n this.processingSavedPaymentMethods(true);\n\n listPaymentMethodsAction(function(response, status, xhr)\n {\n self.processingSavedPaymentMethods(false);\n if (status == \"success\")\n {\n try\n {\n var data = JSON.parse(response);\n var methods = [];\n\n for (var fingerprint in data)\n {\n methods.push(data[fingerprint]);\n }\n\n self.savedPaymentMethods(methods);\n }\n catch (e)\n {\n console.warn(e);\n console.warn(response);\n }\n }\n });\n }\n\n });\n }\n);\n","StripeIntegration_Payments/js/view/subscription_update/review.js":"define(\n [\n 'ko',\n 'Magento_Checkout/js/view/payment/default',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Customer/js/model/customer',\n 'StripeIntegration_Payments/js/helper/subscriptions',\n 'StripeIntegration_Payments/js/model/upcomingInvoice',\n 'mage/translate',\n 'jquery',\n 'Magento_Checkout/js/action/place-order',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_CheckoutAgreements/js/model/agreement-validator',\n 'Magento_CheckoutAgreements/js/model/agreements-assigner'\n ],\n function (\n ko,\n Component,\n globalMessageList,\n quote,\n customer,\n subscriptions,\n upcomingInvoice,\n $t,\n $,\n placeOrderAction,\n additionalValidators,\n agreementValidator,\n agreementsAssigner\n ) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'StripeIntegration_Payments/subscription_update/review',\n },\n currentTotals: null,\n newPrice: ko.observable(\"--\"),\n prorationFee: ko.observable(\"--\"),\n unusedTime: ko.observable(\"--\"),\n isPlaceOrderEnabled: ko.observable(false),\n credit: ko.observable(null),\n\n initObservable: function ()\n {\n this._super()\n .observe([\n 'isLoading',\n 'stripePaymentsError',\n 'permanentError',\n 'userError'\n ]);\n\n var self = this;\n\n this.initParams = window.checkoutConfig.payment.stripe_payments.initParams;\n\n upcomingInvoice.initialize();\n var onUpcomingInvoiceChanged = this.onUpcomingInvoiceChanged.bind(this);\n upcomingInvoice.onChange(onUpcomingInvoiceChanged);\n\n this.hasProrationFee = ko.computed(function(){\n return self.prorationFee() && self.prorationFee() != \"--\";\n });\n\n return this;\n },\n\n getConfig: function(key)\n {\n return subscriptions.getConfig(key);\n },\n\n crash: function(message)\n {\n this.isLoading(false);\n if (this.userError())\n this.showError(this.userError());\n else\n this.permanentError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \" + message);\n },\n\n softCrash: function(message)\n {\n this.isLoading(false);\n if (this.userError())\n this.showError(this.userError());\n else\n this.showError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \" + message);\n },\n\n onChange: function(event)\n {\n this.isLoading(false);\n },\n\n placeOrder: function()\n {\n if (!this.validate())\n return;\n\n var self = this;\n this.isPlaceOrderEnabled(false);\n this.isLoading(true);\n\n this.getPlaceOrderDeferredObject()\n .fail(this.handlePlaceOrderErrors.bind(this))\n .done(this.onOrderPlaced.bind(this))\n .always(function(){\n self.isLoading(false);\n self.isPlaceOrderEnabled(true);\n });\n },\n\n getPlaceOrderDeferredObject: function()\n {\n return placeOrderAction(this.getData(), this.messageContainer);\n },\n\n handlePlaceOrderErrors: function (result)\n {\n if (result && result.responseJSON && result.responseJSON.message)\n this.showError(result.responseJSON.message);\n else\n {\n this.showError($t(\"Sorry, the subscription could not be updated. Please contact us for assistance.\"));\n\n if (result && result.responseText)\n console.error(result.responseText);\n else\n console.error(result);\n }\n },\n\n onOrderPlaced: function(result, outcome, response)\n {\n if (result && !isNaN(result))\n {\n $.mage.redirect(subscriptions.getSuccessUrl());\n return;\n }\n\n try\n {\n var jsonResponse = JSON.parse(result);\n if (jsonResponse && jsonResponse.error)\n {\n return this.showError(jsonResponse.error);\n }\n else\n {\n console.warn(\"The order could not be placed. The server response was: \" + result);\n return this.showError($t(\"Sorry, the subscription could not be updated. Please contact us for assistance.\"));\n }\n }\n catch (e)\n {\n console.warn(\"The order could not be placed. The error was: \" + e);\n return this.showError($t(\"Sorry, the subscription could not be updated. Please contact us for assistance.\"));\n }\n },\n\n getData: function()\n {\n var data = {\n 'method': \"stripe_payments\",\n 'additional_data': {\n 'is_subscription_update': true\n }\n };\n\n agreementsAssigner(data);\n\n return data;\n },\n\n showError: function(message)\n {\n this.isLoading(false);\n this.messageContainer.addErrorMessage({ \"message\": message });\n },\n\n validate: function(elm)\n {\n return agreementValidator.validate() && additionalValidators.validate();\n },\n\n getCode: function()\n {\n return 'stripe_payments';\n },\n\n clearErrors: function()\n {\n this.stripePaymentsError(null);\n },\n\n onUpcomingInvoiceChanged: function(result, outcome, response)\n {\n try\n {\n var params = JSON.parse(result);\n\n this.resetTotals();\n\n if (params && params.error)\n {\n this.userError(params.error);\n return this.softCrash(params.error);\n }\n\n if (!params || !params.upcomingInvoice)\n return this.softCrash(\"Could not retrieve upcoming invoice\");\n\n if (params.upcomingInvoice.new_price &&\n params.upcomingInvoice.new_price.label &&\n params.upcomingInvoice.new_price.label.length > 0)\n {\n this.newPrice(params.upcomingInvoice.new_price.label);\n }\n\n if (params.upcomingInvoice.proration_fee &&\n params.upcomingInvoice.proration_fee.label &&\n params.upcomingInvoice.proration_fee.label.length > 0)\n {\n this.prorationFee(params.upcomingInvoice.proration_fee.label);\n }\n\n if (params.upcomingInvoice.unused_time &&\n params.upcomingInvoice.unused_time.label &&\n params.upcomingInvoice.unused_time.label.length > 0)\n {\n this.unusedTime(params.upcomingInvoice.unused_time.label);\n }\n\n if (params.upcomingInvoice.credit)\n {\n this.credit(params.upcomingInvoice.credit);\n }\n\n this.isPlaceOrderEnabled(true);\n }\n catch (e)\n {\n console.warn(\"Could not calculate subscription update prices\");\n console.warn(e);\n }\n },\n\n resetTotals: function()\n {\n this.newPrice(\"--\");\n this.prorationFee(\"--\");\n this.unusedTime(\"--\");\n },\n\n getCancelUrl: function()\n {\n return subscriptions.getCancelUrl();\n }\n\n });\n }\n);\n","StripeIntegration_Payments/js/view/subscription_update/sidebar.js":"define([\n 'ko',\n 'uiComponent',\n 'Magento_Checkout/js/model/totals',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Customer/js/customer-data',\n 'StripeIntegration_Payments/js/helper/subscriptions',\n 'mage/translate',\n 'jquery'\n],\nfunction (\n ko,\n Component,\n totals,\n quote,\n customerData,\n subscriptions,\n $t,\n $\n)\n{\n 'use strict';\n\n return Component.extend({\n isDisplayed: ko.observable(false),\n isLoading: totals.isLoading,\n\n initialize: function()\n {\n this._super();\n\n this.isDisplayed(subscriptions.displaySidebar());\n\n // var self = this;\n\n // window.addEventListener('hashchange', function()\n // {\n // self.isDisplayed(subscriptions.displaySidebar());\n // });\n },\n\n getConfig: function(key)\n {\n return subscriptions.getConfig(key);\n },\n\n cancelUpdate: function()\n {\n var cancelUrl = subscriptions.getCancelUrl();\n var yes = confirm($t(\"Are you sure you want to cancel the subscription update?\"));\n if (yes)\n {\n $.mage.redirect(cancelUrl);\n }\n },\n\n });\n});\n","StripeIntegration_Payments/js/view/checkout/trialing_subscriptions.js":"define(\n [\n 'ko',\n 'Magento_Checkout/js/view/summary/abstract-total',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Catalog/js/price-utils',\n 'Magento_Checkout/js/model/totals',\n 'mage/translate',\n 'StripeIntegration_Payments/js/action/get-trialing-subscriptions',\n 'Magento_Customer/js/customer-data'\n ],\n function (ko, Component, quote, priceUtils, totals, $t, getTrialingSubscriptions, customerData) {\n \"use strict\";\n return Component.extend({\n defaults: {\n isFullTaxSummaryDisplayed: window.checkoutConfig.isFullTaxSummaryDisplayed || false,\n template: 'StripeIntegration_Payments/checkout/trialing_subscriptions',\n trialingSubscriptions: ko.observable(window.checkoutConfig.payment.stripe_payments.trialingSubscriptions),\n fetching: ko.observable(false)\n },\n totals: quote.getTotals(),\n isTaxDisplayedInGrandTotal: window.checkoutConfig.includeTaxInGrandTotal || false,\n\n initialize: function ()\n {\n this._super();\n\n this.observe(['trialingSubscriptions']);\n this.trialingSubscriptions(window.checkoutConfig.payment.stripe_payments.trialingSubscriptions);\n\n this.getFormattedSubscriptionsPrice = ko.computed(function()\n {\n var price = -this.getAmount('subscriptions_total');\n return this.getFormattedPrice(price);\n }, this);\n\n this.getFormattedShipping = ko.computed(function()\n {\n var price = -this.getAmount('shipping_total');\n return this.getFormattedPrice(price);\n }, this);\n\n this.getFormattedTax = ko.computed(function()\n {\n var price = -this.getAmount('tax_total');\n return this.getFormattedPrice(price);\n }, this);\n\n this.getFormattedDiscount = ko.computed(function()\n {\n var price = this.getAmount('discount_total');\n return this.getFormattedPrice(price);\n }, this);\n\n this.hasTrialingSubscriptions = ko.computed(function()\n {\n return this.getAmount('subscriptions_total') !== 0;\n }, this);\n\n this.hasShipping = ko.computed(function()\n {\n return this.getAmount('shipping_total') !== 0;\n }, this);\n\n this.hasTax = ko.computed(function()\n {\n return this.getAmount('tax_total') !== 0;\n }, this);\n\n this.hasDiscount = ko.computed(function()\n {\n return this.getAmount('discount_total') !== 0;\n }, this);\n\n this.trialingSubscriptions(this.getTrialSubscriptions());\n\n var grandTotal = quote.totals().grand_total;\n\n quote.totals.subscribe(function (totals)\n {\n if (grandTotal == quote.totals().grand_total)\n return;\n\n grandTotal = quote.totals().grand_total;\n\n this.refresh(quote);\n }, this);\n },\n\n isDisplayed: function()\n {\n return this.isFullMode() && this.getPureValue() !== 0;\n },\n\n getTrialSubscriptions: function()\n {\n if (\n window.checkoutConfig &&\n window.checkoutConfig.payment &&\n window.checkoutConfig.payment.stripe_payments &&\n window.checkoutConfig.payment.stripe_payments.hasTrialSubscriptions &&\n window.checkoutConfig.payment.stripe_payments.trialingSubscriptions\n )\n {\n return window.checkoutConfig.payment.stripe_payments.trialingSubscriptions;\n }\n\n return null;\n },\n\n refresh: function(quote)\n {\n if (!this.getTrialSubscriptions())\n return;\n\n if (this.fetching())\n return;\n\n var self = this;\n this.fetching(true);\n\n getTrialingSubscriptions(quote)\n .always(function()\n {\n self.fetching(false);\n })\n .done(function (subscriptions)\n {\n try {\n var data = JSON.parse(subscriptions);\n window.checkoutConfig.payment.stripe_payments.trialingSubscriptions = data;\n self.trialingSubscriptions(data);\n } catch (e) {\n console.warn('Could not retrieve trial subscriptions: ' + e.message);\n self.trialingSubscriptions(window.checkoutConfig.payment.stripe_payments.trialingSubscriptions);\n }\n })\n .fail(function (xhr, textStatus, errorThrown)\n {\n console.warn(console.warn('Could not retrieve trial subscriptions: ' + xhr.responseText));\n });\n },\n\n discountTitle: function()\n {\n return $t('Trial Discount');\n },\n\n shippingTitle: function()\n {\n return $t('Trial Shipping');\n },\n\n taxTitle: function()\n {\n return $t('Trial Tax');\n },\n\n getAmount: function(key)\n {\n var config = this.trialingSubscriptions();\n\n if (config == null)\n return 0;\n\n if ((key in config) && !isNaN(config[key]))\n return config[key];\n\n return 0;\n },\n\n getPureValue: function()\n {\n var price = this.getAmount('discount_total') -\n this.getAmount('subscriptions_total') -\n this.getAmount('shipping_total') -\n this.getAmount('tax_total') +\n this.getAmount('tax_inclusive');\n\n return Math.round(price * 10000) / 10000;\n },\n\n getBasePureValue: function()\n {\n var price = this.getAmount('base_discount_total') -\n this.getAmount('base_subscriptions_total') -\n this.getAmount('base_shipping_total') -\n this.getAmount('base_tax_total') +\n this.getAmount('base_tax_inclusive');\n\n return Math.round(price * 10000) / 10000;\n },\n\n getTaxAmount: function()\n {\n return this.getAmount('tax_total');\n },\n\n config: function()\n {\n return window.checkoutConfig.payment.stripe_payments;\n }\n });\n }\n);\n","StripeIntegration_Payments/js/view/checkout/cart/totals/initial_fee.js":"define(\n [\n 'StripeIntegration_Payments/js/view/checkout/summary/initial_fee'\n ],\n function (Component) {\n 'use strict';\n\n return Component.extend(\n {\n isDisplayed: function ()\n {\n return this.getPureValue() !== 0;\n }\n });\n }\n);\n","StripeIntegration_Payments/js/view/checkout/summary/prorations.js":"define(\n [\n 'ko',\n 'mage/translate',\n 'Magento_Checkout/js/view/summary/abstract-total',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Catalog/js/price-utils',\n 'Magento_Checkout/js/model/totals',\n 'StripeIntegration_Payments/js/helper/subscriptions',\n 'StripeIntegration_Payments/js/model/upcomingInvoice'\n ],\n function (\n ko,\n $t,\n Component,\n quote,\n priceUtils,\n totals,\n subscriptions,\n upcomingInvoice\n ) {\n \"use strict\";\n\n return Component.extend({\n defaults: {\n template: 'StripeIntegration_Payments/checkout/summary/prorations'\n },\n totals: quote.getTotals(),\n prorationAdjustment: ko.observable(0),\n baseProrationAdjustment: ko.observable(0),\n\n initialize: function()\n {\n this._super();\n upcomingInvoice.initialize();\n upcomingInvoice.onChange(this.onUpcomingInvoiceChanged.bind(this));\n },\n\n isDisplayed: function()\n {\n return subscriptions.isSubscriptionUpdate() && this.isFullMode() && this.getPureValue() !== 0;\n },\n\n getValue: function()\n {\n var price = this.getPureValue();\n return this.getFormattedPrice(price);\n },\n\n getPureValue: function()\n {\n var price = 0;\n if (subscriptions.isSubscriptionUpdate() && this.prorationAdjustment()) {\n price = this.prorationAdjustment();\n }\n return price;\n },\n\n getBasePureValue: function()\n {\n var price = 0;\n if (subscriptions.isSubscriptionUpdate() && this.baseProrationAdjustment()) {\n price = this.baseProrationAdjustment();\n }\n return price;\n },\n\n onUpcomingInvoiceChanged: function(result, outcome, response)\n {\n try\n {\n var params = JSON.parse(result);\n\n if (params && params.error)\n {\n return;\n }\n\n if (!params || !params.upcomingInvoice)\n return;\n\n if (!isNaN(params.upcomingInvoice.proration_adjustment))\n {\n this.prorationAdjustment(params.upcomingInvoice.proration_adjustment);\n }\n\n if (!isNaN(params.upcomingInvoice.base_proration_adjustment))\n {\n this.baseProrationAdjustment(params.upcomingInvoice.base_proration_adjustment);\n }\n }\n catch (e)\n {\n console.warn(\"Could not calculate sidebar proration amount\");\n console.warn(e);\n }\n },\n });\n }\n);\n","StripeIntegration_Payments/js/view/checkout/summary/initial_fee.js":"define(\n [\n 'Magento_Checkout/js/view/summary/abstract-total',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Catalog/js/price-utils',\n 'Magento_Checkout/js/model/totals'\n ],\n function (Component, quote, priceUtils, totals) {\n \"use strict\";\n return Component.extend({\n defaults: {\n isFullTaxSummaryDisplayed: window.checkoutConfig.isFullTaxSummaryDisplayed || false,\n template: 'StripeIntegration_Payments/checkout/summary/initial_fee'\n },\n totals: quote.getTotals(),\n isTaxDisplayedInGrandTotal: window.checkoutConfig.includeTaxInGrandTotal || false,\n\n isDisplayed: function() {\n return this.isFullMode() && this.getPureValue() !== 0;\n },\n\n getValue: function() {\n var price = 0;\n if (this.totals() && totals.getSegment('initial_fee')) {\n price = totals.getSegment('initial_fee').value;\n }\n return this.getFormattedPrice(price);\n },\n getPureValue: function() {\n var price = 0;\n if (this.totals() && totals.getSegment('initial_fee')) {\n price = totals.getSegment('initial_fee').value;\n }\n return price;\n }\n });\n }\n);\n","StripeIntegration_Payments/js/view/payment/stripe_payments.js":"define(\n [\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/renderer-list',\n 'Magento_Checkout/js/model/payment/method-group',\n 'StripeIntegration_Payments/js/helper/subscriptions'\n ],\n function (\n Component,\n rendererList,\n methodGroup,\n subscriptions\n ) {\n 'use strict';\n\n var subscriptionUpdateComponent = null;\n if (subscriptions.isSubscriptionUpdate())\n {\n subscriptionUpdateComponent = 'StripeIntegration_Payments/js/view/subscription_update/review';\n }\n\n rendererList.push(\n {\n type: 'stripe_payments',\n component: subscriptionUpdateComponent || 'StripeIntegration_Payments/js/view/payment/method-renderer/stripe_payments'\n },\n {\n type: 'stripe_payments_checkout',\n component: subscriptionUpdateComponent || 'StripeIntegration_Payments/js/view/payment/method-renderer/checkout'\n },\n {\n type: 'stripe_payments_bank_transfers',\n component: subscriptionUpdateComponent || 'StripeIntegration_Payments/js/view/payment/method-renderer/bank_transfers'\n }\n );\n\n // Add view logic here if needed\n return Component.extend({});\n }\n);\n","StripeIntegration_Payments/js/view/payment/express_checkout.js":"// This file can only be loaded at the checkout page because it injects Magento_Checkout/js/model/quote\ndefine(\n [\n 'jquery',\n 'uiComponent',\n 'StripeIntegration_Payments/js/helper/subscriptions',\n 'stripe_payments_express',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Ui/js/model/messageList'\n ],\n function (\n $,\n Component,\n subscriptions,\n stripeExpress,\n quote,\n globalMessageList\n ) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n // template: 'StripeIntegration_Payments/payment/express_checkout',\n stripePaymentsShowExpressCheckoutSection: false,\n isECErendered: false\n },\n\n initObservable: function ()\n {\n this._super()\n .observe([\n 'stripePaymentsShowExpressCheckoutSection',\n 'isExpressCheckoutElementSupported'\n ]);\n\n if (subscriptions.isSubscriptionUpdate())\n return this;\n\n var self = this;\n var currentTotals = quote.totals();\n\n quote.totals.subscribe(function (totals)\n {\n if (JSON.stringify(totals.total_segments) == JSON.stringify(currentTotals.total_segments))\n return;\n\n currentTotals = totals;\n\n if (!self.isECErendered)\n return;\n\n self.initECE();\n }, this);\n\n quote.paymentMethod.subscribe(function(method)\n {\n if (method != null)\n {\n $(\".payment-method.stripe-payments.mobile\").removeClass(\"_active\");\n }\n }, null, 'change');\n\n return this;\n },\n\n initECE: function()\n {\n if (!this.config().enabled)\n return;\n\n var self = this;\n var params = self.config().initParams;\n var payload = {\n location: 'checkout'\n };\n stripeExpress.initStripeExpress('#payment-request-button', params, payload, self.config().buttonConfig,\n function () {\n self.isExpressCheckoutElementSupported(true);\n self.stripePaymentsShowExpressCheckoutSection(true);\n stripeExpress.initCheckoutWidget(self.validate.bind(self));\n self.isECErendered = true;\n }\n );\n },\n\n config: function()\n {\n return window.checkoutConfig.payment.express_checkout;\n },\n\n validate: function()\n {\n var agreementsConfig = window.checkoutConfig ? window.checkoutConfig.checkoutAgreements : {},\n agreementsInputPath = '.payment-method.stripe-payments.mobile div.checkout-agreements input';\n var isValid = true;\n\n if (!agreementsConfig.isEnabled || $(agreementsInputPath).length === 0) {\n return true;\n }\n\n $(agreementsInputPath).each(function (index, element)\n {\n if (!$.validator.validateSingleElement(element, {\n errorElement: 'div',\n hideError: false\n })) {\n isValid = false;\n }\n });\n\n return isValid;\n },\n\n showError: function(message)\n {\n document.getElementById('checkout').scrollIntoView(true);\n globalMessageList.addErrorMessage({ \"message\": message });\n }\n });\n }\n);\n","StripeIntegration_Payments/js/view/payment/method-renderer/stripe_payments.js":"define(\n [\n 'ko',\n 'Magento_Checkout/js/view/payment/default',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Customer/js/model/customer',\n 'StripeIntegration_Payments/js/action/post-update-cart',\n 'StripeIntegration_Payments/js/action/post-restore-quote',\n 'StripeIntegration_Payments/js/action/post-cancel-order',\n 'StripeIntegration_Payments/js/action/get-requires-action',\n 'StripeIntegration_Payments/js/view/checkout/trialing_subscriptions',\n 'StripeIntegration_Payments/js/stripe',\n 'stripe_payments_express',\n 'mage/translate',\n 'mage/url',\n 'jquery',\n 'Magento_Checkout/js/action/place-order',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/action/redirect-on-success',\n 'mage/storage',\n 'mage/url',\n 'Magento_CheckoutAgreements/js/model/agreement-validator',\n 'Magento_Customer/js/customer-data',\n 'Magento_Checkout/js/model/payment-service'\n ],\n function (\n ko,\n Component,\n globalMessageList,\n quote,\n customer,\n updateCartAction,\n restoreQuoteAction,\n cancelLastOrderAction,\n getRequiresAction,\n trialingSubscriptions,\n stripe,\n stripeExpress,\n $t,\n url,\n $,\n placeOrderAction,\n additionalValidators,\n redirectOnSuccessAction,\n storage,\n urlBuilder,\n agreementValidator,\n customerData,\n paymentService\n ) {\n 'use strict';\n\n return Component.extend({\n externalRedirectUrl: null,\n defaults: {\n template: 'StripeIntegration_Payments/payment/element',\n stripePaymentsShowExpressCheckoutSection: false\n },\n redirectAfterPlaceOrder: false,\n elements: null,\n initParams: null,\n paymentElement: null,\n zeroDecimalCurrencies: ['BIF','CLP','DJF','GNF','JPY','KMF','KRW','MGA','PYG','RWF','UGX','VND','VUV','XAF','XOF','XPF'],\n threeDecimalCurrencies: ['BHD','JOD','KWD','OMR','TND'],\n selectedPaymentMethodCode: null,\n\n initObservable: function ()\n {\n this._super()\n .observe([\n 'paymentElement',\n 'isPaymentFormComplete',\n 'isPaymentFormVisible',\n 'isLoading',\n 'stripePaymentsError',\n 'permanentError',\n 'isOrderPlaced',\n 'isInitializing',\n 'isInitialized',\n 'useQuoteBillingAddress',\n 'cvcToken',\n 'paymentElementPaymentMethod',\n\n // Saved payment methods dropdown\n 'dropdownOptions',\n 'selection',\n 'isDropdownOpen'\n ]);\n\n var self = this;\n\n this.isPaymentFormVisible(false);\n this.isOrderPlaced(false);\n this.isInitializing(true);\n this.isInitialized(false);\n this.useQuoteBillingAddress(false);\n this.cvcToken(null);\n this.collectCvc = ko.computed(this.shouldCollectCvc.bind(this));\n this.isAmex = ko.computed(this.isAmexSelected.bind(this));\n this.cardCvcElement = null;\n\n var currentTotals = quote.totals();\n var currentShippingAddress = quote.shippingAddress();\n var currentBillingAddress = quote.billingAddress();\n\n quote.totals.subscribe(function (totals)\n {\n if (!totals || !totals.grand_total || !totals.quote_currency_code)\n {\n return;\n }\n\n if (!currentTotals || !currentTotals.grand_total || !currentTotals.quote_currency_code)\n {\n currentTotals = totals;\n return;\n }\n\n var amount1 = totals.grand_total;\n var amount2 = currentTotals.grand_total;\n var currency1 = totals.quote_currency_code;\n var currency2 = currentTotals.quote_currency_code;\n\n if (amount1 === amount2 && currency1 === currency2)\n {\n return;\n }\n\n currentTotals = totals;\n\n self.onQuoteTotalsChanged.bind(self)();\n self.isOrderPlaced(false);\n }, this);\n\n quote.paymentMethod.subscribe(function (method)\n {\n if (method && method.method == this.getCode() && !this.isInitializing())\n {\n // We intentionally re-create the element because its container element may have changed\n this.initPaymentForm();\n }\n }, this);\n\n quote.billingAddress.subscribe(function(address)\n {\n if (address && self.paymentElement && self.paymentElement.update && !self.isPaymentFormComplete())\n {\n // Remove the postcode & country fields if a billing address has been specified\n self.paymentElement.update(self.getPaymentElementUpdateOptions());\n }\n });\n\n return this;\n },\n\n initSavedPaymentMethods: function()\n {\n // If it is already initialized, do not re-initialize\n if (this.dropdownOptions())\n {\n return;\n }\n\n var options = [];\n var methods = this.getStripeParam(\"savedMethods\");\n if (methods)\n {\n for (var i in methods)\n {\n if (methods.hasOwnProperty(i))\n {\n // We do this because some themes and libraries extend all objects with their own methods\n options.push(methods[i]);\n }\n }\n }\n\n if (options.length > 0)\n {\n this.isPaymentFormVisible(false);\n this.selection(options[0]);\n }\n else\n {\n this.isPaymentFormVisible(true);\n this.selection(false);\n }\n\n this.dropdownOptions(options);\n },\n\n shouldCollectCvc: function()\n {\n var selection = this.selection();\n\n if (!selection)\n return false;\n\n if (selection.type != 'card')\n return false;\n\n return !!selection.cvc;\n },\n\n isAmexSelected: function()\n {\n var selection = this.selection();\n\n if (!selection)\n return false;\n\n if (selection.type != 'card')\n return false;\n\n return (selection.brand == \"amex\");\n },\n\n newPaymentMethod: function()\n {\n this.messageContainer.clear();\n\n this.selection({\n type: 'new',\n value: 'new',\n icon: false,\n label: $t('New payment method')\n });\n this.isDropdownOpen(false);\n this.isPaymentFormVisible(true);\n if (!this.isInitialized())\n {\n this.onContainerRendered();\n this.isInitialized(true);\n }\n },\n\n getPaymentMethodId: function()\n {\n if (this.isExternalPaymentMethodCode(this.selectedPaymentMethodCode))\n {\n return this.selectedPaymentMethodCode;\n }\n\n var selection = this.selection();\n\n if (selection && typeof selection.value != \"undefined\" && selection.value != \"new\")\n {\n return selection.value;\n }\n\n var paymentMethod = this.paymentElementPaymentMethod();\n if (paymentMethod && paymentMethod.id)\n {\n return paymentMethod.id;\n }\n\n return null;\n },\n\n toggleDropdown: function()\n {\n this.isDropdownOpen(!this.isDropdownOpen());\n },\n\n getStripeParam: function(param)\n {\n var params = this.getInitParams();\n\n if (!params)\n {\n return null;\n }\n\n if (typeof params[param] != \"undefined\")\n {\n return params[param];\n }\n\n return null;\n },\n\n onQuoteTotalsChanged: function()\n {\n if (!this.elements || !this.elements.update)\n {\n return;\n }\n\n try\n {\n this.elements.update(this.getElementsOptions(true));\n }\n catch (e)\n {\n this.elements.update(this.getElementsOptions(false));\n }\n },\n\n getInitParams: function()\n {\n return window.checkoutConfig.payment.stripe_payments.initParams;\n },\n\n isWalletEnabled: function(walletName)\n {\n if (window.checkoutConfig &&\n window.checkoutConfig.payment &&\n window.checkoutConfig.payment.express_checkout &&\n window.checkoutConfig.payment.express_checkout.buttonConfig &&\n window.checkoutConfig.payment.express_checkout.buttonConfig.paymentMethods &&\n window.checkoutConfig.payment.express_checkout.buttonConfig.paymentMethods[walletName]\n )\n {\n var value = window.checkoutConfig.payment.express_checkout.buttonConfig.paymentMethods[walletName];\n return (value == \"always\" || value == \"auto\");\n }\n\n return false;\n },\n\n onPaymentElementContainerRendered: function()\n {\n var self = this;\n this.isLoading(true);\n stripe.initStripe(this.getInitParams(), function(err)\n {\n if (err)\n return self.crash(err);\n\n self.initSavedPaymentMethods();\n self.initPaymentForm();\n });\n },\n\n onContainerRendered: function()\n {\n this.onPaymentElementContainerRendered();\n },\n\n getCardCVCOptions: function()\n {\n return {\n style: {\n base: {\n // iconColor: '#c4f0ff',\n // color: '#fff',\n // fontWeight: '500',\n // fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',\n fontSize: '16px',\n // fontSmoothing: 'antialiased',\n // ':-webkit-autofill': {\n // color: '#fce883',\n // },\n // '::placeholder': {\n // color: '#87BBFD',\n // },\n // },\n // invalid: {\n // iconColor: '#FFC7EE',\n // color: '#FFC7EE',\n },\n },\n };\n },\n\n onCvcContainerRendered: function()\n {\n var self = this;\n var params = this.getInitParams();\n\n stripe.initStripe(params, function(err)\n {\n if (err)\n return self.crash(err);\n\n var options = {};\n if (params && params.locale)\n {\n options.locale = params.locale;\n }\n\n try\n {\n var elements = stripe.stripeJs.elements(options);\n self.cardCvcElement = elements.create('cardCvc', self.getCardCVCOptions());\n self.cardCvcElement.mount('#stripe-card-cvc-element');\n self.cardCvcElement.on('change', self.onCvcChange.bind(self));\n self.cardCvcElement.on('loaderror', self.onLoadError.bind(self));\n }\n catch (e)\n {\n this.crash(e.message);\n }\n });\n },\n\n onCvcChange: function(event)\n {\n if (event.error)\n this.selection().cvcError = event.error.message;\n else\n this.selection().cvcError = null;\n },\n\n crash: function(message)\n {\n this.isLoading(false);\n var userError = this.getStripeParam(\"userError\");\n if (userError)\n this.permanentError(userError);\n else\n this.permanentError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \", message);\n },\n\n softCrash: function(message)\n {\n var userError = this.getStripeParam(\"userError\");\n if (userError)\n this.showError(userError);\n else\n this.showError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \", message);\n },\n\n isCollapsed: function()\n {\n if (this.isChecked() == this.getCode())\n {\n return false;\n }\n else\n {\n return true;\n }\n },\n\n initPaymentForm: function()\n {\n this.isInitializing(false);\n this.isLoading(false);\n\n if (this.isCollapsed()) // Don't render PE with a height of 0\n return;\n\n if (document.getElementById('stripe-payment-element') === null)\n return this.crash(\"Cannot initialize Payment Element on a DOM that does not contain a div.stripe-payment-element.\");\n\n if (!stripe.stripeJs)\n return this.crash(\"Stripe.js could not be initialized.\");\n\n if (this.getStripeParam(\"isOrderPlaced\"))\n this.isOrderPlaced(true);\n\n try\n {\n try\n {\n this.elements = stripe.stripeJs.elements(this.getElementsOptions(true));\n }\n catch (e)\n {\n console.warn(\"Could not filter Stripe payment method types: \" + e.message);\n this.elements = stripe.stripeJs.elements(this.getElementsOptions(false));\n }\n this.paymentElement = this.elements.create('payment', this.getPaymentElementOptions());\n this.paymentElement.mount('#stripe-payment-element');\n this.paymentElement.on('change', this.onChange.bind(this));\n this.paymentElement.on('loaderror', this.onLoadError.bind(this));\n }\n catch (e)\n {\n this.crash(e.message);\n }\n },\n\n onLoadError: function(event)\n {\n if (event && event.error && event.error.message)\n {\n this.permanentError(event.error.message);\n }\n else\n {\n this.crash(event);\n }\n },\n\n shouldHideRedirectBasedPaymentMethods: function()\n {\n var totals = quote.totals();\n if (!totals || !totals.total_segments || !totals.total_segments.length)\n {\n return false;\n }\n\n var targetSegments = [\"giftcardaccount\", \"customerbalance\", \"reward\"];\n\n for (var i = 0; i < totals.total_segments.length; i++)\n {\n var segment = totals.total_segments[i];\n if (targetSegments.indexOf(segment.code) >= 0 && !isNaN(segment.value) && segment.value != 0)\n {\n return true;\n }\n }\n\n return false;\n },\n\n getElementsOptions: function(filterPaymentMethods)\n {\n var options = Object.assign({}, window.checkoutConfig.payment.stripe_payments.elementOptions);\n\n if (this.shouldHideRedirectBasedPaymentMethods())\n {\n options.paymentMethodTypes = ['card'];\n\n if (this.isWalletEnabled(\"link\"))\n {\n options.paymentMethodTypes.push('link');\n }\n }\n else if (options.paymentMethodTypes)\n {\n // Case where paymentMethodOptions were passed from the server side\n }\n else\n {\n // Unset any previously set paymentMethodTypes in case a gift card was removed etc\n options.paymentMethodTypes = null;\n }\n\n if (!filterPaymentMethods && options.paymentMethodTypes)\n delete options.paymentMethodTypes;\n\n if (options.mode != \"setup\")\n {\n options.amount = this.getElementsAmount();\n }\n\n var externalPaymentMethods = this.getExternalPaymentMethods();\n if (externalPaymentMethods)\n {\n options.externalPaymentMethodTypes = externalPaymentMethods.map(function(method)\n {\n return method.code;\n });\n }\n\n return options;\n },\n\n getExternalPaymentMethods: function()\n {\n var initParams = this.getInitParams();\n\n if (initParams &&\n initParams.externalPaymentMethods &&\n initParams.externalPaymentMethods.length > 0 &&\n initParams.externalPaymentMethods[0].code &&\n initParams.externalPaymentMethods[0].redirect_url\n )\n {\n return initParams.externalPaymentMethods;\n }\n\n return null;\n },\n\n getPaymentElementOptions: function()\n {\n var options = {};\n\n var params = this.getInitParams();\n if (params)\n {\n if (params.wallets)\n options.wallets = params.wallets;\n\n if (params.layout)\n options.layout = params.layout;\n\n if (params.terms)\n options.terms = params.terms;\n }\n\n var billingAddress = quote.billingAddress();\n\n if (billingAddress)\n {\n try\n {\n this.useQuoteBillingAddress(true);\n\n var hasState = (billingAddress.region || billingAddress.regionCode || billingAddress.regionId);\n\n options.fields = {\n billingDetails: {\n name: 'never',\n email: 'never',\n phone: (billingAddress.telephone ? 'never' : 'auto'),\n address: {\n line1: ((billingAddress.street.length > 0) ? 'never' : 'auto'),\n line2: ((billingAddress.street.length > 0) ? 'never' : 'auto'),\n city: billingAddress.city ? 'never' : 'auto',\n state: hasState ? 'never' : 'auto',\n country: billingAddress.countryId ? 'never' : 'auto',\n postalCode: billingAddress.postcode ? 'never' : 'auto'\n }\n }\n };\n }\n catch (e)\n {\n this.useQuoteBillingAddress(false);\n\n options.fields = {};\n console.warn('Could not retrieve billing address: ' + e.message);\n }\n\n // Set the default billing address in order to enable the Link payment method\n var billingDetails = this.getBillingDetails();\n\n if (billingDetails)\n {\n options.defaultValues = {\n billingDetails: billingDetails\n };\n }\n }\n else\n {\n this.useQuoteBillingAddress(false);\n }\n\n return options;\n },\n\n getPaymentElementUpdateOptions: function()\n {\n var options = this.getPaymentElementOptions();\n\n if (options.wallets)\n {\n delete options.wallets;\n }\n\n return options;\n },\n\n onChange: function(event)\n {\n this.isLoading(false);\n this.isPaymentFormComplete(event.complete);\n\n if (event.value && event.value.type)\n {\n this.selectedPaymentMethodCode = event.value.type;\n }\n else\n {\n this.selectedPaymentMethodCode = null;\n }\n },\n\n isExternalPaymentMethodCode: function(code)\n {\n var methods = this.getExternalPaymentMethods();\n if (!methods)\n return false;\n\n for (var i = 0; i < methods.length; i++)\n {\n if (methods[i].code == code)\n return true;\n }\n\n return false;\n },\n\n getExternalPaymentMethodRedirectUrl: function(code)\n {\n var methods = this.getExternalPaymentMethods();\n if (!methods)\n return null;\n\n for (var i = 0; i < methods.length; i++)\n {\n if (methods[i].code == code)\n return methods[i].redirect_url;\n }\n\n return null;\n },\n\n getElementsAmount: function()\n {\n var totals = quote.totals();\n\n if (totals && totals.grand_total)\n {\n // If total_segments includes a grand_total, we use that instead\n if (totals.total_segments && totals.total_segments.length > 0)\n {\n for (var i = 0; i < totals.total_segments.length; i++)\n {\n var segment = totals.total_segments[i];\n if (segment.code == \"grand_total\")\n {\n return this.convertToStripeAmount(segment.value, this.getElementsCurrency());\n }\n }\n }\n\n // Othewise use the quote grand total\n var amount = totals.grand_total;\n return this.convertToStripeAmount(amount, this.getElementsCurrency());\n }\n\n return 0;\n },\n\n getElementsCurrency: function()\n {\n var totals = quote.totals();\n if (totals && totals.quote_currency_code)\n {\n var currency = totals.quote_currency_code;\n return currency.toLowerCase();\n }\n\n return 'USD';\n },\n\n isBillingAddressSet: function()\n {\n return quote.billingAddress() && quote.billingAddress().canUseForBilling();\n },\n\n convertToStripeAmount: function(amount, currencyCode)\n {\n var code = currencyCode.toUpperCase();\n\n if (this.zeroDecimalCurrencies.indexOf(code) >= 0)\n {\n return Math.round(amount);\n }\n else if (this.threeDecimalCurrencies.indexOf(code) >= 0)\n {\n return Math.round(amount * 100) * 10;\n }\n else\n {\n return Math.round(amount * 100);\n }\n },\n\n isPlaceOrderEnabled: function()\n {\n if (this.stripePaymentsError())\n return false;\n\n if (this.permanentError())\n return false;\n\n return this.isBillingAddressSet();\n },\n\n getAddressField: function(field)\n {\n if (!quote.billingAddress())\n return null;\n\n var address = quote.billingAddress();\n\n if (!address[field] || address[field].length == 0)\n return null;\n\n return address[field];\n },\n\n getBillingDetails: function()\n {\n var details = {};\n var address = {};\n\n if (this.getAddressField('city'))\n address.city = this.getAddressField('city');\n\n if (this.getAddressField('countryId'))\n address.country = this.getAddressField('countryId');\n\n if (this.getAddressField('postcode'))\n address.postal_code = this.getAddressField('postcode');\n\n if (this.getAddressField('region'))\n address.state = this.getAddressField('region');\n\n if (this.getAddressField('street'))\n {\n var street = this.getAddressField('street');\n address.line1 = street[0];\n\n if (street.length > 1)\n address.line2 = street[1];\n }\n\n if (Object.keys(address).length > 0)\n details.address = address;\n\n if (this.getAddressField('telephone'))\n details.phone = this.getAddressField('telephone');\n\n if (this.getAddressField('firstname'))\n details.name = this.getAddressField('firstname') + ' ' + this.getAddressField('lastname');\n\n if (quote.guestEmail)\n details.email = quote.guestEmail;\n else if (customerData.email)\n details.email = customerData.email;\n\n if (Object.keys(details).length > 0)\n return details;\n\n return null;\n },\n\n config: function()\n {\n return window.checkoutConfig.payment[this.getCode()];\n },\n\n isActive: function(parents)\n {\n return true;\n },\n\n placeOrder: function()\n {\n this.messageContainer.clear();\n\n if (!this.isPaymentFormComplete() && !this.getPaymentMethodId())\n return this.showError($t('Please complete your payment details.'));\n\n if (!this.validate())\n return;\n\n this.clearErrors();\n this.isPlaceOrderActionAllowed(false);\n this.isLoading(true);\n this.cvcToken(null);\n\n var params = { };\n\n if (this.useQuoteBillingAddress())\n {\n params.payment_method_data = {\n billing_details: {\n address: this.getStripeFormattedAddress(quote.billingAddress()),\n email: this.getBillingEmail(),\n name: this.getNameFromAddress(quote.billingAddress()),\n phone: this.getBillingPhone()\n }\n };\n }\n\n if (this.hasShipping())\n {\n params.shipping = {\n address: this.getStripeFormattedAddress(quote.shippingAddress()),\n name: this.getNameFromAddress(quote.shippingAddress())\n };\n }\n\n var self = this;\n\n if (this.isSavedCardSelected() && this.selection().cvc)\n {\n stripe.stripeJs.createToken('cvc_update', this.cardCvcElement).then(function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n }\n else if (result.token)\n {\n self.cvcToken(result.token.id);\n self.placeOrderWithSavedPaymentMethod.bind(self)();\n }\n else\n {\n self.showError('Could not perform CVC check.');\n }\n });\n }\n else if (this.isSavedPaymentMethodSelected())\n {\n this.placeOrderWithSavedPaymentMethod();\n }\n else if (this.isExternalPaymentMethodCode(this.selectedPaymentMethodCode))\n {\n this.onPaymentMethodCreatedForOrderPlacement();\n }\n else\n {\n this.createPaymentMethod(this.onPaymentMethodCreatedForOrderPlacement.bind(this));\n }\n\n return false;\n },\n\n hasShipping: function()\n {\n return (quote && quote.shippingMethod() && quote.shippingMethod().method_code);\n },\n\n createPaymentMethod: function(callback)\n {\n this.paymentElementPaymentMethod(null);\n\n var self = this;\n\n var paymentMethodData = {\n elements: this.elements,\n params: {}\n };\n\n var confirmParams = this.getConfirmParams();\n var billingDetails = null;\n if (confirmParams &&\n confirmParams.confirmParams &&\n confirmParams.confirmParams.payment_method_data &&\n confirmParams.confirmParams.payment_method_data.billing_details\n )\n {\n billingDetails = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n\n if (billingDetails)\n {\n paymentMethodData.params.billing_details = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n else\n {\n return this.showError($t(\"Please specify a billing address.\"));\n }\n\n setTimeout(function(){\n // The loading mask is disabled so that the MFTF tests can continue running\n self.isLoading(false);\n }, 4000);\n this.elements.submit().then(function()\n {\n stripe.stripeJs.createPaymentMethod(paymentMethodData).then(function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n console.error(result.error.message);\n }\n else\n {\n self.paymentElementPaymentMethod(result.paymentMethod);\n callback(result.paymentMethod);\n }\n });\n },\n function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n console.error(result.error.message);\n }\n else\n {\n self.showError(\"A payment submission error has occurred.\");\n console.error(result);\n }\n });\n },\n\n isSavedPaymentMethodSelected: function()\n {\n var selectedMethodType = this.getSelectedMethod(\"type\");\n\n if (!selectedMethodType) // There is no saved PMs dropdown\n return false;\n\n if (selectedMethodType != 'new') // A saved PMs is selected\n return true;\n\n return false; // New PM is selected\n },\n\n isSavedCardSelected: function()\n {\n var selectedMethodType = this.getSelectedMethod(\"type\");\n\n if (!selectedMethodType) // There is no saved PMs dropdown\n return false;\n\n if (selectedMethodType == 'card') // A saved PMs is selected\n return true;\n\n return false; // New PM is selected\n },\n\n placeOrderWithSavedPaymentMethod: function()\n {\n var self = this;\n var placeNewOrder = this.placeNewOrder.bind(this);\n\n if (this.isOrderPlaced()) // The order was already placed but either 3D Secure failed or the customer pressed the back button from an external payment page\n {\n updateCartAction(this.getData(), this.onCartUpdated.bind(this));\n }\n else\n {\n try\n {\n placeNewOrder();\n }\n catch (e)\n {\n this.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(e.message);\n }\n }\n },\n\n onPaymentMethodCreatedForOrderPlacement: function(paymentMethod)\n {\n var placeNewOrder = this.placeNewOrder.bind(this);\n var self = this;\n\n if (self.isOrderPlaced()) // The order was already placed but either 3D Secure failed or the customer pressed the back button from an external payment page\n {\n updateCartAction(this.getData(), this.onCartUpdated.bind(this));\n }\n else\n {\n try\n {\n placeNewOrder();\n }\n catch (e)\n {\n self.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(e.message);\n }\n }\n },\n\n onCartUpdated: function(result, outcome, response)\n {\n var placeNewOrder = this.placeNewOrder.bind(this);\n var onOrderPlaced = this.onOrderPlaced.bind(this);\n try\n {\n var data = JSON.parse(result);\n if (data.error)\n {\n this.showError(data.error);\n }\n else if (data.redirect)\n {\n $.mage.redirect(data.redirect);\n }\n else if (data.placeNewOrder)\n {\n placeNewOrder();\n }\n else\n {\n onOrderPlaced();\n }\n }\n catch (e)\n {\n this.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(e.message);\n }\n },\n\n placeNewOrder: function()\n {\n var self = this;\n\n this.isLoading(false); // Needed for the terms and conditions checkbox\n this.getPlaceOrderDeferredObject()\n .fail(this.handlePlaceOrderErrors.bind(this))\n .done(this.onOrderPlaced.bind(this))\n .always(function(response, status, xhr)\n {\n if (status != \"success\")\n {\n self.isLoading(false);\n }\n });\n },\n\n getSelectedMethod: function(param)\n {\n var selection = this.selection();\n if (!selection)\n return null;\n\n if (typeof selection[param] == \"undefined\")\n return null;\n\n return selection[param];\n },\n\n // Called when:\n // - A brand new order has just been placed\n // - After updateCartAction() with placeNewOrder == false\n onOrderPlaced: function(result, outcome, response)\n {\n if (!this.isOrderPlaced() && isNaN(result))\n {\n return this.softCrash(\"The order was placed but the response from the server did not include a numeric order ID.\");\n }\n else\n {\n this.isOrderPlaced(true);\n }\n\n this.isLoading(true);\n\n if (this.isExternalPaymentMethodCode(this.selectedPaymentMethodCode))\n {\n window.location.href = this.getExternalPaymentMethodRedirectUrl(this.selectedPaymentMethodCode);\n return;\n }\n\n var self = this;\n var handleNextActions = this.handleNextActions.bind(this);\n getRequiresAction(function(clientSecret)\n {\n try\n {\n if (clientSecret && clientSecret.length)\n {\n stripe.authenticateCustomer(clientSecret, function(err)\n {\n if (err)\n return self.showError(err);\n\n self.onConfirm.bind(self)();\n });\n }\n else\n {\n // No further actions are needed\n self.onConfirm(null);\n }\n }\n catch (e)\n {\n restoreQuoteAction();\n self.showError(\"The order was placed but we could not confirm if the payment was successful.\");\n console.error(e);\n }\n\n })\n .fail(function(result)\n {\n restoreQuoteAction();\n self.showError(\"The order was placed but we could not confirm if the payment was successful.\");\n console.error(result);\n });\n },\n\n isSuccessful: function(stripeObject)\n {\n\n if (stripeObject.status == \"requires_action\" &&\n stripeObject.next_action &&\n stripeObject.next_action.type &&\n stripeObject.next_action.type != \"use_stripe_sdk\"\n )\n {\n // This is the case for vouchers, where an offline payment is required\n return true;\n }\n\n\n return (['processing', 'requires_capture', 'succeeded'].indexOf(stripeObject.status) >= 0);\n },\n\n // Called when:\n // - A brand new order has just been placed\n // - After updateCartAction() with placeNewOrder == false\n handleNextActions: function(stripeObject)\n {\n if (!this.isOrderPlaced())\n {\n return this.softCrash(\"Cannot handleNextActions without placing the order first\");\n }\n\n var self = this;\n\n if (this.isSuccessful(stripeObject))\n {\n this.onConfirm(null);\n }\n else if (stripeObject.status == \"requires_action\")\n {\n // Non-card based confirms may redirect the customer externally. We restore the quote just before it in case the\n // customer clicks the back button on the browser before authenticating the payment.\n restoreQuoteAction(function()\n {\n stripe.stripeJs.handleNextAction({\n clientSecret: stripeObject.client_secret\n }).then(self.onConfirm.bind(self));\n });\n }\n else if (stripeObject.status == \"requires_confirmation\")\n {\n // This should only hit when a payment failed with a saved PM, and then the customer switched to PaymentElement to enter a new payment method\n restoreQuoteAction(function()\n {\n // We pass null because we do not want to update the PM. It has already been updated with stripe.updatePaymentIntent\n updateCartAction(self.getData(), self.onCartUpdated.bind(self));\n });\n }\n else if (stripeObject.status == \"requires_payment_method\")\n {\n restoreQuoteAction(function()\n {\n updateCartAction(self.getData(), self.onCartUpdated.bind(self));\n });\n }\n else\n {\n restoreQuoteAction(function()\n {\n self.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(\"Could not finalize order bacause the payment intent is in status \" + stripeObject.status);\n });\n }\n },\n\n getConfirmParams: function()\n {\n var params = {\n elements: this.elements,\n confirmParams: {\n return_url: this.getStripeParam(\"successUrl\")\n }\n };\n\n this.getPaymentElementOptions();\n if (this.useQuoteBillingAddress())\n {\n params.confirmParams.payment_method_data = {\n billing_details: {\n address: this.getStripeFormattedAddress(quote.billingAddress()),\n email: this.getBillingEmail(),\n name: this.getNameFromAddress(quote.billingAddress()),\n phone: this.getBillingPhone()\n }\n };\n }\n\n return params;\n },\n\n getStripeFormattedAddress: function(address)\n {\n var stripeAddress = {};\n\n if (address.regionCode)\n stripeAddress.state = address.regionCode;\n else\n stripeAddress.state = address.region ? address.region : null;\n\n stripeAddress.postal_code = address.postcode ? address.postcode : null;\n stripeAddress.country = address.countryId ? address.countryId : null;\n stripeAddress.city = address.city ? address.city : null;\n\n if (address.street && address.street.length > 0)\n {\n stripeAddress.line1 = address.street[0];\n\n if (address.street.length > 1)\n {\n stripeAddress.line2 = address.street[1];\n }\n else\n {\n stripeAddress.line2 = null;\n }\n }\n else\n {\n stripeAddress.line1 = null;\n stripeAddress.line2 = null;\n }\n\n return stripeAddress;\n },\n\n getBillingEmail: function()\n {\n if (quote.guestEmail)\n {\n return quote.guestEmail;\n }\n else if (window.checkoutConfig.customerData && window.checkoutConfig.customerData.email)\n {\n return window.checkoutConfig.customerData.email;\n }\n\n return null;\n },\n\n getNameFromAddress: function(address)\n {\n if (!address)\n return null;\n\n var parts = [];\n if (address.firstname)\n parts.push(address.firstname);\n\n if (address.middlename)\n parts.push(address.middlename);\n\n if (address.lastname)\n parts.push(address.lastname);\n\n return parts.join(\" \");\n },\n\n getBillingPhone: function()\n {\n var billingAddress = quote.billingAddress();\n if (!billingAddress)\n return null;\n\n if (billingAddress.telephone)\n return billingAddress.telephone;\n\n return null;\n },\n\n onConfirm: function(result)\n {\n if (result && result.error)\n {\n this.showError(result.error.message);\n\n if (this.isOrderPlaced())\n {\n cancelLastOrderAction(result.error.message);\n this.isOrderPlaced(false);\n }\n }\n else\n {\n customerData.invalidate(['cart']);\n // In the case of a 3DS, we redirect to stripe/payment/index so that the quote is de-activated\n var successUrl = this.getStripeParam(\"successUrl\");\n $.mage.redirect(successUrl);\n }\n },\n\n /**\n * @return {*}\n */\n getPlaceOrderDeferredObject: function()\n {\n return placeOrderAction(this.getData(), this.messageContainer);\n },\n\n getClientSecretFromResponse: function(response)\n {\n if (typeof response != \"string\")\n {\n return null;\n }\n\n if (response.indexOf(\"Authentication Required: \") >= 0)\n {\n return response.substring(\"Authentication Required: \".length);\n }\n\n return null;\n },\n\n handlePlaceOrderErrors: function (result)\n {\n if (result && result.responseJSON && result.responseJSON.message)\n {\n var clientSecret = this.getClientSecretFromResponse(result.responseJSON.message);\n\n if (clientSecret)\n {\n var self = this;\n return stripe.authenticateCustomer(clientSecret, function(err)\n {\n if (err)\n return self.showError(err);\n\n self.placeNewOrder.bind(self)();\n });\n }\n else\n {\n this.showError(result.responseJSON.message);\n }\n }\n else\n {\n this.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n\n if (result && result.responseText)\n console.error(result.responseText);\n else\n console.error(result);\n }\n },\n\n showError: function(message)\n {\n this.isLoading(false);\n this.isPlaceOrderEnabled(true);\n this.messageContainer.addErrorMessage({ \"message\": message });\n },\n\n validate: function(elm)\n {\n return this.validateCvc() && agreementValidator.validate() && additionalValidators.validate();\n },\n\n validateCvc: function()\n {\n if (!this.selection())\n return true;\n\n if (this.selection().type != \"card\")\n return true;\n\n if (this.selection().cvc != 1)\n return true;\n\n if (typeof this.selection().cvcError == \"undefined\")\n {\n this.showError($t(\"Please enter your card's security code.\"));\n return false;\n }\n else if (!this.selection().cvcError)\n {\n return true;\n }\n else\n {\n this.showError(this.selection().cvcError);\n return false;\n }\n\n return true;\n },\n\n getCode: function()\n {\n return 'stripe_payments';\n },\n\n getData: function()\n {\n var data = {\n 'method': this.item.method,\n 'additional_data': {\n 'payment_method': this.getPaymentMethodId()\n }\n };\n\n if (this.cvcToken())\n {\n data.additional_data.cvc_token = this.cvcToken();\n }\n\n return data;\n },\n\n clearErrors: function()\n {\n this.stripePaymentsError(null);\n }\n\n });\n }\n);\n","StripeIntegration_Payments/js/view/payment/method-renderer/checkout.js":"/*browser:true*/\n/*global define*/\ndefine(\n [\n 'ko',\n 'jquery',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/action/place-order',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'Magento_Customer/js/customer-data',\n 'StripeIntegration_Payments/js/stripe',\n 'StripeIntegration_Payments/js/action/get-checkout-methods',\n 'StripeIntegration_Payments/js/action/get-checkout-session-id',\n 'Magento_Checkout/js/view/payment/default',\n 'mage/translate',\n 'stripejs',\n 'domReady!'\n ],\n function (\n ko,\n $,\n quote,\n additionalValidators,\n placeOrderAction,\n fullScreenLoader,\n customerData,\n stripe,\n getCheckoutMethods,\n getCheckoutSessionId,\n Component,\n $t\n ) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n self: this,\n template: 'StripeIntegration_Payments/payment/checkout',\n code: \"stripe_checkout\",\n customRedirect: true,\n guestEmail: null,\n methodIcons: ko.observableArray([])\n },\n redirectAfterPlaceOrder: false,\n\n initObservable: function()\n {\n this._super().observe([\n 'methodIcons',\n 'permanentError'\n ]);\n\n var params = window.checkoutConfig.payment.stripe_payments.initParams;\n\n stripe.initStripe(params);\n\n var self = this;\n var currentTotals = quote.totals();\n var currentBillingAddress = quote.billingAddress();\n var currentShippingAddress = quote.shippingAddress();\n this.guestEmail = quote.guestEmail;\n\n getCheckoutMethods(quote, self.setPaymentMethods.bind(self));\n\n quote.billingAddress.subscribe(function(address)\n {\n if (!address)\n return;\n\n if (self.isAddressSame(address, currentBillingAddress))\n return;\n\n currentBillingAddress = address;\n\n getCheckoutMethods(quote, self.setPaymentMethods.bind(self));\n }, this);\n\n quote.shippingAddress.subscribe(function(address)\n {\n if (!address)\n return;\n\n if (self.isAddressSame(address, currentShippingAddress))\n return;\n\n currentShippingAddress = address;\n\n getCheckoutMethods(quote, self.setPaymentMethods.bind(self));\n }, this);\n\n quote.totals.subscribe(function (totals)\n {\n if (JSON.stringify(totals.total_segments) == JSON.stringify(currentTotals.total_segments))\n return;\n\n currentTotals = totals;\n\n getCheckoutMethods(quote, self.setPaymentMethods.bind(self));\n }, this);\n\n return this;\n },\n\n isAddressSame: function(address1, address2)\n {\n var a = this.stringifyAddress(address1);\n var b = this.stringifyAddress(address2);\n\n return a == b;\n },\n\n stringifyAddress: function(address)\n {\n if (typeof address == \"undefined\" || !address)\n return null;\n\n return JSON.stringify({\n \"countryId\": (typeof address.countryId != \"undefined\") ? address.countryId : \"\",\n \"region\": (typeof address.region != \"undefined\") ? address.region : \"\",\n \"city\": (typeof address.city != \"undefined\") ? address.city : \"\",\n \"postcode\": (typeof address.postcode != \"undefined\") ? address.postcode : \"\"\n });\n },\n\n setPaymentMethods: function(response)\n {\n var methods = [];\n\n if (typeof response == \"string\")\n response = JSON.parse(response);\n\n if (typeof response.error != \"undefined\")\n {\n this.permanentError(response.error);\n }\n\n if (typeof response.methods != \"undefined\" && response.methods.length > 0)\n methods = response.methods;\n\n var icons = window.checkoutConfig.payment.stripe_payments.icons;\n var self = this;\n\n methods.forEach(function(method)\n {\n if (self.hasPaymentMethod(icons, method))\n return;\n\n if (typeof window.checkoutConfig.payment.stripe_payments.pmIcons[method] != \"undefined\")\n {\n icons.push({\n \"code\": method,\n \"path\": window.checkoutConfig.payment.stripe_payments.pmIcons[method].icon,\n \"name\": window.checkoutConfig.payment.stripe_payments.pmIcons[method].name\n });\n }\n else if (method != \"card\")\n {\n icons.push({\n \"code\": method,\n \"path\": window.checkoutConfig.payment.stripe_payments.pmIcons.bank.icon,\n \"name\": self.methodName(method)\n });\n }\n });\n\n this.methodIcons(icons);\n },\n\n hasPaymentMethod: function(collection, code)\n {\n var exists = collection.filter(function (o)\n {\n return o.hasOwnProperty(\"code\") && o.code == code;\n }).length > 0;\n\n return exists;\n },\n\n performRedirect: function()\n {\n var self = this;\n\n getCheckoutSessionId().then(function (response)\n {\n if (response && response.length && response.indexOf(\"cs_\") === 0)\n {\n self.redirect.bind(self)(response);\n }\n else\n {\n self.showError($t('Could not redirect to Stripe Checkout.'));\n }\n },\n function (e)\n {\n self.showError($t('An error has occurred on the server. Could not redirect to Stripe Checkout.'));\n console.error(e.responseJSON.message);\n });\n },\n\n checkoutPlaceOrder: function()\n {\n var self = this;\n\n if (additionalValidators.validate())\n {\n fullScreenLoader.startLoader();\n getCheckoutSessionId().then(function (response)\n {\n if (response && response.length && response.indexOf(\"cs_\") === 0)\n {\n self.redirect.bind(self)(response);\n }\n else\n {\n self.placeOrder.bind(self)(self.performRedirect.bind(self));\n }\n },\n function (e)\n {\n self.showError($t('An error has occurred on the server. Could not redirect to Stripe Checkout.'));\n console.error(e.responseJSON.message);\n });\n }\n\n return false;\n },\n\n placeOrder: function()\n {\n var self = this;\n\n placeOrderAction(self.getData(), self.messageContainer)\n .then(\n this.performRedirect.bind(this),\n function (e) {\n self.showError($t('An error has occurred. Could not redirect to Stripe Checkout.'));\n console.error(e.responseJSON.message);\n }\n );\n\n return false;\n },\n\n redirectToURL: function(url)\n {\n try\n {\n customerData.invalidate(['cart']);\n $.mage.redirect(url);\n }\n catch (e)\n {\n console.error(e);\n }\n },\n\n redirect: function(sessionId)\n {\n try\n {\n customerData.invalidate(['cart']);\n stripe.stripeJs.redirectToCheckout({ sessionId: sessionId }, this.onRedirectFailure.bind(this));\n }\n catch (e)\n {\n fullScreenLoader.stopLoader();\n console.error(e);\n }\n },\n\n onRedirectFailure: function(result)\n {\n if (result.error)\n {\n this.showError(result.error.message);\n }\n else\n {\n this.showError($(\"A redirect error has occurred.\"));\n console.error(result);\n }\n },\n\n methodName: function(code)\n {\n if (typeof code == 'undefined')\n return '';\n\n return code.charAt(0).toUpperCase() + Array.from(code).splice(1).join('');\n },\n\n showError: function(message)\n {\n fullScreenLoader.stopLoader();\n document.getElementById('stripe-checkout-actions-toolbar').scrollIntoView(true);\n this.messageContainer.addErrorMessage({ \"message\": message });\n },\n });\n }\n);\n","StripeIntegration_Payments/js/view/payment/method-renderer/stripe_payments_multishipping.js":"define(\n [\n 'ko',\n 'Magento_Checkout/js/view/payment/default',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Customer/js/model/customer',\n 'StripeIntegration_Payments/js/action/post-update-cart',\n 'StripeIntegration_Payments/js/action/post-restore-quote',\n 'StripeIntegration_Payments/js/action/get-requires-action',\n 'StripeIntegration_Payments/js/view/checkout/trialing_subscriptions',\n 'StripeIntegration_Payments/js/stripe',\n 'stripe_payments_express',\n 'mage/translate',\n 'mage/url',\n 'jquery',\n 'Magento_Checkout/js/action/place-order',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/action/redirect-on-success',\n 'mage/storage',\n 'mage/url',\n 'Magento_CheckoutAgreements/js/model/agreement-validator',\n 'Magento_Customer/js/customer-data',\n 'Magento_Checkout/js/model/payment-service'\n ],\n function (\n ko,\n Component,\n globalMessageList,\n quote,\n customer,\n updateCartAction,\n restoreQuoteAction,\n getRequiresAction,\n trialingSubscriptions,\n stripe,\n stripeExpress,\n $t,\n url,\n $,\n placeOrderAction,\n additionalValidators,\n redirectOnSuccessAction,\n storage,\n urlBuilder,\n agreementValidator,\n customerData,\n paymentService\n ) {\n 'use strict';\n\n return Component.extend({\n externalRedirectUrl: null,\n defaults: {\n template: 'StripeIntegration_Payments/payment/element',\n stripePaymentsShowApplePaySection: false\n },\n redirectAfterPlaceOrder: false,\n elements: null,\n initParams: null,\n paymentElement: null,\n zeroDecimalCurrencies: ['BIF','CLP','DJF','GNF','JPY','KMF','KRW','MGA','PYG','RWF','UGX','VND','VUV','XAF','XOF','XPF'],\n\n initObservable: function ()\n {\n this._super()\n .observe([\n 'paymentElement',\n 'isPaymentFormComplete',\n 'isPaymentFormVisible',\n 'isLoading',\n 'stripePaymentsError',\n 'permanentError',\n 'isOrderPlaced',\n 'isInitializing',\n 'isInitialized',\n 'useQuoteBillingAddress',\n 'cvcToken',\n 'paymentElementPaymentMethod',\n\n // Saved payment methods dropdown\n 'dropdownOptions',\n 'selection',\n 'isDropdownOpen'\n ]);\n\n var self = this;\n\n this.isPaymentFormVisible(false);\n this.isOrderPlaced(false);\n this.isInitializing(true);\n this.isInitialized(false);\n this.useQuoteBillingAddress(false);\n this.cvcToken(null);\n this.collectCvc = ko.computed(this.shouldCollectCvc.bind(this));\n this.isAmex = ko.computed(this.isAmexSelected.bind(this));\n this.cardCvcElement = null;\n\n var currentTotals = quote.totals();\n var currentShippingAddress = quote.shippingAddress();\n var currentBillingAddress = quote.billingAddress();\n\n quote.totals.subscribe(function (totals)\n {\n if (!totals || !totals.grand_total || !totals.quote_currency_code)\n {\n return;\n }\n\n if (!currentTotals || !currentTotals.grand_total || !currentTotals.quote_currency_code)\n {\n currentTotals = totals;\n return;\n }\n\n var amount1 = totals.grand_total;\n var amount2 = currentTotals.grand_total;\n var currency1 = totals.quote_currency_code;\n var currency2 = currentTotals.quote_currency_code;\n\n if (amount1 === amount2 && currency1 === currency2)\n {\n return;\n }\n\n currentTotals = totals;\n\n self.onQuoteTotalsChanged.bind(self)();\n self.isOrderPlaced(false);\n }, this);\n\n quote.paymentMethod.subscribe(function (method)\n {\n if (method.method == this.getCode() && !this.isInitializing())\n {\n // We intentionally re-create the element because its container element may have changed\n this.initPaymentForm();\n }\n }, this);\n\n quote.billingAddress.subscribe(function(address)\n {\n if (address && self.paymentElement && self.paymentElement.update && !self.isPaymentFormComplete())\n {\n // Remove the postcode & country fields if a billing address has been specified\n self.paymentElement.update(self.getPaymentElementUpdateOptions());\n }\n });\n\n return this;\n },\n\n initSavedPaymentMethods: function()\n {\n // If it is already initialized, do not re-initialize\n if (this.dropdownOptions())\n {\n return;\n }\n\n var options = [];\n var methods = this.getStripeParam(\"savedMethods\");\n if (methods)\n {\n for (var i in methods)\n {\n if (methods.hasOwnProperty(i))\n {\n // We do this because some themes and libraries extend all objects with their own methods\n options.push(methods[i]);\n }\n }\n }\n\n if (options.length > 0)\n {\n this.isPaymentFormVisible(false);\n this.selection(options[0]);\n }\n else\n {\n this.isPaymentFormVisible(true);\n this.selection(false);\n }\n\n this.dropdownOptions(options);\n },\n\n shouldCollectCvc: function()\n {\n var selection = this.selection();\n\n if (!selection)\n return false;\n\n if (selection.type != 'card')\n return false;\n\n return !!selection.cvc;\n },\n\n isAmexSelected: function()\n {\n var selection = this.selection();\n\n if (!selection)\n return false;\n\n if (selection.type != 'card')\n return false;\n\n return (selection.brand == \"amex\");\n },\n\n newPaymentMethod: function()\n {\n this.messageContainer.clear();\n\n this.selection({\n type: 'new',\n value: 'new',\n icon: false,\n label: $t('New payment method')\n });\n this.isDropdownOpen(false);\n this.isPaymentFormVisible(true);\n if (!this.isInitialized())\n {\n this.onContainerRendered();\n this.isInitialized(true);\n }\n },\n\n getPaymentMethodId: function()\n {\n var selection = this.selection();\n\n if (selection && typeof selection.value != \"undefined\" && selection.value != \"new\")\n {\n return selection.value;\n }\n\n var paymentMethod = this.paymentElementPaymentMethod();\n if (paymentMethod && paymentMethod.id)\n {\n return paymentMethod.id;\n }\n\n return null;\n },\n\n toggleDropdown: function()\n {\n this.isDropdownOpen(!this.isDropdownOpen());\n },\n\n getStripeParam: function(param)\n {\n var params = this.getInitParams();\n\n if (!params)\n {\n return null;\n }\n\n if (typeof params[param] != \"undefined\")\n {\n return params[param];\n }\n\n return null;\n },\n\n onQuoteTotalsChanged: function()\n {\n if (!this.elements || !this.elements.update)\n {\n return;\n }\n\n try\n {\n this.elements.update(this.getElementsOptions(true));\n }\n catch (e)\n {\n this.elements.update(this.getElementsOptions(false));\n }\n },\n\n getInitParams: function()\n {\n return window.checkoutConfig.payment.stripe_payments.initParams;\n },\n\n onPaymentElementContainerRendered: function()\n {\n var self = this;\n this.isLoading(true);\n stripe.initStripe(this.getInitParams(), function(err)\n {\n if (err)\n return self.crash(err);\n\n self.initSavedPaymentMethods();\n self.initPaymentForm();\n });\n },\n\n onContainerRendered: function()\n {\n this.onPaymentElementContainerRendered();\n },\n\n getCardCVCOptions: function()\n {\n return {\n style: {\n base: {\n // iconColor: '#c4f0ff',\n // color: '#fff',\n // fontWeight: '500',\n // fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',\n fontSize: '16px',\n // fontSmoothing: 'antialiased',\n // ':-webkit-autofill': {\n // color: '#fce883',\n // },\n // '::placeholder': {\n // color: '#87BBFD',\n // },\n // },\n // invalid: {\n // iconColor: '#FFC7EE',\n // color: '#FFC7EE',\n },\n },\n };\n },\n\n onCvcContainerRendered: function()\n {\n var self = this;\n var params = this.getInitParams();\n\n stripe.initStripe(params, function(err)\n {\n if (err)\n return self.crash(err);\n\n var options = {};\n if (params && params.locale)\n {\n options.locale = params.locale;\n }\n\n try\n {\n var elements = stripe.stripeJs.elements(options);\n self.cardCvcElement = elements.create('cardCvc', self.getCardCVCOptions());\n self.cardCvcElement.mount('#stripe-card-cvc-element');\n self.cardCvcElement.on('change', self.onCvcChange.bind(self));\n }\n catch (e)\n {\n this.crash(e.message);\n }\n });\n },\n\n onCvcChange: function(event)\n {\n if (event.error)\n this.selection().cvcError = event.error.message;\n else\n this.selection().cvcError = null;\n },\n\n crash: function(message)\n {\n this.isLoading(false);\n var userError = this.getStripeParam(\"userError\");\n if (userError)\n this.permanentError(userError);\n else\n this.permanentError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \" + message);\n },\n\n softCrash: function(message)\n {\n var userError = this.getStripeParam(\"userError\");\n if (userError)\n this.showError(userError);\n else\n this.showError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \" + message);\n },\n\n isCollapsed: function()\n {\n if (this.isChecked() == this.getCode())\n {\n return false;\n }\n else\n {\n return true;\n }\n },\n\n initPaymentForm: function()\n {\n this.isInitializing(false);\n this.isLoading(false);\n\n if (this.isCollapsed()) // Don't render PE with a height of 0\n return;\n\n if (document.getElementById('stripe-payment-element') === null)\n return this.crash(\"Cannot initialize Payment Element on a DOM that does not contain a div.stripe-payment-element.\");\n\n if (!stripe.stripeJs)\n return this.crash(\"Stripe.js could not be initialized.\");\n\n if (this.getStripeParam(\"isOrderPlaced\"))\n this.isOrderPlaced(true);\n\n try\n {\n try\n {\n this.elements = stripe.stripeJs.elements(this.getElementsOptions(true));\n }\n catch (e)\n {\n console.warn(\"Could not filter Stripe payment method types: \" + e.message);\n this.elements = stripe.stripeJs.elements(this.getElementsOptions(false));\n }\n this.paymentElement = this.elements.create('payment', this.getPaymentElementOptions());\n this.paymentElement.mount('#stripe-payment-element');\n this.paymentElement.on('change', this.onChange.bind(this));\n }\n catch (e)\n {\n this.crash(e.message);\n }\n },\n\n getElementsOptions: function(filterPaymentMethods)\n {\n var options = window.checkoutConfig.payment.stripe_payments.elementOptions;\n\n if (!filterPaymentMethods && options.payment_method_types)\n delete options.payment_method_types;\n\n if (options.mode != \"setup\")\n {\n options.amount = this.getElementsAmount();\n options.currency = this.getElementsCurrency();\n }\n\n return options;\n },\n\n getPaymentElementOptions: function()\n {\n var options = {};\n\n var params = this.getInitParams();\n if (params && typeof params.wallets != \"undefined\" && params.wallets)\n options.wallets = params.wallets;\n\n var billingAddress = quote.billingAddress();\n\n if (billingAddress)\n {\n try\n {\n this.useQuoteBillingAddress(true);\n\n var hasState = (billingAddress.region || billingAddress.regionCode || billingAddress.regionId);\n\n options.fields = {\n billingDetails: {\n name: 'never',\n email: 'never',\n phone: (billingAddress.telephone ? 'never' : 'auto'),\n address: {\n line1: ((billingAddress.street.length > 0) ? 'never' : 'auto'),\n line2: ((billingAddress.street.length > 0) ? 'never' : 'auto'),\n city: billingAddress.city ? 'never' : 'auto',\n state: hasState ? 'never' : 'auto',\n country: billingAddress.countryId ? 'never' : 'auto',\n postalCode: billingAddress.postcode ? 'never' : 'auto'\n }\n }\n };\n }\n catch (e)\n {\n this.useQuoteBillingAddress(false);\n\n options.fields = {};\n console.warn('Could not retrieve billing address: ' + e.message);\n }\n\n // Set the default billing address in order to enable the Link payment method\n var billingDetails = this.getBillingDetails();\n\n if (billingDetails)\n {\n options.defaultValues = {\n billingDetails: billingDetails\n };\n }\n }\n else\n {\n this.useQuoteBillingAddress(false);\n }\n\n if (params.layout)\n {\n options.layout = params.layout;\n }\n\n return options;\n },\n\n getPaymentElementUpdateOptions: function()\n {\n var options = this.getPaymentElementOptions();\n\n if (options.wallets)\n {\n delete options.wallets;\n }\n\n return options;\n },\n\n onChange: function(event)\n {\n this.isLoading(false);\n this.isPaymentFormComplete(event.complete);\n },\n\n getElementsAmount: function()\n {\n var totals = quote.totals();\n\n if (totals && totals.grand_total)\n {\n var amount = totals.grand_total;\n return this.convertToStripeAmount(amount, this.getElementsCurrency());\n }\n\n return 0;\n },\n\n getElementsCurrency: function()\n {\n var totals = quote.totals();\n if (totals && totals.quote_currency_code)\n {\n var currency = totals.quote_currency_code;\n return currency.toLowerCase();\n }\n\n return 'USD';\n },\n\n isBillingAddressSet: function()\n {\n return quote.billingAddress() && quote.billingAddress().canUseForBilling();\n },\n\n convertToStripeAmount: function(amount, currencyCode)\n {\n var code = currencyCode.toUpperCase();\n\n if (this.zeroDecimalCurrencies.indexOf(code) >= 0)\n {\n return Math.round(amount);\n }\n else\n {\n return Math.round(amount * 100);\n }\n },\n\n isPlaceOrderEnabled: function()\n {\n if (this.stripePaymentsError())\n return false;\n\n if (this.permanentError())\n return false;\n\n return this.isBillingAddressSet();\n },\n\n getAddressField: function(field)\n {\n if (!quote.billingAddress())\n return null;\n\n var address = quote.billingAddress();\n\n if (!address[field] || address[field].length == 0)\n return null;\n\n return address[field];\n },\n\n getBillingDetails: function()\n {\n var details = {};\n var address = {};\n\n if (this.getAddressField('city'))\n address.city = this.getAddressField('city');\n\n if (this.getAddressField('countryId'))\n address.country = this.getAddressField('countryId');\n\n if (this.getAddressField('postcode'))\n address.postal_code = this.getAddressField('postcode');\n\n if (this.getAddressField('region'))\n address.state = this.getAddressField('region');\n\n if (this.getAddressField('street'))\n {\n var street = this.getAddressField('street');\n address.line1 = street[0];\n\n if (street.length > 1)\n address.line2 = street[1];\n }\n\n if (Object.keys(address).length > 0)\n details.address = address;\n\n if (this.getAddressField('telephone'))\n details.phone = this.getAddressField('telephone');\n\n if (this.getAddressField('firstname'))\n details.name = this.getAddressField('firstname') + ' ' + this.getAddressField('lastname');\n\n if (quote.guestEmail)\n details.email = quote.guestEmail;\n else if (customerData.email)\n details.email = customerData.email;\n\n if (Object.keys(details).length > 0)\n return details;\n\n return null;\n },\n\n config: function()\n {\n return window.checkoutConfig.payment[this.getCode()];\n },\n\n isActive: function(parents)\n {\n return true;\n },\n\n placeOrder: function()\n {\n this.messageContainer.clear();\n\n if (!this.isPaymentFormComplete() && !this.getPaymentMethodId())\n return this.showError($t('Please complete your payment details.'));\n\n if (!this.validate())\n return;\n\n this.clearErrors();\n this.isPlaceOrderActionAllowed(false);\n this.isLoading(true);\n this.cvcToken(null);\n\n var params = { };\n\n if (this.useQuoteBillingAddress())\n {\n params.payment_method_data = {\n billing_details: {\n address: this.getStripeFormattedAddress(quote.billingAddress()),\n email: this.getBillingEmail(),\n name: this.getNameFromAddress(quote.billingAddress()),\n phone: this.getBillingPhone()\n }\n };\n }\n\n if (this.hasShipping())\n {\n params.shipping = {\n address: this.getStripeFormattedAddress(quote.shippingAddress()),\n name: this.getNameFromAddress(quote.shippingAddress())\n };\n }\n\n var self = this;\n\n if (this.isSavedCardSelected() && this.selection().cvc)\n {\n stripe.stripeJs.createToken('cvc_update', this.cardCvcElement).then(function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n }\n else if (result.token)\n {\n self.cvcToken(result.token.id);\n self.placeOrderWithSavedPaymentMethod.bind(self)();\n }\n else\n {\n self.showError('Could not perform CVC check.');\n }\n });\n }\n else if (this.isSavedPaymentMethodSelected())\n {\n this.placeOrderWithSavedPaymentMethod();\n }\n else\n {\n this.createPaymentMethod(this.onPaymentMethodCreatedForOrderPlacement.bind(this));\n }\n\n return false;\n },\n\n hasShipping: function()\n {\n return (quote && quote.shippingMethod() && quote.shippingMethod().method_code);\n },\n\n createPaymentMethod: function(callback)\n {\n this.paymentElementPaymentMethod(null);\n\n var self = this;\n\n var paymentMethodData = {\n elements: this.elements,\n params: {}\n };\n\n var confirmParams = this.getConfirmParams();\n var billingDetails = null;\n if (confirmParams &&\n confirmParams.confirmParams &&\n confirmParams.confirmParams.payment_method_data &&\n confirmParams.confirmParams.payment_method_data.billing_details\n )\n {\n billingDetails = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n\n if (billingDetails)\n {\n paymentMethodData.params.billing_details = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n else\n {\n return this.showError($t(\"Please specify a billing address.\"));\n }\n\n this.elements.submit().then(function()\n {\n stripe.stripeJs.createPaymentMethod(paymentMethodData).then(function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n console.error(result.error.message);\n }\n else\n {\n self.paymentElementPaymentMethod(result.paymentMethod);\n callback(result.paymentMethod);\n }\n });\n },\n function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n console.error(result.error.message);\n }\n else\n {\n self.showError(\"A payment submission error has occurred.\");\n console.error(result);\n }\n });\n },\n\n isSavedPaymentMethodSelected: function()\n {\n var selectedMethodType = this.getSelectedMethod(\"type\");\n\n if (!selectedMethodType) // There is no saved PMs dropdown\n return false;\n\n if (selectedMethodType != 'new') // A saved PMs is selected\n return true;\n\n return false; // New PM is selected\n },\n\n isSavedCardSelected: function()\n {\n var selectedMethodType = this.getSelectedMethod(\"type\");\n\n if (!selectedMethodType) // There is no saved PMs dropdown\n return false;\n\n if (selectedMethodType == 'card') // A saved PMs is selected\n return true;\n\n return false; // New PM is selected\n },\n\n placeOrderWithSavedPaymentMethod: function()\n {\n var self = this;\n var placeNewOrder = this.placeNewOrder.bind(this);\n\n if (this.isOrderPlaced()) // The order was already placed but either 3D Secure failed or the customer pressed the back button from an external payment page\n {\n updateCartAction(this.getData(), this.onCartUpdated.bind(this));\n }\n else\n {\n try\n {\n placeNewOrder();\n }\n catch (e)\n {\n this.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(e.message);\n }\n }\n },\n\n onPaymentMethodCreatedForOrderPlacement: function(paymentMethod)\n {\n var placeNewOrder = this.placeNewOrder.bind(this);\n var self = this;\n\n if (self.isOrderPlaced()) // The order was already placed but either 3D Secure failed or the customer pressed the back button from an external payment page\n {\n updateCartAction(this.getData(), this.onCartUpdated.bind(this));\n }\n else\n {\n try\n {\n placeNewOrder();\n }\n catch (e)\n {\n self.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(e.message);\n }\n }\n },\n\n onCartUpdated: function(result, outcome, response)\n {\n var placeNewOrder = this.placeNewOrder.bind(this);\n var onOrderPlaced = this.onOrderPlaced.bind(this);\n try\n {\n var data = JSON.parse(result);\n if (data.error)\n {\n this.showError(data.error);\n }\n else if (data.redirect)\n {\n $.mage.redirect(data.redirect);\n }\n else if (data.placeNewOrder)\n {\n placeNewOrder();\n }\n else\n {\n onOrderPlaced();\n }\n }\n catch (e)\n {\n this.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(e.message);\n }\n },\n\n placeNewOrder: function()\n {\n var self = this;\n\n this.isLoading(false); // Needed for the terms and conditions checkbox\n this.getPlaceOrderDeferredObject()\n .fail(this.handlePlaceOrderErrors.bind(this))\n .done(this.onOrderPlaced.bind(this))\n .always(function(response, status, xhr)\n {\n if (status != \"success\")\n {\n self.isLoading(false);\n self.isPlaceOrderEnabled(true);\n }\n });\n },\n\n getSelectedMethod: function(param)\n {\n var selection = this.selection();\n if (!selection)\n return null;\n\n if (typeof selection[param] == \"undefined\")\n return null;\n\n return selection[param];\n },\n\n // Called when:\n // - A brand new order has just been placed\n // - After updateCartAction() with placeNewOrder == false\n onOrderPlaced: function(result, outcome, response)\n {\n if (!this.isOrderPlaced() && isNaN(result))\n {\n return this.softCrash(\"The order was placed but the response from the server did not include a numeric order ID.\");\n }\n else\n {\n this.isOrderPlaced(true);\n }\n\n this.isLoading(true);\n var self = this;\n var handleNextActions = this.handleNextActions.bind(this);\n getRequiresAction(function(clientSecret)\n {\n try\n {\n if (clientSecret && clientSecret.length)\n {\n stripe.stripeJs.handleNextAction({\n clientSecret: clientSecret\n }).then(self.onConfirm.bind(self));\n }\n else\n {\n // No further actions are needed\n self.onConfirm(null);\n }\n }\n catch (e)\n {\n restoreQuoteAction();\n self.showError(\"The order was placed but we could not confirm if the payment was successful.\");\n console.error(e);\n }\n\n });\n },\n\n isSuccessful: function(stripeObject)\n {\n\n if (stripeObject.status == \"requires_action\" &&\n stripeObject.next_action &&\n stripeObject.next_action.type &&\n stripeObject.next_action.type != \"use_stripe_sdk\"\n )\n {\n // This is the case for vouchers, where an offline payment is required\n return true;\n }\n\n\n return (['processing', 'requires_capture', 'succeeded'].indexOf(stripeObject.status) >= 0);\n },\n\n // Called when:\n // - A brand new order has just been placed\n // - After updateCartAction() with placeNewOrder == false\n handleNextActions: function(stripeObject)\n {\n if (!this.isOrderPlaced())\n {\n return this.softCrash(\"Cannot handleNextActions without placing the order first\");\n }\n\n var self = this;\n\n if (this.isSuccessful(stripeObject))\n {\n this.onConfirm(null);\n }\n else if (stripeObject.status == \"requires_action\")\n {\n // Non-card based confirms may redirect the customer externally. We restore the quote just before it in case the\n // customer clicks the back button on the browser before authenticating the payment.\n restoreQuoteAction(function()\n {\n stripe.stripeJs.handleNextAction({\n clientSecret: stripeObject.client_secret\n }).then(self.onConfirm.bind(self));\n });\n }\n else if (stripeObject.status == \"requires_confirmation\")\n {\n // This should only hit when a payment failed with a saved PM, and then the customer switched to PaymentElement to enter a new payment method\n restoreQuoteAction(function()\n {\n // We pass null because we do not want to update the PM. It has already been updated with stripe.updatePaymentIntent\n updateCartAction(self.getData(), self.onCartUpdated.bind(self));\n });\n }\n else if (stripeObject.status == \"requires_payment_method\")\n {\n restoreQuoteAction(function()\n {\n updateCartAction(self.getData(), self.onCartUpdated.bind(self));\n });\n }\n else\n {\n restoreQuoteAction(function()\n {\n self.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(\"Could not finalize order bacause the payment intent is in status \" + stripeObject.status);\n });\n }\n },\n\n getConfirmParams: function()\n {\n var params = {\n elements: this.elements,\n confirmParams: {\n return_url: this.getStripeParam(\"successUrl\")\n }\n };\n\n this.getPaymentElementOptions();\n if (this.useQuoteBillingAddress())\n {\n params.confirmParams.payment_method_data = {\n billing_details: {\n address: this.getStripeFormattedAddress(quote.billingAddress()),\n email: this.getBillingEmail(),\n name: this.getNameFromAddress(quote.billingAddress()),\n phone: this.getBillingPhone()\n }\n };\n }\n\n return params;\n },\n\n getStripeFormattedAddress: function(address)\n {\n var stripeAddress = {};\n\n stripeAddress.state = address.region ? address.region : null;\n stripeAddress.postal_code = address.postcode ? address.postcode : null;\n stripeAddress.country = address.countryId ? address.countryId : null;\n stripeAddress.city = address.city ? address.city : null;\n\n if (address.street && address.street.length > 0)\n {\n stripeAddress.line1 = address.street[0];\n\n if (address.street.length > 1)\n {\n stripeAddress.line2 = address.street[1];\n }\n else\n {\n stripeAddress.line2 = null;\n }\n }\n else\n {\n stripeAddress.line1 = null;\n stripeAddress.line2 = null;\n }\n\n return stripeAddress;\n },\n\n getBillingEmail: function()\n {\n if (quote.guestEmail)\n {\n return quote.guestEmail;\n }\n else if (window.checkoutConfig.customerData && window.checkoutConfig.customerData.email)\n {\n return window.checkoutConfig.customerData.email;\n }\n\n return null;\n },\n\n getNameFromAddress: function(address)\n {\n if (!address)\n return null;\n\n var parts = [];\n if (address.firstname)\n parts.push(address.firstname);\n\n if (address.middlename)\n parts.push(address.middlename);\n\n if (address.lastname)\n parts.push(address.lastname);\n\n return parts.join(\" \");\n },\n\n getBillingPhone: function()\n {\n var billingAddress = quote.billingAddress();\n if (!billingAddress)\n return null;\n\n if (billingAddress.telephone)\n return billingAddress.telephone;\n\n return null;\n },\n\n onConfirm: function(result)\n {\n this.isLoading(false);\n if (result && result.error)\n {\n this.showError(result.error.message);\n }\n else\n {\n customerData.invalidate(['cart']);\n var successUrl = this.getStripeParam(\"successUrl\");\n $.mage.redirect(successUrl);\n }\n },\n\n /**\n * @return {*}\n */\n getPlaceOrderDeferredObject: function()\n {\n return placeOrderAction(this.getData(), this.messageContainer);\n },\n\n getClientSecretFromResponse: function(response)\n {\n if (typeof response != \"string\")\n {\n return null;\n }\n\n if (response.indexOf(\"Authentication Required: \") >= 0)\n {\n return response.substring(\"Authentication Required: \".length);\n }\n\n return null;\n },\n\n handlePlaceOrderErrors: function (result)\n {\n if (result && result.responseJSON && result.responseJSON.message)\n {\n var clientSecret = this.getClientSecretFromResponse(result.responseJSON.message);\n\n if (clientSecret)\n {\n var self = this;\n return stripe.authenticateCustomer(clientSecret, function(err)\n {\n if (err)\n return self.showError(err);\n\n self.placeNewOrder.bind(self)();\n });\n }\n else\n {\n this.showError(result.responseJSON.message);\n }\n }\n else\n {\n this.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n\n if (result && result.responseText)\n console.error(result.responseText);\n else\n console.error(result);\n }\n },\n\n showError: function(message)\n {\n this.isLoading(false);\n this.isPlaceOrderEnabled(true);\n this.messageContainer.addErrorMessage({ \"message\": message });\n },\n\n validate: function(elm)\n {\n return this.validateCvc() && agreementValidator.validate() && additionalValidators.validate();\n },\n\n validateCvc: function()\n {\n if (!this.selection())\n return true;\n\n if (this.selection().type != \"card\")\n return true;\n\n if (this.selection().cvc != 1)\n return true;\n\n if (typeof this.selection().cvcError == \"undefined\")\n {\n this.showError($t(\"Please enter your card's security code.\"));\n return false;\n }\n else if (!this.selection().cvcError)\n {\n return true;\n }\n else\n {\n this.showError(this.selection().cvcError);\n return false;\n }\n\n return true;\n },\n\n getCode: function()\n {\n return 'stripe_payments';\n },\n\n getData: function()\n {\n var data = {\n 'method': this.item.method,\n 'additional_data': {\n 'payment_method': this.getPaymentMethodId()\n }\n };\n\n if (this.cvcToken())\n {\n data.additional_data.cvc_token = this.cvcToken();\n }\n\n return data;\n },\n\n clearErrors: function()\n {\n this.stripePaymentsError(null);\n }\n\n });\n }\n);\n","StripeIntegration_Payments/js/view/payment/method-renderer/bank_transfers.js":"define(\n [\n 'Magento_Checkout/js/view/payment/default',\n 'Magento_Checkout/js/model/quote',\n 'StripeIntegration_Payments/js/action/post-restore-quote',\n 'StripeIntegration_Payments/js/action/get-requires-action',\n 'StripeIntegration_Payments/js/stripe',\n 'mage/translate',\n 'Magento_Checkout/js/action/place-order',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_Checkout/js/action/redirect-on-success',\n 'Magento_CheckoutAgreements/js/model/agreement-validator',\n 'Magento_Customer/js/customer-data',\n ],\n function (\n Component,\n quote,\n restoreQuoteAction,\n getRequiresAction,\n stripe,\n $t,\n placeOrderAction,\n additionalValidators,\n redirectOnSuccessAction,\n agreementValidator,\n customerData\n ) {\n 'use strict';\n\n return Component.extend({\n externalRedirectUrl: null,\n defaults: {\n template: 'StripeIntegration_Payments/payment/bank_transfers'\n },\n redirectAfterPlaceOrder: false,\n elements: null,\n initParams: null,\n paymentElement: null,\n zeroDecimalCurrencies: ['BIF','CLP','DJF','GNF','JPY','KMF','KRW','MGA','PYG','RWF','UGX','VND','VUV','XAF','XOF','XPF'],\n\n initObservable: function ()\n {\n this._super()\n .observe([\n 'paymentElement',\n 'isPaymentFormComplete',\n 'isLoading',\n 'stripePaymentsError',\n 'permanentError',\n 'isInitializing',\n 'isInitialized',\n 'useQuoteBillingAddress',\n 'paymentElementPaymentMethod',\n ]);\n\n var self = this;\n\n this.isInitializing(true);\n this.isInitialized(false);\n this.useQuoteBillingAddress(false);\n\n quote.paymentMethod.subscribe(function (method)\n {\n if (method && method.method == this.getCode() && !this.isInitializing())\n {\n // We intentionally re-create the element because its container element may have changed\n this.initPaymentForm();\n }\n }, this);\n\n quote.billingAddress.subscribe(function(address)\n {\n if (address && self.paymentElement && self.paymentElement.update && !self.isPaymentFormComplete())\n {\n // Remove the postcode & country fields if a billing address has been specified\n self.paymentElement.update(self.getPaymentElementUpdateOptions());\n }\n });\n\n return this;\n },\n\n\n getPaymentMethodId: function()\n {\n var paymentMethod = this.paymentElementPaymentMethod();\n if (paymentMethod && paymentMethod.id)\n {\n return paymentMethod.id;\n }\n\n return null;\n },\n\n getStripeParam: function(param)\n {\n var params = this.getInitParams();\n\n if (!params)\n {\n return null;\n }\n\n if (typeof params[param] != \"undefined\")\n {\n return params[param];\n }\n\n return null;\n },\n\n getInitParams: function()\n {\n return window.checkoutConfig.payment.stripe_payments_bank_transfers.initParams;\n },\n\n onPaymentElementContainerRendered: function()\n {\n var self = this;\n this.isLoading(true);\n stripe.initStripe(this.getInitParams(), function(err)\n {\n if (err)\n return self.crash(err);\n\n self.initPaymentForm();\n });\n },\n\n onContainerRendered: function()\n {\n this.onPaymentElementContainerRendered();\n },\n\n crash: function(message)\n {\n this.isLoading(false);\n var userError = this.getStripeParam(\"userError\");\n if (userError)\n this.permanentError(userError);\n else\n this.permanentError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \" + message);\n },\n\n softCrash: function(message)\n {\n var userError = this.getStripeParam(\"userError\");\n if (userError)\n this.showError(userError);\n else\n this.showError($t(\"Sorry, this payment method is not available. Please contact us for assistance.\"));\n\n console.error(\"Error: \" + message);\n },\n\n isCollapsed: function()\n {\n if (this.isChecked() == this.getCode())\n {\n return false;\n }\n else\n {\n return true;\n }\n },\n\n initPaymentForm: function()\n {\n this.isInitializing(false);\n this.isLoading(false);\n\n if (this.isCollapsed()) // Don't render PE with a height of 0\n return;\n\n if (document.getElementById('stripe-payment-element-bank-transfers') === null)\n return this.crash(\"Cannot initialize Payment Element on a DOM that does not contain a div.stripe-payment-element-bank-transfers.\");\n\n if (!stripe.stripeJs)\n return this.crash(\"Stripe.js could not be initialized.\");\n\n try\n {\n this.elements = stripe.stripeJs.elements(this.getElementsOptions());\n this.paymentElement = this.elements.create('payment', this.getPaymentElementOptions());\n this.paymentElement.mount('#stripe-payment-element-bank-transfers');\n this.paymentElement.on('change', this.onChange.bind(this));\n }\n catch (e)\n {\n this.crash(e.message);\n }\n },\n\n getElementsOptions: function()\n {\n var options = window.checkoutConfig.payment.stripe_payments_bank_transfers.elementOptions;\n\n options.amount = this.getElementsAmount();\n options.currency = this.getElementsCurrency();\n\n return options;\n },\n\n getPaymentElementOptions: function()\n {\n var options = {};\n\n var billingAddress = quote.billingAddress();\n\n if (billingAddress)\n {\n try\n {\n this.useQuoteBillingAddress(true);\n\n var hasState = (billingAddress.region || billingAddress.regionCode || billingAddress.regionId);\n\n options.fields = {\n billingDetails: {\n name: 'never',\n email: 'never',\n phone: (billingAddress.telephone ? 'never' : 'auto'),\n address: {\n line1: ((billingAddress.street.length > 0) ? 'never' : 'auto'),\n line2: ((billingAddress.street.length > 0) ? 'never' : 'auto'),\n city: billingAddress.city ? 'never' : 'auto',\n state: hasState ? 'never' : 'auto',\n country: billingAddress.countryId ? 'never' : 'auto',\n postalCode: billingAddress.postcode ? 'never' : 'auto'\n }\n }\n };\n }\n catch (e)\n {\n this.useQuoteBillingAddress(false);\n\n options.fields = {};\n console.warn('Could not retrieve billing address: ' + e.message);\n }\n\n // Set the default billing address in order to enable the Link payment method\n var billingDetails = this.getBillingDetails();\n\n if (billingDetails)\n {\n options.defaultValues = {\n billingDetails: billingDetails\n };\n }\n }\n else\n {\n this.useQuoteBillingAddress(false);\n }\n\n return options;\n },\n\n getPaymentElementUpdateOptions: function()\n {\n var options = this.getPaymentElementOptions();\n\n if (options.wallets)\n {\n delete options.wallets;\n }\n\n return options;\n },\n\n onChange: function(event)\n {\n this.isLoading(false);\n this.isPaymentFormComplete(event.complete);\n },\n\n getElementsAmount: function()\n {\n var totals = quote.totals();\n\n if (totals && totals.grand_total)\n {\n var amount = totals.grand_total;\n return this.convertToStripeAmount(amount, this.getElementsCurrency());\n }\n\n return 0;\n },\n\n getElementsCurrency: function()\n {\n var totals = quote.totals();\n if (totals && totals.quote_currency_code)\n {\n var currency = totals.quote_currency_code;\n return currency.toLowerCase();\n }\n\n return 'USD';\n },\n\n isBillingAddressSet: function()\n {\n return quote.billingAddress() && quote.billingAddress().canUseForBilling();\n },\n\n convertToStripeAmount: function(amount, currencyCode)\n {\n var code = currencyCode.toUpperCase();\n\n if (this.zeroDecimalCurrencies.indexOf(code) >= 0)\n {\n return Math.round(amount);\n }\n else\n {\n return Math.round(amount * 100);\n }\n },\n\n isPlaceOrderEnabled: function()\n {\n if (this.stripePaymentsError())\n return false;\n\n if (this.permanentError())\n return false;\n\n return this.isBillingAddressSet();\n },\n\n getAddressField: function(field)\n {\n if (!quote.billingAddress())\n return null;\n\n var address = quote.billingAddress();\n\n if (!address[field] || address[field].length == 0)\n return null;\n\n return address[field];\n },\n\n getBillingDetails: function()\n {\n var details = {};\n var address = {};\n\n if (this.getAddressField('city'))\n address.city = this.getAddressField('city');\n\n if (this.getAddressField('countryId'))\n address.country = this.getAddressField('countryId');\n\n if (this.getAddressField('postcode'))\n address.postal_code = this.getAddressField('postcode');\n\n if (this.getAddressField('region'))\n address.state = this.getAddressField('region');\n\n if (this.getAddressField('street'))\n {\n var street = this.getAddressField('street');\n address.line1 = street[0];\n\n if (street.length > 1)\n address.line2 = street[1];\n }\n\n if (Object.keys(address).length > 0)\n details.address = address;\n\n if (this.getAddressField('telephone'))\n details.phone = this.getAddressField('telephone');\n\n if (this.getAddressField('firstname'))\n details.name = this.getAddressField('firstname') + ' ' + this.getAddressField('lastname');\n\n if (quote.guestEmail)\n details.email = quote.guestEmail;\n else if (customerData.email)\n details.email = customerData.email;\n\n if (Object.keys(details).length > 0)\n return details;\n\n return null;\n },\n\n config: function()\n {\n return window.checkoutConfig.payment[this.getCode()];\n },\n\n placeOrder: function()\n {\n this.messageContainer.clear();\n\n if (!this.isPaymentFormComplete() && !this.getPaymentMethodId())\n return this.showError($t('Please complete your payment details.'));\n\n if (!this.validate())\n return;\n\n this.clearErrors();\n this.isPlaceOrderActionAllowed(false);\n this.isLoading(true);\n\n var params = { };\n\n if (this.useQuoteBillingAddress())\n {\n params.payment_method_data = {\n billing_details: {\n address: this.getStripeFormattedAddress(quote.billingAddress()),\n email: this.getBillingEmail(),\n name: this.getNameFromAddress(quote.billingAddress()),\n phone: this.getBillingPhone()\n }\n };\n }\n\n if (this.hasShipping())\n {\n params.shipping = {\n address: this.getStripeFormattedAddress(quote.shippingAddress()),\n name: this.getNameFromAddress(quote.shippingAddress())\n };\n }\n\n this.createPaymentMethod(this.onPaymentMethodCreatedForOrderPlacement.bind(this));\n\n return false;\n },\n\n hasShipping: function()\n {\n return (quote && quote.shippingMethod() && quote.shippingMethod().method_code);\n },\n\n createPaymentMethod: function(callback)\n {\n this.paymentElementPaymentMethod(null);\n\n var self = this;\n\n var paymentMethodData = {\n elements: this.elements,\n params: {}\n };\n\n var confirmParams = this.getConfirmParams();\n var billingDetails = null;\n if (confirmParams &&\n confirmParams.confirmParams &&\n confirmParams.confirmParams.payment_method_data &&\n confirmParams.confirmParams.payment_method_data.billing_details\n )\n {\n billingDetails = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n\n if (billingDetails)\n {\n paymentMethodData.params.billing_details = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n else\n {\n return this.showError($t(\"Please specify a billing address.\"));\n }\n\n this.elements.submit().then(function()\n {\n stripe.stripeJs.createPaymentMethod(paymentMethodData).then(function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n console.error(result.error.message);\n }\n else\n {\n self.paymentElementPaymentMethod(result.paymentMethod);\n callback(result.paymentMethod);\n }\n });\n },\n function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n console.error(result.error.message);\n }\n else\n {\n self.showError(\"A payment submission error has occurred.\");\n console.error(result);\n }\n });\n },\n\n onPaymentMethodCreatedForOrderPlacement: function(paymentMethod)\n {\n var placeNewOrder = this.placeNewOrder.bind(this);\n var self = this;\n\n try\n {\n placeNewOrder();\n }\n catch (e)\n {\n self.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n console.error(e.message);\n }\n },\n\n placeNewOrder: function()\n {\n var self = this;\n\n this.isLoading(false); // Needed for the terms and conditions checkbox\n this.getPlaceOrderDeferredObject()\n .fail(this.handlePlaceOrderErrors.bind(this))\n .done(this.onOrderPlaced.bind(this))\n .always(function(response, status, xhr)\n {\n if (status != \"success\")\n {\n self.isLoading(false);\n self.isPlaceOrderEnabled(true);\n }\n });\n },\n\n onOrderPlaced: function(result, outcome, response)\n {\n this.isLoading(true);\n var self = this;\n getRequiresAction(function(clientSecret)\n {\n try\n {\n if (clientSecret && clientSecret.length)\n {\n stripe.stripeJs.handleNextAction({\n clientSecret: clientSecret\n }).then(self.onConfirm.bind(self));\n }\n else\n {\n // No further actions are needed\n self.onConfirm(null);\n }\n }\n catch (e)\n {\n restoreQuoteAction();\n self.showError(\"The order was placed but we could not confirm if the payment was successful.\");\n console.error(e);\n }\n\n });\n },\n\n isSuccessful: function(stripeObject)\n {\n\n if (stripeObject.status == \"requires_action\" &&\n stripeObject.next_action &&\n stripeObject.next_action.type &&\n stripeObject.next_action.type != \"use_stripe_sdk\"\n )\n {\n // This is the case for vouchers, where an offline payment is required\n return true;\n }\n\n return (['processing', 'requires_capture', 'succeeded'].indexOf(stripeObject.status) >= 0);\n },\n\n getConfirmParams: function()\n {\n var params = {\n elements: this.elements,\n confirmParams: {\n return_url: this.getStripeParam(\"successUrl\")\n }\n };\n\n this.getPaymentElementOptions();\n if (this.useQuoteBillingAddress())\n {\n params.confirmParams.payment_method_data = {\n billing_details: {\n address: this.getStripeFormattedAddress(quote.billingAddress()),\n email: this.getBillingEmail(),\n name: this.getNameFromAddress(quote.billingAddress()),\n phone: this.getBillingPhone()\n }\n };\n }\n\n return params;\n },\n\n getStripeFormattedAddress: function(address)\n {\n var stripeAddress = {};\n\n stripeAddress.state = address.region ? address.region : null;\n stripeAddress.postal_code = address.postcode ? address.postcode : null;\n stripeAddress.country = address.countryId ? address.countryId : null;\n stripeAddress.city = address.city ? address.city : null;\n\n if (address.street && address.street.length > 0)\n {\n stripeAddress.line1 = address.street[0];\n\n if (address.street.length > 1)\n {\n stripeAddress.line2 = address.street[1];\n }\n else\n {\n stripeAddress.line2 = null;\n }\n }\n else\n {\n stripeAddress.line1 = null;\n stripeAddress.line2 = null;\n }\n\n return stripeAddress;\n },\n\n getBillingEmail: function()\n {\n if (quote.guestEmail)\n {\n return quote.guestEmail;\n }\n else if (window.checkoutConfig.customerData && window.checkoutConfig.customerData.email)\n {\n return window.checkoutConfig.customerData.email;\n }\n\n return null;\n },\n\n getNameFromAddress: function(address)\n {\n if (!address)\n return null;\n\n var parts = [];\n if (address.firstname)\n parts.push(address.firstname);\n\n if (address.middlename)\n parts.push(address.middlename);\n\n if (address.lastname)\n parts.push(address.lastname);\n\n return parts.join(\" \");\n },\n\n getBillingPhone: function()\n {\n var billingAddress = quote.billingAddress();\n if (!billingAddress)\n return null;\n\n if (billingAddress.telephone)\n return billingAddress.telephone;\n\n return null;\n },\n\n onConfirm: function(result)\n {\n this.isLoading(false);\n if (result && result.error)\n {\n this.showError(result.error.message);\n }\n else\n {\n customerData.invalidate(['cart']);\n redirectOnSuccessAction.execute();\n }\n },\n\n /**\n * @return {*}\n */\n getPlaceOrderDeferredObject: function()\n {\n return placeOrderAction(this.getData(), this.messageContainer);\n },\n\n getClientSecretFromResponse: function(response)\n {\n if (typeof response != \"string\")\n {\n return null;\n }\n\n if (response.indexOf(\"Authentication Required: \") >= 0)\n {\n return response.substring(\"Authentication Required: \".length);\n }\n\n return null;\n },\n\n handlePlaceOrderErrors: function (result)\n {\n if (result && result.responseJSON && result.responseJSON.message)\n {\n var clientSecret = this.getClientSecretFromResponse(result.responseJSON.message);\n\n if (clientSecret)\n {\n var self = this;\n return stripe.authenticateCustomer(clientSecret, function(err)\n {\n if (err)\n return self.showError(err);\n\n self.placeNewOrder.bind(self)();\n });\n }\n else\n {\n this.showError(result.responseJSON.message);\n }\n }\n else\n {\n this.showError($t(\"The order could not be placed. Please contact us for assistance.\"));\n\n if (result && result.responseText)\n console.error(result.responseText);\n else\n console.error(result);\n }\n },\n\n showError: function(message)\n {\n this.isLoading(false);\n this.isPlaceOrderEnabled(true);\n this.messageContainer.addErrorMessage({ \"message\": message });\n },\n\n validate: function(elm)\n {\n return agreementValidator.validate() && additionalValidators.validate();\n },\n\n getCode: function()\n {\n return 'stripe_payments_bank_transfers';\n },\n\n getData: function()\n {\n var data = {\n 'method': this.item.method,\n 'additional_data': {\n 'payment_method': this.getPaymentMethodId(),\n }\n };\n\n return data;\n },\n\n clearErrors: function()\n {\n this.stripePaymentsError(null);\n }\n\n });\n }\n);\n","StripeIntegration_Payments/js/view/multishipping/method-renderer/payment_element.js":"define(\n [\n 'ko',\n 'StripeIntegration_Payments/js/view/payment/method-renderer/stripe_payments_multishipping',\n 'StripeIntegration_Payments/js/stripe',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Checkout/js/model/quote',\n 'Magento_Customer/js/model/customer',\n 'Magento_Checkout/js/action/set-payment-information',\n 'mage/translate',\n 'mage/url',\n 'jquery',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'mage/storage',\n 'mage/url',\n 'Magento_CheckoutAgreements/js/model/agreement-validator',\n 'Magento_Customer/js/customer-data',\n 'Magento_Ui/js/modal/alert',\n 'domReady!'\n ],\n function (\n ko,\n Component,\n stripe,\n globalMessageList,\n quote,\n customer,\n setPaymentInformationAction,\n $t,\n url,\n $,\n additionalValidators,\n storage,\n urlBuilder,\n agreementValidator,\n customerData,\n alert\n ) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'StripeIntegration_Payments/multishipping/payment_element',\n continueSelector: '#payment-continue',\n cardElement: null,\n token: ko.observable(null),\n params: null,\n captureMethod: 'automatic'\n },\n\n initObservable: function ()\n {\n this._super();\n\n $(this.continueSelector).on(\"click\", this.onContinue.bind(this));\n\n return this;\n },\n\n onPaymentElementContainerRendered: function()\n {\n var self = this;\n this.isLoading(true);\n\n this.params = window.initParams;\n\n stripe.initStripe(this.params, function(err)\n {\n if (err)\n return self.crash(err);\n\n self.initSavedPaymentMethods.bind(self)();\n self.initPaymentForm.bind(self)();\n });\n },\n\n onContainerRendered: function()\n {\n this.onPaymentElementContainerRendered();\n this.isInitialized(true);\n },\n\n initPaymentForm: function()\n {\n this.isInitializing(false);\n this.isLoading(false);\n\n if (this.isCollapsed()) // Don't render PE with a height of 0\n return;\n\n if (document.getElementById('stripe-payment-element') === null)\n return this.crash(\"Cannot initialize Card Element on a DOM that does not contain a div.stripe-card-element.\");\n\n if (!stripe.stripeJs)\n return this.crash(\"Stripe.js could not be initialized.\");\n\n try\n {\n var elementOptions = this.getElementsOptions(true);\n elementOptions.setupFutureUsage = 'on_session';\n elementOptions.captureMethod = this.captureMethod;\n this.elements = stripe.stripeJs.elements(this.getElementsOptions(true));\n }\n catch (e)\n {\n console.warn(\"Could not filter Stripe payment method types: \" + e.message);\n this.elements = stripe.stripeJs.elements(this.getElementsOptions(false));\n }\n\n this.paymentElement = this.elements.create('payment', this.getPaymentElementOptions());\n this.paymentElement.mount('#stripe-payment-element');\n this.paymentElement.on('change', this.onChange.bind(this));\n\n },\n\n onSetPaymentMethodFail: function(result)\n {\n this.token(null);\n this.isLoading(false);\n console.error(result);\n },\n\n onContinue: function(e)\n {\n // If we already have a tokenized payment method, don't do anything\n if (this.token())\n return;\n\n var self = this;\n\n if (!this.isStripeMethodSelected())\n return;\n\n e.preventDefault();\n e.stopPropagation();\n\n if (!this.validatePaymentMethod())\n return;\n\n this.isLoading(true);\n\n if (this.getSelectedMethod(\"type\") && this.getSelectedMethod(\"type\") != \"new\")\n {\n self.token(this.getSelectedMethod(\"value\"));\n setPaymentInformationAction(this.messageContainer, this.getData()).then(function(){\n $(self.continueSelector).trigger(\"click\");\n }).fail(self.onSetPaymentMethodFail.bind(self));\n }\n else\n {\n this.createPaymentMethod(function(err)\n {\n if (err)\n return self.showError(err);\n\n $(self.continueSelector).trigger(\"click\");\n });\n }\n },\n\n createPaymentMethod: function(done)\n {\n var self = this;\n\n var paymentMethodData = {\n elements: this.elements,\n params: {}\n };\n\n var confirmParams = this.getConfirmParams();\n var billingDetails = null;\n if (confirmParams &&\n confirmParams.confirmParams &&\n confirmParams.confirmParams.payment_method_data &&\n confirmParams.confirmParams.payment_method_data.billing_details\n )\n {\n billingDetails = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n\n if (billingDetails)\n {\n paymentMethodData.params.billing_details = confirmParams.confirmParams.payment_method_data.billing_details;\n }\n else\n {\n return this.showError($t(\"Please specify a billing address.\"));\n }\n\n this.elements.submit().then(function() {\n stripe.stripeJs.createPaymentMethod(paymentMethodData).then(function(result)\n {\n if (result.error)\n {\n self.showError(result.error.message);\n console.error(result.error.message);\n }\n else\n {\n self.token(result.paymentMethod.id);\n\n setPaymentInformationAction(self.messageContainer, self.getData()).then(function()\n {\n done();\n }).fail(self.onSetPaymentMethodFail.bind(self));\n }\n });\n });\n\n },\n\n getData: function()\n {\n var data = {\n 'method': this.item.method,\n 'additional_data': {\n 'payment_method': this.token()\n }\n };\n\n return data;\n },\n\n showError: function(message)\n {\n this.isLoading(false);\n alert({ content: message });\n },\n\n validatePaymentMethod: function ()\n {\n var methods = $('[name^=\"payment[\"]'), isValid = false;\n\n if (methods.length === 0)\n this.showError( $.mage.__('We can\\'t complete your order because you don\\'t have a payment method set up.') );\n else if (methods.filter('input:radio:checked').length)\n return true;\n else\n this.showError( $.mage.__('Please choose a payment method.') );\n\n return isValid;\n },\n\n isStripeMethodSelected: function()\n {\n var methods = $('[name^=\"payment[\"]');\n\n if (methods.length === 0)\n return false;\n\n var stripe = methods.filter(function(index, value)\n {\n if (value.id == \"p_method_stripe_payments\")\n return value;\n });\n\n if (stripe.length == 0)\n return false;\n\n return stripe[0].checked;\n }\n });\n }\n);\n","StripeIntegration_Payments/js/action/list-payment-methods.js":"define(\n [\n 'mage/url',\n 'mage/storage'\n ],\n function (\n urlBuilder,\n storage\n ) {\n 'use strict';\n return function (callback)\n {\n var serviceUrl = urlBuilder.build('rest/V1/stripe/payments/list_payment_methods');\n\n return storage.get(serviceUrl).always(callback);\n };\n }\n);\n","StripeIntegration_Payments/js/action/add-payment-method.js":"define(\n [\n 'mage/url',\n 'mage/storage'\n ],\n function (\n urlBuilder,\n storage\n ) {\n 'use strict';\n return function (paymentMethodId, callback)\n {\n var serviceUrl = urlBuilder.build('rest/V1/stripe/payments/add_payment_method');\n\n var payload = {\n paymentMethodId: paymentMethodId\n };\n\n return storage.post(serviceUrl, JSON.stringify(payload)).always(callback);\n };\n }\n);\n","StripeIntegration_Payments/js/action/delete-payment-method.js":"define(\n [\n 'mage/url',\n 'mage/storage'\n ],\n function (\n urlBuilder,\n storage\n ) {\n 'use strict';\n return function (paymentMethodId, fingerprint, callback)\n {\n var serviceUrl = urlBuilder.build('rest/V1/stripe/payments/delete_payment_method');\n\n var payload = {\n paymentMethodId: paymentMethodId\n };\n\n if (fingerprint)\n {\n payload.fingerprint = fingerprint;\n }\n\n return storage.post(serviceUrl, JSON.stringify(payload)).always(callback);\n };\n }\n);\n","StripeIntegration_Payments/js/action/post-cancel-order.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'Magento_Customer/js/customer-data',\n 'mage/storage'\n ],\n function (urlBuilder, customerData, storage) {\n 'use strict';\n\n var promise = null; // If this is set, the promise is not resolved\n\n return function (errorMessage, callback)\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/cancel_last_order', {});\n\n var payload = {\n errorMessage: errorMessage\n };\n\n customerData.invalidate(['cart']);\n\n if (!promise)\n promise = storage.post(serviceUrl, JSON.stringify(payload));\n else\n return promise.always(callback); // Stack multiple callbacks onto the promise\n\n return promise.always(function(result, outcome, response)\n {\n promise = null; // Marks it as resolved\n callback(result, outcome, response);\n });\n };\n }\n);\n","StripeIntegration_Payments/js/action/get-upcoming-invoice.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage'\n ],\n function (urlBuilder, storage) {\n 'use strict';\n\n var promise = null; // If this is set, the promise is not resolved\n\n return function (callback)\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/get_upcoming_invoice', {});\n\n if (!promise)\n promise = storage.get(serviceUrl);\n else\n return promise.always(callback); // Stack multiple callbacks onto the promise\n\n return promise.always(function(result, outcome, response)\n {\n promise = null; // Marks it as resolved\n callback(result, outcome, response);\n });\n };\n }\n);\n","StripeIntegration_Payments/js/action/get-requires-action.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'Magento_Customer/js/customer-data',\n 'mage/storage'\n ],\n function (urlBuilder, customerData, storage) {\n 'use strict';\n\n var promise = null; // If this is set, the promise is not resolved\n\n return function (callback)\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/get_requires_action', {});\n\n customerData.invalidate(['cart']);\n\n if (!promise)\n promise = storage.get(serviceUrl);\n else\n return promise.always(callback); // Stack multiple callbacks onto the promise\n\n return promise.always(function(result, outcome, response)\n {\n promise = null; // Marks it as resolved\n callback(result, outcome, response);\n });\n };\n }\n);\n","StripeIntegration_Payments/js/action/finalize-multishipping-order.js":"define(\n [\n 'jquery',\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage',\n 'Magento_Customer/js/customer-data',\n 'Magento_Ui/js/modal/alert'\n ],\n function ($, urlBuilder, storage, customerData, alert) {\n 'use strict';\n\n var showError = function(message, e)\n {\n alert( { content: message });\n\n if (typeof e != \"undefined\")\n console.error(e);\n };\n\n return function (error)\n {\n customerData.invalidate(['cart']);\n\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/finalize_multishipping_order', {});\n var payload = { error: error };\n\n return storage.post(serviceUrl, JSON.stringify(payload))\n .then(function(result, b, c)\n {\n var response = null;\n\n try\n {\n response = JSON.parse(result);\n }\n catch (e)\n {\n return showError(\"Sorry, a server side error has occurred.\", e);\n }\n\n if (response.error)\n return showError(response.error, response.error);\n\n if (response.redirect)\n return $.mage.redirect(response.redirect);\n\n return showError(response, response);\n })\n .fail(function(result)\n {\n return showError(\"Sorry, a server side error has occurred.\", result);\n });\n };\n }\n);\n","StripeIntegration_Payments/js/action/post-update-cart.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage',\n 'Magento_Customer/js/customer-data'\n ],\n function (urlBuilder, storage, customerData) {\n 'use strict';\n return function (data, callback)\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/update_cart', {});\n\n // This API call may inactivate the customer cart\n customerData.invalidate(['cart']);\n\n if (data)\n {\n return storage.post(\n serviceUrl,\n JSON.stringify({ data: data })\n ).always(callback);\n }\n else\n {\n\n return storage.post(serviceUrl).always(callback);\n }\n };\n }\n);\n","StripeIntegration_Payments/js/action/post-restore-quote.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage',\n 'Magento_Customer/js/customer-data',\n 'Magento_Checkout/js/model/quote'\n ],\n function (\n urlBuilder,\n storage,\n customerData,\n quote\n ) {\n 'use strict';\n return function (callback)\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/restore_quote', {});\n\n customerData.invalidate(['cart']);\n\n return storage.post(serviceUrl).always(callback);\n };\n }\n);\n","StripeIntegration_Payments/js/action/get-checkout-session-id.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage'\n ],\n function (urlBuilder, storage) {\n 'use strict';\n\n return function ()\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/get_checkout_session_id', {});\n\n return storage.get(serviceUrl);\n };\n }\n);\n","StripeIntegration_Payments/js/action/get-payment-url.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage',\n 'Magento_Checkout/js/model/error-processor',\n 'Magento_Checkout/js/model/full-screen-loader'\n ],\n function (urlBuilder, storage, errorProcessor, fullScreenLoader) {\n 'use strict';\n return function (messageContainer) {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/redirect_url', {});\n\n fullScreenLoader.startLoader();\n\n return storage.get(\n serviceUrl\n ).fail(\n function (response) {\n errorProcessor.process(response, messageContainer);\n fullScreenLoader.stopLoader();\n }\n );\n };\n }\n);\n","StripeIntegration_Payments/js/action/get-trialing-subscriptions.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage',\n 'Magento_Checkout/js/model/error-processor',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'Magento_Checkout/js/model/quote'\n ],\n function (urlBuilder, storage, errorProcessor, fullScreenLoader, quote) {\n 'use strict';\n return function (quote)\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/get_trialing_subscriptions', {});\n\n var payload = {\n billingAddress: quote.billingAddress()\n };\n\n if (quote.shippingAddress())\n payload.shippingAddress = quote.shippingAddress();\n\n if (quote.shippingMethod())\n payload.shippingMethod = quote.shippingMethod();\n\n var totals = quote.totals();\n if (typeof totals.coupon_code != \"undefined\" && totals.coupon_code && totals.coupon_code.length > 0)\n payload.couponCode = totals.coupon_code;\n\n return storage.post(serviceUrl, JSON.stringify(payload));\n };\n }\n);\n","StripeIntegration_Payments/js/action/get-checkout-methods.js":"define(\n [\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage',\n 'Magento_Checkout/js/model/error-processor',\n 'Magento_Checkout/js/model/full-screen-loader',\n 'Magento_Checkout/js/model/quote'\n ],\n function (urlBuilder, storage, errorProcessor, fullScreenLoader, quote) {\n 'use strict';\n\n var timesRequested = 0;\n\n return function (quote, onDoneCallback)\n {\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/get_checkout_payment_methods', {});\n\n var payload = {\n billingAddress: quote.billingAddress()\n };\n\n if (quote.shippingAddress())\n payload.shippingAddress = quote.shippingAddress();\n\n if (quote.shippingMethod())\n payload.shippingMethod = quote.shippingMethod();\n\n var totals = quote.totals();\n if (typeof totals.coupon_code != \"undefined\" && totals.coupon_code && totals.coupon_code.length > 0)\n payload.couponCode = totals.coupon_code;\n\n try\n {\n if (!payload.billingAddress.countryId.length)\n return;\n\n if (!quote.isVirtual())\n {\n if (!payload.shippingAddress.countryId.length)\n return;\n }\n\n if (timesRequested > 0)\n return;\n }\n catch (e)\n {\n return;\n }\n\n timesRequested++;\n return storage.post(serviceUrl, JSON.stringify(payload)).done(onDoneCallback);\n };\n }\n);\n","StripeIntegration_Payments/js/action/place-multishipping-order.js":"define(\n [\n 'jquery',\n 'Magento_Checkout/js/model/url-builder',\n 'mage/storage',\n 'Magento_Customer/js/customer-data',\n 'Magento_Ui/js/modal/alert'\n ],\n function ($, urlBuilder, storage, customerData, alert) {\n 'use strict';\n\n var showError = function(message, e)\n {\n alert( { content: message });\n\n if (typeof e != \"undefined\")\n console.error(e);\n };\n\n return function (callback, onAuthenticationRequired)\n {\n customerData.invalidate(['cart']);\n\n var serviceUrl = urlBuilder.createUrl('/stripe/payments/place_multishipping_order', {});\n\n return storage.post(serviceUrl)\n .then(function(result, b, c)\n {\n var response = null;\n\n try\n {\n response = JSON.parse(result);\n }\n catch (e)\n {\n return showError(\"Sorry, a server side error has occurred.\", e);\n }\n\n if (response.error)\n return showError(response.error, response.error);\n\n if (response.redirect)\n return $.mage.redirect(response.redirect);\n\n if (response.authenticate)\n return onAuthenticationRequired(response.authenticate);\n\n return showError(response, response);\n })\n .fail(function(result)\n {\n return showError(\"Sorry, a server side error has occurred.\", result);\n })\n .always(callback);\n };\n }\n);\n","StripeIntegration_Payments/js/mixins/messages-mixin.js":"define([], function() {\n 'use strict';\n return function(target) {\n return target.extend({\n isVisible: function () {\n var msgs = this.messageContainer.errorMessages();\n for (var i = 0; i < msgs.length; i++)\n {\n if (typeof msgs[i] != 'string')\n continue;\n\n if (msgs[i].indexOf(\"Authentication Required: \") >= 0)\n return false;\n }\n return this.isHidden(this.messageContainer.hasMessages());\n }\n });\n };\n});\n","StripeIntegration_Payments/js/mixins/checkout/payment/list.js":"define([\n 'StripeIntegration_Payments/js/helper/subscriptions',\n 'mage/translate',\n],\nfunction(\n subscriptions,\n $t\n) {\n 'use strict';\n return function(target) {\n return target.extend({\n /**\n * Returns payment group title\n *\n * @param {Object} group\n * @returns {String}\n */\n getGroupTitle: function (group)\n {\n if (subscriptions.isSubscriptionUpdate())\n return $t(\"Subscription Update Review\");\n\n var title = group().title;\n\n if (group().isDefault() && this.paymentGroupsList().length > 1) {\n title = this.defaultGroupTitle;\n }\n\n return title;\n },\n });\n };\n});\n","StripeIntegration_Payments/js/mixins/checkout/summary/grand_total.js":"define([\n 'Magento_Checkout/js/model/quote',\n 'Magento_Checkout/js/model/totals',\n 'Magento_Catalog/js/price-utils',\n 'StripeIntegration_Payments/js/view/checkout/trialing_subscriptions',\n 'StripeIntegration_Payments/js/view/checkout/summary/prorations'\n], function (\n quote,\n totals,\n priceUtils,\n trialingSubscriptions,\n prorations\n) {\n 'use strict';\n\n return function (grandTotal)\n {\n return grandTotal.extend(\n {\n totals: quote.getTotals(),\n\n getValue: function()\n {\n var price = 0;\n\n if (totals && totals.getSegment('grand_total'))\n {\n price = parseFloat(totals.getSegment('grand_total').value);\n price += trialingSubscriptions().getPureValue();\n price += prorations().getPureValue();\n }\n\n return grandTotal().getFormattedPrice(price);\n },\n\n getBaseValue: function () {\n var price = 0;\n\n if (totals && totals.getSegment('base_grand_total'))\n {\n price = parseFloat(totals.getSegment('base_grand_total').value);\n price += trialingSubscriptions().getBasePureValue();\n price += prorations().getBasePureValue();\n }\n\n return priceUtils.formatPrice(price, quote.getBasePriceFormat());\n },\n\n getTaxAmount: function()\n {\n if (totals.getSegment('tax_amount'))\n {\n // Tax exclusive settings\n return parseFloat(totals.getSegment('tax_amount').value);\n }\n\n if (totals.getSegment('tax'))\n {\n // Tax inclusive settings\n return parseFloat(totals.getSegment('tax').value);\n }\n\n // Core implementation should handle both cases\n var total = this.totals();\n if (total && total.tax_amount) {\n return total.tax_amount;\n }\n\n return 0;\n },\n\n getGrandTotalExclTax: function()\n {\n var price = 0;\n\n if (totals.getSegment('grand_total'))\n {\n price = parseFloat(totals.getSegment('grand_total').value);\n price -= parseFloat(this.getTaxAmount());\n price += trialingSubscriptions().getTaxAmount();\n price += trialingSubscriptions().getPureValue();\n price += prorations().getPureValue();\n }\n\n return grandTotal().getFormattedPrice(price);\n }\n });\n };\n});\n","StripeIntegration_Payments/js/helper/subscriptions.js":"define(\n [\n 'ko'\n ],\n function (\n ko\n ) {\n 'use strict';\n\n return {\n isSubscriptionUpdate: function()\n {\n return !!(window.checkoutConfig &&\n window.checkoutConfig.payment &&\n window.checkoutConfig.payment.stripe_payments &&\n window.checkoutConfig.payment.stripe_payments.subscriptionUpdateDetails);\n },\n\n getConfig: function(key)\n {\n var config = null;\n\n if (window.checkoutConfig && window.checkoutConfig.payment && window.checkoutConfig.payment.stripe_payments)\n {\n config = window.checkoutConfig.payment.stripe_payments;\n }\n\n if (!config || !config.subscriptionUpdateDetails)\n {\n return null;\n }\n\n if (!config.subscriptionUpdateDetails[key])\n {\n return \"--\";\n }\n\n return config.subscriptionUpdateDetails[key];\n },\n\n getSuccessUrl: function()\n {\n return this.getConfig(\"success_url\");\n },\n\n getCancelUrl: function()\n {\n return this.getConfig(\"cancel_url\");\n },\n\n displaySidebar: function()\n {\n return this.isSubscriptionUpdate();\n // && !window.checkoutConfig.payment.stripe_payments.subscriptionUpdateDetails.is_virtual\n // && window.location.href.indexOf('#payment') < 0;\n }\n };\n }\n);\n","StripeIntegration_Payments/js/model/upcomingInvoice.js":"define(\n [\n 'ko',\n 'Magento_Checkout/js/model/quote',\n 'StripeIntegration_Payments/js/action/get-upcoming-invoice',\n ],\n function (\n ko,\n quote,\n getUpcomingInvoiceAction\n ) {\n 'use strict';\n\n return {\n upcomingInvoiceRequest: null,\n initialized: false,\n currentTotals: null,\n callbacks: [],\n\n initialize: function()\n {\n if (this.initialized)\n return;\n\n this.initialized = true;\n\n this.watchTotals();\n getUpcomingInvoiceAction(this.upcomingInvoiceChanged.bind(this));\n },\n\n watchTotals: function()\n {\n this.currentTotals = quote.totals();\n var upcomingInvoiceChanged = this.upcomingInvoiceChanged.bind(this);\n var self = this;\n\n quote.totals.subscribe(function (totals)\n {\n if (JSON.stringify(totals.total_segments) == JSON.stringify(self.currentTotals.total_segments))\n return;\n\n self.currentTotals = totals;\n\n getUpcomingInvoiceAction(upcomingInvoiceChanged);\n }, self);\n },\n\n upcomingInvoiceChanged: function(result, outcome, response)\n {\n this.upcomingInvoiceRequest = {\n result: result,\n outcome: outcome,\n response: response\n };\n\n for (var i = 0; i < this.callbacks.length; i++)\n {\n this.callbacks[i](result, outcome, response);\n }\n },\n\n onChange: function(callback)\n {\n this.callbacks.push(callback);\n\n if (this.upcominInvoiceRequest)\n {\n callback(this.upcominInvoiceRequest.result, this.upcominInvoiceRequest.outcome, this.upcominInvoiceRequest.response);\n }\n }\n };\n }\n);\n","Webkul_PrivateShop/js/view/wishlist-view.js":"/**\n * Webkul Software\n *\n * @category Webkul\n * @package Webkul_PrivateShop\n * @author Webkul Software Private Limited\n * @copyright Webkul Software Private Limited (https://webkul.com)\n * @license https://store.webkul.com/license.html\n */\ndefine(\n ['jquery'],\n function ($) {\n $.widget(\n 'webkul.privateProductLabel',\n {\n _create: function () {\n var self = this;\n $(\".price-box\").each(function () {\n var id= $(this).attr('data-product-id');\n var self1 = this;\n $.ajax({\n url: self.options.labetData.url,\n type: 'POST',\n data: { id : id},\n dataType: 'json',\n success: function (response) {\n if (response == 'true') {\n $($(self1).parent().find(\"a\").find(\"span\").find(\"span\"))\n .append(self.options.labetData.html);\n $($(self1).parent().parent('.product-item-info').find(\"a\").find(\"span\").find(\"span\"))\n .append(self.options.labetData.html);\n $($(self1).parent().parent().find(\"div.product-item-img\").find(\"a.product-image\"))\n .prepend(self.options.labetData.html);\n $($(self1).parent().parent().find(\"div.product-item-photo\"))\n .prepend(self.options.labetData.html);\n } \n }\n })\n });\n }\n }\n );\n return $.webkul.privateProductLabel;\n }\n);","Webkul_PrivateShop/js/view/category-view.js":"/**\n * Webkul Software\n *\n * @category Webkul\n * @package Webkul_PrivateShop\n * @author Webkul Software Private Limited\n * @copyright Webkul Software Private Limited (https://webkul.com)\n * @license https://store.webkul.com/license.html\n */\ndefine(\n ['jquery'],\n function ($) {\n $.widget(\n 'webkul.privateProductLabel',\n {\n _create: function () {\n var self = this;\n $(\".private-label-available\").each(function () {\n if ($(this).val() == 1) {\n $($(this).parent().find(\"a\").find(\"span\").find(\"span\"))\n .append(self.options.labetData.html);\n $($(this).parent().parent('.product-item-info').find(\"a\").find(\"span\").find(\"span\"))\n .append(self.options.labetData.html);\n\n $($(this).parent().parent().find(\"div.product-item-img\").find(\"a.product-image\"))\n .prepend(self.options.labetData.html);\n\n $($(this).parent().parent().find(\"div.product-item-photo\"))\n .prepend(self.options.labetData.html);\n }\n });\n }\n }\n );\n return $.webkul.privateProductLabel;\n }\n);","Webkul_PrivateShop/js/view/product-view.js":"/**\n * Webkul Software\n *\n * @category Webkul\n * @package Webkul_PrivateShop\n * @author Webkul Software Private Limited\n * @copyright Webkul Software Private Limited (https://webkul.com)\n * @license https://store.webkul.com/license.html\n */\ndefine(\n [\n 'jquery'\n ],\n function ($) {\n $.widget(\n 'private.viewProduct',\n {\n _create: function () {\n var self = this;\n $(\".product.media\").prepend(self.options.labetData.html);\n }\n }\n );\n return $.private.viewProduct;\n }\n);","Magento_Captcha/js/captcha.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n /**\n * @api\n */\n $.widget('mage.captcha', {\n options: {\n refreshClass: 'refreshing',\n reloadSelector: '.captcha-reload',\n imageSelector: '.captcha-img',\n imageLoader: ''\n },\n\n /**\n * Method binds click event to reload image\n * @private\n */\n _create: function () {\n this.element.on('click', this.options.reloadSelector, $.proxy(this.refresh, this));\n },\n\n /**\n * Method triggers an AJAX request to refresh the CAPTCHA image\n */\n refresh: function () {\n var imageLoader = this.options.imageLoader;\n\n if (imageLoader) {\n this.element.find(this.options.imageSelector).attr('src', imageLoader);\n }\n this.element.addClass(this.options.refreshClass);\n\n $.ajax({\n url: this.options.url,\n type: 'post',\n dataType: 'json',\n context: this,\n data: {\n 'formId': this.options.type\n },\n\n /**\n * @param {Object} response\n */\n success: function (response) {\n if (response.imgSrc) {\n this.element.find(this.options.imageSelector).attr('src', response.imgSrc);\n }\n },\n\n /** Complete callback. */\n complete: function () {\n this.element.removeClass(this.options.refreshClass);\n }\n });\n }\n });\n\n return $.mage.captcha;\n});\n","Magento_Captcha/js/view/checkout/loginCaptcha.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'Magento_Captcha/js/view/checkout/defaultCaptcha',\n 'Magento_Captcha/js/model/captchaList',\n 'Magento_Customer/js/action/login',\n 'underscore'\n],\nfunction (defaultCaptcha, captchaList, loginAction, _) {\n 'use strict';\n\n return defaultCaptcha.extend({\n /** @inheritdoc */\n initialize: function () {\n var self = this,\n currentCaptcha;\n\n this._super();\n currentCaptcha = captchaList.getCaptchaByFormId(this.formId);\n\n if (currentCaptcha != null) {\n currentCaptcha.setIsVisible(true);\n this.setCurrentCaptcha(currentCaptcha);\n\n loginAction.registerLoginCallback(function (loginData) {\n if (loginData['captcha_form_id'] &&\n loginData['captcha_form_id'] === self.formId &&\n self.isRequired()\n ) {\n _.defer(self.refresh.bind(self));\n }\n });\n }\n }\n });\n});\n","Magento_Captcha/js/view/checkout/defaultCaptcha.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'uiComponent',\n 'Magento_Captcha/js/model/captcha',\n 'Magento_Captcha/js/model/captchaList',\n 'Magento_Customer/js/customer-data',\n 'underscore'\n], function ($, Component, Captcha, captchaList, customerData, _) {\n 'use strict';\n\n var captchaConfig;\n\n return Component.extend({\n defaults: {\n template: 'Magento_Captcha/checkout/captcha'\n },\n dataScope: 'global',\n currentCaptcha: null,\n subscribedFormIds: [],\n\n /**\n * @return {*}\n */\n captchaValue: function () {\n return this.currentCaptcha.getCaptchaValue();\n },\n\n /** @inheritdoc */\n initialize: function () {\n this._super();\n\n if (window[this.configSource] && window[this.configSource].captcha) {\n captchaConfig = window[this.configSource].captcha;\n $.each(captchaConfig, function (formId, captchaData) {\n var captcha;\n\n captchaData.formId = formId;\n captcha = Captcha(captchaData);\n this.checkCustomerData(formId, customerData.get('captcha')(), captcha);\n this.subscribeCustomerData(formId, captcha);\n captchaList.add(captcha);\n }.bind(this));\n }\n },\n\n /**\n * Check customer data for captcha configuration.\n *\n * @param {String} formId\n * @param {Object} captchaData\n * @param {Object} captcha\n */\n checkCustomerData: function (formId, captchaData, captcha) {\n if (!_.isEmpty(captchaData) &&\n !_.isEmpty(captchaData[formId]) &&\n captchaData[formId].timestamp > captcha.timestamp\n ) {\n if (!captcha.isRequired() && captchaData[formId].isRequired) {\n captcha.refresh();\n }\n captcha.isRequired(captchaData[formId].isRequired);\n captcha.timestamp = captchaData[formId].timestamp;\n }\n },\n\n /**\n * Subscribe for customer data updates.\n *\n * @param {String} formId\n * @param {Object} captcha\n */\n subscribeCustomerData: function (formId, captcha) {\n if (this.subscribedFormIds.includes(formId) === false) {\n this.subscribedFormIds.push(formId);\n customerData.get('captcha').subscribe(function (captchaData) {\n this.checkCustomerData(formId, captchaData, captcha);\n }.bind(this));\n }\n },\n\n /**\n * @return {Boolean}\n */\n getIsLoading: function () {\n return this.currentCaptcha !== null ? this.currentCaptcha.isLoading : false;\n },\n\n /**\n * @return {null|Object}\n */\n getCurrentCaptcha: function () {\n return this.currentCaptcha;\n },\n\n /**\n * @param {Object} captcha\n */\n setCurrentCaptcha: function (captcha) {\n this.currentCaptcha = captcha;\n },\n\n /**\n * @return {String|null}\n */\n getFormId: function () {\n return this.currentCaptcha !== null ? this.currentCaptcha.getFormId() : null;\n },\n\n /**\n * @return {Boolean}\n */\n getIsVisible: function () {\n return this.currentCaptcha !== null ? this.currentCaptcha.getIsVisible() : false;\n },\n\n /**\n * @param {Boolean} flag\n */\n setIsVisible: function (flag) {\n this.currentCaptcha.setIsVisible(flag);\n },\n\n /**\n * @return {Boolean}\n */\n isRequired: function () {\n return this.currentCaptcha !== null ? this.currentCaptcha.getIsRequired() : false;\n },\n\n /**\n * Set isRequired on current captcha model.\n *\n * @param {Boolean} flag\n */\n setIsRequired: function (flag) {\n this.currentCaptcha.setIsRequired(flag);\n },\n\n /**\n * @return {Boolean}\n */\n isCaseSensitive: function () {\n return this.currentCaptcha !== null ? this.currentCaptcha.getIsCaseSensitive() : false;\n },\n\n /**\n * @return {String|Number|null}\n */\n imageHeight: function () {\n return this.currentCaptcha !== null ? this.currentCaptcha.getImageHeight() : null;\n },\n\n /**\n * @return {String|null}\n */\n getImageSource: function () {\n return this.currentCaptcha !== null ? this.currentCaptcha.getImageSource() : null;\n },\n\n /**\n * Refresh captcha.\n */\n refresh: function () {\n this.currentCaptcha.refresh();\n }\n });\n});\n","Magento_Captcha/js/action/refresh.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery', 'mage/url'\n], function ($, urlBuilder) {\n 'use strict';\n\n return function (refreshUrl, formId, imageSource) {\n return $.ajax({\n url: urlBuilder.build(refreshUrl),\n type: 'POST',\n data: JSON.stringify({\n 'formId': formId\n }),\n global: false,\n contentType: 'application/json'\n }).done(\n function (response) {\n if (response.imgSrc) {\n imageSource(response.imgSrc);\n }\n }\n );\n };\n});\n","Magento_Captcha/js/model/captchaList.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(['jquery'], function ($) {\n 'use strict';\n\n var captchaList = [];\n\n return {\n /**\n * @param {Object} captcha\n */\n add: function (captcha) {\n captchaList.push(captcha);\n },\n\n /**\n * @param {String} formId\n * @return {Object}\n */\n getCaptchaByFormId: function (formId) {\n var captcha = null;\n\n $.each(captchaList, function (key, item) {\n if (formId === item.formId) {\n captcha = item;\n\n return false;\n }\n });\n\n return captcha;\n },\n\n /**\n * @return {Array}\n */\n getCaptchaList: function () {\n return captchaList;\n }\n };\n});\n","Magento_Captcha/js/model/captcha.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'ko',\n 'Magento_Captcha/js/action/refresh'\n], function ($, ko, refreshAction) {\n 'use strict';\n\n return function (captchaData) {\n return {\n formId: captchaData.formId,\n imageSource: ko.observable(captchaData.imageSrc),\n visibility: ko.observable(false),\n captchaValue: ko.observable(null),\n isRequired: ko.observable(captchaData.isRequired),\n isCaseSensitive: captchaData.isCaseSensitive,\n imageHeight: captchaData.imageHeight,\n refreshUrl: captchaData.refreshUrl,\n isLoading: ko.observable(false),\n timestamp: null,\n\n /**\n * @return {String}\n */\n getFormId: function () {\n return this.formId;\n },\n\n /**\n * @param {String} formId\n */\n setFormId: function (formId) {\n this.formId = formId;\n },\n\n /**\n * @return {Boolean}\n */\n getIsVisible: function () {\n return this.visibility();\n },\n\n /**\n * @param {Boolean} flag\n */\n setIsVisible: function (flag) {\n this.visibility(flag);\n },\n\n /**\n * @return {Boolean}\n */\n getIsRequired: function () {\n return this.isRequired();\n },\n\n /**\n * @param {Boolean} flag\n */\n setIsRequired: function (flag) {\n this.isRequired(flag);\n },\n\n /**\n * @return {Boolean}\n */\n getIsCaseSensitive: function () {\n return this.isCaseSensitive;\n },\n\n /**\n * @param {Boolean} flag\n */\n setIsCaseSensitive: function (flag) {\n this.isCaseSensitive = flag;\n },\n\n /**\n * @return {String|Number}\n */\n getImageHeight: function () {\n return this.imageHeight;\n },\n\n /**\n * @param {String|Number}height\n */\n setImageHeight: function (height) {\n this.imageHeight = height;\n },\n\n /**\n * @return {String}\n */\n getImageSource: function () {\n return this.imageSource;\n },\n\n /**\n * @param {String} imageSource\n */\n setImageSource: function (imageSource) {\n this.imageSource(imageSource);\n },\n\n /**\n * @return {String}\n */\n getRefreshUrl: function () {\n return this.refreshUrl;\n },\n\n /**\n * @param {String} url\n */\n setRefreshUrl: function (url) {\n this.refreshUrl = url;\n },\n\n /**\n * @return {*}\n */\n getCaptchaValue: function () {\n return this.captchaValue;\n },\n\n /**\n * @param {*} value\n */\n setCaptchaValue: function (value) {\n this.captchaValue(value);\n },\n\n /**\n * Refresh captcha.\n */\n refresh: function () {\n var refresh,\n self = this;\n\n this.isLoading(true);\n\n refresh = refreshAction(this.getRefreshUrl(), this.getFormId(), this.getImageSource());\n $.when(refresh).done(function () {\n self.isLoading(false);\n });\n }\n };\n };\n});\n","Magento_Sales/js/gift-message.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.giftMessage', {\n options: {\n rowPrefix: '#order-item-row-', // Selector prefix for item's row in the table.\n linkPrefix: '#order-item-gift-message-link-', // Selector prefix for the 'Gift Message' link.\n duration: 100, // Toggle duration.\n expandedClass: 'expanded', // Class added/removed to/from the 'Gift Message' link.\n expandedContentClass: 'expanded-content', // Class added/removed to/from the 'Gift Message' content.\n lastClass: 'last' // Class added/removed to/from the last item's row in the products table.\n },\n\n /**\n * Bind a click handler on the widget's element to toggle the gift message.\n * @private\n */\n _create: function () {\n this.element.on('click', $.proxy(this._toggleGiftMessage, this));\n },\n\n /**\n * Toggle the display of the item's corresponding gift message.\n * @private\n * @param {jQuery.Event} event - Click event.\n */\n _toggleGiftMessage: function (event) {\n var element = $(event.target), // Click target. The 'Gift Message' link or 'Close' button.\n options = this.options, // Cached widget options.\n itemId = element.data('item-id'), // The individual item's numeric id.\n link = $(options.linkPrefix + itemId), // The 'Gift Message' expandable link.\n row = $(options.rowPrefix + itemId), // The item's row in the products table.\n region = $('#' + element.attr('aria-controls')); // The gift message container region.\n\n region.toggleClass(options.expandedContentClass, options.duration, function () {\n if (region.attr('aria-expanded') === 'true') {\n region.attr('aria-expanded', 'false');\n\n if (region.hasClass(options.lastClass)) {\n row.addClass(options.lastClass);\n }\n } else {\n region.attr('aria-expanded', 'true');\n\n if (region.hasClass(options.lastClass)) {\n row.removeClass(options.lastClass);\n }\n }\n link.toggleClass(options.expandedClass);\n });\n event.preventDefault(); // Prevent event propagation and avoid going to the link's href.\n }\n });\n\n return $.mage.giftMessage;\n});\n","Magento_Sales/js/orders-returns.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.ordersReturns', {\n options: {\n zipCode: '#oar-zip', // Search by zip code.\n emailAddress: '#oar-email', // Search by email address.\n searchType: '#quick-search-type-id' // Search element used for choosing between the two.\n },\n\n /** @inheritdoc */\n _create: function () {\n $(this.options.searchType).on('change', $.proxy(this._showIdentifyBlock, this)).trigger('change');\n },\n\n /**\n * Show either the search by zip code option or the search by email address option.\n * @private\n * @param {jQuery.Event} e - Change event. Event target value is either 'zip' or 'email'.\n */\n _showIdentifyBlock: function (e) {\n var value = $(e.target).val();\n\n $(this.options.zipCode).toggle(value === 'zip');\n $(this.options.emailAddress).toggle(value === 'email');\n }\n });\n\n return $.mage.ordersReturns;\n});\n","Magento_Sales/js/view/last-ordered-items.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'underscore'\n], function (Component, customerData, _) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n isShowAddToCart: false\n },\n\n /** @inheritdoc */\n initialize: function () {\n this._super();\n this.lastOrderedItems = customerData.get('last-ordered-items');\n this.lastOrderedItems.subscribe(this.checkSalableItems.bind(this));\n this.checkSalableItems();\n\n return this;\n },\n\n /** @inheritdoc */\n initObservable: function () {\n this._super()\n .observe('isShowAddToCart');\n\n return this;\n },\n\n /**\n * Check if items is_saleable and change add to cart button visibility.\n */\n checkSalableItems: function () {\n var isShowAddToCart = _.some(this.lastOrderedItems().items, {\n 'is_saleable': true\n });\n\n this.isShowAddToCart(isShowAddToCart);\n }\n });\n});\n","Magento_Customer/js/password-strength-indicator.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Customer/js/zxcvbn',\n 'mage/translate',\n 'mage/validation'\n], function ($, zxcvbn, $t) {\n 'use strict';\n\n $.widget('mage.passwordStrengthIndicator', {\n options: {\n cache: {},\n passwordSelector: '[type=password]',\n passwordStrengthMeterSelector: '[data-role=password-strength-meter]',\n passwordStrengthMeterLabelSelector: '[data-role=password-strength-meter-label]',\n formSelector: 'form',\n emailSelector: 'input[type=\"email\"]'\n },\n\n /**\n * Widget initialization\n * @private\n */\n _create: function () {\n this.options.cache.input = $(this.options.passwordSelector, this.element);\n this.options.cache.meter = $(this.options.passwordStrengthMeterSelector, this.element);\n this.options.cache.label = $(this.options.passwordStrengthMeterLabelSelector, this.element);\n\n // We need to look outside the module for backward compatibility, since someone can already use the module.\n // @todo Narrow this selector in 2.3 so it doesn't accidentally finds the email field from the\n // newsletter email field or any other \"email\" field.\n this.options.cache.email = $(this.options.formSelector).find(this.options.emailSelector);\n this._bind();\n },\n\n /**\n * Event binding, will monitor change, keyup and paste events.\n * @private\n */\n _bind: function () {\n this._on(this.options.cache.input, {\n 'change': this._calculateStrength,\n 'keyup': this._calculateStrength,\n 'paste': this._calculateStrength\n });\n\n if (this.options.cache.email.length) {\n this._on(this.options.cache.email, {\n 'change': this._calculateStrength,\n 'keyup': this._calculateStrength,\n 'paste': this._calculateStrength\n });\n }\n },\n\n /**\n * Calculate password strength\n * @private\n */\n _calculateStrength: function () {\n var password = this._getPassword(),\n isEmpty = password.length === 0,\n zxcvbnScore,\n displayScore,\n isValid;\n\n // Display score is based on combination of whether password is empty, valid, and zxcvbn strength\n if (isEmpty) {\n displayScore = 0;\n } else {\n this.options.cache.input.rules('add', {\n 'password-not-equal-to-user-name': this.options.cache.email.val()\n });\n\n // We should only perform this check in case there is an email field on screen\n if (this.options.cache.email.length &&\n password.toLowerCase() === this.options.cache.email.val().toLowerCase()) {\n displayScore = 1;\n } else {\n isValid = $.validator.validateSingleElement(this.options.cache.input);\n zxcvbnScore = zxcvbn(password).score;\n displayScore = isValid && zxcvbnScore > 0 ? zxcvbnScore : 1;\n }\n }\n\n // Update label\n this._displayStrength(displayScore);\n },\n\n /**\n * Display strength\n * @param {Number} displayScore\n * @private\n */\n _displayStrength: function (displayScore) {\n var strengthLabel = '',\n className;\n\n switch (displayScore) {\n case 0:\n strengthLabel = $t('No Password');\n className = 'password-none';\n break;\n\n case 1:\n strengthLabel = $t('Weak');\n className = 'password-weak';\n break;\n\n case 2:\n strengthLabel = $t('Medium');\n className = 'password-medium';\n break;\n\n case 3:\n strengthLabel = $t('Strong');\n className = 'password-strong';\n break;\n\n case 4:\n strengthLabel = $t('Very Strong');\n className = 'password-very-strong';\n break;\n }\n\n this.options.cache.meter\n .removeClass()\n .addClass(className);\n this.options.cache.label.text(strengthLabel);\n },\n\n /**\n * Get password value\n * @returns {*}\n * @private\n */\n _getPassword: function () {\n return this.options.cache.input.val();\n }\n });\n\n return $.mage.passwordStrengthIndicator;\n});\n","Magento_Customer/js/checkout-balance.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.checkoutBalance', {\n /**\n * Initialize store credit events\n * @private\n */\n _create: function () {\n this.eventData = {\n price: this.options.balance,\n totalPrice: 0\n };\n this.element.on('change', $.proxy(function (e) {\n if ($(e.target).is(':checked')) {\n this.eventData.price = -1 * this.options.balance;\n } else {\n if (this.options.amountSubstracted) { //eslint-disable-line no-lonely-if\n this.eventData.price = parseFloat(this.options.usedAmount);\n this.options.amountSubstracted = false;\n } else {\n this.eventData.price = parseFloat(this.options.balance);\n }\n }\n this.element.trigger('updateCheckoutPrice', this.eventData);\n }, this));\n }\n });\n\n return $.mage.checkoutBalance;\n});\n","Magento_Customer/js/validation.js":"define([\n 'jquery',\n 'moment',\n 'mageUtils',\n 'jquery/validate',\n 'validation',\n 'mage/translate'\n], function ($, moment, utils) {\n 'use strict';\n\n $.validator.addMethod(\n 'validate-date',\n function (value, element, params) {\n var dateFormat = utils.normalizeDate(params.dateFormat);\n\n if (value === '') {\n return true;\n }\n\n return moment(value, dateFormat, true).isValid();\n },\n $.mage.__('Invalid date')\n );\n\n $.validator.addMethod(\n 'validate-dob',\n function (value, element, params) {\n var dateFormat = utils.convertToMomentFormat(params.dateFormat);\n\n if (value === '') {\n return true;\n }\n\n return moment(value, dateFormat).isBefore(moment());\n },\n $.mage.__('The Date of Birth should not be greater than today.')\n );\n});\n","Magento_Customer/js/customer-global-session-loader.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Customer/js/customer-data'\n], function ($, customerData) {\n 'use strict';\n\n return function () {\n var customer;\n\n // When the session is available, this customer menu will be available\n if ($('.customer-menu').length > 0) {\n customer = customerData.get('customer');\n\n customerData.getInitCustomerData().done(function () {\n // Check if the customer data is set in local storage, if not reload data from server\n if (!customer().firstname) {\n customerData.reload([], false);\n }\n });\n }\n };\n});\n","Magento_Customer/js/addressValidation.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'underscore',\n 'mageUtils',\n 'mage/translate',\n 'Magento_Checkout/js/model/postcode-validator',\n 'jquery-ui-modules/widget',\n 'validation'\n], function ($, __, utils, $t, postCodeValidator) {\n 'use strict';\n\n $.widget('mage.addressValidation', {\n options: {\n selectors: {\n button: '[data-action=save-address]',\n zip: '#zip',\n country: 'select[name=\"country_id\"]:visible'\n }\n },\n\n zipInput: null,\n countrySelect: null,\n\n /**\n * Validation creation\n *\n * @protected\n */\n _create: function () {\n var button = $(this.options.selectors.button, this.element);\n\n this.zipInput = $(this.options.selectors.zip, this.element);\n this.countrySelect = $(this.options.selectors.country, this.element);\n\n this.element.validation({\n\n /**\n * Submit Handler\n * @param {Element} form - address form\n */\n submitHandler: function (form) {\n\n button.attr('disabled', true);\n form.submit();\n }\n });\n\n this._addPostCodeValidation();\n },\n\n /**\n * Add postcode validation\n *\n * @protected\n */\n _addPostCodeValidation: function () {\n var self = this;\n\n this.zipInput.on('keyup', __.debounce(function (event) {\n var valid = self._validatePostCode(event.target.value);\n\n self._renderValidationResult(valid);\n }, 500)\n );\n\n this.countrySelect.on('change', function () {\n var valid = self._validatePostCode(self.zipInput.val());\n\n self._renderValidationResult(valid);\n });\n },\n\n /**\n * Validate post code value.\n *\n * @protected\n * @param {String} postCode - post code\n * @return {Boolean} Whether is post code valid\n */\n _validatePostCode: function (postCode) {\n var countryId = this.countrySelect.val();\n\n if (postCode === null) {\n return true;\n }\n\n return postCodeValidator.validate(postCode, countryId, this.options.postCodes);\n },\n\n /**\n * Renders warning messages for invalid post code.\n *\n * @protected\n * @param {Boolean} valid\n */\n _renderValidationResult: function (valid) {\n var warnMessage,\n alertDiv = this.zipInput.next();\n\n if (!valid) {\n warnMessage = $t('Provided Zip/Postal Code seems to be invalid.');\n\n if (postCodeValidator.validatedPostCodeExample.length) {\n warnMessage += $t(' Example: ') + postCodeValidator.validatedPostCodeExample.join('; ') + '. ';\n }\n warnMessage += $t('If you believe it is the right one you can ignore this notice.');\n }\n\n alertDiv.children(':first').text(warnMessage);\n\n if (valid) {\n alertDiv.hide();\n } else {\n alertDiv.show();\n }\n }\n });\n\n return $.mage.addressValidation;\n});\n","Magento_Customer/js/customer-data.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'underscore',\n 'ko',\n 'Magento_Customer/js/section-config',\n 'mage/url',\n 'mage/storage',\n 'jquery/jquery-storageapi'\n], function ($, _, ko, sectionConfig, url) {\n 'use strict';\n\n var options = {},\n storage,\n storageInvalidation,\n invalidateCacheBySessionTimeOut,\n invalidateCacheByCloseCookieSession,\n dataProvider,\n buffer,\n customerData,\n deferred = $.Deferred();\n\n url.setBaseUrl(window.BASE_URL);\n options.sectionLoadUrl = url.build('customer/section/load');\n\n /**\n * @param {Object} invalidateOptions\n */\n invalidateCacheBySessionTimeOut = function (invalidateOptions) {\n var date;\n\n if (new Date($.localStorage.get('mage-cache-timeout')) < new Date()) {\n storage.removeAll();\n }\n date = new Date(Date.now() + parseInt(invalidateOptions.cookieLifeTime, 10) * 1000);\n $.localStorage.set('mage-cache-timeout', date);\n };\n\n /**\n * Invalidate Cache By Close Cookie Session\n */\n invalidateCacheByCloseCookieSession = function () {\n if (!$.cookieStorage.isSet('mage-cache-sessid')) {\n storage.removeAll();\n }\n\n $.cookieStorage.set('mage-cache-sessid', true);\n };\n\n dataProvider = {\n\n /**\n * @param {Object} sectionNames\n * @return {Object}\n */\n getFromStorage: function (sectionNames) {\n var result = {};\n\n _.each(sectionNames, function (sectionName) {\n result[sectionName] = storage.get(sectionName);\n });\n\n return result;\n },\n\n /**\n * @param {Object} sectionNames\n * @param {Boolean} forceNewSectionTimestamp\n * @return {*}\n */\n getFromServer: function (sectionNames, forceNewSectionTimestamp) {\n var parameters;\n\n sectionNames = sectionConfig.filterClientSideSections(sectionNames);\n parameters = _.isArray(sectionNames) && sectionNames.indexOf('*') < 0 ? {\n sections: sectionNames.join(',')\n } : [];\n parameters['force_new_section_timestamp'] = forceNewSectionTimestamp;\n\n return $.getJSON(options.sectionLoadUrl, parameters).fail(function (jqXHR) {\n throw new Error(jqXHR);\n });\n }\n };\n\n /**\n * @param {Function} target\n * @param {String} sectionName\n * @return {*}\n */\n ko.extenders.disposableCustomerData = function (target, sectionName) {\n var sectionDataIds, newSectionDataIds = {};\n\n target.subscribe(function () {\n setTimeout(function () {\n storage.remove(sectionName);\n sectionDataIds = $.cookieStorage.get('section_data_ids') || {};\n _.each(sectionDataIds, function (data, name) {\n if (name !== sectionName) {\n newSectionDataIds[name] = data;\n }\n });\n $.cookieStorage.set('section_data_ids', newSectionDataIds);\n }, 3000);\n });\n\n return target;\n };\n\n buffer = {\n data: {},\n\n /**\n * @param {String} sectionName\n */\n bind: function (sectionName) {\n this.data[sectionName] = ko.observable({});\n },\n\n /**\n * @param {String} sectionName\n * @return {Object}\n */\n get: function (sectionName) {\n if (!this.data[sectionName]) {\n this.bind(sectionName);\n }\n\n return this.data[sectionName];\n },\n\n /**\n * @return {Array}\n */\n keys: function () {\n return _.keys(this.data);\n },\n\n /**\n * @param {String} sectionName\n * @param {Object} sectionData\n */\n notify: function (sectionName, sectionData) {\n if (!this.data[sectionName]) {\n this.bind(sectionName);\n }\n this.data[sectionName](sectionData);\n },\n\n /**\n * @param {Object} sections\n */\n update: function (sections) {\n var sectionId = 0,\n sectionDataIds = $.cookieStorage.get('section_data_ids') || {};\n\n _.each(sections, function (sectionData, sectionName) {\n sectionId = sectionData['data_id'];\n sectionDataIds[sectionName] = sectionId;\n storage.set(sectionName, sectionData);\n storageInvalidation.remove(sectionName);\n buffer.notify(sectionName, sectionData);\n });\n $.cookieStorage.set('section_data_ids', sectionDataIds);\n },\n\n /**\n * @param {Object} sections\n */\n remove: function (sections) {\n _.each(sections, function (sectionName) {\n storage.remove(sectionName);\n\n if (!sectionConfig.isClientSideSection(sectionName)) {\n storageInvalidation.set(sectionName, true);\n }\n });\n }\n };\n\n customerData = {\n\n /**\n * Customer data initialization\n */\n init: function () {\n var expiredSectionNames = this.getExpiredSectionNames();\n\n if (expiredSectionNames.length > 0) {\n _.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {\n buffer.notify(sectionName, sectionData);\n });\n this.reload(expiredSectionNames, false);\n } else {\n _.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {\n buffer.notify(sectionName, sectionData);\n });\n\n if (!_.isEmpty(storageInvalidation.keys())) {\n this.reload(storageInvalidation.keys(), false);\n }\n }\n\n if (!_.isEmpty($.cookieStorage.get('section_data_clean'))) {\n this.reload(sectionConfig.getSectionNames(), true);\n $.cookieStorage.set('section_data_clean', '');\n }\n },\n\n /**\n * Storage init\n */\n initStorage: function () {\n $.cookieStorage.setConf({\n path: '/',\n expires: new Date(Date.now() + parseInt(options.cookieLifeTime, 10) * 1000)\n });\n storage = $.initNamespaceStorage('mage-cache-storage').localStorage;\n storageInvalidation = $.initNamespaceStorage('mage-cache-storage-section-invalidation').localStorage;\n },\n\n /**\n * Retrieve the list of sections that has expired since last page reload.\n *\n * Sections can expire due to lifetime constraints or due to inconsistent storage information\n * (validated by cookie data).\n *\n * @return {Array}\n */\n getExpiredSectionNames: function () {\n var expiredSectionNames = [],\n cookieSectionTimestamps = $.cookieStorage.get('section_data_ids') || {},\n sectionLifetime = options.expirableSectionLifetime * 60,\n currentTimestamp = Math.floor(Date.now() / 1000),\n sectionData;\n\n // process sections that can expire due to lifetime constraints\n _.each(options.expirableSectionNames, function (sectionName) {\n sectionData = storage.get(sectionName);\n\n if (typeof sectionData === 'object' && sectionData['data_id'] + sectionLifetime <= currentTimestamp) {\n expiredSectionNames.push(sectionName);\n }\n });\n\n // process sections that can expire due to storage information inconsistency\n _.each(cookieSectionTimestamps, function (cookieSectionTimestamp, sectionName) {\n sectionData = storage.get(sectionName);\n\n if (typeof sectionData === 'undefined' ||\n typeof sectionData === 'object' &&\n cookieSectionTimestamp !== sectionData['data_id']\n ) {\n expiredSectionNames.push(sectionName);\n }\n });\n\n //remove expired section names of previously installed/enable modules\n expiredSectionNames = _.intersection(expiredSectionNames, sectionConfig.getSectionNames());\n\n return _.uniq(expiredSectionNames);\n },\n\n /**\n * Check if some sections have to be reloaded.\n *\n * @deprecated Use getExpiredSectionNames instead.\n *\n * @return {Boolean}\n */\n needReload: function () {\n var expiredSectionNames = this.getExpiredSectionNames();\n\n return expiredSectionNames.length > 0;\n },\n\n /**\n * Retrieve the list of expired keys.\n *\n * @deprecated Use getExpiredSectionNames instead.\n *\n * @return {Array}\n */\n getExpiredKeys: function () {\n return this.getExpiredSectionNames();\n },\n\n /**\n * @param {String} sectionName\n * @return {*}\n */\n get: function (sectionName) {\n return buffer.get(sectionName);\n },\n\n /**\n * @param {String} sectionName\n * @param {Object} sectionData\n */\n set: function (sectionName, sectionData) {\n var data = {};\n\n data[sectionName] = sectionData;\n buffer.update(data);\n },\n\n /**\n * Avoid using this function directly 'cause of possible performance drawbacks.\n * Each customer section reload brings new non-cached ajax request.\n *\n * @param {Array} sectionNames\n * @param {Boolean} forceNewSectionTimestamp\n * @return {*}\n */\n reload: function (sectionNames, forceNewSectionTimestamp) {\n return dataProvider.getFromServer(sectionNames, forceNewSectionTimestamp).done(function (sections) {\n $(document).trigger('customer-data-reload', [sectionNames]);\n buffer.update(sections);\n });\n },\n\n /**\n * @param {Array} sectionNames\n */\n invalidate: function (sectionNames) {\n var sectionDataIds,\n sectionsNamesForInvalidation;\n\n sectionsNamesForInvalidation = _.contains(sectionNames, '*') ? sectionConfig.getSectionNames() :\n sectionNames;\n\n $(document).trigger('customer-data-invalidate', [sectionsNamesForInvalidation]);\n buffer.remove(sectionsNamesForInvalidation);\n sectionDataIds = $.cookieStorage.get('section_data_ids') || {};\n\n // Invalidate section in cookie (increase version of section with 1000)\n _.each(sectionsNamesForInvalidation, function (sectionName) {\n if (!sectionConfig.isClientSideSection(sectionName)) {\n sectionDataIds[sectionName] += 1000;\n }\n });\n $.cookieStorage.set('section_data_ids', sectionDataIds);\n },\n\n /**\n * Checks if customer data is initialized.\n *\n * @returns {jQuery.Deferred}\n */\n getInitCustomerData: function () {\n return deferred.promise();\n },\n\n /**\n * Reload sections on ajax complete\n *\n * @param {Object} jsonResponse\n * @param {Object} settings\n */\n onAjaxComplete: function (jsonResponse, settings) {\n var sections,\n redirects;\n\n if (settings.type.match(/post|put|delete/i)) {\n sections = sectionConfig.getAffectedSections(settings.url);\n\n if (sections && sections.length) {\n this.invalidate(sections);\n redirects = ['redirect', 'backUrl'];\n\n if (_.isObject(jsonResponse) && !_.isEmpty(_.pick(jsonResponse, redirects))) { //eslint-disable-line\n return;\n }\n this.reload(sections, true);\n }\n }\n },\n\n /**\n * @param {Object} settings\n * @constructor\n */\n 'Magento_Customer/js/customer-data': function (settings) {\n options = settings;\n customerData.initStorage();\n invalidateCacheBySessionTimeOut(settings);\n invalidateCacheByCloseCookieSession();\n customerData.init();\n deferred.resolve();\n }\n };\n\n /**\n * Events listener\n */\n $(document).on('ajaxComplete', function (event, xhr, settings) {\n customerData.onAjaxComplete(xhr.responseJSON, settings);\n });\n\n /**\n * Events listener\n */\n $(document).on('submit', function (event) {\n var sections;\n\n if (event.target.method.match(/post|put|delete/i)) {\n sections = sectionConfig.getAffectedSections(event.target.action);\n\n if (sections) {\n customerData.invalidate(sections);\n }\n }\n });\n\n return customerData;\n});\n","Magento_Customer/js/block-submit-on-send.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/mage'\n], function ($) {\n 'use strict';\n\n return function (config) {\n var dataForm = $('#' + config.formId);\n\n dataForm.on('submit', function () {\n $(this).find(':submit').attr('disabled', 'disabled');\n\n if (this.isValid === false) {\n $(this).find(':submit').prop('disabled', false);\n }\n this.isValid = true;\n });\n dataForm.on('invalid-form.validate', function () {\n $(this).find(':submit').prop('disabled', false);\n this.isValid = false;\n });\n };\n});\n","Magento_Customer/js/logout-redirect.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/mage'\n], function ($) {\n 'use strict';\n\n return function (data) {\n $($.mage.redirect(data.url, 'assign', 5000));\n };\n});\n","Magento_Customer/js/change-email-password.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.changeEmailPassword', {\n options: {\n changeEmailSelector: '[data-role=change-email]',\n changePasswordSelector: '[data-role=change-password]',\n mainContainerSelector: '[data-container=change-email-password]',\n titleSelector: '[data-title=change-email-password]',\n emailContainerSelector: '[data-container=change-email]',\n newPasswordContainerSelector: '[data-container=new-password]',\n confirmPasswordContainerSelector: '[data-container=confirm-password]',\n currentPasswordSelector: '[data-input=current-password]',\n emailSelector: '[data-input=change-email]',\n newPasswordSelector: '[data-input=new-password]',\n confirmPasswordSelector: '[data-input=confirm-password]'\n },\n\n /**\n * Create widget\n * @private\n */\n _create: function () {\n this.element.on('change', $.proxy(function () {\n this._checkChoice();\n }, this));\n\n this._checkChoice();\n this._bind();\n },\n\n /**\n * Event binding, will monitor change, keyup and paste events.\n * @private\n */\n _bind: function () {\n this._on($(this.options.emailSelector), {\n 'change': this._updatePasswordFieldWithEmailValue,\n 'keyup': this._updatePasswordFieldWithEmailValue,\n 'paste': this._updatePasswordFieldWithEmailValue\n });\n },\n\n /**\n * Check choice\n * @private\n */\n _checkChoice: function () {\n if ($(this.options.changeEmailSelector).is(':checked') &&\n $(this.options.changePasswordSelector).is(':checked')) {\n this._showAll();\n } else if ($(this.options.changeEmailSelector).is(':checked')) {\n this._showEmail();\n } else if ($(this.options.changePasswordSelector).is(':checked')) {\n this._showPassword();\n } else {\n this._hideAll();\n }\n },\n\n /**\n * Show email and password input fields\n * @private\n */\n _showAll: function () {\n $(this.options.titleSelector).html(this.options.titleChangeEmailAndPassword);\n\n $(this.options.mainContainerSelector).show();\n $(this.options.emailContainerSelector).show();\n $(this.options.newPasswordContainerSelector).show();\n $(this.options.confirmPasswordContainerSelector).show();\n\n $(this.options.currentPasswordSelector).attr('data-validate', '{required:true}').prop('disabled', false);\n $(this.options.emailSelector).attr('data-validate', '{required:true}').prop('disabled', false);\n this._updatePasswordFieldWithEmailValue();\n $(this.options.confirmPasswordSelector).attr(\n 'data-validate',\n '{required:true, equalTo:\"' + this.options.newPasswordSelector + '\"}'\n ).prop('disabled', false);\n },\n\n /**\n * Hide email and password input fields\n * @private\n */\n _hideAll: function () {\n $(this.options.mainContainerSelector).hide();\n $(this.options.emailContainerSelector).hide();\n $(this.options.newPasswordContainerSelector).hide();\n $(this.options.confirmPasswordContainerSelector).hide();\n\n $(this.options.currentPasswordSelector).removeAttr('data-validate').prop('disabled', true);\n $(this.options.emailSelector).removeAttr('data-validate').prop('disabled', true);\n $(this.options.newPasswordSelector).removeAttr('data-validate').prop('disabled', true);\n $(this.options.confirmPasswordSelector).removeAttr('data-validate').prop('disabled', true);\n },\n\n /**\n * Show email input fields\n * @private\n */\n _showEmail: function () {\n this._showAll();\n $(this.options.titleSelector).html(this.options.titleChangeEmail);\n\n $(this.options.newPasswordContainerSelector).hide();\n $(this.options.confirmPasswordContainerSelector).hide();\n\n $(this.options.newPasswordSelector).removeAttr('data-validate').prop('disabled', true);\n $(this.options.confirmPasswordSelector).removeAttr('data-validate').prop('disabled', true);\n },\n\n /**\n * Show password input fields\n * @private\n */\n _showPassword: function () {\n this._showAll();\n $(this.options.titleSelector).html(this.options.titleChangePassword);\n\n $(this.options.emailContainerSelector).hide();\n\n $(this.options.emailSelector).removeAttr('data-validate').prop('disabled', true);\n },\n\n /**\n * Update password validation rules with email input field value\n * @private\n */\n _updatePasswordFieldWithEmailValue: function () {\n $(this.options.newPasswordSelector).attr(\n 'data-validate',\n '{required:true, ' +\n '\\'validate-customer-password\\':true, ' +\n '\\'password-not-equal-to-user-name\\':\\'' + $(this.options.emailSelector).val() + '\\'}'\n ).prop('disabled', false);\n }\n });\n\n return $.mage.changeEmailPassword;\n});\n","Magento_Customer/js/address.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Ui/js/modal/confirm',\n 'jquery-ui-modules/widget',\n 'mage/translate'\n], function ($, confirm) {\n 'use strict';\n\n $.widget('mage.address', {\n /**\n * Options common to all instances of this widget.\n * @type {Object}\n */\n options: {\n deleteConfirmMessage: $.mage.__('Are you sure you want to delete this address?')\n },\n\n /**\n * Bind event handlers for adding and deleting addresses.\n * @private\n */\n _create: function () {\n var options = this.options,\n addAddress = options.addAddress,\n deleteAddress = options.deleteAddress;\n\n if (addAddress) {\n $(document).on('click', addAddress, this._addAddress.bind(this));\n }\n\n if (deleteAddress) {\n $(document).on('click', deleteAddress, this._deleteAddress.bind(this));\n }\n },\n\n /**\n * Add a new address.\n * @private\n */\n _addAddress: function () {\n window.location = this.options.addAddressLocation;\n },\n\n /**\n * Delete the address whose id is specified in a data attribute after confirmation from the user.\n * @private\n * @param {jQuery.Event} e\n * @return {Boolean}\n */\n _deleteAddress: function (e) {\n var self = this;\n\n confirm({\n content: this.options.deleteConfirmMessage,\n actions: {\n\n /** @inheritdoc */\n confirm: function () {\n if (typeof $(e.target).parent().data('address') !== 'undefined') {\n window.location = self.options.deleteUrlPrefix + $(e.target).parent().data('address') +\n '/form_key/' + $.mage.cookies.get('form_key');\n } else {\n window.location = self.options.deleteUrlPrefix + $(e.target).data('address') +\n '/form_key/' + $.mage.cookies.get('form_key');\n }\n }\n }\n });\n\n return false;\n }\n });\n\n return $.mage.address;\n});\n","Magento_Customer/js/invalidation-processor.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'uiElement',\n 'Magento_Customer/js/customer-data'\n], function (_, Element, customerData) {\n 'use strict';\n\n return Element.extend({\n /**\n * Initialize object\n */\n initialize: function () {\n this._super();\n this.process(customerData);\n },\n\n /**\n * Process all rules in loop, each rule can invalidate some sections in customer data\n *\n * @param {Object} customerDataObject\n */\n process: function (customerDataObject) {\n _.each(this.invalidationRules, function (rule, ruleName) {\n _.each(rule, function (ruleArgs, rulePath) {\n require([rulePath], function (Rule) {\n var currentRule = new Rule(ruleArgs);\n\n if (!_.isFunction(currentRule.process)) {\n throw new Error('Rule ' + ruleName + ' should implement invalidationProcessor interface');\n }\n currentRule.process(customerDataObject);\n });\n });\n });\n }\n });\n});\n","Magento_Customer/js/show-password.js":"/**\n* Copyright \u00a9 Magento, Inc. All rights reserved.\n* See COPYING.txt for license details.\n*/\n\ndefine([\n 'jquery',\n 'uiComponent'\n], function ($, Component) {\n 'use strict';\n\n return Component.extend({\n passwordSelector: '',\n passwordInputType: 'password',\n textInputType: 'text',\n\n defaults: {\n template: 'Magento_Customer/show-password',\n isPasswordVisible: false\n },\n\n /**\n * @return {Object}\n */\n initObservable: function () {\n this._super()\n .observe(['isPasswordVisible']);\n\n this.isPasswordVisible.subscribe(function (isChecked) {\n this._showPassword(isChecked);\n }.bind(this));\n\n return this;\n },\n\n /**\n * Show/Hide password\n * @private\n */\n _showPassword: function (isChecked) {\n $(this.passwordSelector).attr('type',\n isChecked ? this.textInputType : this.passwordInputType\n );\n }\n });\n});\n","Magento_Customer/js/section-config.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(['underscore'], function (_) {\n 'use strict';\n\n var baseUrls = [],\n sections = [],\n clientSideSections = [],\n sectionNames = [],\n canonize;\n\n /**\n * @param {String} url\n * @return {String}\n */\n canonize = function (url) {\n var route = url;\n\n _.some(baseUrls, function (baseUrl) {\n route = url.replace(baseUrl, '');\n\n return route !== url;\n });\n\n return route.replace(/^\\/?index.php\\/?/, '').toLowerCase();\n };\n\n return {\n /**\n * Returns a list of sections which should be invalidated for given URL.\n * @param {String} url - URL which was requested.\n * @return {Object} - List of sections to invalidate.\n */\n getAffectedSections: function (url) {\n var route = canonize(url),\n actions = _.find(sections, function (val, section) {\n var matched;\n\n // Covers the case where \"*\" works as a glob pattern.\n if (section.indexOf('*') >= 0) {\n section = section.replace(/\\*/g, '[^/]+') + '$';\n matched = route.match(section);\n\n return matched && matched[0] === route;\n }\n\n return route.indexOf(section) === 0;\n });\n\n return _.union(_.toArray(actions), sections['*']);\n },\n\n /**\n * Filters the list of given sections to the ones defined as client side.\n * @param {Object} allSections - List of sections to check.\n * @return {Object} - List of filtered sections.\n */\n filterClientSideSections: function (allSections) {\n return _.difference(allSections, clientSideSections);\n },\n\n /**\n * Tells if section is defined as client side.\n * @param {String} sectionName - Name of the section to check.\n * @return {Boolean}\n */\n isClientSideSection: function (sectionName) {\n return _.contains(clientSideSections, sectionName);\n },\n\n /**\n * Returns array of section names.\n * @returns {Array}\n */\n getSectionNames: function () {\n return sectionNames;\n },\n\n /**\n * @param {Object} options\n * @constructor\n */\n 'Magento_Customer/js/section-config': function (options) {\n baseUrls = options.baseUrls;\n sections = options.sections;\n clientSideSections = options.clientSideSections;\n sectionNames = options.sectionNames;\n }\n };\n});\n","Magento_Customer/js/view/authentication-popup.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'ko',\n 'Magento_Ui/js/form/form',\n 'Magento_Customer/js/action/login',\n 'Magento_Customer/js/customer-data',\n 'Magento_Customer/js/model/authentication-popup',\n 'mage/translate',\n 'mage/url',\n 'Magento_Ui/js/modal/alert',\n 'mage/validation'\n], function ($, ko, Component, loginAction, customerData, authenticationPopup, $t, url, alert) {\n 'use strict';\n\n return Component.extend({\n registerUrl: window.authenticationPopup.customerRegisterUrl,\n forgotPasswordUrl: window.authenticationPopup.customerForgotPasswordUrl,\n autocomplete: window.authenticationPopup.autocomplete,\n modalWindow: null,\n isLoading: ko.observable(false),\n\n defaults: {\n template: 'Magento_Customer/authentication-popup'\n },\n\n /**\n * Init\n */\n initialize: function () {\n var self = this;\n\n this._super();\n url.setBaseUrl(window.authenticationPopup.baseUrl);\n loginAction.registerLoginCallback(function () {\n self.isLoading(false);\n });\n },\n\n /** Init popup login window */\n setModalElement: function (element) {\n if (authenticationPopup.modalWindow == null) {\n authenticationPopup.createPopUp(element);\n }\n },\n\n /** Is login form enabled for current customer */\n isActive: function () {\n var customer = customerData.get('customer');\n\n return customer() == false; //eslint-disable-line eqeqeq\n },\n\n /** Show login popup window */\n showModal: function () {\n if (this.modalWindow) {\n $(this.modalWindow).modal('openModal');\n } else {\n alert({\n content: $t('Guest checkout is disabled.')\n });\n }\n },\n\n /**\n * Provide login action\n *\n * @return {Boolean}\n */\n login: function (formUiElement, event) {\n var loginData = {},\n formElement = $(event.currentTarget),\n formDataArray = formElement.serializeArray();\n\n event.stopPropagation();\n formDataArray.forEach(function (entry) {\n loginData[entry.name] = entry.value;\n });\n loginData['customerLoginUrl'] = window.authenticationPopup.customerLoginUrl;\n if (formElement.validation() &&\n formElement.validation('isValid')\n ) {\n this.isLoading(true);\n loginAction(loginData);\n }\n\n return false;\n }\n });\n});\n","Magento_Customer/js/view/customer.js":"/**\n* Copyright \u00a9 Magento, Inc. All rights reserved.\n* See COPYING.txt for license details.\n*/\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data'\n], function (Component, customerData) {\n 'use strict';\n\n return Component.extend({\n /** @inheritdoc */\n initialize: function () {\n this._super();\n\n this.customer = customerData.get('customer');\n }\n });\n});\n","Magento_Customer/js/action/login.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/storage',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Customer/js/customer-data',\n 'mage/translate'\n], function ($, storage, globalMessageList, customerData, $t) {\n 'use strict';\n\n var callbacks = [],\n\n /**\n * @param {Object} loginData\n * @param {String} redirectUrl\n * @param {*} isGlobal\n * @param {Object} messageContainer\n */\n action = function (loginData, redirectUrl, isGlobal, messageContainer) {\n messageContainer = messageContainer || globalMessageList;\n let customerLoginUrl = 'customer/ajax/login';\n\n if (loginData.customerLoginUrl) {\n customerLoginUrl = loginData.customerLoginUrl;\n delete loginData.customerLoginUrl;\n }\n\n return storage.post(\n customerLoginUrl,\n JSON.stringify(loginData),\n isGlobal\n ).done(function (response) {\n if (response.errors) {\n messageContainer.addErrorMessage(response);\n callbacks.forEach(function (callback) {\n callback(loginData);\n });\n } else {\n callbacks.forEach(function (callback) {\n callback(loginData);\n });\n customerData.invalidate(['customer']);\n\n if (response.redirectUrl) {\n window.location.href = response.redirectUrl;\n } else if (redirectUrl) {\n window.location.href = redirectUrl;\n } else {\n location.reload();\n }\n }\n }).fail(function () {\n messageContainer.addErrorMessage({\n 'message': $t('Could not authenticate. Please try again later')\n });\n callbacks.forEach(function (callback) {\n callback(loginData);\n });\n });\n };\n\n /**\n * @param {Function} callback\n */\n action.registerLoginCallback = function (callback) {\n callbacks.push(callback);\n };\n\n return action;\n});\n","Magento_Customer/js/action/check-email-availability.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'mage/storage',\n 'Magento_Checkout/js/model/url-builder'\n], function (storage, urlBuilder) {\n 'use strict';\n\n return function (deferred, email) {\n return storage.post(\n urlBuilder.createUrl('/customers/isEmailAvailable', {}),\n JSON.stringify({\n customerEmail: email\n }),\n false\n ).done(function (isEmailAvailable) {\n if (isEmailAvailable) {\n deferred.resolve();\n } else {\n deferred.reject();\n }\n }).fail(function () {\n deferred.reject();\n });\n };\n});\n","Magento_Customer/js/model/address-list.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'ko',\n './customer-addresses'\n], function (ko, defaultProvider) {\n 'use strict';\n\n return ko.observableArray(defaultProvider.getAddressItems());\n});\n","Magento_Customer/js/model/authentication-popup.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Ui/js/modal/modal'\n], function ($, modal) {\n 'use strict';\n\n return {\n modalWindow: null,\n\n /**\n * Create popUp window for provided element\n *\n * @param {HTMLElement} element\n */\n createPopUp: function (element) {\n var options = {\n 'type': 'popup',\n 'modalClass': 'popup-authentication',\n 'focus': '[name=username]',\n 'responsive': true,\n 'innerScroll': true,\n 'trigger': '.proceed-to-checkout',\n 'buttons': []\n };\n\n this.modalWindow = element;\n modal(options, $(this.modalWindow));\n },\n\n /** Show login popup window */\n showModal: function () {\n $(this.modalWindow).modal('openModal').trigger('contentUpdated');\n }\n };\n});\n","Magento_Customer/js/model/customer-addresses.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'ko',\n './customer/address'\n], function ($, ko, Address) {\n 'use strict';\n\n var isLoggedIn = ko.observable(window.isCustomerLoggedIn);\n\n return {\n /**\n * @return {Array}\n */\n getAddressItems: function () {\n var items = [],\n customerData = window.customerData;\n\n if (isLoggedIn()) {\n if (Object.keys(customerData).length) {\n $.each(customerData.addresses, function (key, item) {\n items.push(new Address(item));\n });\n }\n }\n\n return items;\n }\n };\n});\n","Magento_Customer/js/model/customer.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'ko',\n 'underscore',\n './address-list'\n], function ($, ko, _, addressList) {\n 'use strict';\n\n var isLoggedIn = ko.observable(window.isCustomerLoggedIn),\n customerData = {};\n\n if (isLoggedIn()) {\n customerData = window.customerData;\n } else {\n customerData = {};\n }\n\n return {\n customerData: customerData,\n customerDetails: {},\n isLoggedIn: isLoggedIn,\n\n /**\n * @param {Boolean} flag\n */\n setIsLoggedIn: function (flag) {\n isLoggedIn(flag);\n },\n\n /**\n * @return {Array}\n */\n getBillingAddressList: function () {\n return addressList();\n },\n\n /**\n * @return {Array}\n */\n getShippingAddressList: function () {\n return addressList();\n },\n\n /**\n * @param {String} fieldName\n * @param {*} value\n */\n setDetails: function (fieldName, value) {\n if (fieldName) {\n this.customerDetails[fieldName] = value;\n }\n },\n\n /**\n * @param {String} fieldName\n * @return {*}\n */\n getDetails: function (fieldName) {\n if (fieldName) {\n if (this.customerDetails.hasOwnProperty(fieldName)) {\n return this.customerDetails[fieldName];\n }\n\n return undefined;\n }\n\n return this.customerDetails;\n },\n\n /**\n * @param {Array} address\n * @return {Number}\n */\n addCustomerAddress: function (address) {\n var fields = [\n 'customer_id', 'country_id', 'street', 'company', 'telephone', 'fax', 'postcode', 'city',\n 'firstname', 'lastname', 'middlename', 'prefix', 'suffix', 'vat_id', 'default_billing',\n 'default_shipping'\n ],\n customerAddress = {},\n hasAddress = 0,\n existingAddress;\n\n if (!this.customerData.addresses) {\n this.customerData.addresses = [];\n }\n\n customerAddress = _.pick(address, fields);\n\n if (address.hasOwnProperty('region_id')) {\n customerAddress.region = {\n 'region_id': address['region_id'],\n region: address.region\n };\n }\n\n for (existingAddress in this.customerData.addresses) {\n if (this.customerData.addresses.hasOwnProperty(existingAddress)) {\n if (_.isEqual(this.customerData.addresses[existingAddress], customerAddress)) { //eslint-disable-line\n hasAddress = existingAddress;\n break;\n }\n }\n }\n\n if (hasAddress === 0) {\n return this.customerData.addresses.push(customerAddress) - 1;\n }\n\n return hasAddress;\n },\n\n /**\n * @param {*} addressId\n * @return {Boolean}\n */\n setAddressAsDefaultBilling: function (addressId) {\n if (this.customerData.addresses[addressId]) {\n this.customerData.addresses[addressId]['default_billing'] = 1;\n\n return true;\n }\n\n return false;\n },\n\n /**\n * @param {*} addressId\n * @return {Boolean}\n */\n setAddressAsDefaultShipping: function (addressId) {\n if (this.customerData.addresses[addressId]) {\n this.customerData.addresses[addressId]['default_shipping'] = 1;\n\n return true;\n }\n\n return false;\n }\n };\n});\n","Magento_Customer/js/model/customer/address.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine(['underscore'], function (_) {\n 'use strict';\n\n /**\n * Returns new address object.\n *\n * @param {Object} addressData\n * @return {Object}\n */\n return function (addressData) {\n var regionId;\n\n if (addressData.region['region_id'] && addressData.region['region_id'] !== '0') {\n regionId = addressData.region['region_id'] + '';\n }\n\n return {\n customerAddressId: addressData.id,\n email: addressData.email,\n countryId: addressData['country_id'],\n regionId: regionId,\n regionCode: addressData.region['region_code'],\n region: addressData.region.region,\n customerId: addressData['customer_id'],\n street: addressData.street,\n company: addressData.company,\n telephone: addressData.telephone,\n fax: addressData.fax,\n postcode: addressData.postcode,\n city: addressData.city,\n firstname: addressData.firstname,\n lastname: addressData.lastname,\n middlename: addressData.middlename,\n prefix: addressData.prefix,\n suffix: addressData.suffix,\n vatId: addressData['vat_id'],\n sameAsBilling: addressData['same_as_billing'],\n saveInAddressBook: addressData['save_in_address_book'],\n customAttributes: _.toArray(addressData['custom_attributes']).reverse(),\n\n /**\n * @return {*}\n */\n isDefaultShipping: function () {\n return addressData['default_shipping'];\n },\n\n /**\n * @return {*}\n */\n isDefaultBilling: function () {\n return addressData['default_billing'];\n },\n\n /**\n * @return {*}\n */\n getAddressInline: function () {\n return addressData.inline;\n },\n\n /**\n * @return {String}\n */\n getType: function () {\n return 'customer-address';\n },\n\n /**\n * @return {String}\n */\n getKey: function () {\n return this.getType() + this.customerAddressId;\n },\n\n /**\n * @return {String}\n */\n getCacheKey: function () {\n return this.getKey();\n },\n\n /**\n * @return {Boolean}\n */\n isEditable: function () {\n return false;\n },\n\n /**\n * @return {Boolean}\n */\n canUseForBilling: function () {\n return true;\n }\n };\n };\n});\n","Magento_Customer/js/invalidation-rules/website-rule.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'uiClass'\n], function (Element) {\n 'use strict';\n\n return Element.extend({\n\n defaults: {\n scopeConfig: {}\n },\n\n /**\n * Takes website id from current customer data and compare it with current website id\n * If customer belongs to another scope, we need to invalidate current section\n *\n * @param {Object} customerData\n */\n process: function (customerData) {\n var customer = customerData.get('customer');\n\n if (this.scopeConfig && customer() &&\n ~~customer().websiteId !== ~~this.scopeConfig.websiteId && ~~customer().websiteId !== 0) {\n customerData.reload(['customer']);\n }\n }\n });\n});\n","Magento_Directory/js/region-updater.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/template',\n 'underscore',\n 'jquery-ui-modules/widget',\n 'mage/validation'\n], function ($, mageTemplate, _) {\n 'use strict';\n\n $.widget('mage.directoryRegionUpdater', {\n options: {\n regionTemplate:\n '<option value=\"<%- data.value %>\" <% if (data.isSelected) { %>selected=\"selected\"<% } %>>' +\n '<%- data.title %>' +\n '</option>',\n isRegionRequired: true,\n isZipRequired: true,\n isCountryRequired: true,\n currentRegion: null,\n isMultipleCountriesAllowed: true\n },\n\n /**\n *\n * @private\n */\n _create: function () {\n this._initCountryElement();\n\n this.currentRegionOption = this.options.currentRegion;\n this.regionTmpl = mageTemplate(this.options.regionTemplate);\n\n this._updateRegion(this.element.find('option:selected').val());\n\n $(this.options.regionListId).on('change', $.proxy(function (e) {\n this.setOption = false;\n this.currentRegionOption = $(e.target).val();\n }, this));\n\n $(this.options.regionInputId).on('focusout', $.proxy(function () {\n this.setOption = true;\n }, this));\n },\n\n /**\n *\n * @private\n */\n _initCountryElement: function () {\n\n if (this.options.isMultipleCountriesAllowed) {\n this.element.parents('div.field').show();\n this.element.on('change', $.proxy(function (e) {\n // clear region inputs on country change\n $(this.options.regionListId).val('');\n $(this.options.regionInputId).val('');\n this._updateRegion($(e.target).val());\n }, this));\n\n if (this.options.isCountryRequired) {\n this.element.addClass('required-entry');\n this.element.parents('div.field').addClass('required');\n }\n } else {\n this.element.parents('div.field').hide();\n }\n },\n\n /**\n * Remove options from dropdown list\n *\n * @param {Object} selectElement - jQuery object for dropdown list\n * @private\n */\n _removeSelectOptions: function (selectElement) {\n selectElement.find('option').each(function (index) {\n if (index) {\n $(this).remove();\n }\n });\n },\n\n /**\n * Render dropdown list\n * @param {Object} selectElement - jQuery object for dropdown list\n * @param {String} key - region code\n * @param {Object} value - region object\n * @private\n */\n _renderSelectOption: function (selectElement, key, value) {\n selectElement.append($.proxy(function () {\n var name = value.name.replace(/[!\"#$%&'()*+,.\\/:;<=>?@[\\\\\\]^`{|}~]/g, '\\\\$&'),\n tmplData,\n tmpl;\n\n if (value.code && $(name).is('span')) {\n key = value.code;\n value.name = $(name).text();\n }\n\n tmplData = {\n value: key,\n title: value.name,\n isSelected: false\n };\n\n if (this.options.defaultRegion === key) {\n tmplData.isSelected = true;\n }\n\n tmpl = this.regionTmpl({\n data: tmplData\n });\n\n return $(tmpl);\n }, this));\n },\n\n /**\n * Takes clearError callback function as first option\n * If no form is passed as option, look up the closest form and call clearError method.\n * @private\n */\n _clearError: function () {\n var args = ['clearError', this.options.regionListId, this.options.regionInputId, this.options.postcodeId];\n\n if (this.options.clearError && typeof this.options.clearError === 'function') {\n this.options.clearError.call(this);\n } else {\n if (!this.options.form) {\n this.options.form = this.element.closest('form').length ? $(this.element.closest('form')[0]) : null;\n }\n\n this.options.form = $(this.options.form);\n\n this.options.form && this.options.form.data('validator') &&\n this.options.form.validation.apply(this.options.form, _.compact(args));\n\n // Clean up errors on region & zip fix\n $(this.options.regionInputId).removeClass('mage-error').parent().find('[generated]').remove();\n $(this.options.regionListId).removeClass('mage-error').parent().find('[generated]').remove();\n $(this.options.postcodeId).removeClass('mage-error').parent().find('[generated]').remove();\n }\n },\n\n /**\n * Update dropdown list based on the country selected\n *\n * @param {String} country - 2 uppercase letter for country code\n * @private\n */\n _updateRegion: function (country) {\n // Clear validation error messages\n var regionList = $(this.options.regionListId),\n regionInput = $(this.options.regionInputId),\n postcode = $(this.options.postcodeId),\n label = regionList.parent().siblings('label'),\n container = regionList.parents('div.field'),\n regionsEntries,\n regionId,\n regionData;\n\n this._clearError();\n this._checkRegionRequired(country);\n\n // Populate state/province dropdown list if available or use input box\n if (this.options.regionJson[country]) {\n this._removeSelectOptions(regionList);\n regionsEntries = _.pairs(this.options.regionJson[country]);\n $.each(regionsEntries, $.proxy(function (key, value) {\n regionData = value[1];\n regionId = regionData.id;\n this._renderSelectOption(regionList, regionId.toString(), regionData);\n }, this));\n\n if (this.currentRegionOption) {\n regionList.val(this.currentRegionOption);\n }\n\n if (this.setOption) {\n regionList.find('option').filter(function () {\n return this.text === regionInput.val();\n }).attr('selected', true);\n }\n\n if (this.options.isRegionRequired) {\n regionList.addClass('required-entry').removeAttr('disabled');\n container.addClass('required').show();\n } else {\n regionList.removeClass('required-entry validate-select').removeAttr('data-validate');\n container.removeClass('required');\n\n if (!this.options.optionalRegionAllowed) { //eslint-disable-line max-depth\n regionList.hide();\n container.hide();\n } else {\n regionList.removeAttr('disabled').show();\n }\n }\n\n regionList.show();\n regionInput.hide();\n label.attr('for', regionList.attr('id'));\n } else {\n this._removeSelectOptions(regionList);\n\n if (this.options.isRegionRequired) {\n regionInput.addClass('required-entry').removeAttr('disabled');\n container.addClass('required').show();\n } else {\n if (!this.options.optionalRegionAllowed) { //eslint-disable-line max-depth\n regionInput.attr('disabled', 'disabled');\n container.hide();\n }\n container.removeClass('required');\n regionInput.removeClass('required-entry');\n }\n\n regionList.removeClass('required-entry').prop('disabled', 'disabled').hide();\n regionInput.show();\n label.attr('for', regionInput.attr('id'));\n }\n\n // If country is in optionalzip list, make postcode input not required\n if (this.options.isZipRequired) {\n $.inArray(country, this.options.countriesWithOptionalZip) >= 0 ?\n postcode.removeClass('required-entry').closest('.field').removeClass('required') :\n postcode.addClass('required-entry').closest('.field').addClass('required');\n }\n\n // Add defaultvalue attribute to state/province select element\n regionList.attr('defaultvalue', this.options.defaultRegion);\n this.options.form.find('[type=\"submit\"]').removeAttr('disabled').show();\n },\n\n /**\n * Check if the selected country has a mandatory region selection\n *\n * @param {String} country - Code of the country - 2 uppercase letter for country code\n * @private\n */\n _checkRegionRequired: function (country) {\n var self = this;\n\n this.options.isRegionRequired = false;\n $.each(this.options.regionJson.config['regions_required'], function (index, elem) {\n if (elem === country) {\n self.options.isRegionRequired = true;\n }\n });\n }\n });\n\n return $.mage.directoryRegionUpdater;\n});\n","Magento_Theme/js/cookie-status.js":"define([\n 'jquery',\n 'Magento_Ui/js/modal/modal',\n 'mage/translate'\n], function ($, modal) {\n 'use strict';\n\n $.widget('mage.cookieStatus', {\n options: {\n type: 'popup',\n responsive: true,\n innerScroll: true,\n autoOpen: true,\n buttons: [{\n text: $.mage.__('Close'),\n class: 'cookie-status',\n\n /**\n * Callback for click event\n */\n click: function () {\n this.closeModal();\n }\n }]\n },\n\n /**\n * Init object\n * @private\n */\n _init: function () {\n\n if (!navigator.cookieEnabled) {\n modal(this.options, $('#cookie-status'));\n }\n }\n });\n\n return $.mage.cookieStatus;\n});\n","Magento_Theme/js/row-builder.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * JQuery UI Widget declaration: 'mage.rowBuilder'\n *\n * @api\n */\ndefine([\n 'jquery',\n 'mage/template',\n 'jquery-ui-modules/widget'\n], function ($, mageTemplate) {\n 'use strict';\n\n $.widget('mage.rowBuilder', {\n\n /**\n * options with default values for setting up the template\n */\n options: {\n //Default template options\n rowTemplate: '#template-registrant',\n rowContainer: '#registrant-container',\n //Row index used by the template rows.\n rowIndex: 0,\n //Row count: Should not be set externally\n rowCount: 0,\n rowParentElem: '<li></li>',\n rowContainerClass: 'fields',\n addRowBtn: '#add-registrant-button',\n btnRemoveIdPrefix: 'btn-remove',\n btnRemoveSelector: '.btn-remove',\n rowIdPrefix: 'row',\n //This class is added to rows added after the first one. Adds the dotted separator\n additionalRowClass: 'add-row',\n\n /*\n This is provided during widget instantiation. eg :\n formDataPost : {\"formData\":formData,\"templateFields\":['field1-name','field2-name'] }\n -\"formData\" is the multi-dimensional array of form field values : [['a','b'],['c','b']]\n received from the server and encoded\n -\"templateFields\" are the input fields in the template with index suffixed after the field name\n eg field1-name{index}\n */\n formDataPost: null,\n //Default selectors for add element of a template\n addEventSelector: 'button',\n //Default selectors for remove markup elements of a template\n remEventSelector: 'a',\n //This option allows adding first row delete option and a row separator\n hideFirstRowAddSeparator: true,\n //Max rows - This option should be set when instantiating the widget\n maxRows: 1000,\n maxRowsMsg: '#max-registrant-message'\n },\n\n /**\n * Initialize create\n * @private\n */\n _create: function () {\n this.rowTemplate = mageTemplate(this.options.rowTemplate);\n\n this.options.rowCount = this.options.rowIndex = 0;\n\n //On document ready related tasks\n $($.proxy(this.ready, this));\n\n //Binding template-wide events handlers for adding and removing rows\n this.element.on(\n 'click',\n this.options.addEventSelector + this.options.addRowBtn,\n $.proxy(this.handleAdd, this)\n );\n this.element.on(\n 'click',\n this.options.remEventSelector + this.options.btnRemoveSelector,\n $.proxy(this.handleRemove, this)\n );\n },\n\n /**\n * Initialize template\n * @public\n */\n ready: function () {\n if (this.options.formDataPost &&\n this.options.formDataPost.formData &&\n this.options.formDataPost.formData.length\n ) {\n this.processFormDataArr(this.options.formDataPost);\n } else if (this.options.rowIndex === 0 && this.options.maxRows !== 0) {\n //If no form data , then add default row\n this.addRow(0);\n }\n },\n\n /**\n * Process and loop through all row data to create preselected values. This is used for any error on submit.\n * For complex implementations the inheriting widget can override this behavior\n * @public\n * @param {Object} formDataArr\n */\n processFormDataArr: function (formDataArr) {\n var formData = formDataArr.formData,\n templateFields = formDataArr.templateFields,\n formRow,\n i, j;\n\n for (i = this.options.rowIndex = 0; i < formData.length; this.options.rowIndex = i++) {\n this.addRow(i);\n\n formRow = formData[i];\n\n for (j = 0; j < formRow.length; j++) {\n this.setFieldById(templateFields[j] + i, formRow[j]);\n }\n }\n\n },\n\n /**\n * Initialize and create markup for template row. Add it to the parent container.\n * The template processing will substitute row index at all places marked with _index_ in the template\n * using the template\n * @public\n * @param {Number} index - current index/count of the created template. This will be used as the id\n * @return {*}\n */\n addRow: function (index) {\n var row = $(this.options.rowParentElem),\n tmpl;\n\n row.addClass(this.options.rowContainerClass).attr('id', this.options.rowIdPrefix + index);\n\n tmpl = this.rowTemplate({\n data: {\n _index_: index\n }\n });\n\n $(tmpl).appendTo(row);\n\n $(this.options.rowContainer).append(row).trigger('contentUpdated');\n\n row.addClass(this.options.additionalRowClass);\n\n //Remove 'delete' link and additionalRowClass for first row\n if (this.options.rowIndex === 0 && this.options.hideFirstRowAddSeparator) {\n $('#' + this._esc(this.options.btnRemoveIdPrefix) + '0').remove();\n $('#' + this._esc(this.options.rowIdPrefix) + '0').removeClass(this.options.additionalRowClass);\n }\n\n this.maxRowCheck(++this.options.rowCount);\n\n return row;\n },\n\n /**\n * Remove return item information row\n * @public\n * @param {*} rowIndex - return item information row index\n * @return {Boolean}\n */\n removeRow: function (rowIndex) {\n $('#' + this._esc(this.options.rowIdPrefix) + rowIndex).remove();\n this.maxRowCheck(--this.options.rowCount);\n\n return false;\n },\n\n /**\n * Function to check if maximum rows are exceeded and render/hide maxMsg and Add btn\n * @public\n * @param {Number} rowIndex\n */\n maxRowCheck: function (rowIndex) {\n var addRowBtn = $(this.options.addRowBtn),\n maxRowMsg = $(this.options.maxRowsMsg);\n\n //liIndex starts from 0\n if (rowIndex >= this.options.maxRows) {\n addRowBtn.hide();\n maxRowMsg.show();\n } else if (addRowBtn.is(':hidden')) {\n addRowBtn.show();\n maxRowMsg.hide();\n }\n },\n\n /**\n * Set the value on given element\n * @public\n * @param {String} domId\n * @param {String} value\n */\n setFieldById: function (domId, value) {\n var x = $('#' + this._esc(domId));\n\n if (x.length) {\n\n if (x.is(':checkbox')) {\n x.attr('checked', true);\n } else if (x.is('option')) {\n x.attr('selected', 'selected');\n } else {\n x.val(value);\n }\n }\n },\n\n /**\n * Delegated handler for adding a row\n * @public\n * @return {Boolean}\n */\n handleAdd: function () {\n this.addRow(++this.options.rowIndex);\n\n return false;\n },\n\n /**\n * Delegated handler for removing a selected row\n * @public\n * @param {Object} e - Native event object\n * @return {Boolean}\n */\n handleRemove: function (e) {\n this.removeRow($(e.currentTarget).closest('[id^=\"' + this.options.btnRemoveIdPrefix + '\"]')\n .attr('id').replace(this.options.btnRemoveIdPrefix, ''));\n\n return false;\n },\n\n /**\n * Utility function to add escape chars for jquery selector strings\n * @private\n * @param {String} str - String to be processed\n * @return {String}\n */\n _esc: function (str) {\n return str ? str.replace(/([ ;&,.+*~\\':\"!\\^$\\[\\]()=>|\\/@])/g, '\\\\$1') : str;\n }\n });\n\n return $.mage.rowBuilder;\n});\n","Magento_Theme/js/theme.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/smart-keyboard-handler',\n 'mage/mage',\n 'domReady!'\n], function ($, keyboardHandler) {\n 'use strict';\n\n $('.cart-summary').mage('sticky', {\n container: '#maincontent'\n });\n\n $('.panel.header > .header.links').clone().appendTo('#store\\\\.links');\n $('#store\\\\.links li a').each(function () {\n var id = $(this).attr('id');\n\n if (id !== undefined) {\n $(this).attr('id', id + '_mobile');\n }\n });\n keyboardHandler.apply();\n});\n","Magento_Theme/js/view/add-home-breadcrumb.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/* eslint-disable max-nested-callbacks, no-undef */\ndefine([\n 'jquery',\n 'Magento_Theme/js/model/breadcrumb-list',\n 'mage/translate'\n], function ($, breadcrumbList) {\n 'use strict';\n\n /**\n * @return {Object}\n */\n var homeCrumb = function () {\n return {\n name: 'home',\n label: $.mage.__('Home'),\n title: $.mage.__('Go to Home Page'),\n link: BASE_URL || ''\n };\n };\n\n return function (breadcrumb) {\n\n breadcrumbList.unshift(homeCrumb());\n\n return breadcrumb;\n };\n});\n","Magento_Theme/js/view/breadcrumbs.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/template',\n 'Magento_Theme/js/model/breadcrumb-list',\n 'text!Magento_Theme/templates/breadcrumbs.html',\n 'jquery-ui-modules/widget'\n], function ($, mageTemplate, breadcrumbList, tpl) {\n 'use strict';\n\n /**\n * Breadcrumb Widget.\n */\n $.widget('mage.breadcrumbs', {\n\n /** @inheritdoc */\n _init: function () {\n this._super();\n this._render();\n },\n\n /**\n * Render breadcrumb.\n *\n * @private\n */\n _render: function () {\n var html,\n crumbs = breadcrumbList,\n template = mageTemplate(tpl);\n\n this._decorate(crumbs);\n\n html = template({\n 'breadcrumbs': crumbs\n });\n\n if (html.length) {\n $(this.element).html(html);\n }\n },\n\n /**\n * Decorate list.\n *\n * @param {Array} list\n * @private\n */\n _decorate: function (list) {\n\n if (list.length) {\n list[0].first = true;\n }\n\n if (list.length > 1) {\n list[list.length - 1].last = true;\n }\n }\n });\n\n return $.mage.breadcrumbs;\n});\n","Magento_Theme/js/view/messages.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'underscore',\n 'escaper',\n 'jquery/jquery-storageapi'\n], function ($, Component, customerData, _, escaper) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n cookieMessages: [],\n messages: [],\n allowedTags: ['div', 'span', 'b', 'strong', 'i', 'em', 'u', 'a']\n },\n\n /**\n * Extends Component object by storage observable messages.\n */\n initialize: function () {\n this._super();\n\n this.cookieMessages = _.unique($.cookieStorage.get('mage-messages'), 'text');\n this.messages = customerData.get('messages').extend({\n disposableCustomerData: 'messages'\n });\n\n // Force to clean obsolete messages\n if (!_.isEmpty(this.messages().messages)) {\n customerData.set('messages', {});\n }\n\n $.mage.cookies.set('mage-messages', '', {\n samesite: 'strict',\n domain: ''\n });\n },\n\n /**\n * Prepare the given message to be rendered as HTML\n *\n * @param {String} message\n * @return {String}\n */\n prepareMessageForHtml: function (message) {\n return escaper.escapeHtml(message, this.allowedTags);\n }\n });\n});\n","Magento_Theme/js/model/breadcrumb-list.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return [];\n});\n","Magento_Wishlist/js/wishlist.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'mage/template',\n 'Magento_Ui/js/modal/alert',\n 'jquery-ui-modules/widget',\n 'mage/validation/validation',\n 'mage/dataPost'\n], function ($, mageTemplate, alert) {\n 'use strict';\n\n $.widget('mage.wishlist', {\n options: {\n dataAttribute: 'item-id',\n nameFormat: 'qty[{0}]',\n btnRemoveSelector: '[data-role=remove]',\n qtySelector: '[data-role=qty]',\n addToCartSelector: '[data-role=tocart]',\n addAllToCartSelector: '[data-role=all-tocart]',\n commentInputType: 'textarea',\n infoList: false\n },\n\n /**\n * Bind handlers to events.\n */\n _create: function () {\n var _this = this;\n\n if (!this.options.infoList) {\n this.element\n .on('addToCart', function (event, context) {\n var urlParams;\n\n event.stopPropagation(event);\n $(context).data('stop-processing', true);\n urlParams = _this._getItemsToCartParams(\n $(context).parents('[data-row=product-item]').find(_this.options.addToCartSelector)\n );\n $.mage.dataPost().postData(urlParams);\n\n return false;\n })\n .on('click', this.options.btnRemoveSelector, $.proxy(function (event) {\n event.preventDefault();\n $.mage.dataPost().postData($(event.currentTarget).data('post-remove'));\n }, this))\n .on('click', this.options.addToCartSelector, $.proxy(this._beforeAddToCart, this))\n .on('click', this.options.addAllToCartSelector, $.proxy(this._addAllWItemsToCart, this))\n .on('focusin focusout', this.options.commentInputType, $.proxy(this._focusComment, this));\n }\n\n // Setup validation for the form\n this.element.mage('validation', {\n /** @inheritdoc */\n errorPlacement: function (error, element) {\n error.insertAfter(element.next());\n }\n });\n },\n\n /**\n * Process data before add to cart\n *\n * - update item's qty value.\n *\n * @param {Event} event\n * @private\n */\n _beforeAddToCart: function (event) {\n var elem = $(event.currentTarget),\n itemId = elem.data(this.options.dataAttribute),\n qtyName = $.validator.format(this.options.nameFormat, itemId),\n qtyValue = elem.parents().find('[name=\"' + qtyName + '\"]').val(),\n params = elem.data('post');\n\n if (params) {\n params.data = $.extend({}, params.data, {\n 'qty': qtyValue\n });\n elem.data('post', params);\n }\n },\n\n /**\n * Add wish list items to cart.\n * @private\n * @param {jQuery} elem - clicked 'add to cart' button\n */\n _getItemsToCartParams: function (elem) {\n var itemId, url, qtyName, qtyValue;\n\n if (elem.data(this.options.dataAttribute)) {\n itemId = elem.data(this.options.dataAttribute);\n url = this.options.addToCartUrl;\n qtyName = $.validator.format(this.options.nameFormat, itemId);\n qtyValue = elem.parents().find('[name=\"' + qtyName + '\"]').val();\n url.data.item = itemId;\n url.data.qty = qtyValue;\n\n return url;\n }\n },\n\n /**\n * Add all wish list items to cart\n * @private\n */\n _addAllWItemsToCart: function () {\n var urlParams = this.options.addAllToCartUrl,\n separator = urlParams.action.indexOf('?') >= 0 ? '&' : '?';\n\n this.element.find(this.options.qtySelector).each(function (index, element) {\n urlParams.action += separator + $(element).prop('name') + '=' + encodeURIComponent($(element).val());\n separator = '&';\n });\n $.mage.dataPost().postData(urlParams);\n },\n\n /**\n * Toggle comment string.\n * @private\n * @param {Event} e\n */\n _focusComment: function (e) {\n var commentInput = e.currentTarget;\n\n if (commentInput.value === '' || commentInput.value === this.options.commentString) {\n commentInput.value = commentInput.value === this.options.commentString ?\n '' : this.options.commentString;\n }\n }\n });\n\n // Extension for mage.wishlist - Select All checkbox\n $.widget('mage.wishlist', $.mage.wishlist, {\n options: {\n selectAllCheckbox: '#select-all',\n parentContainer: '#wishlist-table'\n },\n\n /** @inheritdoc */\n _create: function () {\n var selectAllCheckboxParent, checkboxCount;\n\n this._super();\n selectAllCheckboxParent = $(this.options.selectAllCheckbox).parents(this.options.parentContainer);\n checkboxCount = selectAllCheckboxParent\n .find('input:checkbox:not(' + this.options.selectAllCheckbox + ')').length;\n // If Select all checkbox is checked, check all item checkboxes, if unchecked, uncheck all item checkboxes\n $(this.options.selectAllCheckbox).on('click', function () {\n selectAllCheckboxParent.find('input:checkbox').attr('checked', $(this).is(':checked'));\n });\n // If all item checkboxes are checked, check select all checkbox,\n // if not all item checkboxes are checked, uncheck select all checkbox\n selectAllCheckboxParent.on(\n 'click',\n 'input:checkbox:not(' + this.options.selectAllCheckbox + ')',\n $.proxy(function () {\n var checkedCount = selectAllCheckboxParent\n .find('input:checkbox:checked:not(' + this.options.selectAllCheckbox + ')').length;\n\n $(this.options.selectAllCheckbox).attr('checked', checkboxCount === checkedCount);\n }, this)\n );\n }\n });\n // Extension for mage.wishlist info add to cart\n $.widget('mage.wishlist', $.mage.wishlist, {\n /** @inheritdoc */\n _create: function () {\n this._super();\n\n if (this.options.infoList) {\n this.element.on('addToCart', $.proxy(function (event, context) {\n this.element.find('input:checkbox').attr('checked', false);\n $(context).closest('tr').find('input:checkbox').attr('checked', true);\n this.element.trigger('submit');\n }, this));\n this._checkBoxValidate();\n }\n },\n\n /**\n * validate checkbox selection.\n * @private\n */\n _checkBoxValidate: function () {\n this.element.validation({\n submitHandler: $.proxy(function (form) {\n if ($(form).find('input:checkbox:checked').length) {\n form.submit();\n } else {\n alert({\n content: this.options.checkBoxValidationMessage\n });\n }\n }, this)\n });\n }\n });\n\n // Extension for mage.wishlist - Add Wishlist item to Gift Registry\n $.widget('mage.wishlist', $.mage.wishlist, {\n options: {\n formTmplSelector: '#form-tmpl',\n formTmplId: '#wishlist-hidden-form'\n },\n\n /** @inheritdoc */\n _create: function () {\n var _this = this;\n\n this._super();\n this.element.on('click', '[data-wishlist-to-giftregistry]', function () {\n var json = $(this).data('wishlist-to-giftregistry'),\n tmplJson = {\n item: json.itemId,\n entity: json.entity,\n url: json.url\n },\n html = mageTemplate(_this.options.formTmplSelector, {\n data: tmplJson\n });\n\n $(html).appendTo('body');\n $(_this.options.formTmplId).trigger('submit');\n });\n }\n });\n\n return $.mage.wishlist;\n});\n","Magento_Wishlist/js/search.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.wishlistSearch', {\n\n /**\n * Bind handlers to events\n */\n _create: function () {\n this.element.on('change', $.proxy(this._toggleForm, this));\n },\n\n /**\n * Toggle Form\n * @private\n */\n _toggleForm: function () {\n switch (this.element.val()) {\n case 'name':\n $(this.options.emailFormSelector).hide();\n $(this.options.nameFormSelector).show();\n break;\n\n case 'email':\n $(this.options.nameFormSelector).hide();\n $(this.options.emailFormSelector).show();\n break;\n default:\n $(this.options.emailFormSelector).add(this.options.nameFormSelector).hide();\n }\n }\n });\n\n return $.mage.wishlistSearch;\n});\n","Magento_Wishlist/js/add-to-wishlist.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.addToWishlist', {\n options: {\n bundleInfo: 'div.control [name^=bundle_option]',\n configurableInfo: '.super-attribute-select',\n groupedInfo: '#super-product-table input',\n downloadableInfo: '#downloadable-links-list input',\n customOptionsInfo: '.product-custom-option',\n qtyInfo: '#qty',\n actionElement: '[data-action=\"add-to-wishlist\"]',\n productListWrapper: '.product-item-info',\n productPageWrapper: '.product-info-main'\n },\n\n /** @inheritdoc */\n _create: function () {\n this._bind();\n },\n\n /**\n * @private\n */\n _bind: function () {\n var options = this.options,\n dataUpdateFunc = '_updateWishlistData',\n validateProductQty = '_validateWishlistQty',\n changeCustomOption = 'change ' + options.customOptionsInfo,\n changeQty = 'change ' + options.qtyInfo,\n updateWishlist = 'click ' + options.actionElement,\n events = {},\n key;\n\n if ('productType' in options) {\n if (typeof options.productType === 'string') {\n options.productType = [options.productType];\n }\n } else {\n options.productType = [];\n }\n\n events[changeCustomOption] = dataUpdateFunc;\n events[changeQty] = dataUpdateFunc;\n events[updateWishlist] = validateProductQty;\n\n for (key in options.productType) {\n if (options.productType.hasOwnProperty(key) && options.productType[key] + 'Info' in options) {\n events['change ' + options[options.productType[key] + 'Info']] = dataUpdateFunc;\n }\n }\n this._on(events);\n },\n\n /**\n * @param {jQuery.Event} event\n * @private\n */\n _updateWishlistData: function (event) {\n var dataToAdd = {},\n isFileUploaded = false,\n handleObjSelector = null,\n self = this;\n\n if (event.handleObj.selector == this.options.qtyInfo) { //eslint-disable-line eqeqeq\n this._updateAddToWishlistButton({}, event);\n event.stopPropagation();\n\n return;\n }\n\n handleObjSelector = $(event.currentTarget).closest('form').find(event.handleObj.selector);\n\n handleObjSelector.each(function (index, element) {\n if ($(element).is('input[type=text]') ||\n $(element).is('input[type=email]') ||\n $(element).is('input[type=number]') ||\n $(element).is('input[type=hidden]') ||\n $(element).is('input[type=checkbox]:checked') ||\n $(element).is('input[type=radio]:checked') ||\n $(element).is('textarea') ||\n $('#' + element.id + ' option:selected').length\n ) {\n if ($(element).data('selector') || $(element).attr('name')) {\n dataToAdd = $.extend({}, dataToAdd, self._getElementData(element));\n }\n\n return;\n }\n\n if ($(element).is('input[type=file]') && $(element).val()) {\n isFileUploaded = true;\n }\n });\n\n if (isFileUploaded) {\n this.bindFormSubmit();\n }\n this._updateAddToWishlistButton(dataToAdd, event);\n event.stopPropagation();\n },\n\n /**\n * @param {Object} dataToAdd\n * @param {jQuery.Event} event\n * @private\n */\n _updateAddToWishlistButton: function (dataToAdd, event) {\n var self = this,\n buttons = this._getAddToWishlistButton(event);\n\n buttons.each(function (index, element) {\n var params = $(element).data('post'),\n currentTarget = event.currentTarget,\n targetElement,\n targetValue;\n\n if (!params) {\n params = {\n 'data': {}\n };\n } else if ($(currentTarget).data('selector') || $(currentTarget).attr('name')) {\n targetElement = self._getElementData(currentTarget);\n targetValue = Object.keys(targetElement)[0];\n\n if (params.data.hasOwnProperty(targetValue) && !dataToAdd.hasOwnProperty(targetValue)) {\n delete params.data[targetValue];\n }\n }\n\n params.data = $.extend({}, params.data, dataToAdd, {\n 'qty': $(self.options.qtyInfo).val()\n });\n $(element).data('post', params);\n });\n },\n\n /**\n * @param {jQuery.Event} event\n * @private\n */\n _getAddToWishlistButton: function (event) {\n var productListWrapper = $(event.currentTarget).closest(this.options.productListWrapper);\n\n if (productListWrapper.length) {\n return productListWrapper.find(this.options.actionElement);\n }\n\n return $(this.options.actionElement);\n },\n\n /**\n * @param {Object} array1\n * @param {Object} array2\n * @return {Object}\n * @private\n * @deprecated\n */\n _arrayDiffByKeys: function (array1, array2) {\n var result = {};\n\n $.each(array1, function (key, value) {\n if (key.indexOf('option') === -1) {\n return;\n }\n\n if (!array2[key]) {\n result[key] = value;\n }\n });\n\n return result;\n },\n\n /**\n * @param {HTMLElement} element\n * @return {Object}\n * @private\n */\n _getElementData: function (element) {\n var data, elementName, elementValue;\n\n element = $(element);\n data = {};\n elementName = element.data('selector') ? element.data('selector') : element.attr('name');\n elementValue = element.val();\n\n if (element.is('select[multiple]') && elementValue !== null) {\n if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq\n elementName = elementName.substring(0, elementName.length - 2);\n }\n $.each(elementValue, function (key, option) {\n data[elementName + '[' + option + ']'] = option;\n });\n } else if (elementName.substr(elementName.length - 2) == '[]') { //eslint-disable-line eqeqeq, max-depth\n elementName = elementName.substring(0, elementName.length - 2);\n\n data[elementName + '[' + elementValue + ']'] = elementValue;\n } else {\n data[elementName] = elementValue;\n }\n\n return data;\n },\n\n /**\n * @param {Object} params\n * @param {Object} dataToAdd\n * @private\n * @deprecated\n */\n _removeExcessiveData: function (params, dataToAdd) {\n var dataToRemove = this._arrayDiffByKeys(params.data, dataToAdd);\n\n $.each(dataToRemove, function (key) {\n delete params.data[key];\n });\n },\n\n /**\n * Bind form submit.\n */\n bindFormSubmit: function () {\n var self = this;\n\n $('[data-action=\"add-to-wishlist\"]').on('click', function (event) {\n var element, params, form, action;\n\n event.stopPropagation();\n event.preventDefault();\n\n element = $('input[type=file]' + self.options.customOptionsInfo);\n params = $(event.currentTarget).data('post');\n form = $(element).closest('form');\n action = params.action;\n\n if (params.data.id) {\n $('<input>', {\n type: 'hidden',\n name: 'id',\n value: params.data.id\n }).appendTo(form);\n }\n\n if (params.data.uenc) {\n action += 'uenc/' + params.data.uenc;\n }\n\n $(form).attr('action', action).trigger('submit');\n });\n },\n\n /**\n * Validate product quantity before updating Wish List\n *\n * @param {jQuery.Event} event\n * @private\n */\n _validateWishlistQty: function (event) {\n var element = $(this.options.qtyInfo);\n\n if (!(element.validation() && element.validation('isValid'))) {\n event.preventDefault();\n event.stopPropagation();\n\n return;\n }\n }\n });\n\n return $.mage.addToWishlist;\n});\n","Magento_Wishlist/js/view/wishlist.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data'\n], function (Component, customerData) {\n 'use strict';\n\n return Component.extend({\n /** @inheritdoc */\n initialize: function () {\n this._super();\n\n this.wishlist = customerData.get('wishlist');\n }\n });\n});\n","Magento_Wishlist/js/product/addtowishlist-button.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'Magento_Ui/js/grid/columns/column',\n 'Magento_Catalog/js/product/uenc-processor',\n 'Magento_Catalog/js/product/list/column-status-validator'\n], function (Element, uencProcessor, columnStatusValidator) {\n 'use strict';\n\n return Element.extend({\n defaults: {\n label: ''\n },\n\n /**\n * Get request POST data.\n *\n * @param {Object} row\n * @return {String}\n */\n getDataPost: function (row) {\n return uencProcessor(row['extension_attributes']['wishlist_button'].url);\n },\n\n /**\n * Check if component must be shown.\n *\n * @return {Boolean}\n */\n isAllowed: function () {\n return columnStatusValidator.isValid(this.source(), 'add_to_wishlist', 'show_buttons');\n },\n\n /**\n * Get button label.\n *\n * @return {String}\n */\n getLabel: function () {\n return this.label;\n }\n });\n});\n","Magento_Downloadable/js/downloadable.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget',\n 'Magento_Catalog/js/price-box'\n], function ($) {\n 'use strict';\n\n /**\n * Downloadable widget\n */\n $.widget('mage.downloadable', {\n options: {\n priceHolderSelector: '.price-box',\n linkElement: '',\n allElements: ''\n },\n\n /**\n * @inheritdoc\n */\n _init: function initLinks() {\n var element = this.element,\n options = $(this.options.linkElement, element);\n\n options.trigger('change');\n },\n\n /**\n * @inheritdoc\n */\n _create: function () {\n var self = this;\n\n this.element.find(this.options.linkElement).on('change', $.proxy(function () {\n this._reloadPrice();\n }, this));\n\n this.element.find(this.options.allElements).on('change', function () {\n if (this.checked) {\n $('label[for=\"' + this.id + '\"] > span').text($(this).attr('data-checked'));\n self.element.find(self.options.linkElement + ':not(:checked)').each(function () {\n $(this).trigger('click');\n });\n } else {\n $('[for=\"' + this.id + '\"] > span').text($(this).attr('data-notchecked'));\n self.element.find(self.options.linkElement + ':checked').each(function () {\n $(this).trigger('click');\n });\n }\n });\n\n this._reloadPrice();\n },\n\n /**\n * Reload product price with selected link price included\n * @private\n */\n _reloadPrice: function () {\n var finalPrice = 0,\n basePrice = 0;\n\n this.element.find(this.options.linkElement + ':checked').each($.proxy(function (index, element) {\n finalPrice += this.options.config.links[$(element).val()].finalPrice;\n basePrice += this.options.config.links[$(element).val()].basePrice;\n }, this));\n\n $(this.options.priceHolderSelector).trigger('updatePrice', {\n 'prices': {\n 'finalPrice': {\n 'amount': finalPrice\n },\n 'basePrice': {\n 'amount': basePrice\n }\n }\n });\n\n this.reloadAllCheckText();\n },\n\n /**\n * Reload all-elements-checkbox's label\n * @private\n */\n reloadAllCheckText: function () {\n var allChecked = true,\n allElementsCheck = $(this.options.allElements),\n allElementsLabel = $('label[for=\"' + allElementsCheck.attr('id') + '\"] > span');\n\n $(this.options.linkElement).each(function () {\n if (!this.checked) {\n allChecked = false;\n }\n });\n\n if (allChecked) {\n allElementsLabel.text(allElementsCheck.attr('data-checked'));\n allElementsCheck.prop('checked', true);\n } else {\n allElementsLabel.text(allElementsCheck.attr('data-notchecked'));\n allElementsCheck.prop('checked', false);\n }\n }\n });\n\n return $.mage.downloadable;\n});\n","Magento_Newsletter/js/newsletter-sign-up.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'uiElement',\n 'mage/url',\n 'subscriptionStatusResolver',\n 'mage/validation'\n], function ($, Component, urlBuilder, subscriptionStatusResolver) {\n 'use strict';\n\n return Component.extend({\n\n defaults: {\n signUpElement: '',\n submitButton: '',\n element: null\n },\n\n /** @inheritdoc */\n initialize: function (config, element) {\n this._super();\n this.element = element;\n $(element).on('change', $.proxy(this.updateSignUpStatus, this));\n this.updateSignUpStatus();\n },\n\n /**\n * Send status request and update subscription element according to result.\n */\n updateSignUpStatus: function () {\n var element = $(this.element),\n email = element.val(),\n self = this,\n newsletterSubscription;\n\n if ($(self.signUpElement).is(':checked')) {\n return;\n }\n\n if (!email || !$.validator.methods['validate-email'].call(this, email, element)) {\n return;\n }\n\n newsletterSubscription = $.Deferred();\n\n $(self.submitButton).prop('disabled', true);\n\n subscriptionStatusResolver(email, newsletterSubscription);\n\n $.when(newsletterSubscription).done(function (isSubscribed) {\n if (isSubscribed) {\n $(self.signUpElement).prop('checked', true);\n }\n }).always(function () {\n $(self.submitButton).prop('disabled', false);\n });\n }\n });\n});\n","Magento_Newsletter/js/subscription-status-resolver.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/url'\n], function ($, urlBuilder) {\n 'use strict';\n\n return function (email, deferred) {\n return $.getJSON(\n urlBuilder.build('newsletter/ajax/status'),\n {\n email: email\n }\n ).done(function (response) {\n if (response.errors) {\n deferred.reject();\n } else {\n deferred.resolve(response.subscribed);\n }\n }).fail(function () {\n deferred.reject();\n });\n };\n});\n","Magento_Review/js/process-reviews.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'tabs',\n 'collapsible'\n], function ($) {\n 'use strict';\n\n /**\n * @param {String} url\n * @param {*} fromPages\n */\n function processReviews(url, fromPages) {\n $.ajax({\n url: url,\n cache: true,\n dataType: 'html',\n showLoader: false,\n loaderContext: $('.product.data.items')\n }).done(function (data) {\n $('#product-review-container').html(data).trigger('contentUpdated');\n $('[data-role=\"product-review\"] .pages a').each(function (index, element) {\n $(element).on('click', function (event) { //eslint-disable-line max-nested-callbacks\n processReviews($(element).attr('href'), true);\n event.preventDefault();\n });\n });\n }).always(function () {\n if (fromPages == true) { //eslint-disable-line eqeqeq\n $('html, body').animate({\n scrollTop: $('#reviews').offset().top - 50\n }, 300);\n }\n });\n }\n\n return function (config) {\n var reviewTab = $(config.reviewsTabSelector),\n requiredReviewTabRole = 'tab';\n\n if (reviewTab.attr('role') === requiredReviewTabRole && reviewTab.hasClass('active')) {\n processReviews(config.productReviewUrl, location.hash === '#reviews');\n } else {\n reviewTab.one('beforeOpen', function () {\n processReviews(config.productReviewUrl);\n });\n }\n\n $(function () {\n $('.product-info-main .reviews-actions a').on('click', function (event) {\n var anchor, addReviewBlock;\n\n event.preventDefault();\n anchor = $(this).attr('href').replace(/^.*?(#|$)/, '');\n addReviewBlock = $('#' + anchor);\n\n if (addReviewBlock.length) {\n $('.product.data.items [data-role=\"content\"]').each(function (index) { //eslint-disable-line\n if (this.id == 'reviews') { //eslint-disable-line eqeqeq\n $('.product.data.items').tabs('activate', index);\n }\n });\n $('html, body').animate({\n scrollTop: addReviewBlock.offset().top - 50\n }, 300);\n }\n\n });\n });\n };\n});\n","Magento_Review/js/validate-review.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery/validate',\n 'mage/translate'\n], function ($) {\n 'use strict';\n\n $.validator.addMethod(\n 'rating-required', function (value) {\n return value !== undefined;\n }, $.mage.__('Please select one of each of the ratings above.'));\n});\n","Magento_Review/js/error-placement.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/mage'\n], function ($) {\n 'use strict';\n\n return function (config, element) {\n $(element).mage('validation', {\n /** @inheritdoc */\n errorPlacement: function (error, el) {\n\n if (el.parents('#product-review-table').length) {\n $('#product-review-table').siblings(this.errorElement + '.' + this.errorClass).remove();\n $('#product-review-table').after(error);\n } else {\n el.after(error);\n }\n }\n });\n };\n});\n","Magento_Review/js/submit-review.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery'\n], function ($) {\n 'use strict';\n\n return function (config, element) {\n $(element).on('submit', function () {\n if ($(this).valid()) {\n $(this).find('.submit').attr('disabled', true);\n }\n });\n };\n});\n","Magento_Review/js/view/review.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Customer/js/customer-data',\n 'Magento_Customer/js/view/customer'\n], function (Component, customerData) {\n 'use strict';\n\n return Component.extend({\n /** @inheritdoc */\n initialize: function () {\n this._super();\n\n this.review = customerData.get('review').extend({\n disposableCustomerData: 'review'\n });\n },\n\n /**\n * @return {*}\n */\n nickname: function () {\n return this.review().nickname || customerData.get('customer')().firstname;\n }\n });\n});\n","Magento_Reports/js/recently-viewed.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.recentlyViewedProducts', {\n options: {\n localStorageKey: 'recently-viewed-products',\n productBlock: '#widget_viewed_item',\n viewedContainer: 'ol'\n },\n\n /**\n * Bind events to the appropriate handlers.\n * @private\n */\n _create: function () {\n var productHtml = $(this.options.productBlock).html(),\n productSku = $(this.options.productBlock).data('sku'),\n products = JSON.parse(window.localStorage.getItem(this.options.localStorageKey)),\n productsLength, maximum, showed, index;\n\n if (products) {\n productsLength = products.sku.length;\n maximum = $(this.element).data('count');\n showed = 0;\n\n for (index = 0; index <= productsLength; index++) {\n if (products.sku[index] == productSku || showed >= maximum) { //eslint-disable-line\n products.sku.splice(index, 1);\n products.html.splice(index, 1);\n } else {\n $(this.element).find(this.options.viewedContainer).append(products.html[index]);\n $(this.element).show();\n showed++;\n }\n }\n $(this.element).find(this.options.productBlock).show();\n } else {\n products = {};\n products.sku = [];\n products.html = [];\n }\n products.sku.unshift(productSku);\n products.html.unshift(productHtml);\n window.localStorage.setItem(this.options.localStorageKey, JSON.stringify(products));\n }\n });\n\n return $.mage.recentlyViewedProducts;\n});\n","Magento_PageCache/js/page-cache.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'domReady',\n 'consoleLogger',\n 'Magento_PageCache/js/form-key-provider',\n 'jquery-ui-modules/widget',\n 'mage/cookies'\n], function ($, domReady, consoleLogger, formKeyInit) {\n 'use strict';\n\n /**\n * Helper. Generate random string\n * TODO: Merge with mage/utils\n * @param {String} chars - list of symbols\n * @param {Number} length - length for need string\n * @returns {String}\n */\n function generateRandomString(chars, length) {\n var result = '';\n\n length = length > 0 ? length : 1;\n\n while (length--) {\n result += chars[Math.round(Math.random() * (chars.length - 1))];\n }\n\n return result;\n }\n\n /**\n * Nodes tree to flat list converter\n * @returns {Array}\n */\n $.fn.comments = function () {\n var elements = [],\n contents,\n elementContents;\n\n /**\n * @param {jQuery} element - Comment holder\n */\n (function lookup(element) {\n var iframeHostName;\n\n // prevent cross origin iframe content reading\n if ($(element).prop('tagName') === 'IFRAME') {\n iframeHostName = $('<a>').prop('href', $(element).prop('src'))\n .prop('hostname');\n\n if (window.location.hostname !== iframeHostName) {\n return [];\n }\n }\n\n /**\n * Rewrite jQuery contents().\n *\n * @param {jQuery} elem\n */\n contents = function (elem) {\n return $.map(elem, function (el) {\n try {\n return el.nodeName.toLowerCase() === 'iframe' ?\n el.contentDocument || (el.contentWindow ? el.contentWindow.document : []) :\n $.merge([], el.childNodes);\n } catch (e) {\n consoleLogger.error(e);\n\n return [];\n }\n });\n };\n\n elementContents = contents($(element));\n\n $.each(elementContents, function (index, el) {\n switch (el.nodeType) {\n case 1: // ELEMENT_NODE\n lookup(el);\n break;\n\n case 8: // COMMENT_NODE\n elements.push(el);\n break;\n\n case 9: // DOCUMENT_NODE\n lookup($(el).find('body'));\n break;\n }\n });\n })(this);\n\n return elements;\n };\n\n /**\n * FormKey Widget - this widget is generating from key, saves it to cookie and\n * @deprecated see Magento/PageCache/view/frontend/web/js/form-key-provider.js\n */\n $.widget('mage.formKey', {\n options: {\n inputSelector: 'input[name=\"form_key\"]',\n allowedCharacters: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',\n length: 16\n },\n\n /**\n * Creates widget 'mage.formKey'\n * @private\n */\n _create: function () {\n var formKey = $.mage.cookies.get('form_key'),\n options = {\n secure: window.cookiesConfig ? window.cookiesConfig.secure : false\n };\n\n if (!formKey) {\n formKey = generateRandomString(this.options.allowedCharacters, this.options.length);\n $.mage.cookies.set('form_key', formKey, options);\n }\n $(this.options.inputSelector).val(formKey);\n }\n });\n\n /**\n * PageCache Widget\n * Handles additional ajax request for rendering user private content.\n */\n $.widget('mage.pageCache', {\n options: {\n url: '/',\n patternPlaceholderOpen: /^ BLOCK (.+) $/,\n patternPlaceholderClose: /^ \\/BLOCK (.+) $/,\n versionCookieName: 'private_content_version',\n handles: []\n },\n\n /**\n * Creates widget 'mage.pageCache'\n * @private\n */\n _create: function () {\n var placeholders,\n version = $.mage.cookies.get(this.options.versionCookieName);\n\n if (!version) {\n return;\n }\n placeholders = this._searchPlaceholders(this.element.comments());\n\n if (placeholders && placeholders.length) {\n this._ajax(placeholders, version);\n }\n },\n\n /**\n * Parse page for placeholders.\n * @param {Array} elements\n * @returns {Array}\n * @private\n */\n _searchPlaceholders: function (elements) {\n var placeholders = [],\n tmp = {},\n ii,\n len,\n el, matches, name;\n\n if (!(elements && elements.length)) {\n return placeholders;\n }\n\n for (ii = 0, len = elements.length; ii < len; ii++) {\n el = elements[ii];\n matches = this.options.patternPlaceholderOpen.exec(el.nodeValue);\n name = null;\n\n if (matches) {\n name = matches[1];\n tmp[name] = {\n name: name,\n openElement: el\n };\n } else {\n matches = this.options.patternPlaceholderClose.exec(el.nodeValue);\n\n if (matches) { //eslint-disable-line max-depth\n name = matches[1];\n\n if (tmp[name]) { //eslint-disable-line max-depth\n tmp[name].closeElement = el;\n placeholders.push(tmp[name]);\n delete tmp[name];\n }\n }\n }\n }\n\n return placeholders;\n },\n\n /**\n * Parse for page and replace placeholders\n * @param {Object} placeholder\n * @param {Object} html\n * @protected\n */\n _replacePlaceholder: function (placeholder, html) {\n var startReplacing = false,\n prevSibling = null,\n parent, contents, yy, len, element;\n\n if (!placeholder || !html) {\n return;\n }\n\n parent = $(placeholder.openElement).parent();\n contents = parent.contents();\n\n for (yy = 0, len = contents.length; yy < len; yy++) {\n element = contents[yy];\n\n if (element == placeholder.openElement) { //eslint-disable-line eqeqeq\n startReplacing = true;\n }\n\n if (startReplacing) {\n $(element).remove();\n } else if (element.nodeType != 8) { //eslint-disable-line eqeqeq\n //due to comment tag doesn't have siblings we try to find it manually\n prevSibling = element;\n }\n\n if (element == placeholder.closeElement) { //eslint-disable-line eqeqeq\n break;\n }\n }\n\n if (prevSibling) {\n $(prevSibling).after(html);\n } else {\n $(parent).prepend(html);\n }\n\n // trigger event to use mage-data-init attribute\n $(parent).trigger('contentUpdated');\n },\n\n /**\n * AJAX helper\n * @param {Object} placeholders\n * @param {String} version\n * @private\n */\n _ajax: function (placeholders, version) {\n var ii,\n data = {\n blocks: [],\n handles: this.options.handles,\n originalRequest: this.options.originalRequest,\n version: version\n };\n\n for (ii = 0; ii < placeholders.length; ii++) {\n data.blocks.push(placeholders[ii].name);\n }\n data.blocks = JSON.stringify(data.blocks.sort());\n data.handles = JSON.stringify(data.handles);\n data.originalRequest = JSON.stringify(data.originalRequest);\n $.ajax({\n url: this.options.url,\n data: data,\n type: 'GET',\n cache: true,\n dataType: 'json',\n context: this,\n\n /**\n * Response handler\n * @param {Object} response\n */\n success: function (response) {\n var placeholder, i;\n\n for (i = 0; i < placeholders.length; i++) {\n placeholder = placeholders[i];\n\n if (response.hasOwnProperty(placeholder.name)) {\n this._replacePlaceholder(placeholder, response[placeholder.name]);\n }\n }\n }\n });\n }\n });\n\n domReady(function () {\n formKeyInit();\n });\n\n return {\n 'pageCache': $.mage.pageCache,\n 'formKey': $.mage.formKey\n };\n});\n","Magento_PageCache/js/form-key-provider.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine(function () {\n 'use strict';\n\n return function (settings) {\n var formKey,\n inputElements,\n inputSelector = 'input[name=\"form_key\"]';\n\n /**\n * Set form_key cookie\n * @private\n */\n function setFormKeyCookie(value) {\n var expires,\n secure,\n date = new Date(),\n cookiesConfig = window.cookiesConfig || {},\n isSecure = !!cookiesConfig.secure,\n samesite = cookiesConfig.samesite || 'lax';\n\n date.setTime(date.getTime() + 86400000);\n expires = '; expires=' + date.toUTCString();\n secure = isSecure ? '; secure' : '';\n samesite = '; samesite=' + samesite;\n\n document.cookie = 'form_key=' + (value || '') + expires + secure + '; path=/' + samesite;\n }\n\n /**\n * Retrieves form key from cookie\n * @private\n */\n function getFormKeyCookie() {\n var cookie,\n i,\n nameEQ = 'form_key=',\n cookieArr = document.cookie.split(';');\n\n for (i = 0; i < cookieArr.length; i++) {\n cookie = cookieArr[i];\n\n while (cookie.charAt(0) === ' ') {\n cookie = cookie.substring(1, cookie.length);\n }\n\n if (cookie.indexOf(nameEQ) === 0) {\n return cookie.substring(nameEQ.length, cookie.length);\n }\n }\n\n return null;\n }\n\n /**\n * Get form key from UI input hidden\n * @private\n */\n function getFormKeyFromUI() {\n return document.querySelector(inputSelector).value;\n }\n\n /**\n * Generate form key string\n * @private\n */\n function generateFormKeyString() {\n var result = '',\n length = 16,\n chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n\n while (length--) {\n result += chars[Math.round(Math.random() * (chars.length - 1))];\n }\n\n return result;\n }\n\n /**\n * Init form_key inputs with value\n * @private\n */\n function initFormKey() {\n formKey = getFormKeyCookie();\n\n if (settings && settings.isPaginationCacheEnabled && !formKey) {\n formKey = getFormKeyFromUI();\n setFormKeyCookie(formKey);\n }\n\n if (!formKey) {\n formKey = generateFormKeyString();\n setFormKeyCookie(formKey);\n }\n inputElements = document.querySelectorAll(inputSelector);\n\n if (inputElements.length) {\n Array.prototype.forEach.call(inputElements, function (element) {\n element.setAttribute('value', formKey);\n });\n }\n }\n\n initFormKey();\n };\n});\n","Magento_ConfigurableProduct/js/configurable.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'underscore',\n 'mage/template',\n 'mage/translate',\n 'priceUtils',\n 'priceBox',\n 'jquery-ui-modules/widget',\n 'jquery/jquery.parsequery',\n 'fotoramaVideoEvents'\n], function ($, _, mageTemplate, $t, priceUtils) {\n 'use strict';\n\n $.widget('mage.configurable', {\n options: {\n superSelector: '.super-attribute-select',\n selectSimpleProduct: '[name=\"selected_configurable_option\"]',\n priceHolderSelector: '.price-box',\n spConfig: {},\n state: {},\n priceFormat: {},\n optionTemplate: '<%- data.label %>' +\n '<% if (typeof data.finalPrice.value !== \"undefined\") { %>' +\n ' <%- data.finalPrice.formatted %>' +\n '<% } %>',\n mediaGallerySelector: '[data-gallery-role=gallery-placeholder]',\n mediaGalleryInitial: null,\n slyOldPriceSelector: '.sly-old-price',\n normalPriceLabelSelector: '.product-info-main .normal-price .price-label',\n\n /**\n * Defines the mechanism of how images of a gallery should be\n * updated when user switches between configurations of a product.\n *\n * As for now value of this option can be either 'replace' or 'prepend'.\n *\n * @type {String}\n */\n gallerySwitchStrategy: 'replace',\n tierPriceTemplateSelector: '#tier-prices-template',\n tierPriceBlockSelector: '[data-role=\"tier-price-block\"]',\n tierPriceTemplate: '',\n selectorProduct: '.product-info-main',\n selectorProductPrice: '[data-role=priceBox]',\n qtyInfo: '#qty'\n },\n\n /**\n * Creates widget\n * @private\n */\n _create: function () {\n // Initial setting of various option values\n this._initializeOptions();\n\n // Override defaults with URL query parameters and/or inputs values\n this._overrideDefaults();\n\n // Change events to check select reloads\n this._setupChangeEvents();\n\n // Fill state\n this._fillState();\n\n // Setup child and prev/next settings\n this._setChildSettings();\n\n // Setup/configure values to inputs\n this._configureForValues();\n\n $(this.element).trigger('configurable.initialized');\n $(this.options.qtyInfo).on('input', this._reloadPrice.bind(this));\n },\n\n /**\n * Initialize tax configuration, initial settings, and options values.\n * @private\n */\n _initializeOptions: function () {\n var options = this.options,\n gallery = $(options.mediaGallerySelector),\n priceBoxOptions = $(this.options.priceHolderSelector).priceBox('option').priceConfig || null;\n\n if (priceBoxOptions && priceBoxOptions.optionTemplate) {\n options.optionTemplate = priceBoxOptions.optionTemplate;\n }\n\n if (priceBoxOptions && priceBoxOptions.priceFormat) {\n options.priceFormat = priceBoxOptions.priceFormat;\n }\n options.optionTemplate = mageTemplate(options.optionTemplate);\n options.tierPriceTemplate = $(this.options.tierPriceTemplateSelector).html();\n\n options.settings = options.spConfig.containerId ?\n $(options.spConfig.containerId).find(options.superSelector) :\n $(options.superSelector);\n\n options.values = options.spConfig.defaultValues || {};\n options.parentImage = $('[data-role=base-image-container] img').attr('src');\n\n this.inputSimpleProduct = this.element.find(options.selectSimpleProduct);\n\n gallery.data('gallery') ?\n this._onGalleryLoaded(gallery) :\n gallery.on('gallery:loaded', this._onGalleryLoaded.bind(this, gallery));\n\n },\n\n /**\n * Override default options values settings with either URL query parameters or\n * initialized inputs values.\n * @private\n */\n _overrideDefaults: function () {\n var hashIndex = window.location.href.indexOf('#');\n\n if (hashIndex !== -1) {\n this._parseQueryParams(window.location.href.substr(hashIndex + 1));\n }\n\n if (this.options.spConfig.inputsInitialized) {\n this._setValuesByAttribute();\n }\n\n this._setInitialOptionsLabels();\n },\n\n /**\n * Parse query parameters from a query string and set options values based on the\n * key value pairs of the parameters.\n * @param {*} queryString - URL query string containing query parameters.\n * @private\n */\n _parseQueryParams: function (queryString) {\n var queryParams = $.parseQuery({\n query: queryString\n });\n\n $.each(queryParams, $.proxy(function (key, value) {\n if (this.options.spConfig.attributes[key] !== undefined &&\n _.find(this.options.spConfig.attributes[key].options, function (element) {\n return element.id === value;\n })) {\n this.options.values[key] = value;\n }\n }, this));\n },\n\n /**\n * Override default options values with values based on each element's attribute\n * identifier.\n * @private\n */\n _setValuesByAttribute: function () {\n this.options.values = {};\n $.each(this.options.settings, $.proxy(function (index, element) {\n var attributeId;\n\n if (element.value) {\n attributeId = element.id.replace(/[a-z]*/, '');\n\n if (this.options.spConfig.attributes[attributeId] !== undefined &&\n _.find(this.options.spConfig.attributes[attributeId].options, function (optionElement) {\n return optionElement.id === element.value;\n })) {\n this.options.values[attributeId] = element.value;\n }\n }\n }, this));\n },\n\n /**\n * Set additional field with initial label to be used when switching between options with different prices.\n * @private\n */\n _setInitialOptionsLabels: function () {\n $.each(this.options.spConfig.attributes, $.proxy(function (index, element) {\n $.each(element.options, $.proxy(function (optIndex, optElement) {\n this.options.spConfig.attributes[index].options[optIndex].initialLabel = optElement.label;\n }, this));\n }, this));\n },\n\n /**\n * Set up .on('change') events for each option element to configure the option.\n * @private\n */\n _setupChangeEvents: function () {\n $.each(this.options.settings, $.proxy(function (index, element) {\n $(element).on('change', this, this._configure);\n }, this));\n },\n\n /**\n * Iterate through the option settings and set each option's element configuration,\n * attribute identifier. Set the state based on the attribute identifier.\n * @private\n */\n _fillState: function () {\n $.each(this.options.settings, $.proxy(function (index, element) {\n var attributeId = element.id.replace(/[a-z]*/, '');\n\n if (attributeId && this.options.spConfig.attributes[attributeId]) {\n element.config = this.options.spConfig.attributes[attributeId];\n element.attributeId = attributeId;\n this.options.state[attributeId] = false;\n }\n }, this));\n },\n\n /**\n * Set each option's child settings, and next/prev option setting. Fill (initialize)\n * an option's list of selections as needed or disable an option's setting.\n * @private\n */\n _setChildSettings: function () {\n var childSettings = [],\n settings = this.options.settings,\n index = settings.length,\n option;\n\n while (index--) {\n option = settings[index];\n\n if (index) {\n option.disabled = true;\n } else {\n this._fillSelect(option);\n }\n\n _.extend(option, {\n childSettings: childSettings.slice(),\n prevSetting: settings[index - 1],\n nextSetting: settings[index + 1]\n });\n\n childSettings.push(option);\n }\n },\n\n /**\n * Setup for all configurable option settings. Set the value of the option and configure\n * the option, which sets its state, and initializes the option's choices, etc.\n * @private\n */\n _configureForValues: function () {\n if (this.options.values) {\n this.options.settings.each($.proxy(function (index, element) {\n var attributeId = element.attributeId;\n\n element.value = this.options.values[attributeId] || '';\n this._configureElement(element);\n }, this));\n }\n },\n\n /**\n * Event handler for configuring an option.\n * @private\n * @param {Object} event - Event triggered to configure an option.\n */\n _configure: function (event) {\n event.data._configureElement(this);\n },\n\n /**\n * Configure an option, initializing it's state and enabling related options, which\n * populates the related option's selection and resets child option selections.\n * @private\n * @param {*} element - The element associated with a configurable option.\n */\n _configureElement: function (element) {\n this.simpleProduct = this._getSimpleProductId(element);\n\n if (element.value) {\n this.options.state[element.config.id] = element.value;\n\n if (element.nextSetting) {\n element.nextSetting.disabled = false;\n this._fillSelect(element.nextSetting);\n this._resetChildren(element.nextSetting);\n } else {\n if (!!document.documentMode) { //eslint-disable-line\n this.inputSimpleProduct.val(element.options[element.selectedIndex].config.allowedProducts[0]);\n } else {\n this.inputSimpleProduct.val(element.selectedOptions[0].config.allowedProducts[0]);\n }\n }\n } else {\n this._resetChildren(element);\n }\n\n this._reloadPrice();\n this._displayRegularPriceBlock(this.simpleProduct);\n this._displayTierPriceBlock(this.simpleProduct);\n this._displayNormalPriceLabel();\n this._changeProductImage();\n },\n\n /**\n * Change displayed product image according to chosen options of configurable product\n *\n * @private\n */\n _changeProductImage: function () {\n var images,\n initialImages = this.options.mediaGalleryInitial,\n gallery = $(this.options.mediaGallerySelector).data('gallery');\n\n if (_.isUndefined(gallery)) {\n $(this.options.mediaGallerySelector).on('gallery:loaded', function () {\n this._changeProductImage();\n }.bind(this));\n\n return;\n }\n\n images = this.options.spConfig.images[this.simpleProduct];\n\n if (images) {\n images = this._sortImages(images);\n\n if (this.options.gallerySwitchStrategy === 'prepend') {\n images = images.concat(initialImages);\n }\n\n images = $.extend(true, [], images);\n images = this._setImageIndex(images);\n\n gallery.updateData(images);\n this._addFotoramaVideoEvents(false);\n } else {\n gallery.updateData(initialImages);\n this._addFotoramaVideoEvents(true);\n }\n },\n\n /**\n * Add video events\n *\n * @param {Boolean} isInitial\n * @private\n */\n _addFotoramaVideoEvents: function (isInitial) {\n if (_.isUndefined($.mage.AddFotoramaVideoEvents)) {\n return;\n }\n\n if (isInitial) {\n $(this.options.mediaGallerySelector).AddFotoramaVideoEvents();\n\n return;\n }\n\n $(this.options.mediaGallerySelector).AddFotoramaVideoEvents({\n selectedOption: this.simpleProduct,\n dataMergeStrategy: this.options.gallerySwitchStrategy\n });\n },\n\n /**\n * Sorting images array\n *\n * @private\n */\n _sortImages: function (images) {\n return _.sortBy(images, function (image) {\n return image.position;\n });\n },\n\n /**\n * Set correct indexes for image set.\n *\n * @param {Array} images\n * @private\n */\n _setImageIndex: function (images) {\n var length = images.length,\n i;\n\n for (i = 0; length > i; i++) {\n images[i].i = i + 1;\n }\n\n return images;\n },\n\n /**\n * For a given option element, reset all of its selectable options. Clear any selected\n * index, disable the option choice, and reset the option's state if necessary.\n * @private\n * @param {*} element - The element associated with a configurable option.\n */\n _resetChildren: function (element) {\n if (element.childSettings) {\n _.each(element.childSettings, function (set) {\n set.selectedIndex = 0;\n set.disabled = true;\n });\n\n if (element.config) {\n this.options.state[element.config.id] = false;\n }\n }\n },\n\n /**\n * Populates an option's selectable choices.\n * @private\n * @param {*} element - Element associated with a configurable option.\n */\n _fillSelect: function (element) {\n var attributeId = element.id.replace(/[a-z]*/, ''),\n options = this._getAttributeOptions(attributeId),\n prevConfig,\n index = 1,\n allowedProducts,\n allowedProductsByOption,\n allowedProductsAll,\n i,\n j,\n finalPrice = parseFloat(this.options.spConfig.prices.finalPrice.amount),\n optionFinalPrice,\n optionPriceDiff,\n optionPrices = this.options.spConfig.optionPrices,\n allowedOptions = [],\n indexKey,\n allowedProductMinPrice,\n allowedProductsAllMinPrice,\n canDisplayOutOfStockProducts = false,\n filteredSalableProducts;\n\n this._clearSelect(element);\n element.options[0] = new Option('', '');\n element.options[0].innerHTML = this.options.spConfig.chooseText;\n prevConfig = false;\n\n if (element.prevSetting) {\n prevConfig = element.prevSetting.options[element.prevSetting.selectedIndex];\n }\n\n if (options) {\n for (indexKey in this.options.spConfig.index) {\n /* eslint-disable max-depth */\n if (this.options.spConfig.index.hasOwnProperty(indexKey)) {\n allowedOptions = allowedOptions.concat(_.values(this.options.spConfig.index[indexKey]));\n }\n }\n\n if (prevConfig) {\n allowedProductsByOption = {};\n allowedProductsAll = [];\n\n for (i = 0; i < options.length; i++) {\n /* eslint-disable max-depth */\n for (j = 0; j < options[i].products.length; j++) {\n // prevConfig.config can be undefined\n if (prevConfig.config &&\n prevConfig.config.allowedProducts &&\n prevConfig.config.allowedProducts.indexOf(options[i].products[j]) > -1) {\n if (!allowedProductsByOption[i]) {\n allowedProductsByOption[i] = [];\n }\n allowedProductsByOption[i].push(options[i].products[j]);\n allowedProductsAll.push(options[i].products[j]);\n }\n }\n }\n\n if (typeof allowedProductsAll[0] !== 'undefined' &&\n typeof optionPrices[allowedProductsAll[0]] !== 'undefined') {\n allowedProductsAllMinPrice = this._getAllowedProductWithMinPrice(allowedProductsAll);\n finalPrice = parseFloat(optionPrices[allowedProductsAllMinPrice].finalPrice.amount);\n }\n }\n\n for (i = 0; i < options.length; i++) {\n if (prevConfig && typeof allowedProductsByOption[i] === 'undefined') {\n continue; //jscs:ignore disallowKeywords\n }\n\n allowedProducts = prevConfig ? allowedProductsByOption[i] : options[i].products.slice(0);\n optionPriceDiff = 0;\n\n if (typeof allowedProducts[0] !== 'undefined' &&\n typeof optionPrices[allowedProducts[0]] !== 'undefined') {\n allowedProductMinPrice = this._getAllowedProductWithMinPrice(allowedProducts);\n optionFinalPrice = parseFloat(optionPrices[allowedProductMinPrice].finalPrice.amount);\n optionPriceDiff = optionFinalPrice - finalPrice;\n options[i].label = options[i].initialLabel;\n\n if (optionPriceDiff !== 0) {\n options[i].label += ' ' + priceUtils.formatPriceLocale(\n optionPriceDiff,\n this.options.priceFormat,\n true\n );\n }\n }\n\n if (allowedProducts.length > 0 || _.include(allowedOptions, options[i].id)) {\n options[i].allowedProducts = allowedProducts;\n element.options[index] = new Option(this._getOptionLabel(options[i]), options[i].id);\n\n if (this.options.spConfig.canDisplayShowOutOfStockStatus) {\n filteredSalableProducts = $(this.options.spConfig.salable[attributeId][options[i].id]).\n filter(options[i].allowedProducts);\n canDisplayOutOfStockProducts = filteredSalableProducts.length === 0;\n }\n\n if (typeof options[i].price !== 'undefined') {\n element.options[index].setAttribute('price', options[i].price);\n }\n\n if (allowedProducts.length === 0 || canDisplayOutOfStockProducts) {\n element.options[index].disabled = true;\n }\n\n element.options[index].config = options[i];\n index++;\n }\n\n /* eslint-enable max-depth */\n }\n }\n },\n\n /**\n * Generate the label associated with a configurable option. This includes the option's\n * label or value and the option's price.\n * @private\n * @param {*} option - A single choice among a group of choices for a configurable option.\n * @return {String} The option label with option value and price (e.g. Black +1.99)\n */\n _getOptionLabel: function (option) {\n return option.label;\n },\n\n /**\n * Removes an option's selections.\n * @private\n * @param {*} element - The element associated with a configurable option.\n */\n _clearSelect: function (element) {\n var i;\n\n for (i = element.options.length - 1; i >= 0; i--) {\n element.remove(i);\n }\n },\n\n /**\n * Retrieve the attribute options associated with a specific attribute Id.\n * @private\n * @param {Number} attributeId - The id of the attribute whose configurable options are sought.\n * @return {Object} Object containing the attribute options.\n */\n _getAttributeOptions: function (attributeId) {\n if (this.options.spConfig.attributes[attributeId]) {\n return this.options.spConfig.attributes[attributeId].options;\n }\n },\n\n /**\n * Reload the price of the configurable product incorporating the prices of all of the\n * configurable product's option selections.\n */\n _reloadPrice: function () {\n $(this.options.priceHolderSelector).trigger('updatePrice', this._getPrices());\n },\n\n /**\n * Get product various prices\n * @returns {{}}\n * @private\n */\n _getPrices: function () {\n var prices = {},\n elements = _.toArray(this.options.settings),\n allowedProduct;\n\n _.each(elements, function (element) {\n var selected = element.options[element.selectedIndex],\n config = selected && selected.config,\n priceValue = this._calculatePrice({});\n\n if (config && config.allowedProducts.length === 1) {\n priceValue = this._calculatePrice(config);\n } else if (element.value) {\n allowedProduct = this._getAllowedProductWithMinPrice(config.allowedProducts);\n priceValue = this._calculatePrice({\n 'allowedProducts': [\n allowedProduct\n ]\n });\n }\n\n if (!_.isEmpty(priceValue)) {\n prices.prices = priceValue;\n }\n }, this);\n\n return prices;\n },\n\n /**\n * Get product with minimum price from selected options.\n *\n * @param {Array} allowedProducts\n * @returns {String}\n * @private\n */\n _getAllowedProductWithMinPrice: function (allowedProducts) {\n var optionPrices = this.options.spConfig.optionPrices,\n product = {},\n optionMinPrice, optionFinalPrice;\n\n _.each(allowedProducts, function (allowedProduct) {\n optionFinalPrice = parseFloat(optionPrices[allowedProduct].finalPrice.amount);\n\n if (_.isEmpty(product) || optionFinalPrice < optionMinPrice) {\n optionMinPrice = optionFinalPrice;\n product = allowedProduct;\n }\n }, this);\n\n return product;\n },\n\n /**\n * Returns prices for configured products\n *\n * @param {*} config - Products configuration\n * @returns {*}\n * @private\n */\n _calculatePrice: function (config) {\n var displayPrices = $(this.options.priceHolderSelector).priceBox('option').prices,\n newPrices = this.options.spConfig.optionPrices[_.first(config.allowedProducts)] || {};\n\n _.each(displayPrices, function (price, code) {\n displayPrices[code].amount = newPrices[code] ? newPrices[code].amount - displayPrices[code].amount : 0;\n });\n\n return displayPrices;\n },\n\n /**\n * Returns Simple product Id\n * depending on current selected option.\n *\n * @private\n * @param {HTMLElement} element\n * @returns {String|undefined}\n */\n _getSimpleProductId: function (element) {\n // TODO: Rewrite algorithm. It should return ID of\n // simple product based on selected options.\n var allOptions = element.config.options,\n value = element.value,\n config;\n\n config = _.filter(allOptions, function (option) {\n return option.id === value;\n });\n config = _.first(config);\n\n return _.isEmpty(config) ?\n undefined :\n _.first(config.allowedProducts);\n\n },\n\n /**\n * Show or hide regular price block\n *\n * @param {*} optionId\n * @private\n */\n _displayRegularPriceBlock: function (optionId) {\n var shouldBeShown = true,\n $priceBox = this.element.parents(this.options.selectorProduct)\n .find(this.options.selectorProductPrice);\n\n _.each(this.options.settings, function (element) {\n if (element.value === '') {\n shouldBeShown = false;\n }\n });\n\n if (shouldBeShown &&\n this.options.spConfig.optionPrices[optionId].oldPrice.amount !==\n this.options.spConfig.optionPrices[optionId].finalPrice.amount\n ) {\n $(this.options.slyOldPriceSelector).show();\n } else {\n $(this.options.slyOldPriceSelector).hide();\n }\n\n $(document).trigger('updateMsrpPriceBlock',\n [\n optionId,\n this.options.spConfig.optionPrices,\n $priceBox\n ]\n );\n },\n\n /**\n * Show or hide normal price label\n *\n * @private\n */\n _displayNormalPriceLabel: function () {\n var shouldBeShown = false;\n\n _.each(this.options.settings, function (element) {\n if (element.value === '') {\n shouldBeShown = true;\n }\n });\n\n if (shouldBeShown) {\n $(this.options.normalPriceLabelSelector).show();\n } else {\n $(this.options.normalPriceLabelSelector).hide();\n }\n },\n\n /**\n * Callback which fired after gallery gets initialized.\n *\n * @param {HTMLElement} element - DOM element associated with gallery.\n */\n _onGalleryLoaded: function (element) {\n var galleryObject = element.data('gallery');\n\n this.options.mediaGalleryInitial = galleryObject.returnCurrentImages();\n },\n\n /**\n * Show or hide tier price block\n *\n * @param {*} optionId\n * @private\n */\n _displayTierPriceBlock: function (optionId) {\n var tierPrices = typeof optionId != 'undefined' && this.options.spConfig.optionPrices[optionId].tierPrices;\n\n if (_.isArray(tierPrices) && tierPrices.length > 0) {\n\n if (this.options.tierPriceTemplate) {\n $(this.options.tierPriceBlockSelector).html(\n mageTemplate(this.options.tierPriceTemplate, {\n 'tierPrices': tierPrices,\n '$t': $t,\n 'currencyFormat': this.options.spConfig.currencyFormat,\n 'priceUtils': priceUtils\n })\n ).show();\n }\n } else {\n $(this.options.tierPriceBlockSelector).hide();\n }\n }\n });\n\n return $.mage.configurable;\n});\n","Magento_ConfigurableProduct/js/catalog-add-to-cart.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\nrequire([\n 'jquery'\n], function ($) {\n 'use strict';\n\n /**\n * Add selected configurable attributes to redirect url\n *\n * @see Magento_Catalog/js/catalog-add-to-cart\n */\n $('body').on('catalogCategoryAddToCartRedirect', function (event, data) {\n $(data.form).find('select[name*=\"super\"]').each(function (index, item) {\n data.redirectParameters.push(item.config.id + '=' + $(item).val());\n });\n });\n});\n","Magento_ConfigurableProduct/js/catalog-add-to-cart-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'jquery',\n 'Magento_ConfigurableProduct/js/product/view/product-info-resolver'\n], function (_, $, productInfoResolver) {\n 'use strict';\n\n return function (widget) {\n\n $.widget('mage.catalogAddToCart', widget, {\n /**\n * @param {jQuery} form\n */\n ajaxSubmit: function (form) {\n var isConfigurable = !!_.find(form.serializeArray(), function (item) {\n return item.name.indexOf('super_attribute') !== -1;\n });\n\n if (isConfigurable) {\n this.options.productInfoResolver = productInfoResolver;\n }\n\n return this._super(form);\n }\n });\n\n return $.mage.catalogAddToCart;\n };\n});\n","Magento_ConfigurableProduct/js/configurable-customer-data.js":"require([\n 'jquery',\n 'Magento_ConfigurableProduct/js/options-updater'\n], function ($, Updater) {\n 'use strict';\n\n var selectors = {\n formSelector: '#product_addtocart_form'\n },\n configurableWidgetName = 'mageConfigurable',\n widgetInitEvent = 'configurable.initialized',\n\n /**\n * Sets all configurable attribute's selected values\n */\n updateConfigurableOptions = function () {\n var configurableWidget = $(selectors.formSelector).data(configurableWidgetName);\n\n if (!configurableWidget) {\n return;\n }\n configurableWidget.options.values = this.productOptions || {};\n configurableWidget._configureForValues();\n },\n updater = new Updater(widgetInitEvent, updateConfigurableOptions);\n\n updater.listen();\n});\n","Magento_ConfigurableProduct/js/options-updater.js":"define([\n 'jquery',\n 'underscore',\n 'Magento_Customer/js/customer-data',\n 'domReady!'\n], function ($, _, customerData) {\n 'use strict';\n\n var selectors = {\n formSelector: '#product_addtocart_form',\n productIdSelector: '#product_addtocart_form [name=\"product\"]',\n itemIdSelector: '#product_addtocart_form [name=\"item\"]'\n },\n cartData = customerData.get('cart'),\n productId = $(selectors.productIdSelector).val(),\n itemId = $(selectors.itemIdSelector).val(),\n\n /**\n * set productOptions according to cart data from customer-data\n *\n * @param {Object} data - cart data from customer-data\n * @returns {Boolean} - whether the new options differ from previous\n */\n setProductOptions = function (data) {\n var changedProductOptions;\n\n if (!(data && data.items && data.items.length && productId)) {\n return false;\n }\n changedProductOptions = _.find(data.items, function (item) {\n if (item['item_id'] === itemId) {\n return item['product_id'] === productId;\n }\n });\n changedProductOptions = changedProductOptions && changedProductOptions.options &&\n changedProductOptions.options.reduce(function (obj, val) {\n obj[val['option_id']] = val['option_value'];\n\n return obj;\n }, {});\n\n if (JSON.stringify(this.productOptions || {}) === JSON.stringify(changedProductOptions || {})) {\n return false;\n }\n\n this.productOptions = changedProductOptions;\n\n return true;\n },\n\n /**\n * Listens to update of cart data or options initialization and update selected option according to customer data\n *\n */\n listen = function () {\n cartData.subscribe(function (updateCartData) {\n if (this.setProductOptions(updateCartData)) {\n this.updateOptions();\n }\n }.bind(this));\n $(selectors.formSelector).on(this.eventName, function () {\n this.setProductOptions(cartData());\n this.updateOptions();\n }.bind(this));\n },\n\n /**\n * Updater constructor function\n *\n */\n Updater = function (eventName, updateOptionsCallback) {\n if (this instanceof Updater) {\n this.eventName = eventName;\n this.updateOptions = updateOptionsCallback;\n this.productOptions = {};\n }\n };\n\n Updater.prototype.setProductOptions = setProductOptions;\n Updater.prototype.listen = listen;\n\n return Updater;\n});\n","Magento_ConfigurableProduct/js/product/view/product-info-resolver.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'underscore',\n 'Magento_Catalog/js/product/view/product-info'\n], function (_, productInfo) {\n 'use strict';\n\n /**\n * Returns info about configurable products in form.\n *\n * @param {jQuery} $form\n * @return {Array}\n */\n return function ($form) {\n var optionValues = [],\n product = _.findWhere($form.serializeArray(), {\n name: 'product'\n }),\n productId;\n\n if (!_.isUndefined(product)) {\n productId = product.value;\n _.each($form.serializeArray(), function (item) {\n if (item.name.indexOf('super_attribute') !== -1) {\n optionValues.push(item.value);\n }\n });\n optionValues.sort();\n productInfo().push(\n {\n 'id': productId,\n 'optionValues': optionValues\n }\n );\n }\n\n return _.uniq(productInfo(), function (item) {\n var optionValuesStr = item.optionValues ? item.optionValues.join() : '';\n\n return item.id + optionValuesStr;\n });\n };\n});\n\n","Magento_CatalogSearch/js/search-terms-log.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mageUtils'\n], function ($, utils) {\n 'use strict';\n\n return function (data) {\n $.ajax({\n method: 'GET',\n url: data.url,\n data: {\n 'q': utils.getUrlParameters(window.location.href).q\n }\n });\n };\n});\n","Magento_Shipping/js/view/checkout/shipping/shipping-policy.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Shipping/js/model/config'\n\n], function (Component, config) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_Shipping/checkout/shipping/shipping-policy'\n },\n config: config()\n });\n});\n","Magento_Shipping/js/model/config.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return function () {\n return window.checkoutConfig.shippingPolicy;\n };\n});\n","Magento_Search/js/form-mini.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'jquery',\n 'underscore',\n 'mage/template',\n 'matchMedia',\n 'jquery-ui-modules/widget',\n 'jquery-ui-modules/core',\n 'mage/translate'\n], function ($, _, mageTemplate, mediaCheck) {\n 'use strict';\n\n /**\n * Check whether the incoming string is not empty or if doesn't consist of spaces.\n *\n * @param {String} value - Value to check.\n * @returns {Boolean}\n */\n function isEmpty(value) {\n return value.length === 0 || value == null || /^\\s+$/.test(value);\n }\n\n $.widget('mage.quickSearch', {\n options: {\n autocomplete: 'off',\n minSearchLength: 3,\n responseFieldElements: 'ul li',\n selectClass: 'selected',\n template:\n '<li class=\"<%- data.row_class %>\" id=\"qs-option-<%- data.index %>\" role=\"option\">' +\n '<span class=\"qs-option-name\">' +\n ' <%- data.title %>' +\n '</span>' +\n '<span aria-hidden=\"true\" class=\"amount\">' +\n '<%- data.num_results %>' +\n '</span>' +\n '</li>',\n submitBtn: 'button[type=\"submit\"]',\n searchLabel: '[data-role=minisearch-label]',\n isExpandable: null,\n suggestionDelay: 300\n },\n\n /** @inheritdoc */\n _create: function () {\n this.responseList = {\n indexList: null,\n selected: null\n };\n this.autoComplete = $(this.options.destinationSelector);\n this.searchForm = $(this.options.formSelector);\n this.submitBtn = this.searchForm.find(this.options.submitBtn)[0];\n this.searchLabel = this.searchForm.find(this.options.searchLabel);\n this.isExpandable = this.options.isExpandable;\n\n _.bindAll(this, '_onKeyDown', '_onPropertyChange', '_onSubmit');\n\n this.submitBtn.disabled = true;\n\n this.element.attr('autocomplete', this.options.autocomplete);\n\n mediaCheck({\n media: '(max-width: 768px)',\n entry: function () {\n this.isExpandable = true;\n }.bind(this),\n exit: function () {\n this.isExpandable = true;\n }.bind(this)\n });\n\n this.searchLabel.on('click', function (e) {\n // allow input to lose its' focus when clicking on label\n if (this.isExpandable && this.isActive()) {\n e.preventDefault();\n }\n }.bind(this));\n\n this.element.on('blur', $.proxy(function () {\n if (!this.searchLabel.hasClass('active')) {\n return;\n }\n\n setTimeout($.proxy(function () {\n if (this.autoComplete.is(':hidden')) {\n this.setActiveState(false);\n } else {\n this.element.trigger('focus');\n }\n this.autoComplete.hide();\n this._updateAriaHasPopup(false);\n }, this), 250);\n }, this));\n\n if (this.element.get(0) === document.activeElement) {\n this.setActiveState(true);\n }\n\n this.element.on('focus', this.setActiveState.bind(this, true));\n this.element.on('keydown', this._onKeyDown);\n // Prevent spamming the server with requests by waiting till the user has stopped typing for period of time\n this.element.on('input propertychange', _.debounce(this._onPropertyChange, this.options.suggestionDelay));\n\n this.searchForm.on('submit', $.proxy(function (e) {\n this._onSubmit(e);\n this._updateAriaHasPopup(false);\n }, this));\n },\n\n /**\n * Checks if search field is active.\n *\n * @returns {Boolean}\n */\n isActive: function () {\n return this.searchLabel.hasClass('active');\n },\n\n /**\n * Sets state of the search field to provided value.\n *\n * @param {Boolean} isActive\n */\n setActiveState: function (isActive) {\n var searchValue;\n\n this.searchForm.toggleClass('active', isActive);\n this.searchLabel.toggleClass('active', isActive);\n\n if (this.isExpandable) {\n this.element.attr('aria-expanded', isActive);\n searchValue = this.element.val();\n this.element.val('');\n this.element.val(searchValue);\n }\n },\n\n /**\n * @private\n * @return {Element} The first element in the suggestion list.\n */\n _getFirstVisibleElement: function () {\n return this.responseList.indexList ? this.responseList.indexList.first() : false;\n },\n\n /**\n * @private\n * @return {Element} The last element in the suggestion list.\n */\n _getLastElement: function () {\n return this.responseList.indexList ? this.responseList.indexList.last() : false;\n },\n\n /**\n * @private\n * @param {Boolean} show - Set attribute aria-haspopup to \"true/false\" for element.\n */\n _updateAriaHasPopup: function (show) {\n if (show) {\n this.element.attr('aria-haspopup', 'true');\n } else {\n this.element.attr('aria-haspopup', 'false');\n }\n },\n\n /**\n * Clears the item selected from the suggestion list and resets the suggestion list.\n * @private\n * @param {Boolean} all - Controls whether to clear the suggestion list.\n */\n _resetResponseList: function (all) {\n this.responseList.selected = null;\n\n if (all === true) {\n this.responseList.indexList = null;\n }\n },\n\n /**\n * Executes when the search box is submitted. Sets the search input field to the\n * value of the selected item.\n * @private\n * @param {Event} e - The submit event\n */\n _onSubmit: function (e) {\n var value = this.element.val();\n\n if (isEmpty(value)) {\n e.preventDefault();\n }\n\n if (this.responseList.selected) {\n this.element.val(this.responseList.selected.find('.qs-option-name').text());\n }\n },\n\n /**\n * Executes when keys are pressed in the search input field. Performs specific actions\n * depending on which keys are pressed.\n * @private\n * @param {Event} e - The key down event\n * @return {Boolean} Default return type for any unhandled keys\n */\n _onKeyDown: function (e) {\n var keyCode = e.keyCode || e.which;\n\n switch (keyCode) {\n case $.ui.keyCode.HOME:\n if (this._getFirstVisibleElement()) {\n this._getFirstVisibleElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getFirstVisibleElement();\n }\n break;\n\n case $.ui.keyCode.END:\n if (this._getLastElement()) {\n this._getLastElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getLastElement();\n }\n break;\n\n case $.ui.keyCode.ESCAPE:\n this._resetResponseList(true);\n this.autoComplete.hide();\n break;\n\n case $.ui.keyCode.ENTER:\n if (this.element.val().length >= parseInt(this.options.minSearchLength, 10)) {\n this.searchForm.trigger('submit');\n e.preventDefault();\n }\n break;\n\n case $.ui.keyCode.DOWN:\n if (this.responseList.indexList) {\n if (!this.responseList.selected) { //eslint-disable-line max-depth\n this._getFirstVisibleElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getFirstVisibleElement();\n } else if (!this._getLastElement().hasClass(this.options.selectClass)) {\n this.responseList.selected = this.responseList.selected\n .removeClass(this.options.selectClass).next().addClass(this.options.selectClass);\n } else {\n this.responseList.selected.removeClass(this.options.selectClass);\n this._getFirstVisibleElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getFirstVisibleElement();\n }\n this.element.val(this.responseList.selected.find('.qs-option-name').text());\n this.element.attr('aria-activedescendant', this.responseList.selected.attr('id'));\n this._updateAriaHasPopup(true);\n this.autoComplete.show();\n }\n break;\n\n case $.ui.keyCode.UP:\n if (this.responseList.indexList !== null) {\n if (!this._getFirstVisibleElement().hasClass(this.options.selectClass)) {\n this.responseList.selected = this.responseList.selected\n .removeClass(this.options.selectClass).prev().addClass(this.options.selectClass);\n\n } else {\n this.responseList.selected.removeClass(this.options.selectClass);\n this._getLastElement().addClass(this.options.selectClass);\n this.responseList.selected = this._getLastElement();\n }\n this.element.val(this.responseList.selected.find('.qs-option-name').text());\n this.element.attr('aria-activedescendant', this.responseList.selected.attr('id'));\n this._updateAriaHasPopup(true);\n this.autoComplete.show();\n }\n break;\n default:\n return true;\n }\n },\n\n /**\n * Executes when the value of the search input field changes. Executes a GET request\n * to populate a suggestion list based on entered text. Handles click (select), hover,\n * and mouseout events on the populated suggestion list dropdown.\n * @private\n */\n _onPropertyChange: function () {\n var searchField = this.element,\n clonePosition = {\n position: 'absolute',\n // Removed to fix display issues\n // left: searchField.offset().left,\n // top: searchField.offset().top + searchField.outerHeight(),\n width: searchField.outerWidth()\n },\n source = this.options.template,\n template = mageTemplate(source),\n dropdown = $('<ul role=\"listbox\"></ul>'),\n value = this.element.val();\n\n this.submitBtn.disabled = true;\n\n if (value.length >= parseInt(this.options.minSearchLength, 10)) {\n this.submitBtn.disabled = false;\n\n if (this.options.url !== '') { //eslint-disable-line eqeqeq\n $.getJSON(this.options.url, {\n q: value\n }, $.proxy(function (data) {\n if (data.length) {\n $.each(data, function (index, element) {\n var html;\n\n element.index = index;\n html = template({\n data: element\n });\n dropdown.append(html);\n });\n\n this._resetResponseList(true);\n\n this.responseList.indexList = this.autoComplete.html(dropdown)\n .css(clonePosition)\n .show()\n .find(this.options.responseFieldElements + ':visible');\n\n this.element.removeAttr('aria-activedescendant');\n\n if (this.responseList.indexList.length) {\n this._updateAriaHasPopup(true);\n } else {\n this._updateAriaHasPopup(false);\n }\n\n this.responseList.indexList\n .on('click', function (e) {\n this.responseList.selected = $(e.currentTarget);\n this.searchForm.trigger('submit');\n }.bind(this))\n .on('mouseenter mouseleave', function (e) {\n this.responseList.indexList.removeClass(this.options.selectClass);\n $(e.target).addClass(this.options.selectClass);\n this.responseList.selected = $(e.target);\n this.element.attr('aria-activedescendant', $(e.target).attr('id'));\n }.bind(this))\n .on('mouseout', function (e) {\n if (!this._getLastElement() &&\n this._getLastElement().hasClass(this.options.selectClass)) {\n $(e.target).removeClass(this.options.selectClass);\n this._resetResponseList(false);\n }\n }.bind(this));\n } else {\n this._resetResponseList(true);\n this.autoComplete.hide();\n this._updateAriaHasPopup(false);\n this.element.removeAttr('aria-activedescendant');\n }\n }, this));\n }\n } else {\n this._resetResponseList(true);\n this.autoComplete.hide();\n this._updateAriaHasPopup(false);\n this.element.removeAttr('aria-activedescendant');\n }\n }\n });\n\n return $.mage.quickSearch;\n});\n","Magento_Vault/js/view/payment/vault.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/*browser:true*/\n\n/* @api */\ndefine([\n 'underscore',\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/renderer-list',\n 'uiLayout',\n 'uiRegistry'\n], function (_, Component, rendererList, layout, registry) {\n 'use strict';\n\n var vaultGroupName = 'vaultGroup';\n\n layout([{\n name: vaultGroupName,\n component: 'Magento_Checkout/js/model/payment/method-group',\n alias: 'vault',\n sortOrder: 10\n }]);\n\n registry.get(vaultGroupName, function (vaultGroup) {\n _.each(window.checkoutConfig.payment.vault, function (config, index) {\n rendererList.push(\n {\n type: index,\n config: config.config,\n component: config.component,\n group: vaultGroup,\n\n /**\n * Custom payment method types comparator\n * @param {String} typeA\n * @param {String} typeB\n * @return {Boolean}\n */\n typeComparatorCallback: function (typeA, typeB) {\n // vault token items have the same name as vault payment without index\n return typeA.substring(0, typeA.lastIndexOf('_')) === typeB;\n }\n }\n );\n });\n });\n\n /**\n * Add view logic here if needed\n */\n return Component.extend({});\n});\n","Magento_Vault/js/view/payment/vault-enabler.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/*browser:true*/\n\n/* @api */\ndefine(\n [\n 'uiElement'\n ],\n function (\n Component\n ) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n isActivePaymentTokenEnabler: true\n },\n\n /**\n * @param {String} paymentCode\n */\n setPaymentCode: function (paymentCode) {\n this.paymentCode = paymentCode;\n },\n\n /**\n * @returns {Object}\n */\n initObservable: function () {\n this._super()\n .observe([\n 'isActivePaymentTokenEnabler'\n ]);\n\n return this;\n },\n\n /**\n * @param {Object} data\n */\n visitAdditionalData: function (data) {\n if (!this.isVaultEnabled()) {\n return;\n }\n\n if (!('additional_data' in data)) {\n data['additional_data'] = {};\n }\n\n data['additional_data']['is_active_payment_token_enabler'] = this.isActivePaymentTokenEnabler();\n },\n\n /**\n * @returns {Boolean}\n */\n isVaultEnabled: function () {\n return typeof window.checkoutConfig.vault[this.paymentCode] !== 'undefined' &&\n window.checkoutConfig.vault[this.paymentCode]['is_enabled'] === true;\n }\n });\n }\n);\n","Magento_Vault/js/view/payment/method-renderer/vault.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n/*browser:true*/\n\ndefine(\n [\n 'Magento_Checkout/js/view/payment/default',\n 'Magento_Checkout/js/action/select-payment-method',\n 'Magento_Checkout/js/checkout-data'\n ],\n function (Component, selectPaymentMethod, checkoutData) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_Vault/payment/form'\n },\n\n /**\n * @returns {exports.initObservable}\n */\n initObservable: function () {\n this._super()\n .observe([]);\n\n return this;\n },\n\n /**\n * @returns\n */\n selectPaymentMethod: function () {\n selectPaymentMethod(\n {\n method: this.getId()\n }\n );\n checkoutData.setSelectedPaymentMethod(this.getId());\n\n return true;\n },\n\n /**\n * @returns {String}\n */\n getTitle: function () {\n return '';\n },\n\n /**\n * @returns {String}\n */\n getToken: function () {\n return '';\n },\n\n /**\n * @returns {String}\n */\n getId: function () {\n return this.index;\n },\n\n /**\n * @returns {String}\n */\n getCode: function () {\n return this.code;\n },\n\n /**\n * Get last 4 digits of card\n * @returns {String}\n */\n getMaskedCard: function () {\n return '';\n },\n\n /**\n * Get expiration date\n * @returns {String}\n */\n getExpirationDate: function () {\n return '';\n },\n\n /**\n * Get card type\n * @returns {String}\n */\n getCardType: function () {\n return '';\n },\n\n /**\n * @param {String} type\n * @returns {Boolean}\n */\n getIcons: function (type) {\n return window.checkoutConfig.payment.ccform.icons.hasOwnProperty(type) ?\n window.checkoutConfig.payment.ccform.icons[type]\n : false;\n },\n\n /**\n * Return state of place order button.\n *\n * @return {Boolean}\n */\n isButtonActive: function () {\n return this.isActive() && this.isPlaceOrderActionAllowed();\n },\n\n /**\n * Check if payment is active.\n *\n * @return {Boolean}\n */\n isActive: function () {\n return this.isChecked() === this.getId();\n },\n\n /**\n * @returns {*}\n */\n getData: function () {\n var data = {\n method: this.getCode()\n };\n\n data['additional_data'] = {};\n data['additional_data']['public_hash'] = this.getToken();\n\n return data;\n }\n });\n }\n);\n","Magento_Vault/js/customer_account/deleteWidget.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'jquery',\n 'Magento_Ui/js/modal/modalToggle',\n 'mage/translate'\n], function ($, modalToggle) {\n 'use strict';\n\n return function (config, deleteButton) {\n config.buttons = [\n {\n text: $.mage.__('Cancel'),\n class: 'action secondary cancel'\n }, {\n text: $.mage.__('Delete'),\n class: 'action primary',\n\n /**\n * Default action on button click\n */\n click: function (event) { //eslint-disable-line no-unused-vars\n $(deleteButton.form).trigger('submit');\n }\n }\n ];\n\n modalToggle(config, deleteButton);\n };\n});\n","Magento_GiftMessage/js/gift-options.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'jquery-ui-modules/widget'\n], function ($) {\n 'use strict';\n\n $.widget('mage.giftOptions', {\n options: {\n mageError: 'mage-error',\n noDisplay: 'no-display',\n requiredEntry: 'required-entry'\n },\n\n /**\n * Initial toggle of the various gift options after widget instantiation.\n * @private\n */\n _init: function () {\n this._toggleVisibility();\n },\n\n /**\n * Bind a click handler to the widget's context element.\n * @private\n */\n _create: function () {\n this.element.on('click', $.proxy(this._toggleVisibility, this));\n $(this.element.data('selector').id).find('.giftmessage-area')\n .on('change', $.proxy(this._toggleRequired, this));\n },\n\n /**\n * Toggle the visibility of the widget's context element's selector(s).\n * @private\n * @param {jQuery.Event} event - Click event. Target is a checkbox.\n */\n _toggleVisibility: function (event) {\n var checkbox = event ? $(event.target) : this.element,\n container = $(checkbox.data('selector').id),\n _this;\n\n if (checkbox.is(':checked')) {\n container.show()\n .find('.giftmessage-area:not(:visible)').each(function (x, element) {\n if ($(element).val().length > 0) {\n $(element).trigger('change');\n container.find('a').trigger('click');\n }\n });\n } else {\n _this = this;\n container.hide()\n .find('.input-text:not(.giftmessage-area)').each(function (x, element) {\n $(element).val(element.defaultValue).removeClass(_this.options.mageError)\n .next('div.' + _this.options.mageError).remove();\n }).end()\n .find('.giftmessage-area').val('').change().end()\n .find('.select').val('').change().end()\n .find('.checkbox:checked').prop('checked', false).trigger('click').prop('checked', false).end()\n .find('.price-box').addClass(this.options.noDisplay).end();\n }\n },\n\n /**\n * Make the From and To input fields required if a gift message has been written.\n * @private\n * @param {jQuery.Event} event - Change event. Target is a textarea.\n */\n _toggleRequired: function (event) {\n var textArea = $(event.target),\n length = textArea.val().length;\n\n textArea.closest('li').prev('.fields')\n .find('.input-text').toggleClass(this.options.requiredEntry, length > 0);\n }\n });\n\n return $.mage.giftOptions;\n});\n","Magento_GiftMessage/js/view/gift-message.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_GiftMessage/js/model/gift-message',\n 'Magento_GiftMessage/js/model/gift-options',\n 'Magento_GiftMessage/js/action/gift-options'\n], function (Component, GiftMessage, giftOptions, giftOptionsService) {\n 'use strict';\n\n return Component.extend({\n formBlockVisibility: null,\n resultBlockVisibility: null,\n model: {},\n\n /**\n * Component init\n */\n initialize: function () {\n var self = this,\n model;\n\n this._super()\n .observe('formBlockVisibility')\n .observe({\n 'resultBlockVisibility': false\n });\n\n this.itemId = this.itemId || 'orderLevel';\n model = new GiftMessage(this.itemId);\n this.model = model;\n this.isResultBlockVisible();\n giftOptions.addOption(model);\n\n this.model.getObservable('isClear').subscribe(function (value) {\n if (value == true) { //eslint-disable-line eqeqeq\n self.formBlockVisibility(false);\n self.model.getObservable('alreadyAdded')(true);\n }\n });\n },\n\n /**\n * Is reslt block visible\n */\n isResultBlockVisible: function () {\n var self = this;\n\n if (this.model.getObservable('alreadyAdded')()) {\n this.resultBlockVisibility(true);\n }\n this.model.getObservable('additionalOptionsApplied').subscribe(function (value) {\n if (value == true) { //eslint-disable-line eqeqeq\n self.resultBlockVisibility(true);\n }\n });\n },\n\n /**\n * @param {String} key\n * @return {*}\n */\n getObservable: function (key) {\n return this.model.getObservable(key);\n },\n\n /**\n * Hide\\Show form block\n */\n toggleFormBlockVisibility: function () {\n if (!this.model.getObservable('alreadyAdded')()) {\n this.formBlockVisibility(!this.formBlockVisibility());\n } else {\n this.resultBlockVisibility(!this.resultBlockVisibility());\n }\n },\n\n /**\n * Edit options\n */\n editOptions: function () {\n this.resultBlockVisibility(false);\n this.formBlockVisibility(true);\n },\n\n /**\n * Delete options\n */\n deleteOptions: function () {\n giftOptionsService(this.model, true);\n },\n\n /**\n * Hide form block\n */\n hideFormBlock: function () {\n this.formBlockVisibility(false);\n\n if (this.model.getObservable('alreadyAdded')()) {\n this.resultBlockVisibility(true);\n }\n },\n\n /**\n * @return {Boolean}\n */\n hasActiveOptions: function () {\n var regionData = this.getRegion('additionalOptions'),\n options = regionData(),\n i;\n\n for (i = 0; i < options.length; i++) {\n if (options[i].isActive()) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * @return {Boolean}\n */\n isActive: function () {\n return this.model.isGiftMessageAvailable();\n },\n\n /**\n * Submit options\n */\n submitOptions: function () {\n giftOptionsService(this.model);\n }\n });\n});\n","Magento_GiftMessage/js/action/gift-options.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'Magento_GiftMessage/js/model/url-builder',\n 'mage/storage',\n 'Magento_Ui/js/model/messageList',\n 'Magento_Checkout/js/model/error-processor',\n 'mage/url',\n 'Magento_Checkout/js/model/quote',\n 'underscore'\n], function (urlBuilder, storage, messageList, errorProcessor, url, quote, _) {\n 'use strict';\n\n return function (giftMessage, remove) {\n var serviceUrl;\n\n url.setBaseUrl(giftMessage.getConfigValue('baseUrl'));\n\n if (giftMessage.getConfigValue('isCustomerLoggedIn')) {\n serviceUrl = urlBuilder.createUrl('/carts/mine/gift-message', {});\n\n if (giftMessage.itemId != 'orderLevel') { //eslint-disable-line eqeqeq\n serviceUrl = urlBuilder.createUrl('/carts/mine/gift-message/:itemId', {\n itemId: giftMessage.itemId\n });\n }\n } else {\n serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/gift-message', {\n cartId: quote.getQuoteId()\n });\n\n if (giftMessage.itemId != 'orderLevel') { //eslint-disable-line eqeqeq\n serviceUrl = urlBuilder.createUrl(\n '/guest-carts/:cartId/gift-message/:itemId',\n {\n cartId: quote.getQuoteId(), itemId: giftMessage.itemId\n }\n );\n }\n }\n messageList.clear();\n\n storage.post(\n serviceUrl,\n JSON.stringify({\n 'gift_message': giftMessage.getSubmitParams(remove)\n })\n ).done(function () {\n giftMessage.reset();\n _.each(giftMessage.getAfterSubmitCallbacks(), function (callback) {\n if (_.isFunction(callback)) {\n callback();\n }\n });\n }).fail(function (response) {\n errorProcessor.process(response);\n });\n };\n});\n","Magento_GiftMessage/js/model/gift-message.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'uiElement',\n 'underscore',\n 'mage/url'\n], function (uiElement, _, url) {\n 'use strict';\n\n var provider = uiElement();\n\n return function (itemId) {\n var model = {\n id: 'message-' + itemId,\n itemId: itemId,\n observables: {},\n additionalOptions: [],\n submitParams: [\n 'recipient',\n 'sender',\n 'message'\n ],\n\n /**\n * Initialize.\n */\n initialize: function () {\n var message = false;\n\n this.getObservable('alreadyAdded')(false);\n\n if (this.itemId == 'orderLevel') { //eslint-disable-line eqeqeq\n message = window.giftOptionsConfig.giftMessage.hasOwnProperty(this.itemId) ?\n window.giftOptionsConfig.giftMessage[this.itemId] :\n null;\n } else {\n message =\n window.giftOptionsConfig.giftMessage.hasOwnProperty('itemLevel') &&\n window.giftOptionsConfig.giftMessage.itemLevel.hasOwnProperty(this.itemId) ?\n window.giftOptionsConfig.giftMessage.itemLevel[this.itemId].message :\n null;\n }\n\n if (_.isObject(message)) {\n this.getObservable('recipient')(message.recipient);\n this.getObservable('sender')(message.sender);\n this.getObservable('message')(message.message);\n this.getObservable('alreadyAdded')(true);\n }\n },\n\n /**\n * @param {String} key\n * @return {*}\n */\n getObservable: function (key) {\n this.initObservable(this.id, key);\n\n return provider[this.getUniqueKey(this.id, key)];\n },\n\n /**\n * @param {String} node\n * @param {String} key\n */\n initObservable: function (node, key) {\n if (node && !this.observables.hasOwnProperty(node)) {\n this.observables[node] = [];\n }\n\n if (key && this.observables[node].indexOf(key) === -1) {\n this.observables[node].push(key);\n provider.observe(this.getUniqueKey(node, key));\n }\n },\n\n /**\n * @param {String} node\n * @param {String} key\n * @return {String}\n */\n getUniqueKey: function (node, key) {\n return node + '-' + key;\n },\n\n /**\n * @param {String} key\n * @return {null}\n */\n getConfigValue: function (key) {\n return window.giftOptionsConfig.hasOwnProperty(key) ?\n window.giftOptionsConfig[key]\n : null;\n },\n\n /**\n * Reset.\n */\n reset: function () {\n this.getObservable('isClear')(true);\n },\n\n /**\n * @return {Array}\n */\n getAfterSubmitCallbacks: function () {\n var callbacks = [];\n\n callbacks.push(this.afterSubmit);\n _.each(this.additionalOptions, function (option) {\n if (_.isFunction(option.afterSubmit)) {\n callbacks.push(option.afterSubmit);\n }\n });\n\n return callbacks;\n },\n\n /**\n * After submit.\n */\n afterSubmit: function () {\n window.location.href = url.build('checkout/cart/updatePost') +\n '?form_key=' + window.checkoutConfig.formKey +\n '&cart[]';\n },\n\n /**\n * @param {Boolean} remove\n * @return {Object}\n */\n getSubmitParams: function (remove) {\n var params = {},\n self = this;\n\n _.each(this.submitParams, function (key) {\n var observable = provider[self.getUniqueKey(self.id, key)];\n\n if (_.isFunction(observable)) {\n params[key] = remove ? null : observable();\n }\n });\n\n if (this.additionalOptions.length) {\n params['extension_attributes'] = {};\n }\n _.each(this.additionalOptions, function (option) {\n if (_.isFunction(option.getSubmitParams)) {\n params['extension_attributes'] = _.extend(\n params['extension_attributes'],\n option.getSubmitParams(remove)\n );\n }\n });\n\n return params;\n },\n\n /**\n * Check if gift message can be displayed\n *\n * @returns {Boolean}\n */\n isGiftMessageAvailable: function () {\n var isGloballyAvailable,\n giftMessageConfig,\n itemConfig;\n\n // itemId represent gift message level: 'orderLevel' constant or cart item ID\n if (this.itemId === 'orderLevel') {\n return this.getConfigValue('isOrderLevelGiftOptionsEnabled');\n }\n\n // gift message product configuration must override system configuration\n isGloballyAvailable = this.getConfigValue('isItemLevelGiftOptionsEnabled');\n giftMessageConfig = window.giftOptionsConfig.giftMessage;\n itemConfig = giftMessageConfig.hasOwnProperty('itemLevel') &&\n giftMessageConfig.itemLevel.hasOwnProperty(this.itemId) ?\n giftMessageConfig.itemLevel[this.itemId] :\n {};\n\n return itemConfig.hasOwnProperty('is_available') ? itemConfig['is_available'] : isGloballyAvailable;\n }\n };\n\n model.initialize();\n\n return model;\n };\n});\n","Magento_GiftMessage/js/model/gift-options.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/**\n * @api\n */\ndefine([\n 'underscore',\n 'ko'\n], function (_, ko) {\n 'use strict';\n\n return {\n options: ko.observableArray([]),\n\n /**\n * @param {Object} option\n */\n addOption: function (option) {\n if (!this.options().hasOwnProperty(option.itemId)) {\n this.options.push({\n id: option.itemId, value: option\n }\n );\n }\n },\n\n /**\n * @param {*} itemId\n * @return {*}\n */\n getOptionByItemId: function (itemId) {\n var option = null;\n\n _.each(this.options(), function (data) {\n if (data.id === itemId) {\n option = data.value;\n\n return false;\n }\n });\n\n return option;\n }\n };\n});\n","Magento_GiftMessage/js/model/url-builder.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Checkout/js/model/url-builder'\n], function ($, urlBuilder) {\n 'use strict';\n\n return $.extend(urlBuilder, {\n storeCode: window.giftOptionsConfig.storeCode\n });\n});\n","Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* global grecaptcha */\ndefine([\n 'jquery',\n 'jquery/z-index'\n], function ($) {\n 'use strict';\n\n var reCaptchaEntities = [],\n initialized = false,\n rendererRecaptchaId = 'recaptcha-invisible',\n rendererReCaptcha = null;\n\n return {\n /**\n * Add reCaptcha entity to checklist.\n *\n * @param {jQuery} reCaptchaEntity\n * @param {Object} parameters\n */\n add: function (reCaptchaEntity, parameters) {\n if (!initialized) {\n this.init();\n grecaptcha.render(rendererRecaptchaId, parameters);\n setInterval(this.resolveVisibility, 100);\n initialized = true;\n }\n\n reCaptchaEntities.push(reCaptchaEntity);\n },\n\n /**\n * Show additional reCaptcha instance if any other should be visible, otherwise hide it.\n */\n resolveVisibility: function () {\n reCaptchaEntities.some(function (entity) {\n return entity.is(':visible') &&\n // 900 is some magic z-index value of modal popups.\n (entity.closest('[data-role=\\'modal\\']').length === 0 || entity.zIndex() > 900);\n }) ? rendererReCaptcha.show() : rendererReCaptcha.hide();\n },\n\n /**\n * Initialize additional reCaptcha instance.\n */\n init: function () {\n rendererReCaptcha = $('<div/>', {\n 'id': rendererRecaptchaId\n });\n rendererReCaptcha.hide();\n $('body').append(rendererReCaptcha);\n }\n };\n});\n","Magento_ReCaptchaFrontendUi/js/reCaptcha.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n/* global grecaptcha */\ndefine(\n [\n 'uiComponent',\n 'jquery',\n 'ko',\n 'underscore',\n 'Magento_ReCaptchaFrontendUi/js/registry',\n 'Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader',\n 'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer'\n ], function (Component, $, ko, _, registry, reCaptchaLoader, nonInlineReCaptchaRenderer) {\n 'use strict';\n\n return Component.extend({\n\n defaults: {\n template: 'Magento_ReCaptchaFrontendUi/reCaptcha',\n reCaptchaId: 'recaptcha'\n },\n\n /**\n * @inheritdoc\n */\n initialize: function () {\n this._super();\n this._loadApi();\n },\n\n /**\n * Loads recaptchaapi API and triggers event, when loaded\n * @private\n */\n _loadApi: function () {\n if (this._isApiRegistered !== undefined) {\n if (this._isApiRegistered === true) {\n $(window).trigger('recaptchaapiready');\n }\n\n return;\n }\n this._isApiRegistered = false;\n\n // global function\n window.globalOnRecaptchaOnLoadCallback = function () {\n this._isApiRegistered = true;\n $(window).trigger('recaptchaapiready');\n }.bind(this);\n\n reCaptchaLoader.addReCaptchaScriptTag();\n },\n\n /**\n * Checking that reCAPTCHA is invisible type\n * @returns {Boolean}\n */\n getIsInvisibleRecaptcha: function () {\n if (this.settings ===\n\n void 0) {\n return false;\n }\n\n return this.settings.invisible;\n },\n\n /**\n * reCAPTCHA callback\n * @param {String} token\n */\n reCaptchaCallback: function (token) {\n if (this.getIsInvisibleRecaptcha()) {\n this.tokenField.value = token;\n this.$parentForm.submit();\n }\n },\n\n /**\n * Initialize reCAPTCHA after first rendering\n */\n initCaptcha: function () {\n var $parentForm,\n $wrapper,\n $reCaptcha,\n widgetId,\n parameters;\n\n if (this.captchaInitialized || this.settings ===\n\n void 0) {\n return;\n }\n\n this.captchaInitialized = true;\n\n /*\n * Workaround for data-bind issue:\n * We cannot use data-bind to link a dynamic id to our component\n * See:\n * https://stackoverflow.com/questions/46657573/recaptcha-the-bind-parameter-must-be-an-element-or-id\n *\n * We create a wrapper element with a wrapping id and we inject the real ID with jQuery.\n * In this way we have no data-bind attribute at all in our reCAPTCHA div\n */\n $wrapper = $('#' + this.getReCaptchaId() + '-wrapper');\n $reCaptcha = $wrapper.find('.g-recaptcha');\n $reCaptcha.attr('id', this.getReCaptchaId());\n\n $parentForm = $wrapper.parents('form');\n\n if (this.settings === undefined) {\n\n return;\n }\n\n parameters = _.extend(\n {\n 'callback': function (token) { // jscs:ignore jsDoc\n this.reCaptchaCallback(token);\n this.validateReCaptcha(true);\n }.bind(this),\n 'expired-callback': function () {\n this.validateReCaptcha(false);\n }.bind(this)\n },\n this.settings.rendering\n );\n\n if (parameters.size === 'invisible' && parameters.badge !== 'inline') {\n nonInlineReCaptchaRenderer.add($reCaptcha, parameters);\n }\n\n // eslint-disable-next-line no-undef\n widgetId = grecaptcha.render(this.getReCaptchaId(), parameters);\n this.initParentForm($parentForm, widgetId);\n\n registry.ids.push(this.getReCaptchaId());\n registry.captchaList.push(widgetId);\n registry.tokenFields.push(this.tokenField);\n\n },\n\n /**\n * Initialize parent form.\n *\n * @param {Object} parentForm\n * @param {String} widgetId\n */\n initParentForm: function (parentForm, widgetId) {\n var listeners;\n\n if (this.getIsInvisibleRecaptcha() && parentForm.length > 0) {\n parentForm.submit(function (event) {\n if (!this.tokenField.value) {\n // eslint-disable-next-line no-undef\n grecaptcha.execute(widgetId);\n event.preventDefault(event);\n event.stopImmediatePropagation();\n }\n }.bind(this));\n\n // Move our (last) handler topmost. We need this to avoid submit bindings with ko.\n listeners = $._data(parentForm[0], 'events').submit;\n listeners.unshift(listeners.pop());\n\n // Create a virtual token field\n this.tokenField = $('<input type=\"text\" name=\"token\" style=\"display: none\" />')[0];\n this.$parentForm = parentForm;\n parentForm.append(this.tokenField);\n } else {\n this.tokenField = null;\n }\n if ($('#send2').length > 0) {$('#send2').prop('disabled', false);}\n },\n\n /**\n * Validates reCAPTCHA\n * @param {*} state\n * @returns {jQuery}\n */\n validateReCaptcha: function (state) {\n if (!this.getIsInvisibleRecaptcha()) {\n return $(document).find('input[type=checkbox].required-captcha').prop('checked', state);\n }\n },\n\n /**\n * Render reCAPTCHA\n */\n renderReCaptcha: function () {\n if (window.grecaptcha && window.grecaptcha.render) { // Check if reCAPTCHA is already loaded\n this.initCaptcha();\n } else { // Wait for reCAPTCHA to be loaded\n $(window).on('recaptchaapiready', function () {\n this.initCaptcha();\n }.bind(this));\n }\n },\n\n /**\n * Get reCAPTCHA ID\n * @returns {String}\n */\n getReCaptchaId: function () {\n return this.reCaptchaId;\n }\n });\n });\n","Magento_ReCaptchaFrontendUi/js/registry.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(['ko'], function (ko) {\n 'use strict';\n\n return {\n ids: ko.observableArray([]),\n captchaList: ko.observableArray([]),\n tokenFields: ko.observableArray([])\n };\n});\n","Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n var scriptTagAdded = false;\n\n return {\n /**\n * Add script tag. Script tag should be added once\n */\n addReCaptchaScriptTag: function () {\n var element, scriptTag;\n\n if (!scriptTagAdded) {\n element = document.createElement('script');\n scriptTag = document.getElementsByTagName('script')[0];\n\n element.async = true;\n element.src = 'https://www.google.com/recaptcha/api.js' +\n '?onload=globalOnRecaptchaOnLoadCallback&render=explicit';\n\n scriptTag.parentNode.insertBefore(element, scriptTag);\n scriptTagAdded = true;\n }\n }\n };\n});\n","Magento_ReCaptchaFrontendUi/js/ui-messages-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine(['Magento_ReCaptchaFrontendUi/js/registry'], function (registry) {\n 'use strict';\n\n return function (originalComponent) {\n return originalComponent.extend({\n /**\n * Initialize reset on messages\n * @returns {initialize}\n */\n initialize: function () {\n this._super();\n\n this.messageContainer.errorMessages.subscribe(function () {\n var\n i,\n captchaList = registry.captchaList(),\n tokenFieldsList = registry.tokenFields();\n\n for (i = 0; i < captchaList.length; i++) {\n // eslint-disable-next-line no-undef\n grecaptcha.reset(captchaList[i]);\n\n if (tokenFieldsList[i]) {\n tokenFieldsList[i].value = '';\n }\n }\n }, null, 'arrayChange');\n\n return this;\n }\n });\n };\n});\n","Magento_InstantPurchase/js/view/instant-purchase.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\ndefine([\n 'ko',\n 'jquery',\n 'underscore',\n 'uiComponent',\n 'Magento_Ui/js/modal/confirm',\n 'Magento_Customer/js/customer-data',\n 'mage/url',\n 'mage/template',\n 'mage/translate',\n 'text!Magento_InstantPurchase/template/confirmation.html',\n 'mage/validation'\n], function (ko, $, _, Component, confirm, customerData, urlBuilder, mageTemplate, $t, confirmationTemplate) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n template: 'Magento_InstantPurchase/instant-purchase',\n buttonText: $t('Instant Purchase'),\n purchaseUrl: urlBuilder.build('instantpurchase/button/placeOrder'),\n showButton: false,\n paymentToken: null,\n shippingAddress: null,\n billingAddress: null,\n shippingMethod: null,\n productFormSelector: '#product_addtocart_form',\n confirmationTitle: $t('Instant Purchase Confirmation'),\n confirmationData: {\n message: $t('Are you sure you want to place order and pay?'),\n shippingAddressTitle: $t('Shipping Address'),\n billingAddressTitle: $t('Billing Address'),\n paymentMethodTitle: $t('Payment Method'),\n shippingMethodTitle: $t('Shipping Method')\n }\n },\n\n /** @inheritdoc */\n initialize: function () {\n var instantPurchase = customerData.get('instant-purchase');\n\n this._super();\n\n this.setPurchaseData(instantPurchase());\n instantPurchase.subscribe(this.setPurchaseData, this);\n },\n\n /** @inheritdoc */\n initObservable: function () {\n this._super()\n .observe('showButton paymentToken shippingAddress billingAddress shippingMethod');\n\n return this;\n },\n\n /**\n * Set data from customerData.\n *\n * @param {Object} data\n */\n setPurchaseData: function (data) {\n this.showButton(data.available);\n this.paymentToken(data.paymentToken);\n this.shippingAddress(data.shippingAddress);\n this.billingAddress(data.billingAddress);\n this.shippingMethod(data.shippingMethod);\n },\n\n /**\n * Confirmation method\n */\n instantPurchase: function () {\n var form = $(this.productFormSelector),\n confirmTemplate = mageTemplate(confirmationTemplate),\n confirmData = _.extend({}, this.confirmationData, {\n paymentToken: this.paymentToken().summary,\n shippingAddress: this.shippingAddress().summary,\n billingAddress: this.billingAddress().summary,\n shippingMethod: this.shippingMethod().summary\n });\n\n if (!(form.validation() && form.validation('isValid'))) {\n return;\n }\n\n confirm({\n title: this.confirmationTitle,\n content: confirmTemplate({\n data: confirmData\n }),\n actions: {\n /** @inheritdoc */\n confirm: function () {\n $.ajax({\n url: this.purchaseUrl,\n data: form.serialize(),\n type: 'post',\n dataType: 'json',\n\n /** Show loader before send */\n beforeSend: function () {\n $('body').trigger('processStart');\n }\n }).always(function () {\n $('body').trigger('processStop');\n });\n }.bind(this)\n }\n });\n }\n });\n});\n","Magento_ReCaptchaWebapiUi/js/webapiReCaptcha.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n// jscs:disable jsDoc\n\n/* global grecaptcha */\ndefine(\n [\n 'Magento_ReCaptchaFrontendUi/js/reCaptcha',\n 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry'\n ],\n function (Component, registry) {\n 'use strict';\n\n return Component.extend({\n defaults: {\n autoTrigger: false\n },\n\n /**\n * Provide the token to the registry.\n *\n * @param {String} token\n */\n reCaptchaCallback: function (token) {\n //Make the token retrievable in other UI components.\n registry.tokens[this.getReCaptchaId()] = token;\n\n if (typeof registry._listeners[this.getReCaptchaId()] !== 'undefined') {\n registry._listeners[this.getReCaptchaId()](token);\n }\n },\n\n /**\n * Register this ReCaptcha.\n *\n * @param {Object} parentForm\n * @param {String} widgetId\n */\n initParentForm: function (parentForm, widgetId) {\n var self = this,\n trigger;\n\n trigger = function () {\n self.reCaptchaCallback(grecaptcha.getResponse(widgetId));\n };\n registry._isInvisibleType[this.getReCaptchaId()] = false;\n\n if (this.getIsInvisibleRecaptcha()) {\n trigger = function () {\n grecaptcha.execute(widgetId);\n };\n registry._isInvisibleType[this.getReCaptchaId()] = true;\n }\n\n if (this.autoTrigger) {\n //Validate ReCaptcha when initiated\n trigger();\n registry.triggers[this.getReCaptchaId()] = new Function();\n } else {\n registry.triggers[this.getReCaptchaId()] = trigger;\n }\n this.tokenField = null;\n }\n });\n }\n);\n","Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([], function () {\n 'use strict';\n\n return {\n /**\n * recaptchaId: token map.\n *\n * Tokens for already verified recaptcha.\n */\n tokens: {},\n\n /**\n * recaptchaId: triggerFn map.\n *\n * Call a trigger to initiate a recaptcha verification.\n */\n triggers: {},\n\n /**\n * recaptchaId: callback map\n */\n _listeners: {},\n\n /**\n * recaptchaId: bool map\n */\n _isInvisibleType: {},\n\n /**\n * Add a listener to when the ReCaptcha finishes verification\n * @param {String} id - ReCaptchaId\n * @param {Function} func - Will be called back with the token\n */\n addListener: function (id, func) {\n if (this.tokens.hasOwnProperty(id)) {\n func(this.tokens[id]);\n } else {\n this._listeners[id] = func;\n }\n },\n\n /**\n * Remove a listener\n *\n * @param id\n */\n removeListener: function (id) {\n this._listeners[id] = undefined;\n }\n };\n});\n","Magento_ReCaptchaWebapiUi/js/jquery-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\n// jscs:disable requireDotNotation\n\ndefine([\n 'mage/utils/wrapper'\n], function (wrapper) {\n 'use strict';\n\n return function (jQuery) {\n jQuery.ajax = wrapper.wrapSuper(jQuery.ajax, function () {\n //Moving ReCaptcha value from payload to the header for requests to web API\n var settings,\n payload;\n\n if (arguments.length !== 0) {\n settings = arguments.length === 1 ? arguments[0] : arguments[1];\n }\n\n if (settings && settings.hasOwnProperty('data')) {\n //The request has a body, trying to parse JSON data\n try {\n payload = JSON.parse(settings.data);\n } catch (e) {\n //Not JSON\n }\n }\n\n if (payload && payload.hasOwnProperty('xReCaptchaValue')) {\n if (!settings.hasOwnProperty('headers')) {\n settings.headers = {};\n }\n settings.headers['X-ReCaptcha'] = payload.xReCaptchaValue;\n delete payload['xReCaptchaValue'];\n settings.data = JSON.stringify(payload);\n }\n\n return this._super.apply(this, arguments);\n });\n\n return jQuery;\n };\n});\n","Magento_CheckoutAgreements/js/view/checkout-agreements.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'ko',\n 'jquery',\n 'uiComponent',\n 'Magento_CheckoutAgreements/js/model/agreements-modal'\n], function (ko, $, Component, agreementsModal) {\n 'use strict';\n\n var checkoutConfig = window.checkoutConfig,\n agreementManualMode = 1,\n agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {};\n\n return Component.extend({\n defaults: {\n template: 'Magento_CheckoutAgreements/checkout/checkout-agreements'\n },\n isVisible: agreementsConfig.isEnabled,\n agreements: agreementsConfig.agreements,\n modalTitle: ko.observable(null),\n modalContent: ko.observable(null),\n contentHeight: ko.observable(null),\n modalWindow: null,\n\n /**\n * Checks if agreement required\n *\n * @param {Object} element\n */\n isAgreementRequired: function (element) {\n return element.mode == agreementManualMode; //eslint-disable-line eqeqeq\n },\n\n /**\n * Show agreement content in modal\n *\n * @param {Object} element\n */\n showContent: function (element) {\n this.modalTitle(element.checkboxText);\n this.modalContent(element.content);\n this.contentHeight(element.contentHeight ? element.contentHeight : 'auto');\n agreementsModal.showModal();\n },\n\n /**\n * build a unique id for the term checkbox\n *\n * @param {Object} context - the ko context\n * @param {Number} agreementId\n */\n getCheckboxId: function (context, agreementId) {\n var paymentMethodName = '',\n paymentMethodRenderer = context.$parents[1];\n\n // corresponding payment method fetched from parent context\n if (paymentMethodRenderer) {\n // item looks like this: {title: \"Check / Money order\", method: \"checkmo\"}\n paymentMethodName = paymentMethodRenderer.item ?\n paymentMethodRenderer.item.method : '';\n }\n\n return 'agreement_' + paymentMethodName + '_' + agreementId;\n },\n\n /**\n * Init modal window for rendered element\n *\n * @param {Object} element\n */\n initModal: function (element) {\n agreementsModal.createModal(element);\n }\n });\n});\n","Magento_CheckoutAgreements/js/view/agreement-validation.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'uiComponent',\n 'Magento_Checkout/js/model/payment/additional-validators',\n 'Magento_CheckoutAgreements/js/model/agreement-validator'\n], function (Component, additionalValidators, agreementValidator) {\n 'use strict';\n\n additionalValidators.registerValidator(agreementValidator);\n\n return Component.extend({});\n});\n","Magento_CheckoutAgreements/js/model/agreements-assigner.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery'\n], function ($) {\n 'use strict';\n\n var agreementsConfig = window.checkoutConfig.checkoutAgreements;\n\n /** Override default place order action and add agreement_ids to request */\n return function (paymentData) {\n var agreementForm,\n agreementData,\n agreementIds;\n\n if (!agreementsConfig.isEnabled) {\n return;\n }\n\n agreementForm = $('.payment-method._active div[data-role=checkout-agreements] input');\n agreementData = agreementForm.serializeArray();\n agreementIds = [];\n\n agreementData.forEach(function (item) {\n agreementIds.push(item.value);\n });\n\n if (paymentData['extension_attributes'] === undefined) {\n paymentData['extension_attributes'] = {};\n }\n\n paymentData['extension_attributes']['agreement_ids'] = agreementIds;\n };\n});\n","Magento_CheckoutAgreements/js/model/place-order-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/utils/wrapper',\n 'Magento_CheckoutAgreements/js/model/agreements-assigner'\n], function ($, wrapper, agreementsAssigner) {\n 'use strict';\n\n return function (placeOrderAction) {\n\n /** Override default place order action and add agreement_ids to request */\n return wrapper.wrap(placeOrderAction, function (originalAction, paymentData, messageContainer) {\n agreementsAssigner(paymentData);\n\n return originalAction(paymentData, messageContainer);\n });\n };\n});\n","Magento_CheckoutAgreements/js/model/agreement-validator.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/validation'\n], function ($) {\n 'use strict';\n\n var checkoutConfig = window.checkoutConfig,\n agreementsConfig = checkoutConfig ? checkoutConfig.checkoutAgreements : {},\n agreementsInputPath = '.payment-method._active div.checkout-agreements input';\n\n return {\n /**\n * Validate checkout agreements\n *\n * @returns {Boolean}\n */\n validate: function (hideError) {\n var isValid = true;\n\n if (!agreementsConfig.isEnabled || $(agreementsInputPath).length === 0) {\n return true;\n }\n\n $(agreementsInputPath).each(function (index, element) {\n if (!$.validator.validateSingleElement(element, {\n errorElement: 'div',\n hideError: hideError || false\n })) {\n isValid = false;\n }\n });\n\n return isValid;\n }\n };\n});\n","Magento_CheckoutAgreements/js/model/agreements-modal.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'Magento_Ui/js/modal/modal',\n 'mage/translate'\n], function ($, modal, $t) {\n 'use strict';\n\n return {\n modalWindow: null,\n\n /**\n * Create popUp window for provided element.\n *\n * @param {HTMLElement} element\n */\n createModal: function (element) {\n var options;\n\n this.modalWindow = element;\n options = {\n 'type': 'popup',\n 'modalClass': 'agreements-modal',\n 'responsive': true,\n 'innerScroll': true,\n 'trigger': '.show-modal',\n 'buttons': [\n {\n text: $t('Close'),\n class: 'action secondary action-hide-popup',\n\n /** @inheritdoc */\n click: function () {\n this.closeModal();\n }\n }\n ]\n };\n modal(options, $(this.modalWindow));\n },\n\n /** Show login popup window */\n showModal: function () {\n $(this.modalWindow).modal('openModal');\n }\n };\n});\n","Magento_CheckoutAgreements/js/model/set-payment-information-mixin.js":"/**\n * Copyright \u00a9 Magento, Inc. All rights reserved.\n * See COPYING.txt for license details.\n */\n\ndefine([\n 'jquery',\n 'mage/utils/wrapper',\n 'Magento_CheckoutAgreements/js/model/agreements-assigner'\n], function ($, wrapper, agreementsAssigner) {\n 'use strict';\n\n return function (placeOrderAction) {\n\n /** Override place-order-mixin for set-payment-information action as they differs only by method signature */\n return wrapper.wrap(placeOrderAction, function (originalAction, messageContainer, paymentData) {\n agreementsAssigner(paymentData);\n\n return originalAction(messageContainer, paymentData);\n });\n };\n});\n"} }});