"use strict";(window.webpackChunkdivi_areas_pro=window.webpackChunkdivi_areas_pro||[]).push([[256],{423:function(e,t,i){function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);if("Map"===i||"Set"===i)return Array.from(e);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return r(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,a=new Array(t);i0,this._hasFocus=!1,this._isTrigger=!1,this._postId=null,this._names=[],this._size={},this._isPrepared=!1,this._session=c.getUniqueId(),this._state=g.newAreaState(this),this.debug("Area Type",this.type),this.debug("Area Hook",this.key),this._configure(),f.initializeAreaAnimation(this),this._setupWrap(),this._setupCloseButton(),this._setupJQuery(this.$area),this._setupJQuery(this.$areaWrap),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this._setAttrs(),this._setupHooks(),this._setupObserver(),this._initTracking()}var t,i,r;return t=e,i=[{key:"_configure",value:function(){for(var e in this._conf=new Map(Object.entries({zindex:0,container:"body",hasshowanim:!0,position:"center-center",positionv:"center",positionh:"center",overflow:"clip",size:"auto",animationspeedin:c.getOption("animateSpeed"),animationspeedout:c.getOption("animateSpeed")})),v)void 0!==this.$area.data("da-"+e)?this.setData(c.toBool(this.$area.data("da-"+e))):void 0!==this.$area.data(e)?this.setData(c.toBool(this.$area.data(e))):this.setData(e,v[e]);var t={};for(var i in t[c.getOption("notMobileClass")]=["onmobile",!1],t[c.getOption("notTabletClass")]=["ontablet",!1],t[c.getOption("notDesktopClass")]=["ondesktop",!1],t[c.getOption("noCloseClass")]=["showclose",!1],t[c.getOption("withCloseClass")]=["showclose",!0],t[c.getOption("altCloseClass")]=["closealt",!0],t[c.getOption("modalIndicatorClass")]=["ismodal",!0],t[c.getOption("blockingIndicatorClass")]=["isblocking",!0],t[c.getOption("exitIndicatorClass")]=["triggerexit",!0],t[c.getOption("noShadowClass")]=["noshadow",!0],t[c.getOption("darkModeClass")]=["darkmode",!0],t[c.getOption("singletonClass")]=["singleton",!0],t[c.getOption("withLoaderClass")]=["withloader",!0],t)if(this.$area.hasClass(i)){var a=t[i];this.setData(a[0],a[1])}}},{key:"_setupWrap",value:function(){if(!this.$areaWrap){var e=c.getOption("popupWrapperClass");if(this.$areaWrap=this.$area.parent(),!this.$areaWrap.hasClass(e)){this.$area.wrap("
"),this.$areaWrap=this.$area.parent(),this.$areaWrap.addClass(e);var t=this.$area.attr("id"),i=this.getNames(0)||t;i&&(this.$areaWrap.attr("id",i),t===i&&this.$area.removeAttr("id"))}this.$areaWrap.detach().hide().appendTo("body"),this.doAction("area_wrap",this.$areaWrap)}}},{key:"_setupCloseButton",value:function(){if(!this.$closeButtonWrapper){var e=c.getOption("closeButtonClass"),t=e+"-wrap";this.$closeButtonWrapper=l("").addClass(t).appendTo(this.$areaWrap),l("").attr("href","#close").addClass(e).html("×").appendTo(this.$closeButtonWrapper),this.$closeButtonWrapper.hide(),this.doAction("area_close_button",this.$closeButtonWrapper)}}},{key:"_setupObserver",value:function(){var e=this;this.observeArea||(this.observeArea=new ResizeObserver((function(){var t=e.$area[0],i=t.scrollHeight-t.clientHeight;i>0&&i-t.scrollTop<1&&(t.scrollTop-=1),e.invalidateSize(!0)})),this.observeWrap=new ResizeObserver((function(){return e.invalidateSize()})),this.$area.on("resize",this.debouncedResize),this.$areaWrap.on("resize",this.debouncedResize))}},{key:"_setupHooks",value:function(){this.addActionOnce("pre_init_area",this._initCoreTriggers),this.addAction("setup_area",this._setTriggerEvent,2),this.addAction("cleanup_area",this._setTriggerEvent)}},{key:"refreshArea",value:function(){this.attached&&this._setAttrs()}},{key:"_setAttrs",value:function(){this.$area.attr("data-da-area",this.id),this.$areaWrap.attr("data-da-area",this.id),this.$areaWrap.attr("data-da-type",this.type),this.$areaWrap.attr("data-da-registered",1),this.$areaWrap.attr("data-da-close-btn",this.getData("showclose")?"yes":"no"),this.$areaWrap.attr("data-da-close-bg",this.getData("closeAlt")?"none":"solid"),this.$areaWrap.attr("data-da-loader",this.getData("withLoader")?"yes":"no"),this.$areaWrap.attr("data-da-shadow",this.getData("shadow")?"yes":"no"),this.$areaWrap.attr("data-da-color",this.getData("darkMode")?"dark":"light"),this.$areaWrap.attr("data-da-overflow",this.getData("overflow")),this.$areaWrap.attr("data-da-size",this.getData("size"));var e=this.getData("wrapClasses");e&&this.$areaWrap.addClass(e),this.debouncedSetPosition(),this.doAction("refresh_area")}},{key:"setPosition",value:function(){var e={},t={};if(!this.visible)return this;if(this.getData("maxheight")&&(e.overflow="auto",e.maxHeight="100%",t.maxHeight=this.getData("maxheight")),this.getData("maxwidth")&&(e.maxWidth="100%",t.maxWidth=this.getData("maxwidth")),t.zIndex=this.getData("zindex"),this.doAction("resize_area"),this.isType("inline")||this.isType("hover"))this.$areaWrap.removeAttr("data-da-position"),this.$areaWrap.removeAttr("data-da-position-h"),this.$areaWrap.removeAttr("data-da-position-v");else{var i=this.getData("positionh"),a=this.getData("positionv"),s=this.getData("size"),r=this.getSize(),n={minX:0,minY:0,maxX:r.windowWidth,maxY:r.windowHeight};if(this.$areaWrap.attr("data-da-position",this.getData("position")),this.$areaWrap.attr("data-da-position-h",i),this.$areaWrap.attr("data-da-position-v",a),this.isType("flyin")&&(n.minY=parseInt(l("html").css("margin-top"))),this.doAction("position_boundary",n),n.minX>n.maxX){var o=n.maxX;n.maxX=n.minX,n.minX=o}if(n.minY>n.maxY){var h=n.maxY;n.maxY=n.minY,n.minY=h}if("full_width"===s||"full_screen"===s)t.left=n.minX,t.right=n.maxX,t.width="auto";else switch(i){case"left":t.left=n.minX;break;case"right":t.right=parseInt(r.windowWidth-n.maxX);break;case"center":t.left=parseInt(n.minX+(n.maxX-n.minX-r.wrapperWidth)/2)}if("full_height"===s||"full_screen"===s)t.top=n.minY,t.bottom=n.maxY,t.height="auto";else if(!this.$areaWrap.attr("data-da-size-full-height"))switch(a){case"top":t.top=n.minY;break;case"bottom":t.bottom=parseInt(r.windowHeight-n.maxY);break;case"center":t.top=parseInt(n.minY+(n.maxY-n.minY-r.wrapperHeight)/2)}this.doAction("position_area",t,e)}return this.$area.css(e),this.$areaWrap.css(t),this}},{key:"_fixAreaDimensions",value:function(){var e=this._getDefinedStyle("width",!1),t=this._getDefinedStyle("max-width",!0);e&&"auto"!==e||(this.isType("popup")||this.$areaWrap.css("width","100%"),this.$area.css("width","100%")),t&&this.$area.css("max-width",t)}},{key:"getSize",value:function(){var e=this.visible;this._size&&void 0!==this._size.width||(this._size={});var t=this.$area[0],i=this.$areaWrap[0];if(this._size.width||(this._size.width=e?t.clientWidth:0),this._size.height||(this._size.height=e?t.clientHeight:0),this._size.contentWidth||(this._size.contentWidth=e?t.scrollWidth:0),!this._size.contentHeight&&(this._size.contentHeight=0,e))if(this.$area.hasClass("et_pb_section")){var a=window.getComputedStyle(t);this._size.contentHeight+=parseInt(a["border-top-width"]),this._size.contentHeight+=parseInt(a["padding-top"]),this._size.contentHeight+=parseInt(a["padding-bottom"]),this._size.contentHeight+=parseInt(a["border-bottom-width"]);for(var s=t.children,r=0;r0&&void 0!==arguments[0]&&arguments[0]?(this._size.width=0,this._size.height=0,this._size.contentWidth=0,this._size.contentHeight=0):(this._size.windowWidth=0,this._size.windowHeight=0,this._size.wrapperWidth=0,this._size.wrapperHeight=0),this.debouncedResize()}},{key:"_resizeArea",value:function(){if(this.visible){var e=this.getSize(),t=[e.width,e.height,e.contentWidth,e.contentHeight,e.windowWidth,e.windowHeight].join("-");if(this._conf.get("_resizeState")!==t){this._conf.set("_resizeState",t),this.$closeButtonWrapper.css({width:e.width,height:e.height});var i=this.isType("popup")||this.isType("flyin"),a=this.getData("overflow"),s=-1===["full_height","full_screen"].indexOf(this.getData("size"));if(i&&"show"!==a&&s){var r="auto"===this.getData("size")?20:0,n=c.getOption("fullHeightClass");this.$areaWrap.attr("data-da-size-full-height")?e.windowHeight-e.contentHeight>r&&(this.$areaWrap.removeAttr("data-da-size-full-height"),this.$areaWrap.removeClass(n)):e.windowHeight-e.contentHeight2&&void 0!==arguments[2]?arguments[2]:{},s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r=function(){var r=g.createNewTrigger(t,i,a,s);r?(r.id=e,i._triggers.set(r.id,r),r.start(),i.log("Trigger added to Area",r.id)):i.log("Could not create trigger!",t,"Args:",a)};this.removeTrigger(e),this.isPro&&s?d.Pro.checkConditions(this,s).then(r).catch((function(e){i.log("Trigger not added, because condition failed",t,"Reason:",e)})):r()}},{key:"removeTrigger",value:function(e){var t=this._triggers.get(e);t&&(t.stop(),this._triggers.delete(e))}},{key:"getTrigger",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return e?this._triggers.get(e):Object.fromEntries(this._triggers)}},{key:"_setTriggerEvent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null!=e&&e.type?this.setData("event",e):this.setData("event",!1)}},{key:"_checkTriggerConditions",value:function(e){var t=this,i=Promise.resolve();return i=(i=i.then((function(){return new Promise((function(e,i){c.showOnViewport(t)?e():i("Area is not available on this device")}))}))).then((function(){return new Promise((function(e,i){d.isClosed(t)?i("Area is still marked as closed"):e()}))})),e&&e.dev&&(i=i.then((function(){return new Promise((function(t,i){c.showOnViewport(e.dev)?t():i("Do not trigger Area on current device")}))}))),i=this.applyFilters("area_trigger_conditions",i)}},{key:"show",value:function(e){this._isTrigger||(this._state.reset(),this._state.setTriggerDetails("api")),this.setData("opencount",this.getData("opencount")+1||1),p.group(this.id,"| Show Area"),this.setData("hasShowAnim",!this.visible),this.doAction("setup_area",e),u.attachArea(this),u.reOrderAreas(),p.group()}},{key:"hide",value:function(){this._state.setCloseDetails("api"),this.setData("hasShowAnim",!0),this.doAction("cleanup_area"),this.setData("event",void 0),this.debug("Close Area and unlink event handlers"),u.detachArea(this),u.reOrderAreas()}},{key:"attach",value:function(){var e=this;if(this.refreshArea(),this.prepare()){if(this.visible)return this}else this._isVisible=!1;this._inDom=!0;var t=this.findHook();return this.$area.hide(),t?("replace"===t.position&&!0===t.target.data("isArea")?(t.target.blur(),t.target.data("area").detach(!1),t=this.findHook()):"before"===t.position&&(t.target=t.target.prev()),t.target.after(this.$areaWrap.detach()),this.$areaWrap.attr("data-inline-pos",t.position),"replace"===t.position&&(this.$replacedElement=t.target.detach())):this.$areaWrap.detach().appendTo(this.getData("container")),this.$areaWrap.closest("#et-boc").length||(this.$areaWrap.wrap('
'),this.$areaWrap.wrap('
')),this.debouncedSetPosition(),this.setVisible(!0,(function(){if(e.debug("Prepare Size-Observer and position the Area"),e.observeArea){var t=c.getOption("closeButtonClass")+"-wrap";e.$area.children().each((function(i,a){-1===a.className.indexOf(t)&&e.observeArea.observe(a)})),e.observeArea.observe(e.$area[0]),e.observeWrap.observe(e.$areaWrap[0])}e.debouncedSetPosition(),e.doAction("area_visible"),e.debug("Area.attach() is completed for Area")})),this}},{key:"detach",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.prepared){if(!this.attached)return this}else this.prepare(),this._isVisible=!0;return this.observeArea&&this.observeArea.disconnect(),this.observeWrap&&this.observeWrap.disconnect(),this.setVisible(!1,(function(){e.debug("Remove Area from DOM");var t=e.$areaWrap.parent();e.$replacedElement&&(e.$areaWrap.after(e.$replacedElement),e.$replacedElement=null),e.$area.hide(),e.$areaWrap.detach(),e.$areaWrap.removeAttr("data-inline-pos"),e._inDom=!1,t.hasClass("dynamic")&&!t.children().length&&t.parent().remove(),e.doAction("area_hidden"),e.debug("Area.detach() is completed for Area")}),t),this}},{key:"findHook",value:function(){var e='[data-area-hook="'+this.getData("hookid")+'"]',t=l(e);return!!t.length&&{position:t.data("area-place"),target:t.nextAll(':not([data-area-hook]):not([data-inline-pos="before"]):not([data-inline-pos="after"])').first()}}},{key:"setVisible",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,a=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(this.prepared&&this.visible===e)return this;"function"!=typeof i&&(i=function(e){});var s=function(i,a,s){if(a&&t.prepared)return t.debug("".concat(i," the prepared Area: Trigger animation")),void t._triggerAnimation((function(){t._isVisible===e&&s()}));t.debug("".concat(i," the Area without animation")),s()};return this._isVisible=e,this._setVisibilityEvents(),this.$areaWrap.show(),e?(s("SHOW",a,i),this._fixAreaDimensions(),this.doAction("show_area")):(s("HIDE",a,i),this.doAction("hide_area"),this._session=c.getUniqueId()),this}},{key:"_setVisibilityEvents",value:function(){var e=this,t=c.getOption("triggerCloseClass"),i=c.getOption("closeButtonClass");if(this.visible){this.$area.find("."+i).off(".da");var a=function(t,i){return e.debug("Click on [".concat(i,"] close-button")),e._state.setCloseDetails(i,t),e.doAction("close_area",e,i),t.preventDefault(),!1};this.$areaWrap.find("div ."+t).off(".da").on("click.da",(function(e){return a(e,"custom")})),this.$closeButtonWrapper.find("a").off(".da").on("click.da",(function(e){return a(e,"default")})),l(window).on("resize.da",(function(){return e.invalidateSize()})),this.addAction("close_area",this._handleCloseEvent)}else this.$areaWrap.find("div ."+t).off(".da"),this.$closeButtonWrapper.find("a").off(".da"),l(window).off("resize.da"),this.removeAction("close_area",this._handleCloseEvent)}},{key:"_triggerAnimation",value:function(e){var t=this;if(this.visible){if(this.getData("hasShowAnim"))return this.log("✨ Animate the area (show)"),void f.animateArea(this,"show",(function(){t.getData("showclose")&&(t.debug("Show the default close button"),t.$closeButtonWrapper.show()),e()}))}else if(this.getData("hasShowAnim"))return this.$closeButtonWrapper.hide(),this.log("✨ Animate the area (hide)"),void f.animateArea(this,"hide",e);e()}},{key:"_handleCloseEvent",value:function(e,t){var i=!1;if(this.visible){if(i=this.applyFilters("ignore_close_area",i,this,t))return this.debug("Ignored, manually cancelled in filter"),!0;this._state.setCloseDetails(t),this.hide()}}},{key:"log",value:function(){for(var e,t=arguments.length,i=new Array(t),a=0;a0&&void 0!==arguments[0]?arguments[0]:-1;return t>=0?String(null!==(e=this._names[t])&&void 0!==e?e:""):this._names.slice()}},{key:"isType",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(!e)return!0;if("string"!=typeof e)throw new Error("DiviAreaItem.isType() expects a string parameter. Given value is a "+a(e));if((e=m(e))===this._type)return!0;if("any"===e||"all"===e)return!0;for(var t=0===e.indexOf("not:"),i=e.replace(/^not:\s*/,"").split(/\s*,\s*/),s=0;s0&&void 0!==arguments[0]?arguments[0]:null;if(t){t=b(t);var i=_.hasOwnProperty(t);i&&(t=_[t]),this._conf.has(t)?(e=this._conf.get(t),i&&(e=!e)):e=null}else e={},this._conf.forEach((function(t,i){"_"!==i[0]&&(e[i]=t)}));return e}},{key:"setData",value:function(e,t){if(void 0===t)return this;if(e=b(e),v.hasOwnProperty(e))t=c.toBool(t,v[e]),_.hasOwnProperty(e)&&(e=_[e],t=!t);else{var i=null,a=null;switch(e){case"fixzindex":case"zindex":t=parseInt(t);break;case"closedelay":t=parseFloat(t);break;case"position":i=-1!==t.indexOf("top")?"top":-1!==t.indexOf("bottom")?"bottom":"center",a=-1!==t.indexOf("left")?"left":-1!==t.indexOf("right")?"right":"center",t=null;break;case"positionh":["left","right","center"].indexOf(t)<0&&(t=null);break;case"positionv":["top","bottom","center"].indexOf(t)<0&&(t=null);break;case"container":t&&(t=l(t).first()),t&&t.length||(t=l("body"));break;case"attachto":t=!!t&&l(t).first()}null!==a&&this._conf.set("positionh",a),null!==i&&this._conf.set("positionv",i)}switch(null!==t&&this._conf.set(e,t),e){case"positionh":case"positionv":this._conf.set("position",this._conf.get("positionv")+"-"+this._conf.get("positionh"))}return this.refreshArea(),this}},{key:"doAction",value:function(e){for(var t,i=arguments.length,a=new Array(i>1?i-1:0),r=1;r2?a-2:0),n=2;n