PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.1
Elementor Website Builder – more than just a page builder v4.3.1
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | assets/js/editor-one-menu.js +1150 -720 4.1.0 → 4.3.1 View file →
@@ -1,737 +1,1167 @@
1 -/******/ (() => { // webpackBootstrap
2 -/******/ var __webpack_modules__ = ({
1 +(function() {
3 2
4 -/***/ "../modules/editor-one/assets/js/admin-menu/classes/flyout-interaction-handler.js":
5 -/*!****************************************************************************************!*\
6 - !*** ../modules/editor-one/assets/js/admin-menu/classes/flyout-interaction-handler.js ***!
7 - \****************************************************************************************/
8 -/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3 +//#region \0rolldown/runtime.js
4 + var __defProp = Object.defineProperty;
5 + var __name = (target, value) => __defProp(target, "name", {
6 + value,
7 + configurable: true
8 + });
9 9
10 -"use strict";
10 +//#endregion
11 11
12 +//#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js
13 + function _classCallCheck(a, n) {
14 + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
15 + }
12 16
13 -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
14 -Object.defineProperty(exports, "__esModule", ({
15 - value: true
16 -}));
17 -exports.FlyoutInteractionHandler = void 0;
18 -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
19 -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
20 -var FlyoutInteractionHandler = exports.FlyoutInteractionHandler = /*#__PURE__*/function () {
21 - function FlyoutInteractionHandler() {
22 - (0, _classCallCheck2.default)(this, FlyoutInteractionHandler);
23 - this.activeMenu = null;
24 - this.activeParent = null;
25 - this.closeTimeout = null;
26 - this.lastMousePos = null;
27 - this.exitPoint = null;
28 - this.mouseMoveHandler = null;
29 - }
30 - return (0, _createClass2.default)(FlyoutInteractionHandler, [{
31 - key: "handle",
32 - value: function handle() {
33 - this.setupFlyoutMenus();
34 - this.setupMobileSupport();
35 - }
36 - }, {
37 - key: "setupFlyoutMenus",
38 - value: function setupFlyoutMenus() {
39 - var _this = this;
40 - var menuItems = document.querySelectorAll('#adminmenu li.elementor-has-flyout');
41 - menuItems.forEach(function (parentLi) {
42 - var flyoutMenu = parentLi.querySelector('.elementor-submenu-flyout');
43 - if (!flyoutMenu) {
44 - return;
45 - }
46 - _this.attachHoverEvents(parentLi, flyoutMenu);
47 - _this.attachFocusEvents(parentLi, flyoutMenu);
48 - _this.attachKeyboardEvents(parentLi, flyoutMenu);
49 - });
50 - }
51 - }, {
52 - key: "attachHoverEvents",
53 - value: function attachHoverEvents(parentLi, flyoutMenu) {
54 - var _this2 = this;
55 - parentLi.addEventListener('mouseenter', function () {
56 - // If moving to a new parent that is NOT part of the current active tree
57 - if (_this2.activeMenu && !_this2.activeMenu.contains(parentLi) && _this2.activeMenu !== flyoutMenu) {
58 - // If we are moving to a sibling or unrelated menu, close the current one immediately
59 - // UNLESS we are in the safe zone triangle of the parent
60 - if (!_this2.isCursorInSafeZone()) {
61 - _this2.hideFlyout(_this2.activeMenu);
62 - }
63 - }
64 - _this2.clearCloseTimeout();
65 - _this2.showFlyout(parentLi, flyoutMenu);
66 - });
67 - parentLi.addEventListener('mouseleave', function (event) {
68 - _this2.exitPoint = {
69 - x: event.clientX,
70 - y: event.clientY
71 - };
72 - _this2.scheduleClose(parentLi, flyoutMenu);
73 - });
74 - flyoutMenu.addEventListener('mouseenter', function () {
75 - _this2.clearCloseTimeout();
76 - _this2.stopMouseTracking();
77 - });
78 - flyoutMenu.addEventListener('mouseleave', function (event) {
79 - _this2.exitPoint = {
80 - x: event.clientX,
81 - y: event.clientY
82 - };
83 - _this2.scheduleClose(parentLi, flyoutMenu);
84 - });
85 - }
86 - }, {
87 - key: "attachFocusEvents",
88 - value: function attachFocusEvents(parentLi, flyoutMenu) {
89 - var _this3 = this;
90 - var parentLink = parentLi.querySelector(':scope > a');
91 - if (parentLink) {
92 - parentLink.addEventListener('focus', function () {
93 - _this3.showFlyout(parentLi, flyoutMenu);
94 - });
95 - }
96 - flyoutMenu.addEventListener('focusout', function (event) {
97 - if (!parentLi.contains(event.relatedTarget)) {
98 - _this3.hideFlyout(flyoutMenu);
99 - }
100 - });
101 - }
102 - }, {
103 - key: "attachKeyboardEvents",
104 - value: function attachKeyboardEvents(parentLi, flyoutMenu) {
105 - var _this4 = this;
106 - parentLi.addEventListener('keydown', function (event) {
107 - _this4.handleKeyNavigation(event, parentLi, flyoutMenu);
108 - });
109 - }
110 - }, {
111 - key: "showFlyout",
112 - value: function showFlyout(parentLi, flyoutMenu) {
113 - if (this.activeMenu && this.activeMenu !== flyoutMenu) {
114 - this.hideFlyout(this.activeMenu);
115 - }
116 - this.exitPoint = null;
117 - this.positionFlyout(parentLi, flyoutMenu);
118 - flyoutMenu.classList.add('elementor-submenu-flyout-visible');
119 - this.activeMenu = flyoutMenu;
120 - this.activeParent = parentLi;
121 - }
122 - }, {
123 - key: "hideFlyout",
124 - value: function hideFlyout(flyoutMenu) {
125 - flyoutMenu.classList.remove('elementor-submenu-flyout-visible');
126 - if (this.activeMenu === flyoutMenu) {
127 - this.activeMenu = null;
128 - this.activeParent = null;
129 - this.exitPoint = null;
130 - this.stopMouseTracking();
131 - }
132 - }
133 - }, {
134 - key: "scheduleClose",
135 - value: function scheduleClose(parentLi, flyoutMenu) {
136 - var _this5 = this;
137 - this.clearCloseTimeout();
138 - this.startMouseTracking(parentLi, flyoutMenu);
139 - this.closeTimeout = setTimeout(function () {
140 - _this5.checkAndClose(flyoutMenu);
141 - }, 300);
142 - }
143 - }, {
144 - key: "checkAndClose",
145 - value: function checkAndClose(flyoutMenu) {
146 - var _this6 = this;
147 - if (!this.activeMenu) {
148 - return;
149 - }
150 - if (!this.isCursorInSafeZone()) {
151 - this.hideFlyout(flyoutMenu);
152 - } else {
153 - this.closeTimeout = setTimeout(function () {
154 - _this6.checkAndClose(flyoutMenu);
155 - }, 300);
156 - }
157 - }
158 - }, {
159 - key: "clearCloseTimeout",
160 - value: function clearCloseTimeout() {
161 - if (this.closeTimeout) {
162 - clearTimeout(this.closeTimeout);
163 - this.closeTimeout = null;
164 - }
165 - }
166 - }, {
167 - key: "startMouseTracking",
168 - value: function startMouseTracking() {
169 - var _this7 = this;
170 - this.stopMouseTracking();
171 - this.mouseMoveHandler = function (event) {
172 - _this7.lastMousePos = {
173 - x: event.clientX,
174 - y: event.clientY
175 - };
176 - };
177 - document.addEventListener('mousemove', this.mouseMoveHandler);
178 - }
179 - }, {
180 - key: "stopMouseTracking",
181 - value: function stopMouseTracking() {
182 - if (this.mouseMoveHandler) {
183 - document.removeEventListener('mousemove', this.mouseMoveHandler);
184 - this.mouseMoveHandler = null;
185 - }
186 - this.lastMousePos = null;
187 - }
188 - }, {
189 - key: "isCursorInSafeZone",
190 - value: function isCursorInSafeZone() {
191 - if (!this.lastMousePos || !this.activeMenu || !this.activeParent) {
192 - return false;
193 - }
194 - var cursor = this.lastMousePos;
195 - var parentRect = this.activeParent.getBoundingClientRect();
196 - if (this.isPointInRect(cursor, parentRect)) {
197 - return true;
198 - }
199 - var flyoutRect = this.activeMenu.getBoundingClientRect();
200 - if (this.isPointInRect(cursor, flyoutRect)) {
201 - return true;
202 - }
203 - return this.isPointInTriangle(cursor, parentRect, flyoutRect);
204 - }
205 - }, {
206 - key: "isPointInRect",
207 - value: function isPointInRect(point, rect) {
208 - return point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;
209 - }
210 - }, {
211 - key: "isPointInTriangle",
212 - value: function isPointInTriangle(cursor, parentRect, flyoutRect) {
213 - var exitX = this.exitPoint ? this.exitPoint.x : parentRect.right;
214 - var distParent = Math.abs(exitX - parentRect.right);
215 - var distFlyout = Math.abs(exitX - flyoutRect.left);
216 - var triangleApex, baseTop, baseBottom;
17 +//#endregion
18 +//#region node_modules/@babel/runtime/helpers/esm/typeof.js
19 + function _typeof(o) {
20 + "@babel/helpers - typeof";
21 + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
22 + return typeof o;
23 + } : function(o) {
24 + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
25 + }, _typeof(o);
26 + }
217 27
218 - // Determine direction: Moving towards Flyout (default) or towards Parent (backwards)
219 - if (distParent < distFlyout) {
220 - // Moving towards Flyout
221 - triangleApex = this.exitPoint || {
222 - x: parentRect.right,
223 - y: parentRect.top + parentRect.height / 2
224 - };
225 - baseTop = {
226 - x: flyoutRect.left,
227 - y: flyoutRect.top - 100
228 - };
229 - baseBottom = {
230 - x: flyoutRect.left,
231 - y: flyoutRect.bottom + 100
232 - };
233 - } else {
234 - // Moving towards Parent
235 - triangleApex = this.exitPoint || {
236 - x: flyoutRect.left,
237 - y: flyoutRect.top + flyoutRect.height / 2
238 - };
239 - baseTop = {
240 - x: parentRect.right,
241 - y: parentRect.top - 100
242 - };
243 - baseBottom = {
244 - x: parentRect.right,
245 - y: parentRect.bottom + 100
246 - };
247 - }
248 - return this.pointInTriangle(cursor, triangleApex, baseTop, baseBottom);
249 - }
250 - }, {
251 - key: "pointInTriangle",
252 - value: function pointInTriangle(p, v1, v2, v3) {
253 - var sign = function sign(p1, p2, p3) {
254 - return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
255 - };
256 - var d1 = sign(p, v1, v2);
257 - var d2 = sign(p, v2, v3);
258 - var d3 = sign(p, v3, v1);
259 - var hasNeg = 0 > d1 || 0 > d2 || 0 > d3;
260 - var hasPos = 0 < d1 || 0 < d2 || 0 < d3;
261 - return !(hasNeg && hasPos);
262 - }
263 - }, {
264 - key: "positionFlyout",
265 - value: function positionFlyout(parentLi, flyoutMenu) {
266 - var windowHeight = window.innerHeight;
267 - var flyoutHeight = flyoutMenu.offsetHeight;
268 - var parentRect = parentLi.getBoundingClientRect();
269 - var relativeTop = parentRect.top;
270 - if (relativeTop + flyoutHeight > windowHeight) {
271 - var newTop = windowHeight - flyoutHeight - relativeTop;
272 - if (newTop < -relativeTop) {
273 - newTop = -relativeTop + 10;
274 - }
275 - flyoutMenu.style.top = newTop + 'px';
276 - } else {
277 - delete flyoutMenu.style.top;
278 - }
279 - }
280 - }, {
281 - key: "handleKeyNavigation",
282 - value: function handleKeyNavigation(event, parentLi, flyoutMenu) {
283 - var allLinks = flyoutMenu.querySelectorAll('a');
284 - var focusedLink = flyoutMenu.querySelector('a:focus');
285 - var currentIndex = Array.from(allLinks).indexOf(focusedLink);
286 - var isVisible = flyoutMenu.classList.contains('elementor-submenu-flyout-visible');
287 - switch (event.key) {
288 - case 'ArrowRight':
289 - if (!isVisible) {
290 - var _allLinks$;
291 - event.preventDefault();
292 - this.showFlyout(parentLi, flyoutMenu);
293 - (_allLinks$ = allLinks[0]) === null || _allLinks$ === void 0 || _allLinks$.focus();
294 - }
295 - break;
296 - case 'ArrowLeft':
297 - if (isVisible) {
298 - var _parentLi$querySelect;
299 - event.preventDefault();
300 - this.hideFlyout(flyoutMenu);
301 - (_parentLi$querySelect = parentLi.querySelector(':scope > a')) === null || _parentLi$querySelect === void 0 || _parentLi$querySelect.focus();
302 - }
303 - break;
304 - case 'ArrowDown':
305 - if (isVisible && currentIndex >= 0) {
306 - var _allLinks$nextIndex;
307 - event.preventDefault();
308 - var nextIndex = (currentIndex + 1) % allLinks.length;
309 - (_allLinks$nextIndex = allLinks[nextIndex]) === null || _allLinks$nextIndex === void 0 || _allLinks$nextIndex.focus();
310 - }
311 - break;
312 - case 'ArrowUp':
313 - if (isVisible && currentIndex >= 0) {
314 - var _allLinks$prevIndex;
315 - event.preventDefault();
316 - var prevIndex = (currentIndex - 1 + allLinks.length) % allLinks.length;
317 - (_allLinks$prevIndex = allLinks[prevIndex]) === null || _allLinks$prevIndex === void 0 || _allLinks$prevIndex.focus();
318 - }
319 - break;
320 - case 'Escape':
321 - if (isVisible) {
322 - var _parentLi$querySelect2;
323 - event.preventDefault();
324 - this.hideFlyout(flyoutMenu);
325 - (_parentLi$querySelect2 = parentLi.querySelector(':scope > a')) === null || _parentLi$querySelect2 === void 0 || _parentLi$querySelect2.focus();
326 - }
327 - break;
328 - }
329 - }
330 - }, {
331 - key: "setupMobileSupport",
332 - value: function setupMobileSupport() {
333 - var _this8 = this;
334 - if (window.innerWidth > 782) {
335 - return;
336 - }
337 - var menuLinks = document.querySelectorAll('#adminmenu li.elementor-has-flyout > a');
338 - menuLinks.forEach(function (link) {
339 - link.addEventListener('click', function (event) {
340 - _this8.handleMobileClick(event, link);
341 - });
342 - });
343 - document.addEventListener('click', function (event) {
344 - _this8.handleDocumentClick(event);
345 - });
346 - }
347 - }, {
348 - key: "handleMobileClick",
349 - value: function handleMobileClick(event, link) {
350 - var parentLi = link.parentElement;
351 - var flyoutMenu = parentLi.querySelector('.elementor-submenu-flyout');
352 - if (!flyoutMenu) {
353 - return;
354 - }
355 - if (parentLi.classList.contains('elementor-flyout-open')) {
356 - return;
357 - }
358 - event.preventDefault();
359 - document.querySelectorAll('#adminmenu li.elementor-has-flyout').forEach(function (item) {
360 - item.classList.remove('elementor-flyout-open');
361 - });
362 - parentLi.classList.add('elementor-flyout-open');
363 - }
364 - }, {
365 - key: "handleDocumentClick",
366 - value: function handleDocumentClick(event) {
367 - if (!event.target.closest('#adminmenu li.elementor-has-flyout')) {
368 - document.querySelectorAll('#adminmenu li.elementor-has-flyout').forEach(function (item) {
369 - item.classList.remove('elementor-flyout-open');
370 - });
371 - }
372 - }
373 - }]);
374 -}();
28 +//#endregion
29 +//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js
30 + function toPrimitive(t, r) {
31 + if ("object" != _typeof(t) || !t) return t;
32 + var e = t[Symbol.toPrimitive];
33 + if (void 0 !== e) {
34 + var i = e.call(t, r || "default");
35 + if ("object" != _typeof(i)) return i;
36 + throw new TypeError("@@toPrimitive must return a primitive value.");
37 + }
38 + return ("string" === r ? String : Number)(t);
39 + }
375 40
376 -/***/ }),
41 +//#endregion
42 +//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
43 + function toPropertyKey(t) {
44 + var i = toPrimitive(t, "string");
45 + return "symbol" == _typeof(i) ? i : i + "";
46 + }
377 47
378 -/***/ "../modules/editor-one/assets/js/admin-menu/classes/flyout-menu-renderer.js":
379 -/*!**********************************************************************************!*\
380 - !*** ../modules/editor-one/assets/js/admin-menu/classes/flyout-menu-renderer.js ***!
381 - \**********************************************************************************/
382 -/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
48 +//#endregion
49 +//#region node_modules/@babel/runtime/helpers/esm/createClass.js
50 + function _defineProperties(e, r) {
51 + for (var t = 0; t < r.length; t++) {
52 + var o = r[t];
53 + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
54 + }
55 + }
56 + function _createClass(e, r, t) {
57 + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e;
58 + }
383 59
384 -"use strict";
60 +//#endregion
61 +//#region modules/editor-one/assets/js/admin-menu/classes/flyout-menu-renderer.js
62 + var FlyoutMenuRenderer = /*#__PURE__*/ function() {
63 + function FlyoutMenuRenderer(config) {
64 + _classCallCheck(this, FlyoutMenuRenderer);
65 + this.config = config;
66 + }
67 + return _createClass(FlyoutMenuRenderer, [{
68 + key: "render",
69 + value: function render() {
70 + var editorFlyout = this.config.editorFlyout;
71 + if (!editorFlyout || !editorFlyout.items || !editorFlyout.items.length) return false;
72 + var editorLi = this.findEditorInMenu("#toplevel_page_elementor-home");
73 + if (!editorLi) return false;
74 + editorLi.classList.add("elementor-has-flyout");
75 + var editorFlyoutUl = document.createElement("ul");
76 + editorFlyoutUl.className = "elementor-submenu-flyout elementor-level-3";
77 + editorFlyout.items.forEach(function(item) {
78 + if (item.has_divider_before) {
79 + var dividerLi = document.createElement("li");
80 + dividerLi.className = "elementor-flyout-divider";
81 + dividerLi.setAttribute("role", "separator");
82 + editorFlyoutUl.appendChild(dividerLi);
83 + }
84 + var li = document.createElement("li");
85 + li.setAttribute("data-group-id", item.group_id || "");
86 + li.setAttribute("data-slug", item.slug || "");
87 + var a = document.createElement("a");
88 + a.href = item.url;
89 + a.textContent = item.label;
90 + li.appendChild(a);
91 + editorFlyoutUl.appendChild(li);
92 + });
93 + editorLi.appendChild(editorFlyoutUl);
94 + return true;
95 + }
96 + }, {
97 + key: "findEditorInMenu",
98 + value: function findEditorInMenu(menuSelector) {
99 + var menuItem = document.querySelector(menuSelector);
100 + if (!menuItem) return null;
101 + var submenu = menuItem.querySelector(".wp-submenu");
102 + if (!submenu) return null;
103 + var editorItem = submenu.querySelector("a[href$=\"page=elementor\"]");
104 + if (!editorItem) return null;
105 + return editorItem.closest("li");
106 + }
107 + }]);
108 + }();
385 109
110 +//#endregion
111 +//#region modules/editor-one/assets/js/admin-menu/classes/sidebar-menu-handler.js
112 + var SidebarMenuHandler = /*#__PURE__*/ function() {
113 + function SidebarMenuHandler() {
114 + _classCallCheck(this, SidebarMenuHandler);
115 + this.elementorHomeMenu = this.findElementorHomeMenu();
116 + if (this.elementorHomeMenu) {
117 + this.deactivateOtherMenus();
118 + this.activateElementorMenu();
119 + this.highlightSubmenu();
120 + }
121 + }
122 + return _createClass(SidebarMenuHandler, [
123 + {
124 + key: "findElementorHomeMenu",
125 + value: function findElementorHomeMenu() {
126 + return document.querySelector("#toplevel_page_elementor-home");
127 + }
128 + },
129 + {
130 + key: "deactivateOtherMenus",
131 + value: function deactivateOtherMenus() {
132 + var _this = this;
133 + document.querySelectorAll("#adminmenu li.wp-has-current-submenu").forEach(function(item) {
134 + if (item !== _this.elementorHomeMenu) {
135 + item.classList.remove("wp-has-current-submenu", "wp-menu-open", "selected");
136 + item.classList.add("wp-not-current-submenu");
137 + var link = item.querySelector(":scope > a");
138 + if (link) link.classList.remove("wp-has-current-submenu", "wp-menu-open", "current");
139 + }
140 + });
141 + }
142 + },
143 + {
144 + key: "activateElementorMenu",
145 + value: function activateElementorMenu() {
146 + this.elementorHomeMenu.classList.remove("wp-not-current-submenu");
147 + this.elementorHomeMenu.classList.add("wp-has-current-submenu", "wp-menu-open", "selected");
148 + var elementorLink = this.elementorHomeMenu.querySelector(":scope > a.menu-top");
149 + if (elementorLink) elementorLink.classList.add("wp-has-current-submenu", "wp-menu-open");
150 + }
151 + },
152 + {
153 + key: "highlightSubmenu",
154 + value: function highlightSubmenu() {
155 + var page = new URL(window.location.href).searchParams.get("page");
156 + var targetSlug = "elementor";
157 + if ("elementor" === page || "elementor-home" === page) targetSlug = "elementor";
158 + else if ("e-form-submissions" === page) targetSlug = "e-form-submissions";
159 + else if ("elementor-mcp" === page) targetSlug = "elementor-mcp";
160 + else if ("elementor-theme-builder" === page) targetSlug = "elementor-theme-builder";
161 + this.elementorHomeMenu.querySelectorAll(".wp-submenu li").forEach(function(item) {
162 + var link = item.querySelector("a");
163 + if (!link) return;
164 + item.classList.remove("current");
165 + link.classList.remove("current");
166 + link.setAttribute("aria-current", "");
167 + if (new URL(link.href, window.location.origin).searchParams.get("page") === targetSlug) {
168 + item.classList.add("current");
169 + link.classList.add("current");
170 + link.setAttribute("aria-current", "page");
171 + }
172 + });
173 + }
174 + }
175 + ]);
176 + }();
386 177
387 -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
388 -Object.defineProperty(exports, "__esModule", ({
389 - value: true
390 -}));
391 -exports.FlyoutMenuRenderer = void 0;
392 -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
393 -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
394 -var FlyoutMenuRenderer = exports.FlyoutMenuRenderer = /*#__PURE__*/function () {
395 - function FlyoutMenuRenderer(config) {
396 - (0, _classCallCheck2.default)(this, FlyoutMenuRenderer);
397 - this.config = config;
398 - }
399 - return (0, _createClass2.default)(FlyoutMenuRenderer, [{
400 - key: "render",
401 - value: function render() {
402 - var editorFlyout = this.config.editorFlyout;
403 - if (!editorFlyout || !editorFlyout.items || !editorFlyout.items.length) {
404 - return false;
405 - }
406 - var editorLi = this.findEditorInMenu("#toplevel_page_elementor-home");
407 - if (!editorLi) {
408 - return false;
409 - }
410 - editorLi.classList.add('elementor-has-flyout');
411 - var editorFlyoutUl = document.createElement('ul');
412 - editorFlyoutUl.className = 'elementor-submenu-flyout elementor-level-3';
413 - editorFlyout.items.forEach(function (item) {
414 - if (item.has_divider_before) {
415 - var dividerLi = document.createElement('li');
416 - dividerLi.className = 'elementor-flyout-divider';
417 - dividerLi.setAttribute('role', 'separator');
418 - editorFlyoutUl.appendChild(dividerLi);
419 - }
420 - var li = document.createElement('li');
421 - li.setAttribute('data-group-id', item.group_id || '');
422 - var a = document.createElement('a');
423 - a.href = item.url;
424 - a.textContent = item.label;
425 - li.appendChild(a);
426 - editorFlyoutUl.appendChild(li);
427 - });
428 - editorLi.appendChild(editorFlyoutUl);
429 - return true;
430 - }
431 - }, {
432 - key: "findEditorInMenu",
433 - value: function findEditorInMenu(menuSelector) {
434 - var menuItem = document.querySelector(menuSelector);
435 - if (!menuItem) {
436 - return null;
437 - }
438 - var submenu = menuItem.querySelector('.wp-submenu');
439 - if (!submenu) {
440 - return null;
441 - }
442 - var editorItem = submenu.querySelector('a[href$="page=elementor"]');
443 - if (!editorItem) {
444 - return null;
445 - }
446 - return editorItem.closest('li');
447 - }
448 - }]);
449 -}();
178 +//#endregion
179 +//#region node_modules/@babel/runtime/helpers/esm/defineProperty.js
180 + function _defineProperty(e, r, t) {
181 + return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
182 + value: t,
183 + enumerable: !0,
184 + configurable: !0,
185 + writable: !0
186 + }) : e[r] = t, e;
187 + }
450 188
451 -/***/ }),
189 +//#endregion
190 +//#region assets/dev/js/editor/utils/editor-one-events.js
191 + function ownKeys(e, r) {
192 + var t = Object.keys(e);
193 + if (Object.getOwnPropertySymbols) {
194 + var o = Object.getOwnPropertySymbols(e);
195 + r && (o = o.filter(function(r) {
196 + return Object.getOwnPropertyDescriptor(e, r).enumerable;
197 + })), t.push.apply(t, o);
198 + }
199 + return t;
200 + }
201 + function _objectSpread(e) {
202 + for (var r = 1; r < arguments.length; r++) {
203 + var t = null != arguments[r] ? arguments[r] : {};
204 + r % 2 ? ownKeys(Object(t), !0).forEach(function(r) {
205 + _defineProperty(e, r, t[r]);
206 + }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r) {
207 + Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
208 + });
209 + }
210 + return e;
211 + }
212 + var EditorOneEventManager = /*#__PURE__*/ function() {
213 + function EditorOneEventManager() {
214 + _classCallCheck(this, EditorOneEventManager);
215 + }
216 + return _createClass(EditorOneEventManager, null, [
217 + {
218 + key: "getEventsManager",
219 + value: function getEventsManager() {
220 + var _elementorCommon;
221 + return (_elementorCommon = elementorCommon) === null || _elementorCommon === void 0 ? void 0 : _elementorCommon.eventsManager;
222 + }
223 + },
224 + {
225 + key: "getConfig",
226 + value: function getConfig() {
227 + var _this$getEventsManage;
228 + return (_this$getEventsManage = this.getEventsManager()) === null || _this$getEventsManage === void 0 ? void 0 : _this$getEventsManage.config;
229 + }
230 + },
231 + {
232 + key: "canSendEvents",
233 + value: function canSendEvents() {
234 + var _elementorCommon2;
235 + return ((_elementorCommon2 = elementorCommon) === null || _elementorCommon2 === void 0 || (_elementorCommon2 = _elementorCommon2.config) === null || _elementorCommon2 === void 0 || (_elementorCommon2 = _elementorCommon2.editor_events) === null || _elementorCommon2 === void 0 ? void 0 : _elementorCommon2.can_send_events) || false;
236 + }
237 + },
238 + {
239 + key: "isEventsManagerAvailable",
240 + value: function isEventsManagerAvailable() {
241 + var eventsManager = this.getEventsManager();
242 + return eventsManager && "function" === typeof eventsManager.dispatchEvent;
243 + }
244 + },
245 + {
246 + key: "dispatchEvent",
247 + value: function dispatchEvent(eventName, payload) {
248 + try {
249 + if (!this.isEventsManagerAvailable() || !this.canSendEvents()) return false;
250 + this.getEventsManager().dispatchEvent(eventName, payload);
251 + return true;
252 + } catch (error) {
253 + return false;
254 + }
255 + }
256 + },
257 + {
258 + key: "toLowerSnake",
259 + value: function toLowerSnake(value) {
260 + if (!value || "string" !== typeof value) return value;
261 + return value.replace(/\s+/g, "_").toLowerCase();
262 + }
263 + },
264 + {
265 + key: "decodeHtmlEntities",
266 + value: function decodeHtmlEntities(text) {
267 + if (!text || "string" !== typeof text) return text;
268 + return new DOMParser().parseFromString(text, "text/html").body.textContent || text;
269 + }
270 + },
271 + {
272 + key: "isInEditorContext",
273 + value: function isInEditorContext() {
274 + var _window$elementor;
275 + return "undefined" !== typeof window.elementor && !!((_window$elementor = window.elementor) !== null && _window$elementor !== void 0 && _window$elementor.documents);
276 + }
277 + },
278 + {
279 + key: "getFinderContext",
280 + value: function getFinderContext() {
281 + var _config$appTypes;
282 + var _config$appTypes2;
283 + var _config$locations;
284 + var _config$locations2;
285 + var config = this.getConfig();
286 + var isEditor = this.isInEditorContext();
287 + return {
288 + windowName: isEditor ? config === null || config === void 0 || (_config$appTypes = config.appTypes) === null || _config$appTypes === void 0 ? void 0 : _config$appTypes.editor : config === null || config === void 0 || (_config$appTypes2 = config.appTypes) === null || _config$appTypes2 === void 0 ? void 0 : _config$appTypes2.wpAdmin,
289 + targetLocation: this.toLowerSnake(isEditor ? config === null || config === void 0 || (_config$locations = config.locations) === null || _config$locations === void 0 ? void 0 : _config$locations.topBar : config === null || config === void 0 || (_config$locations2 = config.locations) === null || _config$locations2 === void 0 ? void 0 : _config$locations2.sidebar)
290 + };
291 + }
292 + },
293 + {
294 + key: "createBasePayload",
295 + value: function createBasePayload() {
296 + var _config$appTypes$edit;
297 + var _config$appTypes3;
298 + var overrides = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
299 + var config = this.getConfig();
300 + return _objectSpread({ window_name: (_config$appTypes$edit = config === null || config === void 0 || (_config$appTypes3 = config.appTypes) === null || _config$appTypes3 === void 0 ? void 0 : _config$appTypes3.editor) !== null && _config$appTypes$edit !== void 0 ? _config$appTypes$edit : "editor" }, overrides);
301 + }
302 + },
303 + {
304 + key: "sendTopBarPublishDropdown",
305 + value: function sendTopBarPublishDropdown(targetName) {
306 + var _config$names;
307 + var _config$triggers;
308 + var _config$targetTypes;
309 + var _config$interactionRe;
310 + var _config$locations3;
311 + var _config$secondaryLoca;
312 + var _config$targetTypes2;
313 + var config = this.getConfig();
314 + return this.dispatchEvent(config === null || config === void 0 || (_config$names = config.names) === null || _config$names === void 0 || (_config$names = _config$names.editorOne) === null || _config$names === void 0 ? void 0 : _config$names.topBarPublishDropdown, this.createBasePayload({
315 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers = config.triggers) === null || _config$triggers === void 0 ? void 0 : _config$triggers.click),
316 + target_type: config === null || config === void 0 || (_config$targetTypes = config.targetTypes) === null || _config$targetTypes === void 0 ? void 0 : _config$targetTypes.dropdownItem,
317 + target_name: targetName,
318 + interaction_result: config === null || config === void 0 || (_config$interactionRe = config.interactionResults) === null || _config$interactionRe === void 0 ? void 0 : _config$interactionRe.actionSelected,
319 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations3 = config.locations) === null || _config$locations3 === void 0 ? void 0 : _config$locations3.topBar),
320 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca = config.secondaryLocations) === null || _config$secondaryLoca === void 0 ? void 0 : _config$secondaryLoca.publishDropdown),
321 + location_l2: config === null || config === void 0 || (_config$targetTypes2 = config.targetTypes) === null || _config$targetTypes2 === void 0 ? void 0 : _config$targetTypes2.dropdownItem,
322 + interaction_description: "User selected an action from the publish dropdown"
323 + }));
324 + }
325 + },
326 + {
327 + key: "sendTopBarPageList",
328 + value: function sendTopBarPageList(targetName) {
329 + var _config$names2;
330 + var _config$triggers2;
331 + var _config$targetTypes3;
332 + var _config$interactionRe2;
333 + var _config$interactionRe3;
334 + var _config$locations4;
335 + var _config$secondaryLoca2;
336 + var _config$targetTypes4;
337 + var isCreate = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
338 + var config = this.getConfig();
339 + return this.dispatchEvent(config === null || config === void 0 || (_config$names2 = config.names) === null || _config$names2 === void 0 || (_config$names2 = _config$names2.editorOne) === null || _config$names2 === void 0 ? void 0 : _config$names2.topBarPageList, this.createBasePayload({
340 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers2 = config.triggers) === null || _config$triggers2 === void 0 ? void 0 : _config$triggers2.click),
341 + target_type: config === null || config === void 0 || (_config$targetTypes3 = config.targetTypes) === null || _config$targetTypes3 === void 0 ? void 0 : _config$targetTypes3.dropdownItem,
342 + target_name: targetName,
343 + interaction_result: isCreate ? config === null || config === void 0 || (_config$interactionRe2 = config.interactionResults) === null || _config$interactionRe2 === void 0 ? void 0 : _config$interactionRe2.create : config === null || config === void 0 || (_config$interactionRe3 = config.interactionResults) === null || _config$interactionRe3 === void 0 ? void 0 : _config$interactionRe3.navigate,
344 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations4 = config.locations) === null || _config$locations4 === void 0 ? void 0 : _config$locations4.topBar),
345 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca2 = config.secondaryLocations) === null || _config$secondaryLoca2 === void 0 ? void 0 : _config$secondaryLoca2.pageListDropdown),
346 + location_l2: config === null || config === void 0 || (_config$targetTypes4 = config.targetTypes) === null || _config$targetTypes4 === void 0 ? void 0 : _config$targetTypes4.dropdownItem,
347 + interaction_description: "User selected an action from the page list dropdown"
348 + }));
349 + }
350 + },
351 + {
352 + key: "sendSiteSettingsSession",
353 + value: function sendSiteSettingsSession(_ref) {
354 + var _config$names3;
355 + var _config$triggers3;
356 + var _config$interactionRe4;
357 + var _config$locations5;
358 + var _config$secondaryLoca3;
359 + var targetType = _ref.targetType;
360 + var _ref$visitedItems = _ref.visitedItems;
361 + var visitedItems = _ref$visitedItems === void 0 ? [] : _ref$visitedItems;
362 + var _ref$savedItems = _ref.savedItems;
363 + var savedItems = _ref$savedItems === void 0 ? [] : _ref$savedItems;
364 + var state = _ref.state;
365 + var config = this.getConfig();
366 + return this.dispatchEvent(config === null || config === void 0 || (_config$names3 = config.names) === null || _config$names3 === void 0 || (_config$names3 = _config$names3.editorOne) === null || _config$names3 === void 0 ? void 0 : _config$names3.siteSettingsSession, this.createBasePayload({
367 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers3 = config.triggers) === null || _config$triggers3 === void 0 ? void 0 : _config$triggers3.click),
368 + target_type: targetType,
369 + target_name: "site_settings",
370 + interaction_result: config === null || config === void 0 || (_config$interactionRe4 = config.interactionResults) === null || _config$interactionRe4 === void 0 ? void 0 : _config$interactionRe4.sessionEnd,
371 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations5 = config.locations) === null || _config$locations5 === void 0 ? void 0 : _config$locations5.leftPanel),
372 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca3 = config.secondaryLocations) === null || _config$secondaryLoca3 === void 0 ? void 0 : _config$secondaryLoca3.siteSettings),
373 + interaction_description: "Records areas visited as part of the site setting session",
374 + metadata: {
375 + visited_items: visitedItems,
376 + saved_items: savedItems
377 + },
378 + state
379 + }));
380 + }
381 + },
382 + {
383 + key: "sendELibraryNav",
384 + value: function sendELibraryNav(tabName) {
385 + var _config$names4;
386 + var _config$triggers4;
387 + var _config$targetTypes5;
388 + var _config$interactionRe5;
389 + var _config$locations6;
390 + var _config$secondaryLoca4;
391 + var config = this.getConfig();
392 + return this.dispatchEvent(config === null || config === void 0 || (_config$names4 = config.names) === null || _config$names4 === void 0 || (_config$names4 = _config$names4.editorOne) === null || _config$names4 === void 0 ? void 0 : _config$names4.eLibraryNav, this.createBasePayload({
393 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers4 = config.triggers) === null || _config$triggers4 === void 0 ? void 0 : _config$triggers4.tabSelect),
394 + target_type: config === null || config === void 0 || (_config$targetTypes5 = config.targetTypes) === null || _config$targetTypes5 === void 0 ? void 0 : _config$targetTypes5.tab,
395 + target_name: this.toLowerSnake(tabName),
396 + interaction_result: config === null || config === void 0 || (_config$interactionRe5 = config.interactionResults) === null || _config$interactionRe5 === void 0 ? void 0 : _config$interactionRe5.tabChanged,
397 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations6 = config.locations) === null || _config$locations6 === void 0 ? void 0 : _config$locations6.elementorLibrary),
398 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca4 = config.secondaryLocations) === null || _config$secondaryLoca4 === void 0 ? void 0 : _config$secondaryLoca4.libraryTabs),
399 + interaction_description: "User navigates within elementor library"
400 + }));
401 + }
402 + },
403 + {
404 + key: "sendELibraryInsert",
405 + value: function sendELibraryInsert(_ref2) {
406 + var _config$triggers5;
407 + var _config$targetTypes6;
408 + var _config$interactionRe6;
409 + var _config$locations7;
410 + var _config$secondaryLoca5;
411 + var _config$names5;
412 + var assetId = _ref2.assetId;
413 + var assetName = _ref2.assetName;
414 + var libraryType = _ref2.libraryType;
415 + var _ref2$proRequired = _ref2.proRequired;
416 + var proRequired = _ref2$proRequired === void 0 ? false : _ref2$proRequired;
417 + var config = this.getConfig();
418 + var payload = this.createBasePayload({
419 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers5 = config.triggers) === null || _config$triggers5 === void 0 ? void 0 : _config$triggers5.insert),
420 + target_type: config === null || config === void 0 || (_config$targetTypes6 = config.targetTypes) === null || _config$targetTypes6 === void 0 ? void 0 : _config$targetTypes6.button,
421 + target_name: String(assetId),
422 + interaction_result: config === null || config === void 0 || (_config$interactionRe6 = config.interactionResults) === null || _config$interactionRe6 === void 0 ? void 0 : _config$interactionRe6.assetInserted,
423 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations7 = config.locations) === null || _config$locations7 === void 0 ? void 0 : _config$locations7.elementorLibrary),
424 + location_l1: this.toLowerSnake(libraryType),
425 + location_l2: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca5 = config.secondaryLocations) === null || _config$secondaryLoca5 === void 0 ? void 0 : _config$secondaryLoca5.assetCard),
426 + interaction_description: "User inserts block/pages from elementor library",
427 + metadata: {
428 + template_id: String(assetId),
429 + template_name: this.decodeHtmlEntities(assetName) || ""
430 + }
431 + });
432 + if (proRequired) payload.state = "pro_plan_required";
433 + return this.dispatchEvent(config === null || config === void 0 || (_config$names5 = config.names) === null || _config$names5 === void 0 || (_config$names5 = _config$names5.editorOne) === null || _config$names5 === void 0 ? void 0 : _config$names5.eLibraryInsert, payload);
434 + }
435 + },
436 + {
437 + key: "sendELibraryFavorite",
438 + value: function sendELibraryFavorite(_ref3) {
439 + var _config$triggers6;
440 + var _config$targetTypes7;
441 + var _config$interactionRe7;
442 + var _config$locations8;
443 + var _config$secondaryLoca6;
444 + var _config$names6;
445 + var assetId = _ref3.assetId;
446 + var assetName = _ref3.assetName;
447 + var libraryType = _ref3.libraryType;
448 + var isFavorite = _ref3.isFavorite;
449 + var _ref3$proRequired = _ref3.proRequired;
450 + var proRequired = _ref3$proRequired === void 0 ? false : _ref3$proRequired;
451 + var config = this.getConfig();
452 + var payload = this.createBasePayload({
453 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers6 = config.triggers) === null || _config$triggers6 === void 0 ? void 0 : _config$triggers6.click),
454 + target_type: config === null || config === void 0 || (_config$targetTypes7 = config.targetTypes) === null || _config$targetTypes7 === void 0 ? void 0 : _config$targetTypes7.toggle,
455 + target_name: String(assetId),
456 + interaction_result: config === null || config === void 0 || (_config$interactionRe7 = config.interactionResults) === null || _config$interactionRe7 === void 0 ? void 0 : _config$interactionRe7.assetFavorite,
457 + target_value: Boolean(isFavorite),
458 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations8 = config.locations) === null || _config$locations8 === void 0 ? void 0 : _config$locations8.elementorLibrary),
459 + location_l1: this.toLowerSnake(libraryType),
460 + location_l2: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca6 = config.secondaryLocations) === null || _config$secondaryLoca6 === void 0 ? void 0 : _config$secondaryLoca6.assetCard),
461 + interaction_description: "User favorite block/pages from elementor library",
462 + metadata: {
463 + template_id: String(assetId),
464 + template_name: this.decodeHtmlEntities(assetName) || ""
465 + }
466 + });
467 + if (proRequired) payload.state = "pro_plan_required";
468 + return this.dispatchEvent(config === null || config === void 0 || (_config$names6 = config.names) === null || _config$names6 === void 0 || (_config$names6 = _config$names6.editorOne) === null || _config$names6 === void 0 ? void 0 : _config$names6.eLibraryFavorite, payload);
469 + }
470 + },
471 + {
472 + key: "sendELibraryGenerateAi",
473 + value: function sendELibraryGenerateAi(_ref4) {
474 + var _config$names7;
475 + var _config$triggers7;
476 + var _config$targetTypes8;
477 + var _config$interactionRe8;
478 + var _config$locations9;
479 + var _config$secondaryLoca7;
480 + var assetId = _ref4.assetId;
481 + var assetName = _ref4.assetName;
482 + var libraryType = _ref4.libraryType;
483 + var config = this.getConfig();
484 + return this.dispatchEvent(config === null || config === void 0 || (_config$names7 = config.names) === null || _config$names7 === void 0 || (_config$names7 = _config$names7.editorOne) === null || _config$names7 === void 0 ? void 0 : _config$names7.eLibraryGenerateAi, this.createBasePayload({
485 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers7 = config.triggers) === null || _config$triggers7 === void 0 ? void 0 : _config$triggers7.click),
486 + target_type: config === null || config === void 0 || (_config$targetTypes8 = config.targetTypes) === null || _config$targetTypes8 === void 0 ? void 0 : _config$targetTypes8.button,
487 + target_name: String(assetId),
488 + interaction_result: config === null || config === void 0 || (_config$interactionRe8 = config.interactionResults) === null || _config$interactionRe8 === void 0 ? void 0 : _config$interactionRe8.aiGenerate,
489 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations9 = config.locations) === null || _config$locations9 === void 0 ? void 0 : _config$locations9.elementorLibrary),
490 + location_l1: this.toLowerSnake(libraryType),
491 + location_l2: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca7 = config.secondaryLocations) === null || _config$secondaryLoca7 === void 0 ? void 0 : _config$secondaryLoca7.assetCard),
492 + interaction_description: "User generated block/page based on a library asset",
493 + metadata: {
494 + template_id: String(assetId),
495 + template_name: this.decodeHtmlEntities(assetName) || ""
496 + }
497 + }));
498 + }
499 + },
500 + {
501 + key: "sendFinderSearchInput",
502 + value: function sendFinderSearchInput(_ref5) {
503 + var _config$triggers8;
504 + var _config$targetTypes9;
505 + var _config$interactionRe9;
506 + var _config$interactionRe0;
507 + var _config$secondaryLoca8;
508 + var _config$names8;
509 + var resultsCount = _ref5.resultsCount;
510 + var _ref5$searchTerm = _ref5.searchTerm;
511 + var searchTerm = _ref5$searchTerm === void 0 ? null : _ref5$searchTerm;
512 + var config = this.getConfig();
513 + var hasResults = resultsCount > 0;
514 + var finderContext = this.getFinderContext();
515 + var payload = this.createBasePayload({
516 + window_name: finderContext.windowName,
517 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers8 = config.triggers) === null || _config$triggers8 === void 0 ? void 0 : _config$triggers8.typing),
518 + target_type: config === null || config === void 0 || (_config$targetTypes9 = config.targetTypes) === null || _config$targetTypes9 === void 0 ? void 0 : _config$targetTypes9.searchInput,
519 + target_name: "finder",
520 + interaction_result: hasResults ? config === null || config === void 0 || (_config$interactionRe9 = config.interactionResults) === null || _config$interactionRe9 === void 0 ? void 0 : _config$interactionRe9.resultsUpdated : config === null || config === void 0 || (_config$interactionRe0 = config.interactionResults) === null || _config$interactionRe0 === void 0 ? void 0 : _config$interactionRe0.noResults,
521 + target_location: finderContext.targetLocation,
522 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca8 = config.secondaryLocations) === null || _config$secondaryLoca8 === void 0 ? void 0 : _config$secondaryLoca8.finder),
523 + interaction_description: "Finder search input, follows debounce behavior",
524 + metadata: { results_count: resultsCount }
525 + });
526 + if (!hasResults && searchTerm) payload.metadata.search_term = searchTerm;
527 + return this.dispatchEvent(config === null || config === void 0 || (_config$names8 = config.names) === null || _config$names8 === void 0 || (_config$names8 = _config$names8.editorOne) === null || _config$names8 === void 0 ? void 0 : _config$names8.finderSearchInput, payload);
528 + }
529 + },
530 + {
531 + key: "sendFinderResultSelect",
532 + value: function sendFinderResultSelect(choice) {
533 + var _config$names9;
534 + var _config$triggers9;
535 + var _config$targetTypes0;
536 + var _config$interactionRe1;
537 + var _config$secondaryLoca9;
538 + var _config$secondaryLoca0;
539 + var config = this.getConfig();
540 + var finderContext = this.getFinderContext();
541 + return this.dispatchEvent(config === null || config === void 0 || (_config$names9 = config.names) === null || _config$names9 === void 0 || (_config$names9 = _config$names9.editorOne) === null || _config$names9 === void 0 ? void 0 : _config$names9.finderResultSelect, this.createBasePayload({
542 + window_name: finderContext.windowName,
543 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers9 = config.triggers) === null || _config$triggers9 === void 0 ? void 0 : _config$triggers9.click),
544 + target_type: config === null || config === void 0 || (_config$targetTypes0 = config.targetTypes) === null || _config$targetTypes0 === void 0 ? void 0 : _config$targetTypes0.searchResult,
545 + target_name: choice,
546 + interaction_result: config === null || config === void 0 || (_config$interactionRe1 = config.interactionResults) === null || _config$interactionRe1 === void 0 ? void 0 : _config$interactionRe1.selected,
547 + target_location: finderContext.targetLocation,
548 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca9 = config.secondaryLocations) === null || _config$secondaryLoca9 === void 0 ? void 0 : _config$secondaryLoca9.finder),
549 + location_l2: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca0 = config.secondaryLocations) === null || _config$secondaryLoca0 === void 0 ? void 0 : _config$secondaryLoca0.finderResults),
550 + interaction_description: "Finder search results was selected"
551 + }));
552 + }
553 + },
554 + {
555 + key: "sendCanvasEmptyBoxAction",
556 + value: function sendCanvasEmptyBoxAction(_ref6) {
557 + var _config$triggers0;
558 + var _config$targetTypes1;
559 + var _config$interactionRe10;
560 + var _config$locations0;
561 + var _config$secondaryLoca1;
562 + var _config$names0;
563 + var targetName = _ref6.targetName;
564 + var _ref6$metadata = _ref6.metadata;
565 + var metadata = _ref6$metadata === void 0 ? {} : _ref6$metadata;
566 + var _ref6$containerCreate = _ref6.containerCreated;
567 + var containerCreated = _ref6$containerCreate === void 0 ? null : _ref6$containerCreate;
568 + var config = this.getConfig();
569 + var payload = this.createBasePayload({
570 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers0 = config.triggers) === null || _config$triggers0 === void 0 ? void 0 : _config$triggers0.click),
571 + target_type: config === null || config === void 0 || (_config$targetTypes1 = config.targetTypes) === null || _config$targetTypes1 === void 0 ? void 0 : _config$targetTypes1.buttons,
572 + target_name: targetName,
573 + interaction_result: config === null || config === void 0 || (_config$interactionRe10 = config.interactionResults) === null || _config$interactionRe10 === void 0 ? void 0 : _config$interactionRe10.selected,
574 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations0 = config.locations) === null || _config$locations0 === void 0 ? void 0 : _config$locations0.canvas),
575 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca1 = config.secondaryLocations) === null || _config$secondaryLoca1 === void 0 ? void 0 : _config$secondaryLoca1.emptyBox),
576 + interaction_description: "Empty box on canvas actions"
577 + });
578 + if (Object.keys(metadata).length > 0) payload.metadata = metadata;
579 + if (containerCreated !== null) payload.state = containerCreated;
580 + return this.dispatchEvent(config === null || config === void 0 || (_config$names0 = config.names) === null || _config$names0 === void 0 || (_config$names0 = _config$names0.editorOne) === null || _config$names0 === void 0 ? void 0 : _config$names0.canvasEmptyBoxAction, payload);
581 + }
582 + },
583 + {
584 + key: "sendWidgetPanelSearch",
585 + value: function sendWidgetPanelSearch(_ref7) {
586 + var _config$triggers1;
587 + var _config$targetTypes10;
588 + var _config$interactionRe11;
589 + var _config$interactionRe12;
590 + var _config$locations1;
591 + var _config$locations10;
592 + var _config$secondaryLoca10;
593 + var _config$names1;
594 + var resultsCount = _ref7.resultsCount;
595 + var _ref7$userInput = _ref7.userInput;
596 + var userInput = _ref7$userInput === void 0 ? null : _ref7$userInput;
597 + var config = this.getConfig();
598 + var hasResults = resultsCount > 0;
599 + var payload = this.createBasePayload({
600 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers1 = config.triggers) === null || _config$triggers1 === void 0 ? void 0 : _config$triggers1.typing),
601 + target_type: config === null || config === void 0 || (_config$targetTypes10 = config.targetTypes) === null || _config$targetTypes10 === void 0 ? void 0 : _config$targetTypes10.searchWidget,
602 + target_name: "search_widget",
603 + interaction_result: hasResults ? config === null || config === void 0 || (_config$interactionRe11 = config.interactionResults) === null || _config$interactionRe11 === void 0 ? void 0 : _config$interactionRe11.resultsUpdated : config === null || config === void 0 || (_config$interactionRe12 = config.interactionResults) === null || _config$interactionRe12 === void 0 ? void 0 : _config$interactionRe12.noResults,
604 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations1 = config.locations) === null || _config$locations1 === void 0 ? void 0 : _config$locations1.leftPanel),
605 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$locations10 = config.locations) === null || _config$locations10 === void 0 ? void 0 : _config$locations10.widgetPanel),
606 + location_l2: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca10 = config.secondaryLocations) === null || _config$secondaryLoca10 === void 0 ? void 0 : _config$secondaryLoca10.searchBar),
607 + interaction_description: "Widget search input, follows debounce behavior"
608 + });
609 + if (!hasResults && userInput) payload.metadata = { user_input: userInput };
610 + return this.dispatchEvent(config === null || config === void 0 || (_config$names1 = config.names) === null || _config$names1 === void 0 || (_config$names1 = _config$names1.editorOne) === null || _config$names1 === void 0 ? void 0 : _config$names1.widgetPanelSearch, payload);
611 + }
612 + },
613 + {
614 + key: "createWpDashPayload",
615 + value: function createWpDashPayload() {
616 + var _config$appTypes$wpDa;
617 + var _config$appTypes4;
618 + var _config$locations11;
619 + var overrides = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
620 + var config = this.getConfig();
621 + return this.createBasePayload(_objectSpread({
622 + window_name: (_config$appTypes$wpDa = config === null || config === void 0 || (_config$appTypes4 = config.appTypes) === null || _config$appTypes4 === void 0 ? void 0 : _config$appTypes4.wpDash) !== null && _config$appTypes$wpDa !== void 0 ? _config$appTypes$wpDa : "wpdash",
623 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations11 = config.locations) === null || _config$locations11 === void 0 ? void 0 : _config$locations11.wpDashAdmin),
624 + location_l2: ""
625 + }, overrides));
626 + }
627 + },
628 + {
629 + key: "sendWpDashElementorMenuClick",
630 + value: function sendWpDashElementorMenuClick() {
631 + var _config$names10;
632 + var _config$triggers10;
633 + var _config$targetTypes11;
634 + var _config$interactionRe13;
635 + var _config$secondaryLoca11;
636 + var config = this.getConfig();
637 + return this.dispatchEvent(config === null || config === void 0 || (_config$names10 = config.names) === null || _config$names10 === void 0 || (_config$names10 = _config$names10.editorOne) === null || _config$names10 === void 0 ? void 0 : _config$names10.wpDashElementorMenuClick, this.createWpDashPayload({
638 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers10 = config.triggers) === null || _config$triggers10 === void 0 ? void 0 : _config$triggers10.click),
639 + target_type: config === null || config === void 0 || (_config$targetTypes11 = config.targetTypes) === null || _config$targetTypes11 === void 0 ? void 0 : _config$targetTypes11.wpDashAdminMenuItem,
640 + target_name: "elementor_menu_item",
641 + interaction_result: config === null || config === void 0 || (_config$interactionRe13 = config.interactionResults) === null || _config$interactionRe13 === void 0 ? void 0 : _config$interactionRe13.elementorSideMenuOpened,
642 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca11 = config.secondaryLocations) === null || _config$secondaryLoca11 === void 0 ? void 0 : _config$secondaryLoca11.wpDashElementorCoreMenu),
643 + interaction_description: "core_user_clicked_elementor_menu_item"
644 + }));
645 + }
646 + },
647 + {
648 + key: "sendWpDashEditorSubMenuHover",
649 + value: function sendWpDashEditorSubMenuHover() {
650 + var _config$names11;
651 + var _config$triggers11;
652 + var _config$targetTypes12;
653 + var _config$interactionRe14;
654 + var _config$secondaryLoca12;
655 + var config = this.getConfig();
656 + return this.dispatchEvent(config === null || config === void 0 || (_config$names11 = config.names) === null || _config$names11 === void 0 || (_config$names11 = _config$names11.editorOne) === null || _config$names11 === void 0 ? void 0 : _config$names11.wpDashEditorSubMenuHover, this.createWpDashPayload({
657 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers11 = config.triggers) === null || _config$triggers11 === void 0 ? void 0 : _config$triggers11.hover),
658 + target_type: config === null || config === void 0 || (_config$targetTypes12 = config.targetTypes) === null || _config$targetTypes12 === void 0 ? void 0 : _config$targetTypes12.wpDashEditorMenu,
659 + target_name: "wpdash_editor_sub_menu",
660 + interaction_result: config === null || config === void 0 || (_config$interactionRe14 = config.interactionResults) === null || _config$interactionRe14 === void 0 ? void 0 : _config$interactionRe14.editorSubMenuOpened,
661 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca12 = config.secondaryLocations) === null || _config$secondaryLoca12 === void 0 ? void 0 : _config$secondaryLoca12.wpDashElementorCoreSubMenu),
662 + interaction_description: "core_user_hovered_sub_menu"
663 + }));
664 + }
665 + },
666 + {
667 + key: "sendWpDashThemeBuilderClick",
668 + value: function sendWpDashThemeBuilderClick() {
669 + var _config$names12;
670 + var _config$triggers12;
671 + var _config$targetTypes13;
672 + var _config$interactionRe15;
673 + var _config$secondaryLoca13;
674 + var config = this.getConfig();
675 + return this.dispatchEvent(config === null || config === void 0 || (_config$names12 = config.names) === null || _config$names12 === void 0 || (_config$names12 = _config$names12.editorOne) === null || _config$names12 === void 0 ? void 0 : _config$names12.wpDashThemeBuilderClick, this.createWpDashPayload({
676 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers12 = config.triggers) === null || _config$triggers12 === void 0 ? void 0 : _config$triggers12.click),
677 + target_type: config === null || config === void 0 || (_config$targetTypes13 = config.targetTypes) === null || _config$targetTypes13 === void 0 ? void 0 : _config$targetTypes13.wpDashSubMenuItem,
678 + target_name: "theme_builder_menu_item",
679 + interaction_result: config === null || config === void 0 || (_config$interactionRe15 = config.interactionResults) === null || _config$interactionRe15 === void 0 ? void 0 : _config$interactionRe15.themeBuilderPromotionWindow,
680 + location_l1: this.toLowerSnake(config === null || config === void 0 || (_config$secondaryLoca13 = config.secondaryLocations) === null || _config$secondaryLoca13 === void 0 ? void 0 : _config$secondaryLoca13.wpDashThemeBuilder),
681 + interaction_description: "core_user_clicked_theme_builder_menu_item"
682 + }));
683 + }
684 + },
685 + {
686 + key: "sendSidebarMenuItemClicked",
687 + value: function sendSidebarMenuItemClicked(_ref8) {
688 + var eventId = _ref8.eventId;
689 + var groupEventId = _ref8.groupEventId;
690 + try {
691 + var _config$windowNames;
692 + var _config$triggers13;
693 + var _config$targetTypes14;
694 + var _config$interactionRe16;
695 + var _config$locations12;
696 + var _config$names13;
697 + var config = this.getConfig();
698 + var payload = this.createBasePayload({
699 + window_name: config === null || config === void 0 || (_config$windowNames = config.windowNames) === null || _config$windowNames === void 0 ? void 0 : _config$windowNames.sidebarMenu,
700 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers13 = config.triggers) === null || _config$triggers13 === void 0 ? void 0 : _config$triggers13.click),
701 + target_type: config === null || config === void 0 || (_config$targetTypes14 = config.targetTypes) === null || _config$targetTypes14 === void 0 ? void 0 : _config$targetTypes14.link,
702 + target_name: eventId,
703 + interaction_result: config === null || config === void 0 || (_config$interactionRe16 = config.interactionResults) === null || _config$interactionRe16 === void 0 ? void 0 : _config$interactionRe16.pageOpened,
704 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations12 = config.locations) === null || _config$locations12 === void 0 ? void 0 : _config$locations12.sidebar)
705 + });
706 + if (groupEventId) payload.location_l1 = groupEventId;
707 + return this.dispatchEvent(config === null || config === void 0 || (_config$names13 = config.names) === null || _config$names13 === void 0 || (_config$names13 = _config$names13.editorOne) === null || _config$names13 === void 0 ? void 0 : _config$names13.sidebarMenuItemClicked, payload);
708 + } catch (error) {
709 + return false;
710 + }
711 + }
712 + },
713 + {
714 + key: "sendSidebarMenuGroupToggled",
715 + value: function sendSidebarMenuGroupToggled(_ref9) {
716 + var eventId = _ref9.eventId;
717 + var isExpanded = _ref9.isExpanded;
718 + try {
719 + var _config$interactionRe17;
720 + var _config$interactionRe18;
721 + var _config$names14;
722 + var _config$windowNames2;
723 + var _config$triggers14;
724 + var _config$targetTypes15;
725 + var _config$locations13;
726 + var config = this.getConfig();
727 + var interactionResult = isExpanded ? config === null || config === void 0 || (_config$interactionRe17 = config.interactionResults) === null || _config$interactionRe17 === void 0 ? void 0 : _config$interactionRe17.expanded : config === null || config === void 0 || (_config$interactionRe18 = config.interactionResults) === null || _config$interactionRe18 === void 0 ? void 0 : _config$interactionRe18.collapsed;
728 + return this.dispatchEvent(config === null || config === void 0 || (_config$names14 = config.names) === null || _config$names14 === void 0 || (_config$names14 = _config$names14.editorOne) === null || _config$names14 === void 0 ? void 0 : _config$names14.sidebarMenuGroupToggled, this.createBasePayload({
729 + window_name: config === null || config === void 0 || (_config$windowNames2 = config.windowNames) === null || _config$windowNames2 === void 0 ? void 0 : _config$windowNames2.sidebarMenu,
730 + interaction_type: this.toLowerSnake(config === null || config === void 0 || (_config$triggers14 = config.triggers) === null || _config$triggers14 === void 0 ? void 0 : _config$triggers14.click),
731 + target_type: config === null || config === void 0 || (_config$targetTypes15 = config.targetTypes) === null || _config$targetTypes15 === void 0 ? void 0 : _config$targetTypes15.toggle,
732 + target_name: eventId,
733 + interaction_result: interactionResult,
734 + target_location: this.toLowerSnake(config === null || config === void 0 || (_config$locations13 = config.locations) === null || _config$locations13 === void 0 ? void 0 : _config$locations13.sidebar)
735 + }));
736 + } catch (error) {
737 + return false;
738 + }
739 + }
740 + }
741 + ]);
742 + }();
452 743
453 -/***/ "../modules/editor-one/assets/js/admin-menu/classes/sidebar-menu-handler.js":
454 -/*!**********************************************************************************!*\
455 - !*** ../modules/editor-one/assets/js/admin-menu/classes/sidebar-menu-handler.js ***!
456 - \**********************************************************************************/
457 -/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
744 +//#endregion
745 +//#region modules/editor-one/assets/js/admin-menu/classes/menu-events-tracker.js
746 + var SELECTORS = {
747 + elementorMenuLink: "#toplevel_page_elementor-home > a.menu-top",
748 + themeBuilderItem: "[data-slug=\"elementor-theme-builder\"] a, .wp-submenu a[href*=\"page=elementor-theme-builder\"]"
749 + };
750 + var MenuEventsTracker = /*#__PURE__*/ function() {
751 + function MenuEventsTracker() {
752 + _classCallCheck(this, MenuEventsTracker);
753 + }
754 + return _createClass(MenuEventsTracker, null, [
755 + {
756 + key: "attach",
757 + value: function attach() {
758 + this.attachElementorMenuClick();
759 + this.attachThemeBuilderClick();
760 + }
761 + },
762 + {
763 + key: "attachElementorMenuClick",
764 + value: function attachElementorMenuClick() {
765 + var menuLink = document.querySelector(SELECTORS.elementorMenuLink);
766 + if (!menuLink) return;
767 + menuLink.addEventListener("click", function() {
768 + EditorOneEventManager.sendWpDashElementorMenuClick();
769 + });
770 + }
771 + },
772 + {
773 + key: "attachThemeBuilderClick",
774 + value: function attachThemeBuilderClick() {
775 + document.addEventListener("click", function(event) {
776 + if (event.target.closest(SELECTORS.themeBuilderItem)) EditorOneEventManager.sendWpDashThemeBuilderClick();
777 + }, true);
778 + }
779 + },
780 + {
781 + key: "trackEditorSubMenuOpened",
782 + value: function trackEditorSubMenuOpened() {
783 + EditorOneEventManager.sendWpDashEditorSubMenuHover();
784 + }
785 + }
786 + ]);
787 + }();
458 788
459 -"use strict";
789 +//#endregion
790 +//#region modules/editor-one/assets/js/admin-menu/classes/flyout-interaction-handler.js
791 + var FlyoutInteractionHandler = /*#__PURE__*/ function() {
792 + function FlyoutInteractionHandler() {
793 + _classCallCheck(this, FlyoutInteractionHandler);
794 + this.activeMenu = null;
795 + this.activeParent = null;
796 + this.closeTimeout = null;
797 + this.lastMousePos = null;
798 + this.exitPoint = null;
799 + this.mouseMoveHandler = null;
800 + }
801 + return _createClass(FlyoutInteractionHandler, [
802 + {
803 + key: "handle",
804 + value: function handle() {
805 + this.setupFlyoutMenus();
806 + this.setupMobileSupport();
807 + }
808 + },
809 + {
810 + key: "setupFlyoutMenus",
811 + value: function setupFlyoutMenus() {
812 + var _this = this;
813 + document.querySelectorAll("#adminmenu li.elementor-has-flyout").forEach(function(parentLi) {
814 + var flyoutMenu = parentLi.querySelector(".elementor-submenu-flyout");
815 + if (!flyoutMenu) return;
816 + _this.attachHoverEvents(parentLi, flyoutMenu);
817 + _this.attachFocusEvents(parentLi, flyoutMenu);
818 + _this.attachKeyboardEvents(parentLi, flyoutMenu);
819 + });
820 + }
821 + },
822 + {
823 + key: "attachHoverEvents",
824 + value: function attachHoverEvents(parentLi, flyoutMenu) {
825 + var _this2 = this;
826 + parentLi.addEventListener("mouseenter", function() {
827 + if (_this2.activeMenu && !_this2.activeMenu.contains(parentLi) && _this2.activeMenu !== flyoutMenu) {
828 + if (!_this2.isCursorInSafeZone()) _this2.hideFlyout(_this2.activeMenu);
829 + }
830 + _this2.clearCloseTimeout();
831 + _this2.showFlyout(parentLi, flyoutMenu);
832 + });
833 + parentLi.addEventListener("mouseleave", function(event) {
834 + _this2.exitPoint = {
835 + x: event.clientX,
836 + y: event.clientY
837 + };
838 + _this2.scheduleClose(parentLi, flyoutMenu);
839 + });
840 + flyoutMenu.addEventListener("mouseenter", function() {
841 + _this2.clearCloseTimeout();
842 + _this2.stopMouseTracking();
843 + });
844 + flyoutMenu.addEventListener("mouseleave", function(event) {
845 + _this2.exitPoint = {
846 + x: event.clientX,
847 + y: event.clientY
848 + };
849 + _this2.scheduleClose(parentLi, flyoutMenu);
850 + });
851 + }
852 + },
853 + {
854 + key: "attachFocusEvents",
855 + value: function attachFocusEvents(parentLi, flyoutMenu) {
856 + var _this3 = this;
857 + var parentLink = parentLi.querySelector(":scope > a");
858 + if (parentLink) parentLink.addEventListener("focus", function() {
859 + _this3.showFlyout(parentLi, flyoutMenu);
860 + });
861 + flyoutMenu.addEventListener("focusout", function(event) {
862 + if (!parentLi.contains(event.relatedTarget)) _this3.hideFlyout(flyoutMenu);
863 + });
864 + }
865 + },
866 + {
867 + key: "attachKeyboardEvents",
868 + value: function attachKeyboardEvents(parentLi, flyoutMenu) {
869 + var _this4 = this;
870 + parentLi.addEventListener("keydown", function(event) {
871 + _this4.handleKeyNavigation(event, parentLi, flyoutMenu);
872 + });
873 + }
874 + },
875 + {
876 + key: "showFlyout",
877 + value: function showFlyout(parentLi, flyoutMenu) {
878 + var wasAlreadyVisible = flyoutMenu.classList.contains("elementor-submenu-flyout-visible");
879 + if (this.activeMenu && this.activeMenu !== flyoutMenu) this.hideFlyout(this.activeMenu);
880 + this.exitPoint = null;
881 + this.positionFlyout(parentLi, flyoutMenu);
882 + flyoutMenu.classList.add("elementor-submenu-flyout-visible");
883 + this.activeMenu = flyoutMenu;
884 + this.activeParent = parentLi;
885 + if (!wasAlreadyVisible) MenuEventsTracker.trackEditorSubMenuOpened();
886 + }
887 + },
888 + {
889 + key: "hideFlyout",
890 + value: function hideFlyout(flyoutMenu) {
891 + flyoutMenu.classList.remove("elementor-submenu-flyout-visible");
892 + if (this.activeMenu === flyoutMenu) {
893 + this.activeMenu = null;
894 + this.activeParent = null;
895 + this.exitPoint = null;
896 + this.stopMouseTracking();
897 + }
898 + }
899 + },
900 + {
901 + key: "scheduleClose",
902 + value: function scheduleClose(parentLi, flyoutMenu) {
903 + var _this5 = this;
904 + this.clearCloseTimeout();
905 + this.startMouseTracking(parentLi, flyoutMenu);
906 + this.closeTimeout = setTimeout(function() {
907 + _this5.checkAndClose(flyoutMenu);
908 + }, 300);
909 + }
910 + },
911 + {
912 + key: "checkAndClose",
913 + value: function checkAndClose(flyoutMenu) {
914 + var _this6 = this;
915 + if (!this.activeMenu) return;
916 + if (!this.isCursorInSafeZone()) this.hideFlyout(flyoutMenu);
917 + else this.closeTimeout = setTimeout(function() {
918 + _this6.checkAndClose(flyoutMenu);
919 + }, 300);
920 + }
921 + },
922 + {
923 + key: "clearCloseTimeout",
924 + value: function clearCloseTimeout() {
925 + if (this.closeTimeout) {
926 + clearTimeout(this.closeTimeout);
927 + this.closeTimeout = null;
928 + }
929 + }
930 + },
931 + {
932 + key: "startMouseTracking",
933 + value: function startMouseTracking() {
934 + var _this7 = this;
935 + this.stopMouseTracking();
936 + this.mouseMoveHandler = function(event) {
937 + _this7.lastMousePos = {
938 + x: event.clientX,
939 + y: event.clientY
940 + };
941 + };
942 + document.addEventListener("mousemove", this.mouseMoveHandler);
943 + }
944 + },
945 + {
946 + key: "stopMouseTracking",
947 + value: function stopMouseTracking() {
948 + if (this.mouseMoveHandler) {
949 + document.removeEventListener("mousemove", this.mouseMoveHandler);
950 + this.mouseMoveHandler = null;
951 + }
952 + this.lastMousePos = null;
953 + }
954 + },
955 + {
956 + key: "isCursorInSafeZone",
957 + value: function isCursorInSafeZone() {
958 + if (!this.lastMousePos || !this.activeMenu || !this.activeParent) return false;
959 + var cursor = this.lastMousePos;
960 + var parentRect = this.activeParent.getBoundingClientRect();
961 + if (this.isPointInRect(cursor, parentRect)) return true;
962 + var flyoutRect = this.activeMenu.getBoundingClientRect();
963 + if (this.isPointInRect(cursor, flyoutRect)) return true;
964 + return this.isPointInTriangle(cursor, parentRect, flyoutRect);
965 + }
966 + },
967 + {
968 + key: "isPointInRect",
969 + value: function isPointInRect(point, rect) {
970 + return point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;
971 + }
972 + },
973 + {
974 + key: "isPointInTriangle",
975 + value: function isPointInTriangle(cursor, parentRect, flyoutRect) {
976 + var exitX = this.exitPoint ? this.exitPoint.x : parentRect.right;
977 + var distParent = Math.abs(exitX - parentRect.right);
978 + var distFlyout = Math.abs(exitX - flyoutRect.left);
979 + var triangleApex;
980 + var baseTop;
981 + var baseBottom;
982 + if (distParent < distFlyout) {
983 + triangleApex = this.exitPoint || {
984 + x: parentRect.right,
985 + y: parentRect.top + parentRect.height / 2
986 + };
987 + baseTop = {
988 + x: flyoutRect.left,
989 + y: flyoutRect.top - 100
990 + };
991 + baseBottom = {
992 + x: flyoutRect.left,
993 + y: flyoutRect.bottom + 100
994 + };
995 + } else {
996 + triangleApex = this.exitPoint || {
997 + x: flyoutRect.left,
998 + y: flyoutRect.top + flyoutRect.height / 2
999 + };
1000 + baseTop = {
1001 + x: parentRect.right,
1002 + y: parentRect.top - 100
1003 + };
1004 + baseBottom = {
1005 + x: parentRect.right,
1006 + y: parentRect.bottom + 100
1007 + };
1008 + }
1009 + return this.pointInTriangle(cursor, triangleApex, baseTop, baseBottom);
1010 + }
1011 + },
1012 + {
1013 + key: "pointInTriangle",
1014 + value: function pointInTriangle(p, v1, v2, v3) {
1015 + var sign = function sign(p1, p2, p3) {
1016 + return (p1.x - p3.x) * (p2.y - p3.y) - (p2.x - p3.x) * (p1.y - p3.y);
1017 + };
1018 + var d1 = sign(p, v1, v2);
1019 + var d2 = sign(p, v2, v3);
1020 + var d3 = sign(p, v3, v1);
1021 + return !((0 > d1 || 0 > d2 || 0 > d3) && (0 < d1 || 0 < d2 || 0 < d3));
1022 + }
1023 + },
1024 + {
1025 + key: "positionFlyout",
1026 + value: function positionFlyout(parentLi, flyoutMenu) {
1027 + var windowHeight = window.innerHeight;
1028 + var flyoutHeight = flyoutMenu.offsetHeight;
1029 + var relativeTop = parentLi.getBoundingClientRect().top;
1030 + if (relativeTop + flyoutHeight > windowHeight) {
1031 + var newTop = windowHeight - flyoutHeight - relativeTop;
1032 + if (newTop < -relativeTop) newTop = -relativeTop + 10;
1033 + flyoutMenu.style.top = newTop + "px";
1034 + } else delete flyoutMenu.style.top;
1035 + }
1036 + },
1037 + {
1038 + key: "handleKeyNavigation",
1039 + value: function handleKeyNavigation(event, parentLi, flyoutMenu) {
1040 + var allLinks = flyoutMenu.querySelectorAll("a");
1041 + var focusedLink = flyoutMenu.querySelector("a:focus");
1042 + var currentIndex = Array.from(allLinks).indexOf(focusedLink);
1043 + var isVisible = flyoutMenu.classList.contains("elementor-submenu-flyout-visible");
1044 + switch (event.key) {
1045 + case "ArrowRight":
1046 + if (!isVisible) {
1047 + var _allLinks$;
1048 + event.preventDefault();
1049 + this.showFlyout(parentLi, flyoutMenu);
1050 + (_allLinks$ = allLinks[0]) === null || _allLinks$ === void 0 || _allLinks$.focus();
1051 + }
1052 + break;
1053 + case "ArrowLeft":
1054 + if (isVisible) {
1055 + var _parentLi$querySelect;
1056 + event.preventDefault();
1057 + this.hideFlyout(flyoutMenu);
1058 + (_parentLi$querySelect = parentLi.querySelector(":scope > a")) === null || _parentLi$querySelect === void 0 || _parentLi$querySelect.focus();
1059 + }
1060 + break;
1061 + case "ArrowDown":
1062 + if (isVisible && currentIndex >= 0) {
1063 + var _allLinks$nextIndex;
1064 + event.preventDefault();
1065 + (_allLinks$nextIndex = allLinks[(currentIndex + 1) % allLinks.length]) === null || _allLinks$nextIndex === void 0 || _allLinks$nextIndex.focus();
1066 + }
1067 + break;
1068 + case "ArrowUp":
1069 + if (isVisible && currentIndex >= 0) {
1070 + var _allLinks$prevIndex;
1071 + event.preventDefault();
1072 + (_allLinks$prevIndex = allLinks[(currentIndex - 1 + allLinks.length) % allLinks.length]) === null || _allLinks$prevIndex === void 0 || _allLinks$prevIndex.focus();
1073 + }
1074 + break;
1075 + case "Escape":
1076 + if (isVisible) {
1077 + var _parentLi$querySelect2;
1078 + event.preventDefault();
1079 + this.hideFlyout(flyoutMenu);
1080 + (_parentLi$querySelect2 = parentLi.querySelector(":scope > a")) === null || _parentLi$querySelect2 === void 0 || _parentLi$querySelect2.focus();
1081 + }
1082 + break;
1083 + }
1084 + }
1085 + },
1086 + {
1087 + key: "setupMobileSupport",
1088 + value: function setupMobileSupport() {
1089 + var _this8 = this;
1090 + if (window.innerWidth > 782) return;
1091 + document.querySelectorAll("#adminmenu li.elementor-has-flyout > a").forEach(function(link) {
1092 + link.addEventListener("click", function(event) {
1093 + _this8.handleMobileClick(event, link);
1094 + });
1095 + });
1096 + document.addEventListener("click", function(event) {
1097 + _this8.handleDocumentClick(event);
1098 + });
1099 + }
1100 + },
1101 + {
1102 + key: "handleMobileClick",
1103 + value: function handleMobileClick(event, link) {
1104 + var parentLi = link.parentElement;
1105 + if (!parentLi.querySelector(".elementor-submenu-flyout")) return;
1106 + if (parentLi.classList.contains("elementor-flyout-open")) return;
1107 + event.preventDefault();
1108 + document.querySelectorAll("#adminmenu li.elementor-has-flyout").forEach(function(item) {
1109 + item.classList.remove("elementor-flyout-open");
1110 + });
1111 + parentLi.classList.add("elementor-flyout-open");
1112 + }
1113 + },
1114 + {
1115 + key: "handleDocumentClick",
1116 + value: function handleDocumentClick(event) {
1117 + if (!event.target.closest("#adminmenu li.elementor-has-flyout")) document.querySelectorAll("#adminmenu li.elementor-has-flyout").forEach(function(item) {
1118 + item.classList.remove("elementor-flyout-open");
1119 + });
1120 + }
1121 + }
1122 + ]);
1123 + }();
460 1124
1125 +//#endregion
1126 +//#region modules/editor-one/assets/js/admin-menu/app.js
1127 + var EditorOneMenu = /*#__PURE__*/ function() {
1128 + function EditorOneMenu() {
1129 + var _window;
1130 + _classCallCheck(this, EditorOneMenu);
1131 + this.config = ((_window = window) === null || _window === void 0 ? void 0 : _window.editorOneMenuConfig) || {};
1132 + }
1133 + return _createClass(EditorOneMenu, [
1134 + {
1135 + key: "init",
1136 + value: function init() {
1137 + MenuEventsTracker.attach();
1138 + if (this.isSidebarNavigationActive()) {
1139 + new SidebarMenuHandler();
1140 + return;
1141 + }
1142 + this.buildFlyoutMenus();
1143 + }
1144 + },
1145 + {
1146 + key: "isSidebarNavigationActive",
1147 + value: function isSidebarNavigationActive() {
1148 + return document.body.classList.contains("e-has-sidebar-navigation");
1149 + }
1150 + },
1151 + {
1152 + key: "buildFlyoutMenus",
1153 + value: function buildFlyoutMenus() {
1154 + if (new FlyoutMenuRenderer(this.config).render()) new FlyoutInteractionHandler().handle();
1155 + }
1156 + }
1157 + ]);
1158 + }();
1159 + var initEditorOneMenu = function initEditorOneMenu() {
1160 + new EditorOneMenu().init();
1161 + };
1162 + if ("loading" === document.readyState) document.addEventListener("DOMContentLoaded", initEditorOneMenu);
1163 + else initEditorOneMenu();
461 1164
462 -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
463 -Object.defineProperty(exports, "__esModule", ({
464 - value: true
465 -}));
466 -exports.SidebarMenuHandler = void 0;
467 -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
468 -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
469 -var SidebarMenuHandler = exports.SidebarMenuHandler = /*#__PURE__*/function () {
470 - function SidebarMenuHandler() {
471 - (0, _classCallCheck2.default)(this, SidebarMenuHandler);
472 - this.elementorHomeMenu = this.findElementorHomeMenu();
473 - if (this.elementorHomeMenu) {
474 - this.deactivateOtherMenus();
475 - this.activateElementorMenu();
476 - this.highlightSubmenu();
477 - }
478 - }
479 - return (0, _createClass2.default)(SidebarMenuHandler, [{
480 - key: "findElementorHomeMenu",
481 - value: function findElementorHomeMenu() {
482 - return document.querySelector('#toplevel_page_elementor-home');
483 - }
484 - }, {
485 - key: "deactivateOtherMenus",
486 - value: function deactivateOtherMenus() {
487 - var _this = this;
488 - document.querySelectorAll('#adminmenu li.wp-has-current-submenu').forEach(function (item) {
489 - if (item !== _this.elementorHomeMenu) {
490 - item.classList.remove('wp-has-current-submenu', 'wp-menu-open', 'selected');
491 - item.classList.add('wp-not-current-submenu');
492 - var link = item.querySelector(':scope > a');
493 - if (link) {
494 - link.classList.remove('wp-has-current-submenu', 'wp-menu-open', 'current');
495 - }
496 - }
497 - });
498 - }
499 - }, {
500 - key: "activateElementorMenu",
501 - value: function activateElementorMenu() {
502 - this.elementorHomeMenu.classList.remove('wp-not-current-submenu');
503 - this.elementorHomeMenu.classList.add('wp-has-current-submenu', 'wp-menu-open', 'selected');
504 - var elementorLink = this.elementorHomeMenu.querySelector(':scope > a.menu-top');
505 - if (elementorLink) {
506 - elementorLink.classList.add('wp-has-current-submenu', 'wp-menu-open');
507 - }
508 - }
509 - }, {
510 - key: "highlightSubmenu",
511 - value: function highlightSubmenu() {
512 - var currentUrl = new URL(window.location.href);
513 - var searchParams = currentUrl.searchParams;
514 - var page = searchParams.get('page');
515 - var targetSlug = 'elementor';
516 - if ('elementor' === page || 'elementor-home' === page) {
517 - targetSlug = 'elementor';
518 - } else if ('e-form-submissions' === page) {
519 - targetSlug = 'e-form-submissions';
520 - } else if ('elementor-theme-builder' === page) {
521 - targetSlug = 'elementor-theme-builder';
522 - }
523 - var submenuItems = this.elementorHomeMenu.querySelectorAll('.wp-submenu li');
524 - submenuItems.forEach(function (item) {
525 - var link = item.querySelector('a');
526 - if (!link) {
527 - return;
528 - }
529 - item.classList.remove('current');
530 - link.classList.remove('current');
531 - link.setAttribute('aria-current', '');
532 - var linkUrl = new URL(link.href, window.location.origin);
533 - var linkPage = linkUrl.searchParams.get('page');
534 - if (linkPage === targetSlug) {
535 - item.classList.add('current');
536 - link.classList.add('current');
537 - link.setAttribute('aria-current', 'page');
538 - }
539 - });
540 - }
541 - }]);
542 -}();
543 -
544 -/***/ }),
545 -
546 -/***/ "../node_modules/@babel/runtime/helpers/classCallCheck.js":
547 -/*!****************************************************************!*\
548 - !*** ../node_modules/@babel/runtime/helpers/classCallCheck.js ***!
549 - \****************************************************************/
550 -/***/ ((module) => {
551 -
552 -function _classCallCheck(a, n) {
553 - if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
554 -}
555 -module.exports = _classCallCheck, module.exports.__esModule = true, module.exports["default"] = module.exports;
556 -
557 -/***/ }),
558 -
559 -/***/ "../node_modules/@babel/runtime/helpers/createClass.js":
560 -/*!*************************************************************!*\
561 - !*** ../node_modules/@babel/runtime/helpers/createClass.js ***!
562 - \*************************************************************/
563 -/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
564 -
565 -var toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ "../node_modules/@babel/runtime/helpers/toPropertyKey.js");
566 -function _defineProperties(e, r) {
567 - for (var t = 0; t < r.length; t++) {
568 - var o = r[t];
569 - o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, toPropertyKey(o.key), o);
570 - }
571 -}
572 -function _createClass(e, r, t) {
573 - return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
574 - writable: !1
575 - }), e;
576 -}
577 -module.exports = _createClass, module.exports.__esModule = true, module.exports["default"] = module.exports;
578 -
579 -/***/ }),
580 -
581 -/***/ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js":
582 -/*!***********************************************************************!*\
583 - !*** ../node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!
584 - \***********************************************************************/
585 -/***/ ((module) => {
586 -
587 -function _interopRequireDefault(e) {
588 - return e && e.__esModule ? e : {
589 - "default": e
590 - };
591 -}
592 -module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
593 -
594 -/***/ }),
595 -
596 -/***/ "../node_modules/@babel/runtime/helpers/toPrimitive.js":
597 -/*!*************************************************************!*\
598 - !*** ../node_modules/@babel/runtime/helpers/toPrimitive.js ***!
599 - \*************************************************************/
600 -/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
601 -
602 -var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
603 -function toPrimitive(t, r) {
604 - if ("object" != _typeof(t) || !t) return t;
605 - var e = t[Symbol.toPrimitive];
606 - if (void 0 !== e) {
607 - var i = e.call(t, r || "default");
608 - if ("object" != _typeof(i)) return i;
609 - throw new TypeError("@@toPrimitive must return a primitive value.");
610 - }
611 - return ("string" === r ? String : Number)(t);
612 -}
613 -module.exports = toPrimitive, module.exports.__esModule = true, module.exports["default"] = module.exports;
614 -
615 -/***/ }),
616 -
617 -/***/ "../node_modules/@babel/runtime/helpers/toPropertyKey.js":
618 -/*!***************************************************************!*\
619 - !*** ../node_modules/@babel/runtime/helpers/toPropertyKey.js ***!
620 - \***************************************************************/
621 -/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
622 -
623 -var _typeof = (__webpack_require__(/*! ./typeof.js */ "../node_modules/@babel/runtime/helpers/typeof.js")["default"]);
624 -var toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ "../node_modules/@babel/runtime/helpers/toPrimitive.js");
625 -function toPropertyKey(t) {
626 - var i = toPrimitive(t, "string");
627 - return "symbol" == _typeof(i) ? i : i + "";
628 -}
629 -module.exports = toPropertyKey, module.exports.__esModule = true, module.exports["default"] = module.exports;
630 -
631 -/***/ }),
632 -
633 -/***/ "../node_modules/@babel/runtime/helpers/typeof.js":
634 -/*!********************************************************!*\
635 - !*** ../node_modules/@babel/runtime/helpers/typeof.js ***!
636 - \********************************************************/
637 -/***/ ((module) => {
638 -
639 -function _typeof(o) {
640 - "@babel/helpers - typeof";
641 -
642 - return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
643 - return typeof o;
644 - } : function (o) {
645 - return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
646 - }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
647 -}
648 -module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
649 -
650 -/***/ })
651 -
652 -/******/ });
653 -/************************************************************************/
654 -/******/ // The module cache
655 -/******/ var __webpack_module_cache__ = {};
656 -/******/
657 -/******/ // The require function
658 -/******/ function __webpack_require__(moduleId) {
659 -/******/ // Check if module is in cache
660 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
661 -/******/ if (cachedModule !== undefined) {
662 -/******/ return cachedModule.exports;
663 -/******/ }
664 -/******/ // Create a new module (and put it into the cache)
665 -/******/ var module = __webpack_module_cache__[moduleId] = {
666 -/******/ // no module.id needed
667 -/******/ // no module.loaded needed
668 -/******/ exports: {}
669 -/******/ };
670 -/******/
671 -/******/ // Execute the module function
672 -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
673 -/******/
674 -/******/ // Return the exports of the module
675 -/******/ return module.exports;
676 -/******/ }
677 -/******/
678 -/************************************************************************/
679 -var __webpack_exports__ = {};
680 -// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
681 -(() => {
682 -"use strict";
683 -/*!*********************************************************!*\
684 - !*** ../modules/editor-one/assets/js/admin-menu/app.js ***!
685 - \*********************************************************/
686 -
687 -
688 -var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js");
689 -var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../node_modules/@babel/runtime/helpers/classCallCheck.js"));
690 -var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "../node_modules/@babel/runtime/helpers/createClass.js"));
691 -var _flyoutMenuRenderer = __webpack_require__(/*! ./classes/flyout-menu-renderer */ "../modules/editor-one/assets/js/admin-menu/classes/flyout-menu-renderer.js");
692 -var _sidebarMenuHandler = __webpack_require__(/*! ./classes/sidebar-menu-handler */ "../modules/editor-one/assets/js/admin-menu/classes/sidebar-menu-handler.js");
693 -var _flyoutInteractionHandler = __webpack_require__(/*! ./classes/flyout-interaction-handler */ "../modules/editor-one/assets/js/admin-menu/classes/flyout-interaction-handler.js");
694 -var EditorOneMenu = /*#__PURE__*/function () {
695 - function EditorOneMenu() {
696 - var _window;
697 - (0, _classCallCheck2.default)(this, EditorOneMenu);
698 - this.config = ((_window = window) === null || _window === void 0 ? void 0 : _window.editorOneMenuConfig) || {};
699 - }
700 - return (0, _createClass2.default)(EditorOneMenu, [{
701 - key: "init",
702 - value: function init() {
703 - if (this.isSidebarNavigationActive()) {
704 - new _sidebarMenuHandler.SidebarMenuHandler();
705 - return;
706 - }
707 - this.buildFlyoutMenus();
708 - }
709 - }, {
710 - key: "isSidebarNavigationActive",
711 - value: function isSidebarNavigationActive() {
712 - return document.body.classList.contains('e-has-sidebar-navigation');
713 - }
714 - }, {
715 - key: "buildFlyoutMenus",
716 - value: function buildFlyoutMenus() {
717 - var renderer = new _flyoutMenuRenderer.FlyoutMenuRenderer(this.config);
718 - if (renderer.render()) {
719 - new _flyoutInteractionHandler.FlyoutInteractionHandler().handle();
720 - }
721 - }
722 - }]);
723 -}();
724 -var initEditorOneMenu = function initEditorOneMenu() {
725 - var editorOneMenu = new EditorOneMenu();
726 - editorOneMenu.init();
727 -};
728 -if ('loading' === document.readyState) {
729 - document.addEventListener('DOMContentLoaded', initEditorOneMenu);
730 -} else {
731 - initEditorOneMenu();
732 -}
1165 +//#endregion
733 1166 })();
734 -
735 -/******/ })()
736 -;
737 1167 //# sourceMappingURL=editor-one-menu.js.map