/*! For license information please see frontend-handlers.js.LICENSE.txt */
!function(){"use strict";var e={"./packages/packages/core/frontend-handlers/src/handlers-registry.ts":function(e,t,n){n.r(t),n.d(t,{handlers:function(){return r},register:function(){return register},unregister:function(){return unregister}});const r=new Map,register=({elementType:e,id:t,callback:n})=>{r.has(e)||r.set(e,new Map),r.get(e)?.has(t)||r.get(e)?.set(t,n)},unregister=({elementType:e,id:t})=>{r.has(e)&&(t?(r.get(e)?.delete(t),0===r.get(e)?.size&&r.delete(e)):r.delete(e))}},"./packages/packages/core/frontend-handlers/src/init.ts":function(e,t,n){n.r(t),n.d(t,{init:function(){return init}});var r=n("./packages/packages/core/frontend-handlers/src/lifecycle-events.ts");function init(){window.addEventListener("elementor/element/render",e=>{const t=e,{id:n,type:s,element:a}=t.detail;(0,r.onElementDestroy)({elementType:s,elementId:n}),(0,r.onElementRender)({element:a,elementType:s,elementId:n})}),window.addEventListener("elementor/element/destroy",e=>{const t=e,{id:n,type:s,element:a}=t.detail;(0,r.onElementDestroy)({elementType:s,elementId:n,element:a})}),document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll("[data-e-type]").forEach(e=>{const t=e,{eType:n,id:r}=t.dataset;n&&r&&window.dispatchEvent(new CustomEvent("elementor/element/render",{detail:{id:r,type:n,element:e}}))})})}},"./packages/packages/core/frontend-handlers/src/lifecycle-events.ts":function(e,t,n){n.r(t),n.d(t,{onElementDestroy:function(){return onElementDestroy},onElementRender:function(){return onElementRender}});var r=n("./packages/packages/core/frontend-handlers/src/handlers-registry.ts");const s=new Map,a="elementor/element/rendered",o="elementor/element/destroyed",onElementRender=({element:e,elementType:t,elementId:n})=>{const i=new AbortController,l=[],dispatchRenderedEvent=()=>{e.dispatchEvent(new CustomEvent(a,{bubbles:!0,detail:{element:e,elementType:t,elementId:n}}))};e.isConnected?dispatchRenderedEvent():requestAnimationFrame(()=>{dispatchRenderedEvent()}),r.handlers.has(t)&&(Array.from(r.handlers.get(t)?.values()??[]).forEach(t=>{const n=e.getAttribute("data-e-settings"),r=t({element:e,signal:i.signal,settings:n?JSON.parse(n):{},listenToChildren:t=>({render:n=>{const listener=e=>{const{elementType:r}=e.detail;t.includes(r)&&n()};e.addEventListener(a,listener,{signal:i.signal}),e.addEventListener(o,listener,{signal:i.signal})}})});"function"==typeof r&&l.push(r)}),s.has(t)||s.set(t,new Map),s.get(t)?.set(n,()=>{i.abort(),l.forEach(e=>e())}))},onElementDestroy=({elementType:e,elementId:t,element:n})=>{const r=s.get(e)?.get(t);var a;n&&(a={element:n,elementType:e,elementId:t}).element.dispatchEvent(new CustomEvent(o,{bubbles:!0,detail:a})),r&&(r(),s.get(e)?.delete(t),0===s.get(e)?.size&&s.delete(e))}}},t={};function __webpack_require__(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,__webpack_require__),s.exports}__webpack_require__.d=function(e,t){for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},__webpack_require__.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};!function(){__webpack_require__.r(n),__webpack_require__.d(n,{init:function(){return t.init},register:function(){return e.register},unregister:function(){return e.unregister}});var e=__webpack_require__("./packages/packages/core/frontend-handlers/src/handlers-registry.ts"),t=__webpack_require__("./packages/packages/core/frontend-handlers/src/init.ts")}(),(window.elementorV2=window.elementorV2||{}).frontendHandlers=n}(),window.elementorV2.frontendHandlers?.init?.();
//# sourceMappingURL=frontend-handlers.js.map