PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.2
Elementor Website Builder – more than just a page builder v4.3.2
4.3.2 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 All 455 releases
elementor / assets / js / packages / editor-app-bar / editor-app-bar.js

editor-app-bar.js in Elementor Website Builder – more than just a page builder 4.3.2, at assets/js/packages/editor-app-bar/editor-app-bar.js

1,782 lines 69.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(_elementor_locations, _elementor_menus, react, _elementor_icons, _elementor_ui, _elementor_editor, _elementor_editor_documents, _wordpress_i18n, _elementor_editor_current_user, _elementor_editor_ui, _elementor_events, _elementor_editor_v1_adapters, _elementor_http_client, _elementor_editor_mcp, _elementor_editor_responsive) {
2
3 //#region \0rolldown/runtime.js
4 var __create = Object.create;
5 var __defProp = Object.defineProperty;
6 var __name = (target, value) => __defProp(target, "name", {
7 value,
8 configurable: true
9 });
10 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11 var __getOwnPropNames = Object.getOwnPropertyNames;
12 var __getProtoOf = Object.getPrototypeOf;
13 var __hasOwnProp = Object.prototype.hasOwnProperty;
14 var __exportAll = (all, no_symbols) => {
15 let target = {};
16 for (var name in all) {
17 __defProp(target, name, {
18 get: all[name],
19 enumerable: true
20 });
21 }
22 if (!no_symbols) {
23 __defProp(target, Symbol.toStringTag, { value: "Module" });
24 }
25 return target;
26 };
27 var __copyProps = (to, from, except, desc) => {
28 if (from && typeof from === "object" || typeof from === "function") {
29 for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
30 key = keys[i];
31 if (!__hasOwnProp.call(to, key) && key !== except) {
32 __defProp(to, key, {
33 get: ((k) => from[k]).bind(null, key),
34 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
35 });
36 }
37 }
38 }
39 return to;
40 };
41 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
42 value: mod,
43 enumerable: true
44 }) : target, mod));
45
46 //#endregion
47 react = __toESM(react);
48
49 //#region packages/packages/core/editor-app-bar/src/contexts/menu-context.tsx
50 var MenuContext = (0, react.createContext)({ type: "toolbar" });
51 function MenuContextProvider({ type, popupState, children }) {
52 return /* @__PURE__ */ react.createElement(MenuContext.Provider, { value: {
53 type,
54 popupState
55 } }, children);
56 }
57 function useMenuContext() {
58 return (0, react.useContext)(MenuContext);
59 }
60
61 //#endregion
62 //#region packages/packages/core/editor-app-bar/src/components/ui/popover-menu-item.tsx
63 var DirectionalArrowIcon = (0, _elementor_ui.withDirection)(_elementor_icons.ArrowUpRightIcon);
64 var DirectionalChevronIcon = (0, _elementor_ui.withDirection)(_elementor_icons.ChevronRightIcon);
65 function PopoverMenuItem({ text, icon, onClick, href, target, disabled, isGroupParent, showExternalLinkIcon, ...props }) {
66 const isExternalLink = href && target === "_blank" && showExternalLinkIcon;
67 return /* @__PURE__ */ react.createElement(_elementor_ui.MenuItem, {
68 ...props,
69 disabled,
70 onClick,
71 component: href ? "a" : "div",
72 href,
73 target,
74 sx: { "&:hover": { color: "text.primary" } }
75 }, /* @__PURE__ */ react.createElement(_elementor_ui.ListItemIcon, null, icon), /* @__PURE__ */ react.createElement(_elementor_ui.ListItemText, { primary: text }), isExternalLink && /* @__PURE__ */ react.createElement(DirectionalArrowIcon, null), isGroupParent && /* @__PURE__ */ react.createElement(DirectionalChevronIcon, null));
76 }
77
78 //#endregion
79 //#region packages/packages/core/editor-app-bar/src/components/ui/toolbar-menu-item.tsx
80 function ToolbarMenuItem({ title, ...props }) {
81 return /* @__PURE__ */ react.createElement(Tooltip$3, { title }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
82 component: "span",
83 "aria-label": void 0
84 }, /* @__PURE__ */ react.createElement(_elementor_ui.IconButton, {
85 ...props,
86 "aria-label": title,
87 size: "medium",
88 sx: {
89 "& svg": {
90 fontSize: "1.25rem",
91 height: "1em",
92 width: "1em"
93 },
94 "&:hover": { color: "text.primary" }
95 }
96 })));
97 }
98 function Tooltip$3(props) {
99 return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
100 PopperProps: { sx: { "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { mt: 2 } } },
101 ...props
102 });
103 }
104 __name(Tooltip$3, "Tooltip");
105
106 //#endregion
107 //#region packages/packages/core/editor-app-bar/src/components/actions/action.tsx
108 function Action({ icon: Icon, title, visible = true, ...props }) {
109 const { type } = useMenuContext();
110 if (!visible) return null;
111 return type === "toolbar" ? /* @__PURE__ */ react.createElement(ToolbarMenuItem, {
112 title,
113 ...props
114 }, /* @__PURE__ */ react.createElement(Icon, null)) : /* @__PURE__ */ react.createElement(PopoverMenuItem, {
115 ...props,
116 text: title,
117 icon: /* @__PURE__ */ react.createElement(Icon, null)
118 });
119 }
120
121 //#endregion
122 //#region packages/packages/core/editor-app-bar/src/components/actions/link.tsx
123 function Link({ icon: Icon, title, visible = true, showExternalLinkIcon = false, ...props }) {
124 const { type } = useMenuContext();
125 if (!visible) return null;
126 return type === "toolbar" ? /* @__PURE__ */ react.createElement(ToolbarMenuItem, {
127 title,
128 ...props
129 }, /* @__PURE__ */ react.createElement(Icon, null)) : /* @__PURE__ */ react.createElement(PopoverMenuItem, {
130 ...props,
131 text: title,
132 icon: /* @__PURE__ */ react.createElement(Icon, null),
133 showExternalLinkIcon
134 });
135 }
136
137 //#endregion
138 //#region packages/packages/core/editor-app-bar/src/components/ui/toolbar-menu-toggle-item.tsx
139 function ToolbarMenuToggleItem({ title, onClick, ...props }) {
140 return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, { title }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
141 component: "span",
142 "aria-label": void 0
143 }, /* @__PURE__ */ react.createElement(_elementor_ui.ToggleButton, {
144 ...props,
145 onChange: onClick,
146 "aria-label": title,
147 size: "small",
148 sx: {
149 border: 0,
150 "&.Mui-disabled": { border: 0 },
151 "& svg": {
152 fontSize: "1.25rem",
153 height: "1em",
154 width: "1em"
155 }
156 }
157 })));
158 }
159
160 //#endregion
161 //#region packages/packages/core/editor-app-bar/src/components/actions/toggle-action.tsx
162 function ToggleAction({ icon: Icon, title, value, visible = true, ...props }) {
163 const { type } = useMenuContext();
164 if (!visible) return null;
165 return type === "toolbar" ? /* @__PURE__ */ react.createElement(ToolbarMenuToggleItem, {
166 value: value || title,
167 title,
168 ...props
169 }, /* @__PURE__ */ react.createElement(Icon, null)) : /* @__PURE__ */ react.createElement(PopoverMenuItem, {
170 ...props,
171 text: title,
172 icon: /* @__PURE__ */ react.createElement(Icon, null)
173 });
174 }
175
176 //#endregion
177 //#region packages/packages/core/editor-app-bar/src/locations.ts
178 var { inject: injectIntoPageIndication, Slot: PageIndicationSlot } = (0, _elementor_locations.createLocation)();
179 var { inject: injectIntoResponsive, Slot: ResponsiveSlot } = (0, _elementor_locations.createLocation)();
180 var { inject: injectIntoPrimaryAction, Slot: PrimaryActionSlot } = (0, _elementor_locations.createLocation)();
181 var components = {
182 Action,
183 ToggleAction,
184 Link
185 };
186 var mainMenu = (0, _elementor_menus.createMenu)({
187 groups: ["help", "exits"],
188 components
189 });
190 var toolsMenu = (0, _elementor_menus.createMenu)({ components });
191 var utilitiesMenu = (0, _elementor_menus.createMenu)({ components });
192 var integrationsMenu = (0, _elementor_menus.createMenu)({ components });
193
194 //#endregion
195 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/locations.ts
196 var documentOptionsMenu = (0, _elementor_menus.createMenu)({
197 groups: ["save"],
198 components: {
199 Action,
200 ToggleAction,
201 Link
202 }
203 });
204
205 //#endregion
206 //#region packages/packages/core/editor-app-bar/src/constants.ts
207 var DEFAULT_MAX_TOOLBAR_ACTIONS = {
208 tools: 6,
209 utilities: 5
210 };
211
212 //#endregion
213 //#region packages/packages/core/editor-app-bar/src/contexts/app-bar-size-context.tsx
214 var AppBarSizeContext = (0, react.createContext)(DEFAULT_MAX_TOOLBAR_ACTIONS);
215 function AppBarSizeProvider({ value, children }) {
216 return /* @__PURE__ */ react.createElement(AppBarSizeContext.Provider, { value }, children);
217 }
218 function useMaxToolbarActions() {
219 return (0, react.useContext)(AppBarSizeContext);
220 }
221
222 //#endregion
223 //#region packages/packages/core/editor-app-bar/src/hooks/use-container-width.ts
224 function useContainerWidth(ref) {
225 const [width, setWidth] = (0, react.useState)(0);
226 (0, react.useEffect)(() => {
227 const element = ref.current;
228 if (!element || typeof ResizeObserver === "undefined") return;
229 const observer = new ResizeObserver((entries) => {
230 const entry = entries[0];
231 if (entry) setWidth(entry.contentRect.width);
232 });
233 setWidth(element.getBoundingClientRect().width);
234 observer.observe(element);
235 return () => observer.disconnect();
236 }, [ref]);
237 return width;
238 }
239
240 //#endregion
241 //#region packages/packages/core/editor-app-bar/src/utils/get-max-toolbar-actions.ts
242 var BREAKPOINTS = [
243 {
244 minWidth: 1200,
245 ...DEFAULT_MAX_TOOLBAR_ACTIONS
246 },
247 {
248 minWidth: 950,
249 tools: 3,
250 utilities: 2
251 },
252 {
253 minWidth: 800,
254 tools: 1,
255 utilities: 0
256 },
257 {
258 minWidth: 0,
259 tools: 0,
260 utilities: 0
261 }
262 ];
263 function getMaxToolbarActions(containerWidth) {
264 if (!containerWidth) return DEFAULT_MAX_TOOLBAR_ACTIONS;
265 const breakpoint = BREAKPOINTS.find(({ minWidth }) => containerWidth >= minWidth) ?? BREAKPOINTS.at(-1);
266 return {
267 tools: breakpoint?.tools ?? 0,
268 utilities: breakpoint?.utilities ?? 0
269 };
270 }
271
272 //#endregion
273 //#region packages/packages/core/editor-app-bar/src/components/ui/popover-menu.tsx
274 function PopoverMenu({ children, popupState, ...props }) {
275 return /* @__PURE__ */ react.createElement(MenuContextProvider, {
276 type: "popover",
277 popupState
278 }, /* @__PURE__ */ react.createElement(_elementor_ui.Menu, {
279 PaperProps: { sx: { mt: 1.5 } },
280 ...props,
281 MenuListProps: {
282 component: "div",
283 dense: true
284 }
285 }, children));
286 }
287
288 //#endregion
289 //#region packages/packages/core/editor-app-bar/src/components/ui/toolbar-logo.tsx
290 var ElementorLogo = (props) => {
291 return /* @__PURE__ */ react.createElement(_elementor_ui.SvgIcon, {
292 viewBox: "0 0 32 32",
293 ...props
294 }, /* @__PURE__ */ react.createElement("g", null, /* @__PURE__ */ react.createElement("circle", {
295 cx: "16",
296 cy: "16",
297 r: "16"
298 }), /* @__PURE__ */ react.createElement("path", { d: "M11.7 9H9V22.3H11.7V9Z" }), /* @__PURE__ */ react.createElement("path", { d: "M22.4 9H9V11.7H22.4V9Z" }), /* @__PURE__ */ react.createElement("path", { d: "M22.4 14.4004H9V17.1004H22.4V14.4004Z" }), /* @__PURE__ */ react.createElement("path", { d: "M22.4 19.6992H9V22.3992H22.4V19.6992Z" })));
299 };
300 var StyledToggleButton = (0, _elementor_ui.styled)(_elementor_ui.ToggleButton)(({ theme }) => ({
301 padding: 0,
302 border: 0,
303 color: theme.palette.text.primary,
304 "&.MuiToggleButton-root:hover": { backgroundColor: "initial" },
305 "&.MuiToggleButton-root.Mui-selected": { backgroundColor: "initial" }
306 }));
307 var StyledElementorLogo = (0, _elementor_ui.styled)(ElementorLogo, { shouldForwardProp: (prop) => prop !== "showMenuIcon" })(({ theme, showMenuIcon }) => ({ "& path": {
308 fill: theme.palette.background.default,
309 transition: "all 0.2s linear",
310 transformOrigin: "bottom left",
311 "&:first-of-type": {
312 transitionDelay: !showMenuIcon && "0.2s",
313 transform: showMenuIcon && "translateY(-9px) scaleY(0)"
314 },
315 "&:not(:first-of-type)": { transform: !showMenuIcon && `translateX(${theme.direction === "rtl" ? "4" : "9"}px) scaleX(0.6)` },
316 "&:nth-of-type(2)": { transitionDelay: showMenuIcon ? "0" : "0.2s" },
317 "&:nth-of-type(3)": { transitionDelay: "0.1s" },
318 "&:nth-of-type(4)": { transitionDelay: showMenuIcon ? "0.2s" : "0" }
319 } }));
320 function ToolbarLogo(props) {
321 const [isHoverState, setIsHoverState] = (0, react.useState)(false);
322 const showMenuIcon = props.selected || isHoverState;
323 return /* @__PURE__ */ react.createElement(StyledToggleButton, {
324 ...props,
325 value: "selected",
326 size: "large",
327 onMouseEnter: () => setIsHoverState(true),
328 onMouseLeave: () => setIsHoverState(false)
329 }, /* @__PURE__ */ react.createElement(StyledElementorLogo, {
330 fontSize: "large",
331 showMenuIcon,
332 titleAccess: (0, _wordpress_i18n.__)("Elementor Logo", "elementor")
333 }));
334 }
335
336 //#endregion
337 //#region packages/packages/core/editor-app-bar/src/components/locations/main-menu-location.tsx
338 var { useMenuItems: useMenuItems$4 } = mainMenu;
339 function MainMenuLocation() {
340 const menuItems = useMenuItems$4();
341 const popupState = (0, _elementor_ui.usePopupState)({
342 variant: "popover",
343 popupId: "elementor-v2-app-bar-main-menu"
344 });
345 const toolbarLogoProps = (0, _elementor_ui.bindTrigger)(popupState);
346 const onToolbarClick = (e) => {
347 const extendedWindow = window;
348 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
349 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.elementorLogoDropdown, {
350 location: config.locations.topBar,
351 secondaryLocation: config.secondaryLocations.eLogoMenu,
352 trigger: config.triggers.dropdownClick,
353 element: config.elements.buttonIcon
354 });
355 toolbarLogoProps.onClick(e);
356 };
357 return /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
358 sx: { paddingInlineStart: 3 },
359 direction: "row",
360 alignItems: "center"
361 }, /* @__PURE__ */ react.createElement(ToolbarLogo, {
362 ...toolbarLogoProps,
363 onClick: onToolbarClick,
364 selected: popupState.isOpen
365 }), /* @__PURE__ */ react.createElement(PopoverMenu, {
366 onClick: popupState.close,
367 ...(0, _elementor_ui.bindMenu)(popupState),
368 marginThreshold: 8
369 }, menuItems.default.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(MenuItem, { key: id })), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), menuItems.help.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(MenuItem, { key: id })), menuItems.exits.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(MenuItem, { key: id }))));
370 }
371
372 //#endregion
373 //#region packages/packages/core/editor-app-bar/src/components/locations/page-indication-location.tsx
374 function PageIndicationLocation() {
375 return /* @__PURE__ */ react.createElement(PageIndicationSlot, null);
376 }
377
378 //#endregion
379 //#region packages/packages/core/editor-app-bar/src/components/locations/primary-action-location.tsx
380 function PrimaryActionLocation() {
381 return /* @__PURE__ */ react.createElement(PrimaryActionSlot, null);
382 }
383
384 //#endregion
385 //#region packages/packages/core/editor-app-bar/src/components/locations/responsive-location.tsx
386 function ResponsiveLocation() {
387 return /* @__PURE__ */ react.createElement(ResponsiveSlot, null);
388 }
389
390 //#endregion
391 //#region packages/packages/core/editor-app-bar/src/extensions/angie/angie-consts.ts
392 var ANGIE_GUIDE_TOGGLE_EVENT = "elementor/editor/toggle-angie-guide";
393 var CREATE_WIDGET_EVENT = "elementor/editor/create-widget";
394 var ANGIE_BUTTON_ARIA_LABEL = (0, _wordpress_i18n.__)("Angie", "elementor");
395 var ANGIE_LEARN_MORE_URL = "https://go.elementor.com/angie-learn-more";
396 var ANGIE_DESCRIPTION = (0, _wordpress_i18n.__)("Angie lets you generate custom widgets, sections, and code using simple instructions.", "elementor");
397 var AI_WIDGET_CTA_VIEWED_EVENT = "ai_widget_cta_viewed";
398 var ANGIE_TOP_BAR_PROMOTION_IMAGE_URL = "https://assets.elementor.com/packages/v1/images/angie-top-bar-promotion-0926.svg";
399 var ANGIE_TOP_BAR_DESCRIPTION = (0, _wordpress_i18n.__)("Describe what you want to build in plain language and Angie generates it in native Elementor structure, fully editable and customizable.", "elementor");
400
401 //#endregion
402 //#region packages/packages/core/editor-app-bar/src/extensions/angie/components/angie-guide-card.tsx
403 function AngieGuideCard({ imageUrl, description, learnMoreUrl, onInstall, onClose }) {
404 return /* @__PURE__ */ react.createElement(_elementor_ui.ClickAwayListener, { onClickAway: onClose }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
405 sx: { width: 296 },
406 "data-testid": "e-angie-guide-card"
407 }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, { sx: {
408 position: "relative",
409 p: 1.5
410 } }, /* @__PURE__ */ react.createElement(_elementor_ui.Image, {
411 src: imageUrl,
412 alt: (0, _wordpress_i18n.__)("Angie", "elementor"),
413 sx: {
414 width: "100%",
415 maxHeight: 200,
416 objectFit: "cover",
417 objectPosition: "center top",
418 borderRadius: 1,
419 display: "block"
420 }
421 }), /* @__PURE__ */ react.createElement(_elementor_ui.CloseButton, {
422 sx: {
423 position: "absolute",
424 top: 15,
425 insetInlineEnd: 15,
426 color: "common.white",
427 filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.6))",
428 "&:hover": {
429 bgcolor: "rgba(255,255,255,0.2)",
430 color: "common.white"
431 }
432 },
433 slotProps: { icon: { fontSize: "small" } },
434 onClick: onClose
435 })), /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
436 px: 2,
437 pt: .5,
438 pb: .5
439 }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, { variant: "subtitle2" }, (0, _wordpress_i18n.__)("Generate full pages with AI", "elementor"))), /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
440 px: 2,
441 pt: .5,
442 pb: 1.5
443 }, /* @__PURE__ */ react.createElement(_elementor_ui.Typography, {
444 variant: "body2",
445 color: "secondary"
446 }, description)), /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
447 direction: "row",
448 justifyContent: "flex-end",
449 gap: 1,
450 pb: 1.5,
451 px: 2
452 }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
453 variant: "text",
454 size: "small",
455 color: "secondary",
456 onClick: () => {
457 window.open(learnMoreUrl, "_blank", "noopener,noreferrer");
458 onClose();
459 }
460 }, (0, _wordpress_i18n.__)("Learn More", "elementor")), onInstall && /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
461 variant: "contained",
462 size: "small",
463 color: "primary",
464 onClick: onInstall
465 }, (0, _wordpress_i18n.__)("Build with Angie", "elementor")))));
466 }
467
468 //#endregion
469 //#region packages/packages/core/editor-app-bar/src/extensions/angie/hooks/use-auto-show.ts
470 function useAutoShow() {
471 (0, react.useEffect)(() => {
472 if (!window.elementor?.config?.angie?.autoShow) return;
473 const id = setTimeout(() => {
474 window.dispatchEvent(new CustomEvent(CREATE_WIDGET_EVENT, { detail: { entry_point: "auto_show" } }));
475 }, 0);
476 return () => clearTimeout(id);
477 }, []);
478 }
479
480 //#endregion
481 //#region packages/packages/core/editor-app-bar/src/extensions/angie/components/angie-guide-location.tsx
482 function AngieGuideLocation() {
483 useAutoShow();
484 const [anchorEl, setAnchorEl] = (0, react.useState)(null);
485 const { dispatchEvent } = (0, _elementor_events.useMixpanel)();
486 const { isAdmin } = (0, _elementor_editor_current_user.useCurrentUserCapabilities)();
487 const isOpen = Boolean(anchorEl);
488 (0, react.useEffect)(() => {
489 const handleToggle = () => {
490 setAnchorEl((prev) => {
491 if (prev) return null;
492 return document.querySelector(`[aria-label="${ANGIE_BUTTON_ARIA_LABEL}"]`);
493 });
494 };
495 window.addEventListener(ANGIE_GUIDE_TOGGLE_EVENT, handleToggle);
496 return () => {
497 window.removeEventListener(ANGIE_GUIDE_TOGGLE_EVENT, handleToggle);
498 };
499 }, []);
500 const handleClose = () => setAnchorEl(null);
501 const handleInstall = async () => {
502 dispatchEvent?.(AI_WIDGET_CTA_VIEWED_EVENT, { entry_point: "top_bar_icon" });
503 window.dispatchEvent(new CustomEvent(CREATE_WIDGET_EVENT, { detail: { entry_point: "top_bar_icon" } }));
504 handleClose();
505 };
506 return /* @__PURE__ */ react.createElement(_elementor_editor_ui.ThemeProvider, null, /* @__PURE__ */ react.createElement(_elementor_ui.Infotip, {
507 content: /* @__PURE__ */ react.createElement(AngieGuideCard, {
508 imageUrl: ANGIE_TOP_BAR_PROMOTION_IMAGE_URL,
509 description: ANGIE_TOP_BAR_DESCRIPTION,
510 learnMoreUrl: ANGIE_LEARN_MORE_URL,
511 onInstall: isAdmin ? handleInstall : void 0,
512 onClose: handleClose
513 }),
514 placement: "bottom-start",
515 open: isOpen,
516 disableHoverListener: true,
517 PopperProps: {
518 anchorEl,
519 modifiers: [{
520 name: "offset",
521 options: { offset: [-4, -4] }
522 }]
523 }
524 }, /* @__PURE__ */ react.createElement("span", { style: { display: "contents" } })));
525 }
526
527 //#endregion
528 //#region packages/packages/core/editor-app-bar/src/components/ui/toolbar-menu.tsx
529 function ToolbarMenu({ children, ...props }) {
530 return /* @__PURE__ */ react.createElement(MenuContextProvider, { type: "toolbar" }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
531 sx: { px: 1.5 },
532 spacing: 1.5,
533 direction: "row",
534 alignItems: "center",
535 ...props
536 }, children));
537 }
538
539 //#endregion
540 //#region packages/packages/core/editor-app-bar/src/components/ui/toolbar-menu-more.tsx
541 function ToolbarMenuMore({ children, id }) {
542 const popupState = (0, _elementor_ui.usePopupState)({
543 variant: "popover",
544 popupId: id
545 });
546 return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(ToolbarMenuItem, {
547 ...(0, _elementor_ui.bindTrigger)(popupState),
548 title: (0, _wordpress_i18n.__)("More", "elementor")
549 }, /* @__PURE__ */ react.createElement(_elementor_icons.DotsVerticalIcon, null)), /* @__PURE__ */ react.createElement(PopoverMenu, {
550 onClick: popupState.close,
551 ...(0, _elementor_ui.bindMenu)(popupState)
552 }, children));
553 }
554
555 //#endregion
556 //#region packages/packages/core/editor-app-bar/src/components/locations/integrations-menu-location.tsx
557 var { useMenuItems: useMenuItems$3 } = integrationsMenu;
558 function IntegrationsMenuLocation() {
559 const menuItems = useMenuItems$3();
560 const popupState = (0, _elementor_ui.usePopupState)({
561 variant: "popover",
562 popupId: "elementor-v2-app-bar-integrations"
563 });
564 if (menuItems.default.length === 0) return null;
565 return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(ToolbarMenuItem, {
566 ...(0, _elementor_ui.bindTrigger)(popupState),
567 title: (0, _wordpress_i18n.__)("Integrations", "elementor")
568 }, /* @__PURE__ */ react.createElement(_elementor_icons.PlugIcon, null)), /* @__PURE__ */ react.createElement(PopoverMenu, {
569 onClick: popupState.close,
570 ...(0, _elementor_ui.bindMenu)(popupState),
571 marginThreshold: 8,
572 open: popupState.isOpen
573 }, menuItems.default.map(({ MenuItem: IntegrationsMenuItem, id }) => /* @__PURE__ */ react.createElement(IntegrationsMenuItem, { key: id }))));
574 }
575
576 //#endregion
577 //#region packages/packages/core/editor-app-bar/src/extensions/feedback/feedback-consts.ts
578 var EXPERIMENT_NAME = "in_editor_feedback";
579 var FEEDBACK_TOGGLE_EVENT = "elementor/open-feedback";
580
581 //#endregion
582 //#region packages/packages/core/editor-app-bar/src/components/locations/send-feedback-popup-location.tsx
583 var checkIfUserIsConnected = () => {
584 const extendedWindow = window;
585 return extendedWindow?.elementorCommon?.config.library_connect.is_connected || extendedWindow?.elementorPro?.config.isActive;
586 };
587 function SendFeedbackPopupLocation() {
588 const isActive = (0, _elementor_editor_v1_adapters.isExperimentActive)(EXPERIMENT_NAME);
589 const extendedWindow = window;
590 const [isUserConnected, setIsUserConnected] = (0, react.useState)(checkIfUserIsConnected());
591 const connectUrl = extendedWindow?.elementor?.config.user.top_bar.connect_url;
592 const [feedbackContent, setFeedbackContent] = (0, react.useState)("");
593 const [feedbackResult, setFeedbackResult] = (0, react.useState)(null);
594 const [submitDisabled, setSubmitDisabled] = (0, react.useState)(true);
595 const { dispatchEvent: trackEvent = (...args) => void 0 } = (0, _elementor_events.useMixpanel)();
596 const popupState = (0, _elementor_ui.usePopupState)({
597 variant: "dialog",
598 popupId: FEEDBACK_TOGGLE_EVENT
599 });
600 const [isFetching, setIsFetching] = (0, react.useState)(false);
601 (0, react.useEffect)(() => {
602 const handler = () => {
603 popupState.toggle();
604 setIsUserConnected(checkIfUserIsConnected());
605 setFeedbackResult(null);
606 trackEvent("feedback_modal_opened", {
607 source: "top_bar",
608 context: "v4_beta"
609 });
610 };
611 window.addEventListener(FEEDBACK_TOGGLE_EVENT, handler);
612 return () => {
613 window.removeEventListener(FEEDBACK_TOGGLE_EVENT, handler);
614 };
615 }, [popupState, trackEvent]);
616 (0, react.useEffect)(() => {
617 setSubmitDisabled(feedbackContent.trim().length < 10 || !isUserConnected || isFetching);
618 }, [
619 feedbackContent,
620 feedbackResult,
621 isUserConnected,
622 isFetching
623 ]);
624 const handleClose = () => {
625 popupState.close();
626 trackEvent("feedback_modal_closed", { feedback_text: feedbackContent });
627 };
628 const handleStartAnother = () => {
629 setFeedbackContent("");
630 setFeedbackResult(null);
631 };
632 const submitFeedback = () => {
633 setIsFetching(true);
634 (0, _elementor_http_client.httpService)().post("elementor/v1/feedback/submit", { description: feedbackContent.trim() }).then((response) => {
635 setFeedbackResult({
636 message: response.data.message,
637 success: response.data.success
638 });
639 if (!response.data.success && response.data.code.toString() === "401" || response.data.code.toString() === "403") setIsUserConnected(false);
640 trackEvent(response.data.success ? "feedback_submitted" : "feedback_error", {
641 feedback_length: feedbackContent.length,
642 error_type: response.data.success ? void 0 : "server",
643 error_message: response.data.success ? void 0 : response.data.message
644 });
645 }).finally(() => setIsFetching(false));
646 };
647 if (!isActive) return null;
648 return /* @__PURE__ */ react.createElement(_elementor_editor_ui.ThemeProvider, null, /* @__PURE__ */ react.createElement(_elementor_ui.Popover, {
649 ...(0, _elementor_ui.bindDialog)(popupState),
650 onClose: () => handleClose()
651 }, /* @__PURE__ */ react.createElement(_elementor_ui.Dialog, { open: popupState.isOpen }, /* @__PURE__ */ react.createElement(_elementor_ui.DialogHeader, { style: {
652 width: "100%",
653 minWidth: "35rem"
654 } }, /* @__PURE__ */ react.createElement(_elementor_ui.DialogTitle, { style: { width: "100%" } }, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
655 display: "flex",
656 direction: "row",
657 alignItems: "center",
658 justifyContent: "space-between",
659 width: "100%"
660 }, (0, _wordpress_i18n.__)("Submit Feedback", "elementor"), /* @__PURE__ */ react.createElement(_elementor_ui.CloseButton, { onClick: popupState.close })))), /* @__PURE__ */ react.createElement(_elementor_ui.DialogContent, null, /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
661 direction: "column",
662 gap: 2
663 }, isUserConnected ? /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.TextField, {
664 autofocus: true,
665 placeholder: (0, _wordpress_i18n.__)("E.g. Can you add ABC features? I want to do ABC and it’s important because …", "elementor"),
666 fullwith: true,
667 label: (0, _wordpress_i18n.__)("Your Feedback", "elementor"),
668 multiline: true,
669 id: "elementor-feedback-usercontent",
670 rows: 6,
671 cols: 80,
672 disabled: isFetching || feedbackResult?.success,
673 onChange: (event) => setFeedbackContent(event.target.value),
674 value: feedbackContent
675 }), /* @__PURE__ */ react.createElement(_elementor_ui.Stack, {
676 direction: "row",
677 justifyContent: "flex-end",
678 alignItems: "center",
679 gap: 2
680 }, feedbackResult && /* @__PURE__ */ react.createElement(react.Fragment, null, feedbackResult.success ? /* @__PURE__ */ react.createElement(_elementor_icons.CheckIcon, { color: "success" }) : /* @__PURE__ */ react.createElement(_elementor_icons.AlertCircleIcon, { color: "error" }), feedbackResult.message), feedbackResult?.success ? /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
681 variant: "text",
682 onClick: () => handleStartAnother()
683 }, (0, _wordpress_i18n.__)("Submit Another Feedback", "elementor")) : /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
684 disabled: submitDisabled,
685 onClick: submitFeedback,
686 variant: "contained",
687 color: "primary",
688 size: "small"
689 }, (0, _wordpress_i18n.__)("Submit", "elementor")))) : /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
690 variant: "contained",
691 color: "primary",
692 size: "large",
693 href: connectUrl,
694 target: "_blank",
695 rel: "noopener",
696 onClick: popupState.close
697 }, (0, _wordpress_i18n.__)("Connect to Elementor", "elementor"))))))));
698 }
699
700 //#endregion
701 //#region packages/packages/core/editor-app-bar/src/components/locations/tools-menu-location.tsx
702 var { useMenuItems: useMenuItems$2 } = toolsMenu;
703 function ToolsMenuLocation() {
704 const menuItems = useMenuItems$2();
705 const { tools: maxToolbarActions } = useMaxToolbarActions();
706 const toolbarMenuItems = menuItems.default.slice(0, maxToolbarActions);
707 const popoverMenuItems = menuItems.default.slice(maxToolbarActions);
708 return /* @__PURE__ */ react.createElement(ToolbarMenu, null, toolbarMenuItems.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(MenuItem, { key: id })), /* @__PURE__ */ react.createElement(AngieGuideLocation, null), /* @__PURE__ */ react.createElement(SendFeedbackPopupLocation, null), /* @__PURE__ */ react.createElement(IntegrationsMenuLocation, null), popoverMenuItems.length > 0 && /* @__PURE__ */ react.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-tools-more" }, popoverMenuItems.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(MenuItem, { key: id }))));
709 }
710
711 //#endregion
712 //#region packages/packages/core/editor-app-bar/src/components/locations/utilities-menu-location.tsx
713 var { useMenuItems: useMenuItems$1 } = utilitiesMenu;
714 function UtilitiesMenuLocation() {
715 const menuItems = useMenuItems$1();
716 const { utilities: maxToolbarActions } = useMaxToolbarActions();
717 const shouldUsePopover = menuItems.default.length > maxToolbarActions;
718 const toolbarMenuItems = shouldUsePopover ? menuItems.default.slice(0, maxToolbarActions) : menuItems.default;
719 const popoverMenuItems = shouldUsePopover ? menuItems.default.slice(maxToolbarActions) : [];
720 return /* @__PURE__ */ react.createElement(ToolbarMenu, null, popoverMenuItems.length > 0 && /* @__PURE__ */ react.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-utilities-more" }, popoverMenuItems.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(MenuItem, { key: id }))), toolbarMenuItems.map(({ MenuItem, id }) => /* @__PURE__ */ react.createElement(react.Fragment, { key: id }, /* @__PURE__ */ react.createElement(MenuItem, null))));
721 }
722
723 //#endregion
724 //#region packages/packages/core/editor-app-bar/src/components/app-bar.tsx
725 function AppBar() {
726 const document = (0, _elementor_editor_documents.__useActiveDocument)();
727 const containerRef = (0, react.useRef)(null);
728 const maxToolbarActions = getMaxToolbarActions(useContainerWidth(containerRef));
729 return /* @__PURE__ */ react.createElement(_elementor_ui.ThemeProvider, { colorScheme: "dark" }, /* @__PURE__ */ react.createElement(_elementor_ui.AppBar, { position: "sticky" }, /* @__PURE__ */ react.createElement(_elementor_ui.Toolbar, {
730 disableGutters: true,
731 variant: "dense",
732 sx: { overflowX: "auto" }
733 }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
734 ref: containerRef,
735 display: "grid",
736 gridTemplateColumns: "minmax(0, 1fr) auto minmax(0, 1fr)",
737 flexGrow: 1,
738 minWidth: `${800}px`
739 }, /* @__PURE__ */ react.createElement(AppBarSizeProvider, { value: maxToolbarActions }, /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
740 container: true,
741 flexWrap: "nowrap",
742 sx: {
743 minWidth: 0,
744 overflow: "hidden"
745 }
746 }, /* @__PURE__ */ react.createElement(MainMenuLocation, null), document?.permissions?.allowAddingWidgets && /* @__PURE__ */ react.createElement(ToolsMenuLocation, null)), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
747 container: true,
748 justifyContent: "center"
749 }, /* @__PURE__ */ react.createElement(ToolbarMenu, { spacing: 1.5 }, /* @__PURE__ */ react.createElement(_elementor_ui.Divider, { orientation: "vertical" }), /* @__PURE__ */ react.createElement(PageIndicationLocation, null), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, { orientation: "vertical" }), /* @__PURE__ */ react.createElement(ResponsiveLocation, null), /* @__PURE__ */ react.createElement(_elementor_ui.Divider, { orientation: "vertical" }))), /* @__PURE__ */ react.createElement(_elementor_ui.Grid, {
750 container: true,
751 justifyContent: "flex-end",
752 flexWrap: "nowrap",
753 sx: {
754 minWidth: 0,
755 overflow: "hidden"
756 }
757 }, /* @__PURE__ */ react.createElement(UtilitiesMenuLocation, null), /* @__PURE__ */ react.createElement(PrimaryActionLocation, null)))))));
758 }
759
760 //#endregion
761 //#region packages/packages/core/editor-app-bar/src/hooks/use-is-angie-available.ts
762 function useIsAngieAvailable() {
763 const [available, setAvailable] = (0, react.useState)(() => (0, _elementor_editor_mcp.isAngieAvailable)());
764 (0, react.useEffect)(() => {
765 if (available) return;
766 if ((0, _elementor_editor_mcp.isAngieAvailable)()) {
767 setAvailable(true);
768 return;
769 }
770 const observer = new MutationObserver(() => {
771 if ((0, _elementor_editor_mcp.isAngieAvailable)()) {
772 observer.disconnect();
773 setAvailable(true);
774 }
775 });
776 observer.observe(document.body, {
777 childList: true,
778 subtree: true
779 });
780 return () => observer.disconnect();
781 }, [available]);
782 return available;
783 }
784
785 //#endregion
786 //#region packages/packages/core/editor-app-bar/src/extensions/angie/hooks/use-action-props.ts
787 function useActionProps$11() {
788 const visible = !useIsAngieAvailable();
789 (0, react.useEffect)(() => {
790 if (!visible) return;
791 (0, _elementor_events.trackEvent)({
792 eventName: AI_WIDGET_CTA_VIEWED_EVENT,
793 entry_point: "top_bar_icon",
794 has_angie_installed: false
795 });
796 }, [visible]);
797 return {
798 title: (0, _wordpress_i18n.__)("Angie", "elementor"),
799 icon: _elementor_icons.AngieIcon,
800 onClick: () => {
801 window.dispatchEvent(new CustomEvent(ANGIE_GUIDE_TOGGLE_EVENT));
802 },
803 selected: false,
804 visible
805 };
806 }
807 __name(useActionProps$11, "useActionProps");
808
809 //#endregion
810 //#region packages/packages/core/editor-app-bar/src/extensions/angie/index.ts
811 function init$18() {
812 toolsMenu.registerToggleAction({
813 id: "toggle-angie",
814 priority: 2,
815 useProps: useActionProps$11
816 });
817 }
818 __name(init$18, "init");
819
820 //#endregion
821 //#region packages/packages/core/editor-app-bar/src/extensions/connect/hooks/use-connect-link-config.tsx
822 var dispatchConnectClickEvent = (eventName) => {
823 try {
824 const extendedWindow = window;
825 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
826 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar[eventName], {
827 location: config.locations.topBar,
828 secondaryLocation: config.secondaryLocations.eLogoMenu,
829 trigger: config.triggers.dropdownClick,
830 element: config.elements.buttonIcon
831 });
832 } catch (error) {
833 console.warn(error);
834 }
835 };
836 function useConnectLinkConfig() {
837 const extendedWindow = window;
838 let isUserConnected = false;
839 const isPro = extendedWindow?.elementor?.helpers.hasPro();
840 let target = "_blank";
841 if (isPro) isUserConnected = extendedWindow?.elementorPro?.config.isActive ?? false;
842 else {
843 isUserConnected = extendedWindow?.elementorCommon?.config.library_connect.is_connected ?? false;
844 target = "_self";
845 }
846 const handleConnectClick = (0, react.useCallback)((event) => {
847 event.preventDefault();
848 if (extendedWindow.jQuery && extendedWindow.jQuery.fn?.elementorConnect) {
849 const connectUrl = extendedWindow?.elementor?.config.user.top_bar.connect_url;
850 const $tempButton = extendedWindow.jQuery("<a>");
851 $tempButton?.attr("href", connectUrl)?.attr("target", "_blank")?.attr("rel", "opener")?.css("display", "none")?.appendTo("body");
852 $tempButton.elementorConnect({ success: () => {
853 dispatchConnectClickEvent("accountConnected");
854 setTimeout(() => {
855 extendedWindow.location.reload();
856 }, 200);
857 } });
858 $tempButton[0].click();
859 dispatchConnectClickEvent("connectAccount");
860 setTimeout(() => {
861 $tempButton.remove();
862 }, 1e3);
863 }
864 }, [extendedWindow]);
865 return isUserConnected ? {
866 title: (0, _wordpress_i18n.__)("My Elementor", "elementor"),
867 href: extendedWindow?.elementor?.config.user.top_bar.my_elementor_url,
868 icon: _elementor_icons.UserIcon,
869 target: "_blank"
870 } : {
871 title: (0, _wordpress_i18n.__)("Connect my account", "elementor"),
872 href: extendedWindow?.elementor?.config.user.top_bar.connect_url,
873 icon: _elementor_icons.UserIcon,
874 target,
875 onClick: handleConnectClick
876 };
877 }
878
879 //#endregion
880 //#region packages/packages/core/editor-app-bar/src/extensions/connect/index.ts
881 function init$17() {
882 mainMenu.registerLink({
883 id: "app-bar-connect",
884 group: "exits",
885 priority: 10,
886 useProps: useConnectLinkConfig
887 });
888 }
889 __name(init$17, "init");
890
891 //#endregion
892 //#region packages/packages/core/editor-app-bar/src/extensions/documents-preview/hooks/use-action-props.ts
893 function useActionProps$10() {
894 const document = (0, _elementor_editor_documents.__useActiveDocument)();
895 return {
896 icon: _elementor_icons.EyeIcon,
897 title: (0, _wordpress_i18n.__)("Preview Changes", "elementor"),
898 onClick: () => {
899 const extendedWindow = window;
900 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
901 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.previewPage, {
902 location: config.locations.topBar,
903 secondaryLocation: config.secondaryLocations["preview-page"],
904 trigger: config.triggers.click,
905 element: config.elements.buttonIcon
906 });
907 if (document) (0, _elementor_editor_v1_adapters.__privateRunCommand)("editor/documents/preview", {
908 id: document.id,
909 force: true
910 });
911 }
912 };
913 }
914 __name(useActionProps$10, "useActionProps");
915
916 //#endregion
917 //#region packages/packages/core/editor-app-bar/src/extensions/documents-preview/index.ts
918 function init$16() {
919 utilitiesMenu.registerAction({
920 id: "document-preview-button",
921 priority: 30,
922 useProps: useActionProps$10
923 });
924 }
925 __name(init$16, "init");
926
927 //#endregion
928 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/components/primary-action-menu.tsx
929 var { useMenuItems } = documentOptionsMenu;
930 var StyledPopoverMenu = (0, _elementor_ui.styled)(PopoverMenu)`
931 & > .MuiPopover-paper > .MuiList-root {
932 & > .MuiDivider-root {
933 display: none;
934 }
935
936 & > *:not( .MuiDivider-root ):not( :last-of-type ) + .MuiDivider-root {
937 display: block;
938 }
939 }
940 `;
941 function PrimaryActionMenu(props) {
942 const { save: saveActions, default: defaultActions } = useMenuItems();
943 return /* @__PURE__ */ react.createElement(StyledPopoverMenu, {
944 ...props,
945 anchorOrigin: {
946 vertical: "bottom",
947 horizontal: "right"
948 },
949 transformOrigin: {
950 vertical: "top",
951 horizontal: "right"
952 },
953 marginThreshold: 4,
954 PaperProps: { sx: { mt: .5 } }
955 }, saveActions.map(({ MenuItem, id }, index) => [index > 0 && /* @__PURE__ */ react.createElement(_elementor_ui.Divider, { key: `${id}-divider` }), /* @__PURE__ */ react.createElement(MenuItem, { key: id })]), saveActions.length > 0 && defaultActions.length > 0 && /* @__PURE__ */ react.createElement(_elementor_ui.Divider, null), defaultActions.map(({ MenuItem, id }, index) => [index > 0 && /* @__PURE__ */ react.createElement(_elementor_ui.Divider, { key: `${id}-divider` }), /* @__PURE__ */ react.createElement(MenuItem, { key: id })]));
956 }
957
958 //#endregion
959 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/components/primary-action.tsx
960 function PrimaryAction$1() {
961 const document = (0, _elementor_editor_documents.__useActiveDocument)();
962 const { save } = (0, _elementor_editor_documents.__useActiveDocumentActions)();
963 const isEditMode = (0, _elementor_editor_v1_adapters.useEditMode)() === "edit";
964 const popupState = (0, _elementor_ui.usePopupState)({
965 variant: "popover",
966 popupId: "document-save-options"
967 });
968 if (!document) return null;
969 const isPublishDisabled = !isEditMode || !isPublishEnabled(document);
970 const isSaveOptionsDisabled = !isEditMode || document.type.value === "kit";
971 const shouldShowSpinner = document.isSaving && !isPublishDisabled;
972 return /* @__PURE__ */ react.createElement(react.Fragment, null, /* @__PURE__ */ react.createElement(_elementor_ui.ButtonGroup, {
973 size: "large",
974 variant: "contained"
975 }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
976 onClick: () => {
977 const extendedWindow = window;
978 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
979 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.publishButton, {
980 location: config.locations.topBar,
981 secondaryLocation: config.secondaryLocations["publish-button"],
982 trigger: config.triggers.click,
983 element: config.elements.mainCta
984 });
985 if (!document.isSaving) save();
986 },
987 sx: {
988 height: "100%",
989 borderRadius: 0,
990 maxWidth: "158px",
991 "&.MuiButtonBase-root.MuiButtonGroup-grouped": { minWidth: "110px" }
992 },
993 disabled: isPublishDisabled
994 }, shouldShowSpinner ? /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, {
995 color: "inherit",
996 size: "1.5em"
997 }) : getLabel(document)), /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
998 title: (0, _wordpress_i18n.__)("Save Options", "elementor"),
999 PopperProps: { sx: { "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
1000 mt: 1,
1001 mr: .25
1002 } } }
1003 }, /* @__PURE__ */ react.createElement(_elementor_ui.Box, {
1004 component: "span",
1005 "aria-label": void 0
1006 }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
1007 size: "small",
1008 ...(0, _elementor_ui.bindTrigger)(popupState),
1009 sx: {
1010 px: 0,
1011 height: "100%",
1012 borderRadius: 0
1013 },
1014 disabled: isSaveOptionsDisabled,
1015 "aria-label": (0, _wordpress_i18n.__)("Save Options", "elementor")
1016 }, /* @__PURE__ */ react.createElement(_elementor_icons.ChevronDownIcon, null))))), /* @__PURE__ */ react.createElement(PrimaryActionMenu, {
1017 ...(0, _elementor_ui.bindMenu)(popupState),
1018 onClick: popupState.close
1019 }));
1020 }
1021 __name(PrimaryAction$1, "PrimaryAction");
1022 function getLabel(document) {
1023 return document.userCan.publish ? (0, _wordpress_i18n.__)("Publish", "elementor") : (0, _wordpress_i18n.__)("Submit", "elementor");
1024 }
1025 function isPublishEnabled(document) {
1026 if (document.type.value === "kit") return false;
1027 return document.isDirty || document.status.value === "draft";
1028 }
1029
1030 //#endregion
1031 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/hooks/use-document-copy-and-share-props.ts
1032 function useDocumentCopyAndShareProps() {
1033 const document = (0, _elementor_editor_documents.__useActiveDocument)();
1034 const { copyAndShare } = (0, _elementor_editor_documents.__useActiveDocumentActions)();
1035 const { dispatchEvent, config } = (0, _elementor_events.useMixpanel)();
1036 return {
1037 icon: _elementor_icons.LinkIcon,
1038 title: (0, _wordpress_i18n.__)("Copy and Share", "elementor"),
1039 onClick: () => {
1040 const eventName = config?.names?.editorOne?.topBarPublishDropdown;
1041 if (eventName) dispatchEvent?.(eventName, {
1042 window_name: config?.appTypes?.editor,
1043 interaction_type: config?.triggers?.click?.toLowerCase(),
1044 target_type: config?.targetTypes?.dropdownItem,
1045 target_name: config?.targetNames?.publishDropdown?.copyAndShare,
1046 interaction_result: config?.interactionResults?.actionSelected,
1047 target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
1048 location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
1049 location_l2: config?.targetTypes?.dropdownItem
1050 });
1051 copyAndShare();
1052 },
1053 disabled: !document || document.isSaving || document.isSavingDraft || !("publish" === document.status.value),
1054 visible: document?.permissions?.showCopyAndShare
1055 };
1056 }
1057
1058 //#endregion
1059 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/hooks/use-document-save-draft-props.ts
1060 function useDocumentSaveDraftProps() {
1061 const document = (0, _elementor_editor_documents.__useActiveDocument)();
1062 const { saveDraft } = (0, _elementor_editor_documents.__useActiveDocumentActions)();
1063 const { dispatchEvent, config } = (0, _elementor_events.useMixpanel)();
1064 return {
1065 icon: _elementor_icons.FileReportIcon,
1066 title: (0, _wordpress_i18n.__)("Save Draft", "elementor"),
1067 onClick: () => {
1068 const eventName = config?.names?.editorOne?.topBarPublishDropdown;
1069 if (eventName) dispatchEvent?.(eventName, {
1070 window_name: config?.appTypes?.editor,
1071 interaction_type: config?.triggers?.click?.toLowerCase(),
1072 target_type: config?.targetTypes?.dropdownItem,
1073 target_name: config?.targetNames?.publishDropdown?.saveDraft,
1074 interaction_result: config?.interactionResults?.actionSelected,
1075 target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
1076 location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
1077 location_l2: config?.targetTypes?.dropdownItem
1078 });
1079 saveDraft();
1080 },
1081 disabled: !document || document.isSaving || document.isSavingDraft || !document.isDirty
1082 };
1083 }
1084
1085 //#endregion
1086 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/hooks/use-document-save-template-props.ts
1087 function useDocumentSaveTemplateProps() {
1088 const { saveTemplate } = (0, _elementor_editor_documents.__useActiveDocumentActions)();
1089 const { dispatchEvent, config } = (0, _elementor_events.useMixpanel)();
1090 return {
1091 icon: _elementor_icons.FolderIcon,
1092 title: (0, _wordpress_i18n.__)("Save as Template", "elementor"),
1093 onClick: () => {
1094 const eventName = config?.names?.editorOne?.topBarPublishDropdown;
1095 if (eventName) dispatchEvent?.(eventName, {
1096 window_name: config?.appTypes?.editor,
1097 interaction_type: config?.triggers?.click?.toLowerCase(),
1098 target_type: config?.targetTypes?.dropdownItem,
1099 target_name: config?.targetNames?.publishDropdown?.saveAsTemplate,
1100 interaction_result: config?.interactionResults?.actionSelected,
1101 target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
1102 location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
1103 location_l2: config?.targetTypes?.dropdownItem
1104 });
1105 saveTemplate();
1106 }
1107 };
1108 }
1109
1110 //#endregion
1111 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/hooks/use-document-view-page-props.ts
1112 function useDocumentViewPageProps() {
1113 const document = (0, _elementor_editor_documents.__useActiveDocument)();
1114 const { dispatchEvent, config } = (0, _elementor_events.useMixpanel)();
1115 return {
1116 icon: _elementor_icons.EyeIcon,
1117 title: (0, _wordpress_i18n.__)("View Page", "elementor"),
1118 onClick: () => {
1119 const eventName = config?.names?.editorOne?.topBarPublishDropdown;
1120 if (eventName) dispatchEvent?.(eventName, {
1121 window_name: config?.appTypes?.editor,
1122 interaction_type: config?.triggers?.click?.toLowerCase(),
1123 target_type: config?.targetTypes?.dropdownItem,
1124 target_name: config?.targetNames?.publishDropdown?.viewPage,
1125 interaction_result: config?.interactionResults?.actionSelected,
1126 target_location: config?.locations?.topBar?.replace(/\s+/g, "_").toLowerCase(),
1127 location_l1: config?.secondaryLocations?.publishDropdown?.replace(/\s+/g, "_").toLowerCase(),
1128 location_l2: config?.targetTypes?.dropdownItem
1129 });
1130 if (document?.id) (0, _elementor_editor_v1_adapters.__privateRunCommand)("editor/documents/view", { id: document.id });
1131 }
1132 };
1133 }
1134
1135 //#endregion
1136 //#region packages/packages/core/editor-app-bar/src/extensions/documents-save/index.ts
1137 function init$15() {
1138 injectIntoPrimaryAction({
1139 id: "document-primary-action",
1140 component: PrimaryAction$1
1141 });
1142 documentOptionsMenu.registerAction({
1143 group: "save",
1144 id: "document-save-draft",
1145 priority: 10,
1146 useProps: useDocumentSaveDraftProps
1147 });
1148 documentOptionsMenu.registerAction({
1149 group: "save",
1150 id: "document-save-as-template",
1151 priority: 20,
1152 useProps: useDocumentSaveTemplateProps
1153 });
1154 documentOptionsMenu.registerAction({
1155 id: "document-copy-and-share",
1156 priority: 10,
1157 useProps: useDocumentCopyAndShareProps
1158 });
1159 documentOptionsMenu.registerAction({
1160 id: "document-view-page",
1161 priority: 50,
1162 useProps: useDocumentViewPageProps
1163 });
1164 }
1165 __name(init$15, "init");
1166
1167 //#endregion
1168 //#region packages/packages/core/editor-app-bar/src/extensions/documents-settings/hooks/use-action-props.ts
1169 function useActionProps$9() {
1170 const activeDocument = (0, _elementor_editor_documents.__useActiveDocument)();
1171 const hostDocument = (0, _elementor_editor_documents.__useHostDocument)();
1172 const { isActive, isBlocked } = (0, _elementor_editor_v1_adapters.__privateUseRouteStatus)("panel/page-settings");
1173 const document = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument;
1174 return {
1175 title: document ? (0, _wordpress_i18n.__)("%s Settings", "elementor").replace("%s", document.type.label) : (0, _wordpress_i18n.__)("Document Settings", "elementor"),
1176 icon: _elementor_icons.FileSettingsIcon,
1177 onClick: () => {
1178 if (!document) return;
1179 const extendedWindow = window;
1180 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1181 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.documentSettings, {
1182 location: config.locations.topBar,
1183 secondaryLocation: config.secondaryLocations["document-settings"],
1184 trigger: config.triggers.click,
1185 element: config.elements.buttonIcon
1186 });
1187 (0, _elementor_editor_v1_adapters.__privateOpenRoute)("panel/page-settings/settings");
1188 },
1189 selected: isActive,
1190 disabled: isBlocked || !document
1191 };
1192 }
1193 __name(useActionProps$9, "useActionProps");
1194
1195 //#endregion
1196 //#region packages/packages/core/editor-app-bar/src/extensions/documents-settings/index.ts
1197 function init$14() {
1198 toolsMenu.registerToggleAction({
1199 id: "document-settings-button",
1200 priority: 5,
1201 useProps: useActionProps$9
1202 });
1203 }
1204 __name(init$14, "init");
1205
1206 //#endregion
1207 //#region packages/packages/core/editor-app-bar/src/extensions/elements/hooks/use-action-props.ts
1208 function useActionProps$8() {
1209 const { isActive, isBlocked } = (0, _elementor_editor_v1_adapters.__privateUseRouteStatus)("panel/elements");
1210 return {
1211 title: (0, _wordpress_i18n.__)("Add Element", "elementor"),
1212 icon: _elementor_icons.PlusIcon,
1213 id: "ele-add-element",
1214 onClick: () => {
1215 const extendedWindow = window;
1216 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1217 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.widgetPanel, {
1218 location: config.locations.topBar,
1219 secondaryLocation: config.secondaryLocations["widget-panel"],
1220 trigger: config.triggers.toggleClick,
1221 element: config.elements.buttonIcon
1222 });
1223 (0, _elementor_editor_v1_adapters.__privateOpenRoute)("panel/elements/categories");
1224 },
1225 selected: isActive,
1226 disabled: isBlocked
1227 };
1228 }
1229 __name(useActionProps$8, "useActionProps");
1230
1231 //#endregion
1232 //#region packages/packages/core/editor-app-bar/src/extensions/elements/sync/sync-panel-title.ts
1233 function syncPanelTitle() {
1234 const panelTitle = (0, _wordpress_i18n.__)("Elements", "elementor");
1235 const tabTitle = (0, _wordpress_i18n.__)("Widgets", "elementor");
1236 (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.routeOpenEvent)("panel/elements"), () => {
1237 setPanelTitle(panelTitle);
1238 setTabTitle(tabTitle);
1239 });
1240 (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.v1ReadyEvent)(), () => {
1241 if ((0, _elementor_editor_v1_adapters.__privateIsRouteActive)("panel/elements")) {
1242 setPanelTitle(panelTitle);
1243 setTabTitle(tabTitle);
1244 }
1245 });
1246 }
1247 function setPanelTitle(title) {
1248 window.elementor?.getPanelView?.()?.getHeaderView?.()?.setTitle?.(title);
1249 }
1250 function setTabTitle(title) {
1251 const tab = document.querySelector(".elementor-component-tab[data-tab=\"categories\"]");
1252 if (tab) tab.textContent = title;
1253 }
1254
1255 //#endregion
1256 //#region packages/packages/core/editor-app-bar/src/extensions/elements/index.ts
1257 function init$13() {
1258 syncPanelTitle();
1259 toolsMenu.registerToggleAction({
1260 id: "open-elements-panel",
1261 priority: 1,
1262 useProps: useActionProps$8
1263 });
1264 }
1265 __name(init$13, "init");
1266
1267 //#endregion
1268 //#region packages/packages/core/editor-app-bar/src/extensions/feedback/index.ts
1269 function init$12() {
1270 if (!(0, _elementor_editor_v1_adapters.isExperimentActive)("in_editor_feedback")) return;
1271 mainMenu.registerAction({
1272 id: "open-send-feedback",
1273 group: "help",
1274 priority: 20,
1275 useProps: () => {
1276 return {
1277 icon: _elementor_icons.MessageLinesIcon,
1278 title: (0, _wordpress_i18n.__)("Send Feedback", "elementor"),
1279 onClick: () => {
1280 dispatchEvent(new CustomEvent(FEEDBACK_TOGGLE_EVENT));
1281 }
1282 };
1283 }
1284 });
1285 }
1286 __name(init$12, "init");
1287
1288 //#endregion
1289 //#region packages/packages/core/editor-app-bar/src/extensions/finder/hooks/use-action-props.ts
1290 function useActionProps$7() {
1291 return {
1292 title: (0, _wordpress_i18n.__)("Finder", "elementor"),
1293 icon: _elementor_icons.SearchIcon,
1294 onClick: () => {
1295 const extendedWindow = window;
1296 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1297 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.finder, {
1298 location: config.locations.topBar,
1299 secondaryLocation: config.secondaryLocations.finder,
1300 trigger: config.triggers.toggleClick,
1301 element: config.elements.buttonIcon
1302 });
1303 (0, _elementor_editor_v1_adapters.__privateRunCommand)("finder/toggle");
1304 }
1305 };
1306 }
1307 __name(useActionProps$7, "useActionProps");
1308
1309 //#endregion
1310 //#region packages/packages/core/editor-app-bar/src/extensions/finder/index.ts
1311 function init$11() {
1312 utilitiesMenu.registerAction({
1313 id: "toggle-finder",
1314 priority: 15,
1315 useProps: useActionProps$7
1316 });
1317 }
1318 __name(init$11, "init");
1319
1320 //#endregion
1321 //#region packages/packages/core/editor-app-bar/src/extensions/help/hooks/use-action-props.ts
1322 var HELP_CENTER_URL = "https://go.elementor.com/editor-top-bar-learn/";
1323 var HELP_CENTER_ANGIE_PROMPT = `${(0, _wordpress_i18n.__)("Help me with", "elementor")} `;
1324 var dispatchHelpClickEvent = () => {
1325 const extendedWindow = window;
1326 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1327 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.help, {
1328 location: config.locations.topBar,
1329 secondaryLocation: config.secondaryLocations.help,
1330 trigger: config.triggers.click,
1331 element: config.elements.buttonIcon
1332 });
1333 };
1334 function useActionProps$6() {
1335 if ((0, _elementor_editor_mcp.isAngieAvailable)()) return {
1336 title: (0, _wordpress_i18n.__)("Help Center", "elementor"),
1337 icon: _elementor_icons.HelpIcon,
1338 onClick: (event) => {
1339 event.preventDefault();
1340 dispatchHelpClickEvent();
1341 (0, _elementor_editor_mcp.openAngieInAskMode)(HELP_CENTER_ANGIE_PROMPT);
1342 }
1343 };
1344 return {
1345 title: (0, _wordpress_i18n.__)("Help Center", "elementor"),
1346 href: HELP_CENTER_URL,
1347 icon: _elementor_icons.HelpIcon,
1348 target: "_blank",
1349 onClick: () => {
1350 dispatchHelpClickEvent();
1351 }
1352 };
1353 }
1354 __name(useActionProps$6, "useActionProps");
1355
1356 //#endregion
1357 //#region packages/packages/core/editor-app-bar/src/extensions/help/index.ts
1358 function init$10() {
1359 mainMenu.registerLink({
1360 id: "open-help-center",
1361 group: "help",
1362 priority: 10,
1363 useProps: useActionProps$6
1364 });
1365 }
1366 __name(init$10, "init");
1367
1368 //#endregion
1369 //#region packages/packages/core/editor-app-bar/src/extensions/history/hooks/use-action-props.ts
1370 function useActionProps$5() {
1371 const { isActive, isBlocked } = (0, _elementor_editor_v1_adapters.__privateUseRouteStatus)("panel/history");
1372 return {
1373 title: (0, _wordpress_i18n.__)("History", "elementor"),
1374 icon: _elementor_icons.HistoryIcon,
1375 onClick: () => {
1376 const extendedWindow = window;
1377 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1378 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.history, {
1379 location: config.locations.topBar,
1380 secondaryLocation: config.secondaryLocations.elementorLogo,
1381 trigger: config.triggers.click,
1382 element: config.elements.link
1383 });
1384 (0, _elementor_editor_v1_adapters.__privateOpenRoute)("panel/history/actions");
1385 },
1386 selected: isActive,
1387 disabled: isBlocked
1388 };
1389 }
1390 __name(useActionProps$5, "useActionProps");
1391
1392 //#endregion
1393 //#region packages/packages/core/editor-app-bar/src/extensions/history/index.ts
1394 function init$9() {
1395 toolsMenu.registerToggleAction({
1396 id: "open-history",
1397 priority: 3,
1398 useProps: useActionProps$5
1399 });
1400 }
1401 __name(init$9, "init");
1402
1403 //#endregion
1404 //#region packages/packages/core/editor-app-bar/src/extensions/keyboard-shortcuts/hooks/use-action-props.ts
1405 function useActionProps$4() {
1406 return {
1407 icon: _elementor_icons.KeyboardIcon,
1408 title: (0, _wordpress_i18n.__)("Keyboard Shortcuts", "elementor"),
1409 onClick: () => {
1410 const extendedWindow = window;
1411 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1412 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.keyboardShortcuts, {
1413 location: config.locations.topBar,
1414 secondaryLocation: config.secondaryLocations.elementorLogo,
1415 trigger: config.triggers.click,
1416 element: config.elements.link
1417 });
1418 (0, _elementor_editor_v1_adapters.__privateRunCommand)("shortcuts/open");
1419 }
1420 };
1421 }
1422 __name(useActionProps$4, "useActionProps");
1423
1424 //#endregion
1425 //#region packages/packages/core/editor-app-bar/src/extensions/keyboard-shortcuts/index.ts
1426 function init$8() {
1427 mainMenu.registerAction({
1428 id: "open-keyboard-shortcuts",
1429 group: "default",
1430 priority: 40,
1431 useProps: useActionProps$4
1432 });
1433 }
1434 __name(init$8, "init");
1435
1436 //#endregion
1437 //#region packages/packages/core/editor-app-bar/src/extensions/responsive/components/breakpoints-switcher.tsx
1438 function BreakpointsSwitcher() {
1439 const breakpoints = (0, _elementor_editor_responsive.useBreakpoints)();
1440 const activeBreakpoint = (0, _elementor_editor_responsive.useActiveBreakpoint)();
1441 const activateBreakpoint = (0, _elementor_editor_responsive.useActivateBreakpoint)();
1442 if (!breakpoints.length || !activeBreakpoint) return null;
1443 const onChange = (_, value) => {
1444 const extendedWindow = window;
1445 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1446 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.responsiveControls, {
1447 location: config.locations.topBar,
1448 secondaryLocation: config.secondaryLocations.responsiveControls,
1449 trigger: config.triggers.click,
1450 element: config.elements.buttonIcon,
1451 mode: value
1452 });
1453 activateBreakpoint(value);
1454 };
1455 return /* @__PURE__ */ react.createElement(_elementor_ui.Tabs, {
1456 textColor: "inherit",
1457 indicatorColor: "secondary",
1458 value: activeBreakpoint,
1459 onChange,
1460 "aria-label": (0, _wordpress_i18n.__)("Switch Device", "elementor"),
1461 sx: { "& .MuiTabs-indicator": { backgroundColor: "text.primary" } }
1462 }, breakpoints.map(({ id, label, type, width }) => {
1463 const Icon = iconsMap[id];
1464 const title = labelsMap[type || "default"].replace("%s", label).replace("%d", width?.toString() || "");
1465 return /* @__PURE__ */ react.createElement(_elementor_ui.Tab, {
1466 value: id,
1467 key: id,
1468 "aria-label": title,
1469 icon: /* @__PURE__ */ react.createElement(Tooltip, { title }, /* @__PURE__ */ react.createElement(Icon, null)),
1470 sx: { minWidth: "auto" },
1471 "data-testid": `switch-device-to-${id}`
1472 });
1473 }));
1474 }
1475 function Tooltip(props) {
1476 return /* @__PURE__ */ react.createElement(_elementor_ui.Tooltip, {
1477 PopperProps: { sx: { "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": { mt: 2.5 } } },
1478 ...props
1479 });
1480 }
1481 var iconsMap = {
1482 widescreen: _elementor_icons.WidescreenIcon,
1483 desktop: _elementor_icons.DesktopIcon,
1484 laptop: _elementor_icons.LaptopIcon,
1485 tablet_extra: _elementor_icons.TabletLandscapeIcon,
1486 tablet: _elementor_icons.TabletPortraitIcon,
1487 mobile_extra: _elementor_icons.MobileLandscapeIcon,
1488 mobile: _elementor_icons.MobilePortraitIcon
1489 };
1490 var labelsMap = {
1491 default: "%s",
1492 "min-width": (0, _wordpress_i18n.__)("%s (%dpx and up)", "elementor"),
1493 "max-width": (0, _wordpress_i18n.__)("%s (up to %dpx)", "elementor")
1494 };
1495
1496 //#endregion
1497 //#region packages/packages/core/editor-app-bar/src/extensions/responsive/index.ts
1498 function init$7() {
1499 injectIntoResponsive({
1500 id: "responsive-breakpoints-switcher",
1501 component: BreakpointsSwitcher,
1502 options: { priority: 20 }
1503 });
1504 }
1505 __name(init$7, "init");
1506
1507 //#endregion
1508 //#region packages/packages/core/editor-app-bar/src/extensions/site-settings/components/portal.tsx
1509 function Portal(props) {
1510 const containerRef = (0, _elementor_editor_v1_adapters.__privateUseListenTo)([(0, _elementor_editor_v1_adapters.routeOpenEvent)("panel/global"), (0, _elementor_editor_v1_adapters.routeCloseEvent)("panel/global")], getContainerRef);
1511 if (!containerRef.current) return null;
1512 return /* @__PURE__ */ react.createElement(_elementor_ui.Portal, {
1513 container: containerRef.current,
1514 ...props
1515 });
1516 }
1517 function getContainerRef() {
1518 return (0, _elementor_editor_v1_adapters.__privateIsRouteActive)("panel/global") ? { current: document.querySelector("#elementor-panel-inner") } : { current: null };
1519 }
1520
1521 //#endregion
1522 //#region packages/packages/core/editor-app-bar/src/extensions/site-settings/components/primary-action.tsx
1523 function PrimaryAction() {
1524 const document = (0, _elementor_editor_documents.__useActiveDocument)();
1525 const { save } = (0, _elementor_editor_documents.__useActiveDocumentActions)();
1526 return /* @__PURE__ */ react.createElement(_elementor_ui.Paper, { sx: {
1527 px: 5,
1528 py: 4,
1529 borderTop: 1,
1530 borderColor: "divider"
1531 } }, /* @__PURE__ */ react.createElement(_elementor_ui.Button, {
1532 variant: "contained",
1533 disabled: !document || !document.isDirty,
1534 size: "medium",
1535 sx: { width: "100%" },
1536 onClick: () => document && !document.isSaving ? save() : null
1537 }, document?.isSaving ? /* @__PURE__ */ react.createElement(_elementor_ui.CircularProgress, null) : (0, _wordpress_i18n.__)("Save Changes", "elementor")));
1538 }
1539
1540 //#endregion
1541 //#region packages/packages/core/editor-app-bar/src/extensions/site-settings/components/portalled-primary-action.tsx
1542 function PortalledPrimaryAction() {
1543 return /* @__PURE__ */ react.createElement(Portal, null, /* @__PURE__ */ react.createElement(PrimaryAction, null));
1544 }
1545
1546 //#endregion
1547 //#region packages/packages/core/editor-app-bar/src/extensions/site-settings/hooks/use-action-props.ts
1548 function useActionProps$3() {
1549 const { isActive, isBlocked } = (0, _elementor_editor_v1_adapters.__privateUseRouteStatus)("panel/global", { blockOnKitRoutes: false });
1550 return {
1551 title: (0, _wordpress_i18n.__)("Site Settings", "elementor"),
1552 icon: _elementor_icons.SettingsIcon,
1553 onClick: () => {
1554 const extendedWindow = window;
1555 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1556 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.siteSettings, {
1557 location: config.locations.topBar,
1558 secondaryLocation: config.secondaryLocations.siteSettings,
1559 trigger: config.triggers.toggleClick,
1560 element: config.elements.buttonIcon
1561 });
1562 if (isActive) (0, _elementor_editor_v1_adapters.__privateRunCommand)("panel/global/close");
1563 else (0, _elementor_editor_v1_adapters.__privateRunCommand)("panel/global/open");
1564 },
1565 selected: isActive,
1566 disabled: isBlocked
1567 };
1568 }
1569 __name(useActionProps$3, "useActionProps");
1570
1571 //#endregion
1572 //#region packages/packages/core/editor-app-bar/src/extensions/site-settings/index.ts
1573 function init$6() {
1574 (0, _elementor_editor.injectIntoTop)({
1575 id: "site-settings-primary-action-portal",
1576 component: PortalledPrimaryAction
1577 });
1578 mainMenu.registerToggleAction({
1579 id: "toggle-site-settings",
1580 group: "default",
1581 priority: 1,
1582 useProps: useActionProps$3
1583 });
1584 }
1585 __name(init$6, "init");
1586
1587 //#endregion
1588 //#region packages/packages/core/editor-app-bar/src/extensions/structure/hooks/use-action-props.ts
1589 function useActionProps$2() {
1590 const { isActive, isBlocked } = (0, _elementor_editor_v1_adapters.__privateUseRouteStatus)("navigator");
1591 return {
1592 title: (0, _wordpress_i18n.__)("Structure", "elementor"),
1593 icon: _elementor_icons.StructureIcon,
1594 onClick: () => {
1595 const extendedWindow = window;
1596 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1597 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.structure, {
1598 location: config.locations.topBar,
1599 secondaryLocation: config.secondaryLocations.structure,
1600 trigger: config.triggers.toggleClick,
1601 element: config.elements.buttonIcon
1602 });
1603 (0, _elementor_editor_v1_adapters.__privateRunCommand)("navigator/toggle");
1604 },
1605 selected: isActive,
1606 disabled: isBlocked
1607 };
1608 }
1609 __name(useActionProps$2, "useActionProps");
1610
1611 //#endregion
1612 //#region packages/packages/core/editor-app-bar/src/extensions/structure/index.ts
1613 function init$5() {
1614 utilitiesMenu.registerToggleAction({
1615 id: "toggle-structure-view",
1616 priority: 25,
1617 useProps: useActionProps$2
1618 });
1619 }
1620 __name(init$5, "init");
1621
1622 //#endregion
1623 //#region packages/packages/core/editor-app-bar/src/extensions/theme-builder/hooks/use-action-props.ts
1624 function useActionProps$1() {
1625 return {
1626 icon: _elementor_icons.ThemeBuilderIcon,
1627 title: (0, _wordpress_i18n.__)("Theme Builder", "elementor"),
1628 onClick: () => {
1629 const extendedWindow = window;
1630 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1631 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.themeBuilder, {
1632 location: config.locations.topBar,
1633 secondaryLocation: config.secondaryLocations.elementorLogo,
1634 trigger: config.triggers.click,
1635 element: config.elements.link
1636 });
1637 (0, _elementor_editor_v1_adapters.__privateRunCommand)("app/open");
1638 }
1639 };
1640 }
1641 __name(useActionProps$1, "useActionProps");
1642
1643 //#endregion
1644 //#region packages/packages/core/editor-app-bar/src/extensions/theme-builder/index.ts
1645 function init$4() {
1646 mainMenu.registerAction({
1647 id: "open-theme-builder",
1648 group: "default",
1649 priority: 10,
1650 useProps: useActionProps$1
1651 });
1652 }
1653 __name(init$4, "init");
1654
1655 //#endregion
1656 //#region packages/packages/core/editor-app-bar/src/extensions/user-preferences/hooks/use-action-props.ts
1657 function useActionProps() {
1658 const { isActive, isBlocked } = (0, _elementor_editor_v1_adapters.__privateUseRouteStatus)("panel/editor-preferences");
1659 return {
1660 icon: _elementor_icons.ToggleRightIcon,
1661 title: (0, _wordpress_i18n.__)("User Preferences", "elementor"),
1662 onClick: () => {
1663 const extendedWindow = window;
1664 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1665 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.userPreferences, {
1666 location: config.locations.topBar,
1667 secondaryLocation: config.secondaryLocations.elementorLogo,
1668 trigger: config.triggers.click,
1669 element: config.elements.link
1670 });
1671 (0, _elementor_editor_v1_adapters.__privateOpenRoute)("panel/editor-preferences");
1672 },
1673 selected: isActive,
1674 disabled: isBlocked
1675 };
1676 }
1677
1678 //#endregion
1679 //#region packages/packages/core/editor-app-bar/src/extensions/user-preferences/index.ts
1680 function init$3() {
1681 mainMenu.registerToggleAction({
1682 id: "open-user-preferences",
1683 group: "default",
1684 priority: 30,
1685 useProps: useActionProps
1686 });
1687 }
1688 __name(init$3, "init");
1689
1690 //#endregion
1691 //#region packages/packages/core/editor-app-bar/src/extensions/wordpress/index.ts
1692 function init$2() {
1693 mainMenu.registerLink({
1694 id: "exit-to-wordpress",
1695 group: "exits",
1696 priority: 20,
1697 useProps: () => {
1698 const document = (0, _elementor_editor_documents.__useActiveDocument)();
1699 return {
1700 title: (0, _wordpress_i18n.__)("Exit to WordPress", "elementor"),
1701 href: document?.links?.platformEdit,
1702 icon: _elementor_icons.WordpressIcon,
1703 onClick: () => {
1704 const extendedWindow = window;
1705 const config = extendedWindow?.elementorCommon?.eventsManager?.config;
1706 if (config) extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.exitToWordpress, {
1707 location: config.locations.topBar,
1708 secondaryLocation: config.secondaryLocations.elementorLogo,
1709 trigger: config.triggers.click,
1710 element: config.elements.link
1711 });
1712 }
1713 };
1714 }
1715 });
1716 }
1717 __name(init$2, "init");
1718
1719 //#endregion
1720 //#region packages/packages/core/editor-app-bar/src/extensions/index.ts
1721 function init$1() {
1722 init$18();
1723 init$16();
1724 init$15();
1725 init$14();
1726 init$13();
1727 init$11();
1728 init$10();
1729 init$9();
1730 init$8();
1731 init$7();
1732 init$6();
1733 init$12();
1734 init$5();
1735 init$4();
1736 init$3();
1737 init$2();
1738 init$17();
1739 }
1740 __name(init$1, "init");
1741
1742 //#endregion
1743 //#region packages/packages/core/editor-app-bar/src/sync/redirect-old-menus.ts
1744 function redirectOldMenus() {
1745 (0, _elementor_editor_v1_adapters.__privateListenTo)((0, _elementor_editor_v1_adapters.routeOpenEvent)("panel/menu"), () => {
1746 (0, _elementor_editor_v1_adapters.__privateOpenRoute)("panel/elements/categories");
1747 });
1748 }
1749
1750 //#endregion
1751 //#region packages/packages/core/editor-app-bar/src/init.ts
1752 function init() {
1753 redirectOldMenus();
1754 init$1();
1755 (0, _elementor_editor.injectIntoTop)({
1756 id: "app-bar",
1757 component: AppBar
1758 });
1759 }
1760
1761 //#endregion
1762 //#region packages/packages/core/editor-app-bar/src/index.ts
1763 var src_exports = /* @__PURE__ */ __exportAll({
1764 documentOptionsMenu: () => documentOptionsMenu,
1765 init: () => init,
1766 injectIntoPageIndication: () => injectIntoPageIndication,
1767 injectIntoPrimaryAction: () => injectIntoPrimaryAction,
1768 injectIntoResponsive: () => injectIntoResponsive,
1769 integrationsMenu: () => integrationsMenu,
1770 mainMenu: () => mainMenu,
1771 toolsMenu: () => toolsMenu,
1772 utilitiesMenu: () => utilitiesMenu
1773 });
1774
1775 //#endregion
1776 //#region \0elementor-package-library-entry
1777 (window.elementorV2 = window.elementorV2 || {}).editorAppBar = src_exports;
1778
1779 //#endregion
1780 })(elementorV2.locations, elementorV2.menus, React, elementorV2.icons, elementorV2.ui, elementorV2.editor, elementorV2.editorDocuments, wp.i18n, elementorV2.editorCurrentUser, elementorV2.editorUi, elementorV2.events, elementorV2.editorV1Adapters, elementorV2.httpClient, elementorV2.editorMcp, elementorV2.editorResponsive);
1781 window.elementorV2.editorAppBar?.init?.();
1782 //# sourceMappingURL=editor-app-bar.js.map