@elementor/editor-global-classes 3.33.0-99 → 3.34.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/index.js +1000 -430
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +940 -366
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +21 -18
  6. package/src/api.ts +4 -0
  7. package/src/components/class-manager/class-manager-button.tsx +15 -1
  8. package/src/components/class-manager/class-manager-panel.tsx +2 -2
  9. package/src/components/class-manager/delete-class.ts +9 -3
  10. package/src/components/class-manager/delete-confirmation-dialog.tsx +2 -2
  11. package/src/components/class-manager/duplicate-label-dialog.tsx +159 -0
  12. package/src/components/class-manager/global-classes-list.tsx +53 -22
  13. package/src/components/convert-local-class-to-global-class.tsx +7 -0
  14. package/src/components/css-class-usage/components/css-class-usage-popover.tsx +10 -1
  15. package/src/components/css-class-usage/components/css-class-usage-trigger.tsx +22 -7
  16. package/src/components/search-and-filter/components/filter/active-filters.tsx +8 -0
  17. package/src/components/search-and-filter/components/filter/clear-icon-button.tsx +12 -3
  18. package/src/components/search-and-filter/components/filter/css-class-filter.tsx +10 -0
  19. package/src/components/search-and-filter/components/filter/filter-list.tsx +7 -0
  20. package/src/components/search-and-filter/components/search/class-manager-search.tsx +6 -0
  21. package/src/components/search-and-filter/context.tsx +12 -2
  22. package/src/errors.ts +5 -0
  23. package/src/global-classes-styles-provider.ts +13 -3
  24. package/src/hooks/use-css-class-by-id.ts +8 -0
  25. package/src/hooks/use-prefetch-css-class-usage.ts +6 -0
  26. package/src/init.ts +14 -5
  27. package/src/mcp-integration/classes-resource.ts +20 -0
  28. package/src/mcp-integration/index.ts +15 -0
  29. package/src/mcp-integration/mcp-apply-unapply-global-classes.ts +117 -0
  30. package/src/mcp-integration/mcp-get-global-class-usages.ts +72 -0
  31. package/src/save-global-classes.tsx +55 -0
  32. package/src/store.ts +32 -1
  33. package/src/sync-with-document-save.ts +9 -6
  34. package/src/sync-with-document.tsx +19 -0
  35. package/src/utils/tracking.ts +204 -0
  36. package/src/components/class-manager/save-changes-dialog.tsx +0 -92
  37. package/src/save-global-classes.ts +0 -42
package/dist/index.js CHANGED
@@ -36,23 +36,23 @@ module.exports = __toCommonJS(index_exports);
36
36
 
37
37
  // src/init.ts
38
38
  var import_editor = require("@elementor/editor");
39
- var import_editor_editing_panel = require("@elementor/editor-editing-panel");
39
+ var import_editor_editing_panel2 = require("@elementor/editor-editing-panel");
40
40
  var import_editor_panels2 = require("@elementor/editor-panels");
41
- var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
42
- var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
43
- var import_store24 = require("@elementor/store");
41
+ var import_editor_styles_repository6 = require("@elementor/editor-styles-repository");
42
+ var import_store26 = require("@elementor/store");
44
43
 
45
44
  // src/components/class-manager/class-manager-button.tsx
46
- var React18 = __toESM(require("react"));
45
+ var React19 = __toESM(require("react"));
47
46
  var import_editor_documents5 = require("@elementor/editor-documents");
48
47
  var import_editor_styles_repository3 = require("@elementor/editor-styles-repository");
48
+ var import_editor_ui9 = require("@elementor/editor-ui");
49
49
  var import_ui16 = require("@elementor/ui");
50
- var import_i18n14 = require("@wordpress/i18n");
50
+ var import_i18n15 = require("@wordpress/i18n");
51
51
 
52
52
  // src/global-classes-styles-provider.ts
53
53
  var import_editor_styles2 = require("@elementor/editor-styles");
54
54
  var import_editor_styles_repository = require("@elementor/editor-styles-repository");
55
- var import_store2 = require("@elementor/store");
55
+ var import_store4 = require("@elementor/store");
56
56
  var import_i18n = require("@wordpress/i18n");
57
57
 
58
58
  // src/capabilities.ts
@@ -81,9 +81,12 @@ var GlobalClassLabelAlreadyExistsError = (0, import_utils.createError)({
81
81
  code: "global_class_label_already_exists",
82
82
  message: "Class with this name already exists."
83
83
  });
84
+ var GlobalClassTrackingError = (0, import_utils.createError)({
85
+ code: "global_class_tracking_error",
86
+ message: "Error tracking global classes event."
87
+ });
84
88
 
85
89
  // src/store.ts
86
- var import_editor_props = require("@elementor/editor-props");
87
90
  var import_editor_styles = require("@elementor/editor-styles");
88
91
  var import_store = require("@elementor/store");
89
92
 
@@ -199,6 +202,13 @@ var slice = (0, import_store.__createSlice)({
199
202
  state.data.items[payload.style.id] = mergedData;
200
203
  state.isDirty = true;
201
204
  },
205
+ updateMultiple(state, { payload }) {
206
+ localHistory.next(state.data);
207
+ Object.entries(payload).forEach(([id2, { modified }]) => {
208
+ state.data.items[id2].label = modified;
209
+ });
210
+ state.isDirty = false;
211
+ },
202
212
  updateProps(state, {
203
213
  payload
204
214
  }) {
@@ -211,7 +221,7 @@ var slice = (0, import_store.__createSlice)({
211
221
  let customCss = ("custom_css" in payload ? payload.custom_css : variant?.custom_css) ?? null;
212
222
  customCss = customCss?.raw ? customCss : null;
213
223
  if (variant) {
214
- variant.props = (0, import_editor_props.mergeProps)(variant.props, payload.props);
224
+ variant.props = mergeProps(variant.props, payload.props);
215
225
  variant.custom_css = customCss;
216
226
  style.variants = getNonEmptyVariants(style);
217
227
  } else {
@@ -256,6 +266,17 @@ var slice = (0, import_store.__createSlice)({
256
266
  }
257
267
  }
258
268
  });
269
+ var mergeProps = (current, updates) => {
270
+ const props = Array.isArray(current) ? {} : current;
271
+ Object.entries(updates).forEach(([key, value]) => {
272
+ if (value === null || value === void 0) {
273
+ delete props[key];
274
+ } else {
275
+ props[key] = value;
276
+ }
277
+ });
278
+ return props;
279
+ };
259
280
  var getNonEmptyVariants = (style) => {
260
281
  return style.variants.filter(
261
282
  ({ props, custom_css: customCss }) => Object.keys(props).length || customCss?.raw
@@ -278,8 +299,159 @@ var selectEmptyCssClass = (0, import_store.__createSelector)(
278
299
  ({ items }) => Object.values(items).filter((cssClass) => cssClass.variants.length === 0)
279
300
  );
280
301
 
302
+ // src/utils/tracking.ts
303
+ var import_mixpanel = require("@elementor/mixpanel");
304
+ var import_store2 = require("@elementor/store");
305
+
306
+ // src/api.ts
307
+ var import_http_client = require("@elementor/http-client");
308
+ var RESOURCE_URL = "/global-classes";
309
+ var BASE_URL = "elementor/v1";
310
+ var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
311
+ var apiClient = {
312
+ usage: () => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
313
+ all: (context2 = "preview") => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_URL}`, {
314
+ params: { context: context2 }
315
+ }),
316
+ publish: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
317
+ params: {
318
+ context: "frontend"
319
+ }
320
+ }),
321
+ saveDraft: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
322
+ params: {
323
+ context: "preview"
324
+ }
325
+ })
326
+ };
327
+ var API_ERROR_CODES = {
328
+ DUPLICATED_LABEL: "DUPLICATED_LABEL"
329
+ };
330
+
331
+ // src/components/css-class-usage/utils.ts
332
+ var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
333
+ acc[key] = {
334
+ content: value || [],
335
+ total: value.reduce((total, val) => total + (val?.total || 0), 0)
336
+ };
337
+ return acc;
338
+ }, {});
339
+
340
+ // service/css-class-usage-service.ts
341
+ var fetchCssClassUsage = async () => {
342
+ const response = await apiClient.usage();
343
+ return transformData(response?.data?.data || {});
344
+ };
345
+
346
+ // src/utils/tracking.ts
347
+ var trackGlobalClasses = async (payload) => {
348
+ const { runAction } = payload;
349
+ const data = await getSanitizedData(payload);
350
+ if (data) {
351
+ track(data);
352
+ if (data.event === "classCreated" && "classId" in data) {
353
+ fireClassApplied(data.classId);
354
+ }
355
+ }
356
+ runAction?.();
357
+ };
358
+ var fireClassApplied = async (classId) => {
359
+ const appliedInfo = await getAppliedInfo(classId);
360
+ track({
361
+ event: "classApplied",
362
+ classId,
363
+ ...appliedInfo,
364
+ totalInstancesAfterApply: 1
365
+ });
366
+ };
367
+ var getSanitizedData = async (payload) => {
368
+ switch (payload.event) {
369
+ case "classApplied":
370
+ if ("classId" in payload && payload.classId) {
371
+ const appliedInfo = await getAppliedInfo(payload.classId);
372
+ return { ...payload, ...appliedInfo };
373
+ }
374
+ break;
375
+ case "classRemoved":
376
+ if ("classId" in payload && payload.classId) {
377
+ const deleteInfo = getRemovedInfo(payload.classId);
378
+ return { ...payload, ...deleteInfo };
379
+ }
380
+ break;
381
+ case "classDeleted":
382
+ if ("classId" in payload && payload.classId) {
383
+ const deleteInfo = await trackDeleteClass(payload.classId);
384
+ return { ...payload, ...deleteInfo };
385
+ }
386
+ break;
387
+ case "classCreated":
388
+ if ("source" in payload && payload.source !== "created") {
389
+ if ("classId" in payload && payload.classId) {
390
+ return { ...payload, classTitle: getCssClass(payload.classId).label };
391
+ }
392
+ }
393
+ return payload;
394
+ case "classStateClicked":
395
+ if ("classId" in payload && payload.classId) {
396
+ return { ...payload, classTitle: getCssClass(payload.classId).label };
397
+ }
398
+ break;
399
+ default:
400
+ return payload;
401
+ }
402
+ };
403
+ var track = (data) => {
404
+ const { dispatchEvent, config } = (0, import_mixpanel.getMixpanel)();
405
+ if (!config?.names?.global_classes?.[data.event]) {
406
+ console.error("Global class tracking event not found", { event: data.event });
407
+ return;
408
+ }
409
+ const name = config.names.global_classes[data.event];
410
+ const { event, ...eventData } = data;
411
+ try {
412
+ dispatchEvent?.(name, {
413
+ event,
414
+ ...eventData
415
+ });
416
+ } catch (error) {
417
+ throw new GlobalClassTrackingError({ cause: error });
418
+ }
419
+ };
420
+ var extractCssClassData = (classId) => {
421
+ const cssClass = getCssClass(classId);
422
+ const classTitle = cssClass.label;
423
+ return { classTitle };
424
+ };
425
+ var getCssClass = (classId) => {
426
+ const cssClass = selectClass((0, import_store2.__getState)(), classId);
427
+ if (!cssClass) {
428
+ throw new Error(`CSS class with ID ${classId} not found`);
429
+ }
430
+ return cssClass;
431
+ };
432
+ var trackDeleteClass = async (classId) => {
433
+ const totalInstances = await getTotalInstancesByCssClassID(classId);
434
+ const classTitle = getCssClass(classId).label;
435
+ return { totalInstances, classTitle };
436
+ };
437
+ var getTotalInstancesByCssClassID = async (classId) => {
438
+ const cssClassUsage = await fetchCssClassUsage();
439
+ return cssClassUsage[classId]?.total ?? 1;
440
+ };
441
+ var getAppliedInfo = async (classId) => {
442
+ const { classTitle } = extractCssClassData(classId);
443
+ const totalInstancesAfterApply = await getTotalInstancesByCssClassID(classId) + 1;
444
+ return { classTitle, totalInstancesAfterApply };
445
+ };
446
+ var getRemovedInfo = (classId) => {
447
+ const { classTitle } = extractCssClassData(classId);
448
+ return {
449
+ classTitle
450
+ };
451
+ };
452
+
281
453
  // src/global-classes-styles-provider.ts
282
- var MAX_CLASSES = 50;
454
+ var MAX_CLASSES = 100;
283
455
  var GLOBAL_CLASSES_PROVIDER_KEY = "global-classes";
284
456
  var globalClassesStylesProvider = (0, import_editor_styles_repository.createStylesProvider)({
285
457
  key: GLOBAL_CLASSES_PROVIDER_KEY,
@@ -292,20 +464,24 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
292
464
  subscribe: (cb) => subscribeWithStates(cb),
293
465
  capabilities: getCapabilities(),
294
466
  actions: {
295
- all: () => selectOrderedClasses((0, import_store2.__getState)()),
296
- get: (id2) => selectClass((0, import_store2.__getState)(), id2),
467
+ all: () => {
468
+ const selectAllClasses = selectOrderedClasses((0, import_store4.__getState)());
469
+ localStorage.setItem("elementor-global-classes", JSON.stringify(selectAllClasses));
470
+ return selectAllClasses;
471
+ },
472
+ get: (id2) => selectClass((0, import_store4.__getState)(), id2),
297
473
  resolveCssName: (id2) => {
298
- return selectClass((0, import_store2.__getState)(), id2)?.label ?? id2;
474
+ return selectClass((0, import_store4.__getState)(), id2)?.label ?? id2;
299
475
  },
300
476
  create: (label, variants = []) => {
301
- const classes = selectGlobalClasses((0, import_store2.__getState)());
477
+ const classes = selectGlobalClasses((0, import_store4.__getState)());
302
478
  const existingLabels = Object.values(classes).map((style) => style.label);
303
479
  if (existingLabels.includes(label)) {
304
480
  throw new GlobalClassLabelAlreadyExistsError({ context: { label } });
305
481
  }
306
482
  const existingIds = Object.keys(classes);
307
483
  const id2 = (0, import_editor_styles2.generateId)("g-", existingIds);
308
- (0, import_store2.__dispatch)(
484
+ (0, import_store4.__dispatch)(
309
485
  slice.actions.add({
310
486
  id: id2,
311
487
  type: "class",
@@ -316,17 +492,17 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
316
492
  return id2;
317
493
  },
318
494
  update: (payload) => {
319
- (0, import_store2.__dispatch)(
495
+ (0, import_store4.__dispatch)(
320
496
  slice.actions.update({
321
497
  style: payload
322
498
  })
323
499
  );
324
500
  },
325
501
  delete: (id2) => {
326
- (0, import_store2.__dispatch)(slice.actions.delete(id2));
502
+ (0, import_store4.__dispatch)(slice.actions.delete(id2));
327
503
  },
328
504
  updateProps: (args) => {
329
- (0, import_store2.__dispatch)(
505
+ (0, import_store4.__dispatch)(
330
506
  slice.actions.updateProps({
331
507
  id: args.id,
332
508
  meta: args.meta,
@@ -335,7 +511,7 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
335
511
  );
336
512
  },
337
513
  updateCustomCss: (args) => {
338
- (0, import_store2.__dispatch)(
514
+ (0, import_store4.__dispatch)(
339
515
  slice.actions.updateProps({
340
516
  id: args.id,
341
517
  meta: args.meta,
@@ -343,12 +519,17 @@ var globalClassesStylesProvider = (0, import_editor_styles_repository.createStyl
343
519
  props: {}
344
520
  })
345
521
  );
522
+ },
523
+ tracking: (data) => {
524
+ trackGlobalClasses(data).catch((error) => {
525
+ throw new GlobalClassTrackingError({ cause: error });
526
+ });
346
527
  }
347
528
  }
348
529
  });
349
530
  var subscribeWithStates = (cb) => {
350
- let previousState = selectData((0, import_store2.__getState)());
351
- return (0, import_store2.__subscribeWithSelector)(
531
+ let previousState = selectData((0, import_store4.__getState)());
532
+ return (0, import_store4.__subscribeWithSelector)(
352
533
  (state) => state.globalClasses,
353
534
  (currentState) => {
354
535
  cb(previousState.items, currentState.data.items);
@@ -360,43 +541,6 @@ var subscribeWithStates = (cb) => {
360
541
  // src/hooks/use-prefetch-css-class-usage.ts
361
542
  var import_query = require("@elementor/query");
362
543
 
363
- // src/api.ts
364
- var import_http_client = require("@elementor/http-client");
365
- var RESOURCE_URL = "/global-classes";
366
- var BASE_URL = "elementor/v1";
367
- var RESOURCE_USAGE_URL = `${RESOURCE_URL}/usage`;
368
- var apiClient = {
369
- usage: () => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_USAGE_URL}`),
370
- all: (context2 = "preview") => (0, import_http_client.httpService)().get(`${BASE_URL}${RESOURCE_URL}`, {
371
- params: { context: context2 }
372
- }),
373
- publish: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
374
- params: {
375
- context: "frontend"
376
- }
377
- }),
378
- saveDraft: (payload) => (0, import_http_client.httpService)().put("elementor/v1" + RESOURCE_URL, payload, {
379
- params: {
380
- context: "preview"
381
- }
382
- })
383
- };
384
-
385
- // src/components/css-class-usage/utils.ts
386
- var transformData = (data) => Object.entries(data).reduce((acc, [key, value]) => {
387
- acc[key] = {
388
- content: value || [],
389
- total: value.reduce((total, val) => total + (val?.total || 0), 0)
390
- };
391
- return acc;
392
- }, {});
393
-
394
- // service/css-class-usage-service.ts
395
- var fetchCssClassUsage = async () => {
396
- const response = await apiClient.usage();
397
- return transformData(response.data.data);
398
- };
399
-
400
544
  // src/components/css-class-usage/types.ts
401
545
  var QUERY_KEY = "css-classes-usage";
402
546
 
@@ -409,30 +553,35 @@ function usePrefetchCssClassUsage() {
409
553
  });
410
554
  return { prefetchClassesUsage };
411
555
  }
556
+ var PrefetchCssClassUsage = () => {
557
+ const { prefetchClassesUsage } = usePrefetchCssClassUsage();
558
+ prefetchClassesUsage();
559
+ return null;
560
+ };
412
561
 
413
562
  // src/components/class-manager/class-manager-panel.tsx
414
- var React17 = __toESM(require("react"));
415
- var import_react9 = require("react");
563
+ var React18 = __toESM(require("react"));
564
+ var import_react8 = require("react");
416
565
  var import_editor_documents4 = require("@elementor/editor-documents");
417
566
  var import_editor_panels = require("@elementor/editor-panels");
418
- var import_editor_ui6 = require("@elementor/editor-ui");
567
+ var import_editor_ui8 = require("@elementor/editor-ui");
419
568
  var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
420
569
  var import_icons12 = require("@elementor/icons");
421
570
  var import_query3 = require("@elementor/query");
422
- var import_store18 = require("@elementor/store");
571
+ var import_store20 = require("@elementor/store");
423
572
  var import_ui15 = require("@elementor/ui");
424
- var import_i18n13 = require("@wordpress/i18n");
573
+ var import_i18n14 = require("@wordpress/i18n");
425
574
 
426
575
  // src/hooks/use-classes-order.ts
427
- var import_store4 = require("@elementor/store");
576
+ var import_store6 = require("@elementor/store");
428
577
  var useClassesOrder = () => {
429
- return (0, import_store4.__useSelector)(selectOrder);
578
+ return (0, import_store6.__useSelector)(selectOrder);
430
579
  };
431
580
 
432
581
  // src/hooks/use-dirty-state.ts
433
- var import_store6 = require("@elementor/store");
582
+ var import_store8 = require("@elementor/store");
434
583
  var useDirtyState = () => {
435
- return (0, import_store6.__useSelector)(selectIsDirty);
584
+ return (0, import_store8.__useSelector)(selectIsDirty);
436
585
  };
437
586
 
438
587
  // src/hooks/use-filters.ts
@@ -450,9 +599,17 @@ var INIT_CHECKED_FILTERS = {
450
599
  };
451
600
  var SearchAndFilterProvider = ({ children }) => {
452
601
  const [filters, setFilters] = React.useState(INIT_CHECKED_FILTERS);
602
+ const getInitialSearchValue = () => {
603
+ const storedValue = localStorage.getItem("elementor-global-classes-search");
604
+ if (storedValue) {
605
+ localStorage.removeItem("elementor-global-classes-search");
606
+ return storedValue;
607
+ }
608
+ return "";
609
+ };
453
610
  const { debouncedValue, inputValue, handleChange } = (0, import_utils3.useDebounceState)({
454
611
  delay: 300,
455
- initialValue: ""
612
+ initialValue: getInitialSearchValue()
456
613
  });
457
614
  const onClearSearch = () => {
458
615
  handleChange("");
@@ -504,12 +661,12 @@ var useCssClassUsage = () => {
504
661
  };
505
662
 
506
663
  // src/hooks/use-empty-css-class.ts
507
- var import_store8 = require("@elementor/store");
664
+ var import_store10 = require("@elementor/store");
508
665
  var useEmptyCssClass = () => {
509
- return (0, import_store8.__useSelector)(selectEmptyCssClass);
666
+ return (0, import_store10.__useSelector)(selectEmptyCssClass);
510
667
  };
511
668
  var useAllCssClassesIDs = () => {
512
- const cssClasses = (0, import_store8.__useSelector)(selectGlobalClasses);
669
+ const cssClasses = (0, import_store10.__useSelector)(selectGlobalClasses);
513
670
  return Object.keys(cssClasses);
514
671
  };
515
672
 
@@ -583,25 +740,139 @@ var useFilters = () => {
583
740
  }, [filters, allFilters]);
584
741
  };
585
742
 
586
- // src/save-global-classes.ts
587
- var import_store10 = require("@elementor/store");
743
+ // src/save-global-classes.tsx
744
+ var React3 = __toESM(require("react"));
745
+ var import_editor_ui2 = require("@elementor/editor-ui");
746
+ var import_store12 = require("@elementor/store");
588
747
  var import_utils4 = require("@elementor/utils");
589
- async function saveGlobalClasses({ context: context2 }) {
590
- const state = selectData((0, import_store10.__getState)());
591
- if (context2 === "preview") {
592
- await apiClient.saveDraft({
593
- items: state.items,
594
- order: state.order,
595
- changes: calculateChanges(state, selectPreviewInitialData((0, import_store10.__getState)()))
748
+
749
+ // src/components/class-manager/duplicate-label-dialog.tsx
750
+ var React2 = __toESM(require("react"));
751
+ var import_editor_ui = require("@elementor/editor-ui");
752
+ var import_icons = require("@elementor/icons");
753
+ var import_ui = require("@elementor/ui");
754
+ var import_i18n2 = require("@wordpress/i18n");
755
+ var DUP_PREFIX = "DUP_";
756
+ var DuplicateLabelDialog = ({
757
+ modifiedLabels,
758
+ onApprove
759
+ }) => {
760
+ const handleButtonClick = () => {
761
+ localStorage.setItem("elementor-global-classes-search", DUP_PREFIX);
762
+ onApprove?.();
763
+ (0, import_editor_ui.closeDialog)();
764
+ };
765
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(import_ui.DialogHeader, { logo: false }, /* @__PURE__ */ React2.createElement(import_ui.Box, { display: "flex", alignItems: "center", gap: 1 }, /* @__PURE__ */ React2.createElement(import_ui.Icon, { color: "secondary" }, /* @__PURE__ */ React2.createElement(import_icons.InfoCircleFilledIcon, { fontSize: "medium" })), /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "subtitle1" }, (0, import_i18n2.__)("We've published your page and updated class names.", "elementor")))), /* @__PURE__ */ React2.createElement(import_ui.DialogContent, null, /* @__PURE__ */ React2.createElement(import_ui.Stack, { spacing: 2, direction: "column" }, /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "body2" }, (0, import_i18n2.__)(
766
+ "Some new classes used the same names as existing ones. To prevent conflicts, we added the prefix",
767
+ "elementor"
768
+ ), /* @__PURE__ */ React2.createElement("strong", null, " ", DUP_PREFIX)), /* @__PURE__ */ React2.createElement(import_ui.Box, null, /* @__PURE__ */ React2.createElement(
769
+ import_ui.Box,
770
+ {
771
+ sx: {
772
+ width: "100%",
773
+ display: "flex",
774
+ gap: 2,
775
+ alignItems: "flex-start"
776
+ }
777
+ },
778
+ /* @__PURE__ */ React2.createElement(
779
+ import_ui.Typography,
780
+ {
781
+ variant: "subtitle2",
782
+ sx: {
783
+ fontWeight: "bold",
784
+ flex: 1,
785
+ flexShrink: 1,
786
+ flexGrow: 1,
787
+ minWidth: 0
788
+ }
789
+ },
790
+ (0, import_i18n2.__)("Before", "elementor")
791
+ ),
792
+ /* @__PURE__ */ React2.createElement(
793
+ import_ui.Typography,
794
+ {
795
+ variant: "subtitle2",
796
+ sx: {
797
+ minWidth: "200px",
798
+ fontWeight: "bold",
799
+ flexShrink: 0,
800
+ flexGrow: 0,
801
+ width: "200px",
802
+ maxWidth: "200px"
803
+ }
804
+ },
805
+ (0, import_i18n2.__)("After", "elementor")
806
+ )
807
+ ), /* @__PURE__ */ React2.createElement(import_ui.Divider, { sx: { mt: 0.5, mb: 0.5 } }), /* @__PURE__ */ React2.createElement(import_ui.Stack, { direction: "column", gap: 0.5, sx: { pb: 2 } }, Object.values(modifiedLabels).map(({ original, modified }, index) => /* @__PURE__ */ React2.createElement(
808
+ import_ui.Box,
809
+ {
810
+ key: index,
811
+ sx: {
812
+ width: "100%",
813
+ display: "flex",
814
+ gap: 2,
815
+ alignItems: "flex-start"
816
+ }
817
+ },
818
+ /* @__PURE__ */ React2.createElement(
819
+ import_ui.Box,
820
+ {
821
+ sx: {
822
+ flex: 1,
823
+ flexShrink: 1,
824
+ flexGrow: 1,
825
+ minWidth: 0
826
+ }
827
+ },
828
+ /* @__PURE__ */ React2.createElement(import_editor_ui.EllipsisWithTooltip, { title: original }, /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "body2", sx: { color: "text.secondary" } }, original))
829
+ ),
830
+ /* @__PURE__ */ React2.createElement(
831
+ import_ui.Box,
832
+ {
833
+ sx: {
834
+ minWidth: "200px",
835
+ flexShrink: 0,
836
+ flexGrow: 0,
837
+ width: "200px",
838
+ maxWidth: "200px"
839
+ }
840
+ },
841
+ /* @__PURE__ */ React2.createElement(import_editor_ui.EllipsisWithTooltip, { title: modified }, /* @__PURE__ */ React2.createElement(import_ui.Typography, { variant: "body2", sx: { color: "text.primary" } }, modified))
842
+ )
843
+ ))), /* @__PURE__ */ React2.createElement(import_ui.Box, null, /* @__PURE__ */ React2.createElement(import_ui.Alert, { severity: "info", size: "small", color: "secondary" }, /* @__PURE__ */ React2.createElement("strong", null, (0, import_i18n2.__)("Your designs and classes are safe.", "elementor")), (0, import_i18n2.__)(
844
+ "Only the prefixes were added. Find them in Class Manager by searching",
845
+ "elementor"
846
+ ), /* @__PURE__ */ React2.createElement("strong", null, DUP_PREFIX)))))), /* @__PURE__ */ React2.createElement(import_ui.DialogActions, null, /* @__PURE__ */ React2.createElement(import_ui.Button, { color: "secondary", variant: "text", onClick: handleButtonClick }, (0, import_i18n2.__)("Go to Class Manager", "elementor")), /* @__PURE__ */ React2.createElement(import_ui.Button, { color: "secondary", variant: "contained", onClick: import_editor_ui.closeDialog }, (0, import_i18n2.__)("Done", "elementor"))));
847
+ };
848
+
849
+ // src/save-global-classes.tsx
850
+ async function saveGlobalClasses({ context: context2, onApprove }) {
851
+ const state = selectData((0, import_store12.__getState)());
852
+ const apiAction = context2 === "preview" ? apiClient.saveDraft : apiClient.publish;
853
+ const currentContext = context2 === "preview" ? selectPreviewInitialData : selectFrontendInitialData;
854
+ const response = await apiAction({
855
+ items: state.items,
856
+ order: state.order,
857
+ changes: calculateChanges(state, currentContext((0, import_store12.__getState)()))
858
+ });
859
+ (0, import_store12.__dispatch)(slice.actions.reset({ context: context2 }));
860
+ if (response?.data?.data?.code === API_ERROR_CODES.DUPLICATED_LABEL) {
861
+ (0, import_store12.__dispatch)(slice.actions.updateMultiple(response.data.data.modifiedLabels));
862
+ trackGlobalClasses({
863
+ event: "classPublishConflict",
864
+ numOfConflicts: Object.keys(response.data.data.modifiedLabels).length
596
865
  });
597
- } else {
598
- await apiClient.publish({
599
- items: state.items,
600
- order: state.order,
601
- changes: calculateChanges(state, selectFrontendInitialData((0, import_store10.__getState)()))
866
+ (0, import_editor_ui2.openDialog)({
867
+ component: /* @__PURE__ */ React3.createElement(
868
+ DuplicateLabelDialog,
869
+ {
870
+ modifiedLabels: response.data.data.modifiedLabels || [],
871
+ onApprove
872
+ }
873
+ )
602
874
  });
603
875
  }
604
- (0, import_store10.__dispatch)(slice.actions.reset({ context: context2 }));
605
876
  }
606
877
  function calculateChanges(state, initialData) {
607
878
  const stateIds = Object.keys(state.items);
@@ -616,21 +887,28 @@ function calculateChanges(state, initialData) {
616
887
  }
617
888
 
618
889
  // src/components/search-and-filter/components/filter/active-filters.tsx
619
- var React4 = __toESM(require("react"));
620
- var import_ui3 = require("@elementor/ui");
621
- var import_i18n3 = require("@wordpress/i18n");
890
+ var React6 = __toESM(require("react"));
891
+ var import_ui4 = require("@elementor/ui");
892
+ var import_i18n4 = require("@wordpress/i18n");
622
893
 
623
894
  // src/components/search-and-filter/components/filter/clear-icon-button.tsx
624
- var React2 = __toESM(require("react"));
625
- var import_icons = require("@elementor/icons");
626
- var import_ui = require("@elementor/ui");
627
- var ClearIconButton = ({ tooltipText, sx }) => {
895
+ var React4 = __toESM(require("react"));
896
+ var import_icons2 = require("@elementor/icons");
897
+ var import_ui2 = require("@elementor/ui");
898
+ var ClearIconButton = ({ tooltipText, sx, trigger }) => {
628
899
  const {
629
900
  filters: { onClearFilter }
630
901
  } = useSearchAndFilters();
631
- return /* @__PURE__ */ React2.createElement(import_ui.Tooltip, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React2.createElement(import_ui.Box, null, /* @__PURE__ */ React2.createElement(CustomIconButton, { "aria-label": tooltipText, size: "tiny", onClick: onClearFilter, sx }, /* @__PURE__ */ React2.createElement(import_icons.BrushBigIcon, { fontSize: "tiny" }))));
902
+ const handleClearFilters = () => {
903
+ onClearFilter(trigger);
904
+ trackGlobalClasses({
905
+ event: "classManagerFilterCleared",
906
+ trigger
907
+ });
908
+ };
909
+ return /* @__PURE__ */ React4.createElement(import_ui2.Tooltip, { title: tooltipText, placement: "top", disableInteractive: true }, /* @__PURE__ */ React4.createElement(import_ui2.Box, null, /* @__PURE__ */ React4.createElement(CustomIconButton, { "aria-label": tooltipText, size: "tiny", onClick: handleClearFilters, sx }, /* @__PURE__ */ React4.createElement(import_icons2.BrushBigIcon, { fontSize: "tiny" }))));
632
910
  };
633
- var CustomIconButton = (0, import_ui.styled)(import_ui.IconButton)(({ theme }) => ({
911
+ var CustomIconButton = (0, import_ui2.styled)(import_ui2.IconButton)(({ theme }) => ({
634
912
  "&.Mui-disabled": {
635
913
  pointerEvents: "auto",
636
914
  "&:hover": {
@@ -640,13 +918,13 @@ var CustomIconButton = (0, import_ui.styled)(import_ui.IconButton)(({ theme }) =
640
918
  }));
641
919
 
642
920
  // src/components/search-and-filter/components/filter/filter-list.tsx
643
- var React3 = __toESM(require("react"));
644
- var import_ui2 = require("@elementor/ui");
645
- var import_i18n2 = require("@wordpress/i18n");
921
+ var React5 = __toESM(require("react"));
922
+ var import_ui3 = require("@elementor/ui");
923
+ var import_i18n3 = require("@wordpress/i18n");
646
924
  var filterConfig = {
647
- unused: (0, import_i18n2.__)("Unused", "elementor"),
648
- empty: (0, import_i18n2.__)("Empty", "elementor"),
649
- onThisPage: (0, import_i18n2.__)("On this page", "elementor")
925
+ unused: (0, import_i18n3.__)("Unused", "elementor"),
926
+ empty: (0, import_i18n3.__)("Empty", "elementor"),
927
+ onThisPage: (0, import_i18n3.__)("On this page", "elementor")
650
928
  };
651
929
  var FilterList = () => {
652
930
  const {
@@ -655,32 +933,38 @@ var FilterList = () => {
655
933
  const filteredCssClass = useFilteredCssClassUsage();
656
934
  const handleOnClick = (value) => {
657
935
  setFilters((prev) => ({ ...prev, [value]: !prev[value] }));
936
+ trackGlobalClasses({
937
+ event: "classManagerFilterUsed",
938
+ action: filters[value] ? "remove" : "apply",
939
+ type: value,
940
+ trigger: "menu"
941
+ });
658
942
  };
659
- return /* @__PURE__ */ React3.createElement(import_ui2.MenuList, null, /* @__PURE__ */ React3.createElement(import_ui2.MenuItem, { onClick: () => handleOnClick("unused") }, /* @__PURE__ */ React3.createElement(
943
+ return /* @__PURE__ */ React5.createElement(import_ui3.MenuList, null, /* @__PURE__ */ React5.createElement(import_ui3.MenuItem, { onClick: () => handleOnClick("unused") }, /* @__PURE__ */ React5.createElement(
660
944
  LabeledCheckbox,
661
945
  {
662
946
  label: filterConfig.unused,
663
947
  checked: filters.unused,
664
- suffix: /* @__PURE__ */ React3.createElement(import_ui2.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.unused.length })
948
+ suffix: /* @__PURE__ */ React5.createElement(import_ui3.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.unused.length })
665
949
  }
666
- )), /* @__PURE__ */ React3.createElement(import_ui2.MenuItem, { onClick: () => handleOnClick("empty") }, /* @__PURE__ */ React3.createElement(
950
+ )), /* @__PURE__ */ React5.createElement(import_ui3.MenuItem, { onClick: () => handleOnClick("empty") }, /* @__PURE__ */ React5.createElement(
667
951
  LabeledCheckbox,
668
952
  {
669
953
  label: filterConfig.empty,
670
954
  checked: filters.empty,
671
- suffix: /* @__PURE__ */ React3.createElement(import_ui2.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.empty.length })
955
+ suffix: /* @__PURE__ */ React5.createElement(import_ui3.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.empty.length })
672
956
  }
673
- )), /* @__PURE__ */ React3.createElement(import_ui2.MenuItem, { onClick: () => handleOnClick("onThisPage") }, /* @__PURE__ */ React3.createElement(
957
+ )), /* @__PURE__ */ React5.createElement(import_ui3.MenuItem, { onClick: () => handleOnClick("onThisPage") }, /* @__PURE__ */ React5.createElement(
674
958
  LabeledCheckbox,
675
959
  {
676
960
  label: filterConfig.onThisPage,
677
961
  checked: filters.onThisPage,
678
- suffix: /* @__PURE__ */ React3.createElement(import_ui2.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.onThisPage.length })
962
+ suffix: /* @__PURE__ */ React5.createElement(import_ui3.Chip, { size: "tiny", sx: { ml: "auto" }, label: filteredCssClass.onThisPage.length })
679
963
  }
680
964
  )));
681
965
  };
682
- var LabeledCheckbox = ({ label, suffix, checked }) => /* @__PURE__ */ React3.createElement(import_ui2.Stack, { direction: "row", alignItems: "center", gap: 0.5, flex: 1 }, /* @__PURE__ */ React3.createElement(
683
- import_ui2.Checkbox,
966
+ var LabeledCheckbox = ({ label, suffix, checked }) => /* @__PURE__ */ React5.createElement(import_ui3.Stack, { direction: "row", alignItems: "center", gap: 0.5, flex: 1 }, /* @__PURE__ */ React5.createElement(
967
+ import_ui3.Checkbox,
684
968
  {
685
969
  size: "small",
686
970
  checked,
@@ -692,7 +976,7 @@ var LabeledCheckbox = ({ label, suffix, checked }) => /* @__PURE__ */ React3.cre
692
976
  }
693
977
  }
694
978
  }
695
- ), /* @__PURE__ */ React3.createElement(import_ui2.Typography, { variant: "caption", sx: { color: "text.secondary" } }, label), suffix);
979
+ ), /* @__PURE__ */ React5.createElement(import_ui3.Typography, { variant: "caption", sx: { color: "text.secondary" } }, label), suffix);
696
980
 
697
981
  // src/components/search-and-filter/components/filter/active-filters.tsx
698
982
  var ActiveFilters = () => {
@@ -701,11 +985,17 @@ var ActiveFilters = () => {
701
985
  } = useSearchAndFilters();
702
986
  const handleRemove = (key) => {
703
987
  setFilters((prev) => ({ ...prev, [key]: false }));
988
+ trackGlobalClasses({
989
+ event: "classManagerFilterUsed",
990
+ action: "remove",
991
+ type: key,
992
+ trigger: "header"
993
+ });
704
994
  };
705
995
  const activeKeys = Object.keys(filters).filter((key) => filters[key]);
706
996
  const showClearIcon = activeKeys.length > 0;
707
- return /* @__PURE__ */ React4.createElement(import_ui3.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React4.createElement(import_ui3.Stack, { direction: "row", gap: 0.5, alignItems: "center", flexWrap: "wrap" }, activeKeys.map((key) => /* @__PURE__ */ React4.createElement(
708
- import_ui3.Chip,
997
+ return /* @__PURE__ */ React6.createElement(import_ui4.Stack, { direction: "row", alignItems: "center", justifyContent: "space-between" }, /* @__PURE__ */ React6.createElement(import_ui4.Stack, { direction: "row", gap: 0.5, alignItems: "center", flexWrap: "wrap" }, activeKeys.map((key) => /* @__PURE__ */ React6.createElement(
998
+ import_ui4.Chip,
709
999
  {
710
1000
  key,
711
1001
  label: filterConfig[key],
@@ -713,10 +1003,11 @@ var ActiveFilters = () => {
713
1003
  sx: chipSx,
714
1004
  size: "tiny"
715
1005
  }
716
- ))), showClearIcon && /* @__PURE__ */ React4.createElement(
1006
+ ))), showClearIcon && /* @__PURE__ */ React6.createElement(
717
1007
  ClearIconButton,
718
1008
  {
719
- tooltipText: (0, import_i18n3.__)("Clear Filters", "elementor"),
1009
+ trigger: "header",
1010
+ tooltipText: (0, import_i18n4.__)("Clear Filters", "elementor"),
720
1011
  sx: { margin: "0 0 auto auto" }
721
1012
  }
722
1013
  ));
@@ -732,31 +1023,38 @@ var chipSx = {
732
1023
  };
733
1024
 
734
1025
  // src/components/search-and-filter/components/filter/css-class-filter.tsx
735
- var React5 = __toESM(require("react"));
736
- var import_editor_ui = require("@elementor/editor-ui");
737
- var import_icons2 = require("@elementor/icons");
738
- var import_ui4 = require("@elementor/ui");
739
- var import_i18n4 = require("@wordpress/i18n");
1026
+ var React7 = __toESM(require("react"));
1027
+ var import_editor_ui3 = require("@elementor/editor-ui");
1028
+ var import_icons3 = require("@elementor/icons");
1029
+ var import_ui5 = require("@elementor/ui");
1030
+ var import_i18n5 = require("@wordpress/i18n");
740
1031
  var CssClassFilter = () => {
741
1032
  const {
742
1033
  filters: { filters }
743
1034
  } = useSearchAndFilters();
744
- const popupState = (0, import_ui4.usePopupState)({
1035
+ const popupState = (0, import_ui5.usePopupState)({
745
1036
  variant: "popover",
746
1037
  disableAutoFocus: true
747
1038
  });
1039
+ React7.useEffect(() => {
1040
+ if (popupState.isOpen) {
1041
+ trackGlobalClasses({
1042
+ event: "classManagerFiltersOpened"
1043
+ });
1044
+ }
1045
+ }, [popupState.isOpen]);
748
1046
  const showCleanIcon = Object.values(filters).some((value) => value);
749
- return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(import_ui4.Tooltip, { title: (0, import_i18n4.__)("Filters", "elementor"), placement: "top" }, /* @__PURE__ */ React5.createElement(
750
- import_ui4.ToggleButton,
1047
+ return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(import_ui5.Tooltip, { title: (0, import_i18n5.__)("Filters", "elementor"), placement: "top" }, /* @__PURE__ */ React7.createElement(
1048
+ import_ui5.ToggleButton,
751
1049
  {
752
1050
  value: "filter",
753
1051
  size: "tiny",
754
1052
  selected: popupState.isOpen,
755
- ...(0, import_ui4.bindToggle)(popupState)
1053
+ ...(0, import_ui5.bindToggle)(popupState)
756
1054
  },
757
- /* @__PURE__ */ React5.createElement(import_icons2.FilterIcon, { fontSize: "tiny" })
758
- )), /* @__PURE__ */ React5.createElement(
759
- import_ui4.Popover,
1055
+ /* @__PURE__ */ React7.createElement(import_icons3.FilterIcon, { fontSize: "tiny" })
1056
+ )), /* @__PURE__ */ React7.createElement(
1057
+ import_ui5.Popover,
760
1058
  {
761
1059
  sx: {
762
1060
  maxWidth: "344px"
@@ -769,78 +1067,84 @@ var CssClassFilter = () => {
769
1067
  vertical: "top",
770
1068
  horizontal: -21
771
1069
  },
772
- ...(0, import_ui4.bindPopover)(popupState)
1070
+ ...(0, import_ui5.bindPopover)(popupState)
773
1071
  },
774
- /* @__PURE__ */ React5.createElement(
775
- import_editor_ui.PopoverHeader,
1072
+ /* @__PURE__ */ React7.createElement(
1073
+ import_editor_ui3.PopoverHeader,
776
1074
  {
777
1075
  actions: showCleanIcon ? [
778
- /* @__PURE__ */ React5.createElement(
1076
+ /* @__PURE__ */ React7.createElement(
779
1077
  ClearIconButton,
780
1078
  {
1079
+ trigger: "menu",
781
1080
  key: "clear-all-button",
782
- tooltipText: (0, import_i18n4.__)("Clear all", "elementor")
1081
+ tooltipText: (0, import_i18n5.__)("Clear all", "elementor")
783
1082
  }
784
1083
  )
785
1084
  ] : [],
786
1085
  onClose: popupState.close,
787
- title: (0, import_i18n4.__)("Filters", "elementor"),
788
- icon: /* @__PURE__ */ React5.createElement(import_icons2.FilterIcon, { fontSize: "tiny" })
1086
+ title: (0, import_i18n5.__)("Filters", "elementor"),
1087
+ icon: /* @__PURE__ */ React7.createElement(import_icons3.FilterIcon, { fontSize: "tiny" })
789
1088
  }
790
1089
  ),
791
- /* @__PURE__ */ React5.createElement(
792
- import_ui4.Divider,
1090
+ /* @__PURE__ */ React7.createElement(
1091
+ import_ui5.Divider,
793
1092
  {
794
1093
  sx: {
795
1094
  borderWidth: "1px 0 0 0"
796
1095
  }
797
1096
  }
798
1097
  ),
799
- /* @__PURE__ */ React5.createElement(import_editor_ui.PopoverBody, { width: 344, height: 125 }, /* @__PURE__ */ React5.createElement(FilterList, null))
1098
+ /* @__PURE__ */ React7.createElement(import_editor_ui3.PopoverBody, { width: 344, height: 125 }, /* @__PURE__ */ React7.createElement(FilterList, null))
800
1099
  ));
801
1100
  };
802
1101
 
803
1102
  // src/components/search-and-filter/components/search/class-manager-search.tsx
804
- var React6 = __toESM(require("react"));
805
- var import_icons3 = require("@elementor/icons");
806
- var import_ui5 = require("@elementor/ui");
807
- var import_i18n5 = require("@wordpress/i18n");
1103
+ var React8 = __toESM(require("react"));
1104
+ var import_icons4 = require("@elementor/icons");
1105
+ var import_ui6 = require("@elementor/ui");
1106
+ var import_i18n6 = require("@wordpress/i18n");
808
1107
  var ClassManagerSearch = () => {
809
1108
  const {
810
1109
  search: { inputValue, handleChange }
811
1110
  } = useSearchAndFilters();
812
- return /* @__PURE__ */ React6.createElement(import_ui5.Stack, { direction: "row", gap: 0.5, sx: { width: "100%" } }, /* @__PURE__ */ React6.createElement(import_ui5.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React6.createElement(
813
- import_ui5.TextField,
1111
+ return /* @__PURE__ */ React8.createElement(import_ui6.Stack, { direction: "row", gap: 0.5, sx: { width: "100%" } }, /* @__PURE__ */ React8.createElement(import_ui6.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React8.createElement(
1112
+ import_ui6.TextField,
814
1113
  {
815
1114
  role: "search",
816
1115
  fullWidth: true,
817
1116
  size: "tiny",
818
1117
  value: inputValue,
819
- placeholder: (0, import_i18n5.__)("Search", "elementor"),
1118
+ onFocus: () => {
1119
+ trackGlobalClasses({
1120
+ event: "classManagerSearched"
1121
+ });
1122
+ },
1123
+ placeholder: (0, import_i18n6.__)("Search", "elementor"),
820
1124
  onChange: (e) => handleChange(e.target.value),
821
1125
  InputProps: {
822
- startAdornment: /* @__PURE__ */ React6.createElement(import_ui5.InputAdornment, { position: "start" }, /* @__PURE__ */ React6.createElement(import_icons3.SearchIcon, { fontSize: "tiny" }))
1126
+ startAdornment: /* @__PURE__ */ React8.createElement(import_ui6.InputAdornment, { position: "start" }, /* @__PURE__ */ React8.createElement(import_icons4.SearchIcon, { fontSize: "tiny" }))
823
1127
  }
824
1128
  }
825
1129
  )));
826
1130
  };
827
1131
 
828
1132
  // src/components/class-manager/class-manager-introduction.tsx
829
- var React7 = __toESM(require("react"));
1133
+ var React9 = __toESM(require("react"));
830
1134
  var import_react4 = require("react");
831
1135
  var import_editor_current_user = require("@elementor/editor-current-user");
832
- var import_editor_ui2 = require("@elementor/editor-ui");
833
- var import_ui6 = require("@elementor/ui");
834
- var import_i18n6 = require("@wordpress/i18n");
1136
+ var import_editor_ui4 = require("@elementor/editor-ui");
1137
+ var import_ui7 = require("@elementor/ui");
1138
+ var import_i18n7 = require("@wordpress/i18n");
835
1139
  var MESSAGE_KEY = "global-class-manager";
836
1140
  var ClassManagerIntroduction = () => {
837
1141
  const [isMessageSuppressed, suppressMessage] = (0, import_editor_current_user.useSuppressedMessage)(MESSAGE_KEY);
838
1142
  const [shouldShowIntroduction, setShouldShowIntroduction] = (0, import_react4.useState)(!isMessageSuppressed);
839
- return /* @__PURE__ */ React7.createElement(
840
- import_editor_ui2.IntroductionModal,
1143
+ return /* @__PURE__ */ React9.createElement(
1144
+ import_editor_ui4.IntroductionModal,
841
1145
  {
842
1146
  open: shouldShowIntroduction,
843
- title: (0, import_i18n6.__)("Class Manager", "elementor"),
1147
+ title: (0, import_i18n7.__)("Class Manager", "elementor"),
844
1148
  handleClose: (shouldShowAgain) => {
845
1149
  if (!shouldShowAgain) {
846
1150
  suppressMessage();
@@ -848,22 +1152,22 @@ var ClassManagerIntroduction = () => {
848
1152
  setShouldShowIntroduction(false);
849
1153
  }
850
1154
  },
851
- /* @__PURE__ */ React7.createElement(
852
- import_ui6.Image,
1155
+ /* @__PURE__ */ React9.createElement(
1156
+ import_ui7.Image,
853
1157
  {
854
1158
  sx: { width: "100%", aspectRatio: "16 / 9" },
855
1159
  src: "https://assets.elementor.com/packages/v1/images/class-manager-intro.svg",
856
1160
  alt: ""
857
1161
  }
858
1162
  ),
859
- /* @__PURE__ */ React7.createElement(IntroductionContent, null)
1163
+ /* @__PURE__ */ React9.createElement(IntroductionContent, null)
860
1164
  );
861
1165
  };
862
1166
  var IntroductionContent = () => {
863
- return /* @__PURE__ */ React7.createElement(import_ui6.Box, { p: 3 }, /* @__PURE__ */ React7.createElement(import_ui6.Typography, { variant: "body2" }, (0, import_i18n6.__)(
1167
+ return /* @__PURE__ */ React9.createElement(import_ui7.Box, { p: 3 }, /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0, import_i18n7.__)(
864
1168
  "The Class Manager lets you see all the classes you've created, plus adjust their priority, rename them, and delete unused classes to keep your CSS structured.",
865
1169
  "elementor"
866
- )), /* @__PURE__ */ React7.createElement("br", null), /* @__PURE__ */ React7.createElement(import_ui6.Typography, { variant: "body2" }, (0, import_i18n6.__)(
1170
+ )), /* @__PURE__ */ React9.createElement("br", null), /* @__PURE__ */ React9.createElement(import_ui7.Typography, { variant: "body2" }, (0, import_i18n7.__)(
867
1171
  "Remember, when editing an item within a specific class, any changes you make will apply across all elements in that class.",
868
1172
  "elementor"
869
1173
  )));
@@ -872,11 +1176,17 @@ var IntroductionContent = () => {
872
1176
  // src/components/class-manager/delete-class.ts
873
1177
  var import_editor_documents2 = require("@elementor/editor-documents");
874
1178
  var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
875
- var import_store12 = require("@elementor/store");
1179
+ var import_store14 = require("@elementor/store");
876
1180
  var isDeleted = false;
877
1181
  var deleteClass = (id2) => {
878
- (0, import_store12.__dispatch)(slice.actions.delete(id2));
879
- isDeleted = true;
1182
+ trackGlobalClasses({
1183
+ event: "classDeleted",
1184
+ classId: id2,
1185
+ runAction: () => {
1186
+ (0, import_store14.__dispatch)(slice.actions.delete(id2));
1187
+ isDeleted = true;
1188
+ }
1189
+ });
880
1190
  };
881
1191
  var onDelete = async () => {
882
1192
  await reloadDocument();
@@ -895,39 +1205,39 @@ var reloadDocument = () => {
895
1205
  };
896
1206
 
897
1207
  // src/components/class-manager/flipped-color-swatch-icon.tsx
898
- var React8 = __toESM(require("react"));
899
- var import_icons4 = require("@elementor/icons");
900
- var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */ React8.createElement(import_icons4.ColorSwatchIcon, { sx: { transform: "rotate(90deg)", ...sx }, ...props });
1208
+ var React10 = __toESM(require("react"));
1209
+ var import_icons5 = require("@elementor/icons");
1210
+ var FlippedColorSwatchIcon = ({ sx, ...props }) => /* @__PURE__ */ React10.createElement(import_icons5.ColorSwatchIcon, { sx: { transform: "rotate(90deg)", ...sx }, ...props });
901
1211
 
902
1212
  // src/components/class-manager/global-classes-list.tsx
903
- var React15 = __toESM(require("react"));
1213
+ var React17 = __toESM(require("react"));
904
1214
  var import_react7 = require("react");
905
- var import_store16 = require("@elementor/store");
906
- var import_ui13 = require("@elementor/ui");
907
- var import_i18n12 = require("@wordpress/i18n");
1215
+ var import_store18 = require("@elementor/store");
1216
+ var import_ui14 = require("@elementor/ui");
1217
+ var import_i18n13 = require("@wordpress/i18n");
908
1218
 
909
1219
  // src/hooks/use-ordered-classes.ts
910
- var import_store14 = require("@elementor/store");
1220
+ var import_store16 = require("@elementor/store");
911
1221
  var useOrderedClasses = () => {
912
- return (0, import_store14.__useSelector)(selectOrderedClasses);
1222
+ return (0, import_store16.__useSelector)(selectOrderedClasses);
913
1223
  };
914
1224
 
915
1225
  // src/components/class-manager/class-item.tsx
916
- var React13 = __toESM(require("react"));
1226
+ var React15 = __toESM(require("react"));
917
1227
  var import_react6 = require("react");
918
1228
  var import_editor_styles_repository2 = require("@elementor/editor-styles-repository");
919
- var import_editor_ui5 = require("@elementor/editor-ui");
920
- var import_icons9 = require("@elementor/icons");
921
- var import_ui11 = require("@elementor/ui");
922
- var import_i18n10 = require("@wordpress/i18n");
1229
+ var import_editor_ui7 = require("@elementor/editor-ui");
1230
+ var import_icons10 = require("@elementor/icons");
1231
+ var import_ui12 = require("@elementor/ui");
1232
+ var import_i18n11 = require("@wordpress/i18n");
923
1233
 
924
1234
  // src/components/css-class-usage/components/css-class-usage-popover.tsx
925
- var React9 = __toESM(require("react"));
1235
+ var React11 = __toESM(require("react"));
926
1236
  var import_editor_documents3 = require("@elementor/editor-documents");
927
- var import_editor_ui3 = require("@elementor/editor-ui");
928
- var import_icons5 = require("@elementor/icons");
929
- var import_ui7 = require("@elementor/ui");
930
- var import_i18n7 = require("@wordpress/i18n");
1237
+ var import_editor_ui5 = require("@elementor/editor-ui");
1238
+ var import_icons6 = require("@elementor/icons");
1239
+ var import_ui8 = require("@elementor/ui");
1240
+ var import_i18n8 = require("@wordpress/i18n");
931
1241
 
932
1242
  // src/hooks/use-css-class-usage-by-id.ts
933
1243
  var EMPTY_CLASS_USAGE = {
@@ -943,24 +1253,24 @@ var useCssClassUsageByID = (id2) => {
943
1253
  // src/components/css-class-usage/components/css-class-usage-popover.tsx
944
1254
  var iconMapper = {
945
1255
  "wp-post": {
946
- label: (0, import_i18n7.__)("Post", "elementor"),
947
- icon: /* @__PURE__ */ React9.createElement(import_icons5.PostTypeIcon, { fontSize: "inherit" })
1256
+ label: (0, import_i18n8.__)("Post", "elementor"),
1257
+ icon: /* @__PURE__ */ React11.createElement(import_icons6.PostTypeIcon, { fontSize: "inherit" })
948
1258
  },
949
1259
  "wp-page": {
950
- label: (0, import_i18n7.__)("Page", "elementor"),
951
- icon: /* @__PURE__ */ React9.createElement(import_icons5.PagesIcon, { fontSize: "inherit" })
1260
+ label: (0, import_i18n8.__)("Page", "elementor"),
1261
+ icon: /* @__PURE__ */ React11.createElement(import_icons6.PagesIcon, { fontSize: "inherit" })
952
1262
  },
953
1263
  popup: {
954
- label: (0, import_i18n7.__)("Popup", "elementor"),
955
- icon: /* @__PURE__ */ React9.createElement(import_icons5.PopupTemplateIcon, { fontSize: "inherit" })
1264
+ label: (0, import_i18n8.__)("Popup", "elementor"),
1265
+ icon: /* @__PURE__ */ React11.createElement(import_icons6.PopupTemplateIcon, { fontSize: "inherit" })
956
1266
  },
957
1267
  header: {
958
- label: (0, import_i18n7.__)("Header", "elementor"),
959
- icon: /* @__PURE__ */ React9.createElement(import_icons5.HeaderTemplateIcon, { fontSize: "inherit" })
1268
+ label: (0, import_i18n8.__)("Header", "elementor"),
1269
+ icon: /* @__PURE__ */ React11.createElement(import_icons6.HeaderTemplateIcon, { fontSize: "inherit" })
960
1270
  },
961
1271
  footer: {
962
- label: (0, import_i18n7.__)("Footer", "elementor"),
963
- icon: /* @__PURE__ */ React9.createElement(import_icons5.FooterTemplateIcon, { fontSize: "inherit" })
1272
+ label: (0, import_i18n8.__)("Footer", "elementor"),
1273
+ icon: /* @__PURE__ */ React11.createElement(import_icons6.FooterTemplateIcon, { fontSize: "inherit" })
964
1274
  }
965
1275
  };
966
1276
  var CssClassUsagePopover = ({
@@ -978,42 +1288,49 @@ var CssClassUsagePopover = ({
978
1288
  docType: type
979
1289
  })
980
1290
  ) ?? [];
981
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(
982
- import_editor_ui3.PopoverHeader,
1291
+ const handleSelect = (value) => {
1292
+ onNavigate(+value);
1293
+ trackGlobalClasses({
1294
+ event: "classUsageLocate",
1295
+ classId: cssClassID
1296
+ });
1297
+ };
1298
+ return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
1299
+ import_editor_ui5.PopoverHeader,
983
1300
  {
984
- icon: /* @__PURE__ */ React9.createElement(import_icons5.CurrentLocationIcon, { fontSize: "tiny" }),
985
- title: /* @__PURE__ */ React9.createElement(import_ui7.Stack, { flexDirection: "row", gap: 1, alignItems: "center" }, /* @__PURE__ */ React9.createElement(import_ui7.Box, { "aria-label": "header-title" }, (0, import_i18n7.__)("Locator", "elementor")), /* @__PURE__ */ React9.createElement(import_ui7.Box, null, /* @__PURE__ */ React9.createElement(import_ui7.Chip, { sx: { lineHeight: 1 }, size: "tiny", label: classUsage.total }))),
1301
+ icon: /* @__PURE__ */ React11.createElement(import_icons6.CurrentLocationIcon, { fontSize: "tiny" }),
1302
+ title: /* @__PURE__ */ React11.createElement(import_ui8.Stack, { flexDirection: "row", gap: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui8.Box, { "aria-label": "header-title" }, (0, import_i18n8.__)("Locator", "elementor")), /* @__PURE__ */ React11.createElement(import_ui8.Box, null, /* @__PURE__ */ React11.createElement(import_ui8.Chip, { sx: { lineHeight: 1 }, size: "tiny", label: classUsage.total }))),
986
1303
  onClose
987
1304
  }
988
- ), /* @__PURE__ */ React9.createElement(import_ui7.Divider, null), /* @__PURE__ */ React9.createElement(import_editor_ui3.PopoverBody, { width: 300 }, /* @__PURE__ */ React9.createElement(
989
- import_editor_ui3.PopoverMenuList,
1305
+ ), /* @__PURE__ */ React11.createElement(import_ui8.Divider, null), /* @__PURE__ */ React11.createElement(import_editor_ui5.PopoverBody, { width: 300 }, /* @__PURE__ */ React11.createElement(
1306
+ import_editor_ui5.PopoverMenuList,
990
1307
  {
991
- onSelect: (value) => onNavigate(+value),
1308
+ onSelect: handleSelect,
992
1309
  items: cssClassUsageRecords,
993
1310
  onClose: () => {
994
1311
  },
995
1312
  menuListTemplate: StyledCssClassUsageItem,
996
- menuItemContentTemplate: (cssClassUsageRecord) => /* @__PURE__ */ React9.createElement(import_ui7.Stack, { flexDirection: "row", flex: 1, alignItems: "center" }, /* @__PURE__ */ React9.createElement(import_ui7.Box, { display: "flex", sx: { pr: 1 } }, /* @__PURE__ */ React9.createElement(
997
- import_ui7.Tooltip,
1313
+ menuItemContentTemplate: (cssClassUsageRecord) => /* @__PURE__ */ React11.createElement(import_ui8.Stack, { flexDirection: "row", flex: 1, alignItems: "center" }, /* @__PURE__ */ React11.createElement(import_ui8.Box, { display: "flex", sx: { pr: 1 } }, /* @__PURE__ */ React11.createElement(
1314
+ import_ui8.Tooltip,
998
1315
  {
999
1316
  disableInteractive: true,
1000
1317
  title: iconMapper?.[cssClassUsageRecord.docType]?.label ?? cssClassUsageRecord.docType,
1001
1318
  placement: "top"
1002
1319
  },
1003
- /* @__PURE__ */ React9.createElement(import_ui7.Icon, { fontSize: "small" }, iconMapper?.[cssClassUsageRecord.docType]?.icon || /* @__PURE__ */ React9.createElement(import_icons5.PagesIcon, { fontSize: "inherit" }))
1004
- )), /* @__PURE__ */ React9.createElement(import_ui7.Box, { sx: { pr: 0.5, maxWidth: "173px" }, display: "flex" }, /* @__PURE__ */ React9.createElement(
1005
- import_editor_ui3.EllipsisWithTooltip,
1320
+ /* @__PURE__ */ React11.createElement(import_ui8.Icon, { fontSize: "small" }, iconMapper?.[cssClassUsageRecord.docType]?.icon || /* @__PURE__ */ React11.createElement(import_icons6.PagesIcon, { fontSize: "inherit" }))
1321
+ )), /* @__PURE__ */ React11.createElement(import_ui8.Box, { sx: { pr: 0.5, maxWidth: "173px" }, display: "flex" }, /* @__PURE__ */ React11.createElement(
1322
+ import_editor_ui5.EllipsisWithTooltip,
1006
1323
  {
1007
1324
  title: cssClassUsageRecord.label,
1008
- as: import_ui7.Typography,
1325
+ as: import_ui8.Typography,
1009
1326
  variant: "caption",
1010
1327
  maxWidth: "173px",
1011
1328
  sx: {
1012
1329
  lineHeight: 1
1013
1330
  }
1014
1331
  }
1015
- )), /* @__PURE__ */ React9.createElement(import_icons5.ExternalLinkIcon, { className: "hover-only-icon", fontSize: "tiny" }), /* @__PURE__ */ React9.createElement(
1016
- import_ui7.Chip,
1332
+ )), /* @__PURE__ */ React11.createElement(import_icons6.ExternalLinkIcon, { className: "hover-only-icon", fontSize: "tiny" }), /* @__PURE__ */ React11.createElement(
1333
+ import_ui8.Chip,
1017
1334
  {
1018
1335
  sx: {
1019
1336
  ml: "auto"
@@ -1025,7 +1342,7 @@ var CssClassUsagePopover = ({
1025
1342
  }
1026
1343
  )));
1027
1344
  };
1028
- var StyledCssClassUsageItem = (0, import_ui7.styled)(import_ui7.MenuList)(({ theme }) => ({
1345
+ var StyledCssClassUsageItem = (0, import_ui8.styled)(import_ui8.MenuList)(({ theme }) => ({
1029
1346
  "& > li": {
1030
1347
  display: "flex",
1031
1348
  cursor: "pointer",
@@ -1059,37 +1376,49 @@ var StyledCssClassUsageItem = (0, import_ui7.styled)(import_ui7.MenuList)(({ the
1059
1376
  }));
1060
1377
 
1061
1378
  // src/components/css-class-usage/components/css-class-usage-trigger.tsx
1062
- var React10 = __toESM(require("react"));
1063
- var import_editor_ui4 = require("@elementor/editor-ui");
1064
- var import_icons6 = require("@elementor/icons");
1065
- var import_ui8 = require("@elementor/ui");
1066
- var import_i18n8 = require("@wordpress/i18n");
1379
+ var React12 = __toESM(require("react"));
1380
+ var import_editor_ui6 = require("@elementor/editor-ui");
1381
+ var import_icons7 = require("@elementor/icons");
1382
+ var import_ui9 = require("@elementor/ui");
1383
+ var import_i18n9 = require("@wordpress/i18n");
1067
1384
  var CssClassUsageTrigger = ({ id: id2, onClick }) => {
1068
1385
  const {
1069
1386
  data: { total },
1070
1387
  isLoading
1071
1388
  } = useCssClassUsageByID(id2);
1072
- const cssClassUsagePopover = (0, import_ui8.usePopupState)({ variant: "popover", popupId: "css-class-usage-popover" });
1389
+ const cssClassUsagePopover = (0, import_ui9.usePopupState)({ variant: "popover", popupId: "css-class-usage-popover" });
1073
1390
  if (isLoading) {
1074
1391
  return null;
1075
1392
  }
1076
1393
  const WrapperComponent = total !== 0 ? TooltipWrapper : InfoAlertMessage;
1077
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(import_ui8.Box, { position: "relative" }, /* @__PURE__ */ React10.createElement(WrapperComponent, { total }, /* @__PURE__ */ React10.createElement(
1394
+ const handleMouseEnter = () => {
1395
+ trackGlobalClasses({
1396
+ event: "classUsageHovered",
1397
+ classId: id2,
1398
+ usage: total
1399
+ });
1400
+ };
1401
+ const handleClick = (e) => {
1402
+ if (total !== 0) {
1403
+ (0, import_ui9.bindTrigger)(cssClassUsagePopover).onClick(e);
1404
+ onClick(id2);
1405
+ trackGlobalClasses({
1406
+ event: "classUsageClicked",
1407
+ classId: id2
1408
+ });
1409
+ }
1410
+ };
1411
+ return /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(import_ui9.Box, { position: "relative", onMouseEnter: handleMouseEnter }, /* @__PURE__ */ React12.createElement(WrapperComponent, { total }, /* @__PURE__ */ React12.createElement(
1078
1412
  CustomIconButton2,
1079
1413
  {
1080
1414
  disabled: total === 0,
1081
1415
  size: "tiny",
1082
- ...(0, import_ui8.bindTrigger)(cssClassUsagePopover),
1083
- onClick: (e) => {
1084
- if (total !== 0) {
1085
- (0, import_ui8.bindTrigger)(cssClassUsagePopover).onClick(e);
1086
- onClick(id2);
1087
- }
1088
- }
1416
+ ...(0, import_ui9.bindTrigger)(cssClassUsagePopover),
1417
+ onClick: handleClick
1089
1418
  },
1090
- /* @__PURE__ */ React10.createElement(import_icons6.CurrentLocationIcon, { fontSize: "tiny" })
1091
- ))), /* @__PURE__ */ React10.createElement(import_ui8.Box, null, /* @__PURE__ */ React10.createElement(
1092
- import_ui8.Popover,
1419
+ /* @__PURE__ */ React12.createElement(import_icons7.CurrentLocationIcon, { fontSize: "tiny" })
1420
+ ))), /* @__PURE__ */ React12.createElement(import_ui9.Box, null, /* @__PURE__ */ React12.createElement(
1421
+ import_ui9.Popover,
1093
1422
  {
1094
1423
  anchorOrigin: {
1095
1424
  vertical: "center",
@@ -1099,13 +1428,13 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
1099
1428
  vertical: 15,
1100
1429
  horizontal: -50
1101
1430
  },
1102
- ...(0, import_ui8.bindPopover)(cssClassUsagePopover),
1431
+ ...(0, import_ui9.bindPopover)(cssClassUsagePopover),
1103
1432
  onClose: () => {
1104
- (0, import_ui8.bindPopover)(cssClassUsagePopover).onClose();
1433
+ (0, import_ui9.bindPopover)(cssClassUsagePopover).onClose();
1105
1434
  onClick("");
1106
1435
  }
1107
1436
  },
1108
- /* @__PURE__ */ React10.createElement(
1437
+ /* @__PURE__ */ React12.createElement(
1109
1438
  CssClassUsagePopover,
1110
1439
  {
1111
1440
  onClose: cssClassUsagePopover.close,
@@ -1115,7 +1444,7 @@ var CssClassUsageTrigger = ({ id: id2, onClick }) => {
1115
1444
  )
1116
1445
  )));
1117
1446
  };
1118
- var CustomIconButton2 = (0, import_ui8.styled)(import_ui8.IconButton)(({ theme }) => ({
1447
+ var CustomIconButton2 = (0, import_ui9.styled)(import_ui9.IconButton)(({ theme }) => ({
1119
1448
  "&.Mui-disabled": {
1120
1449
  pointerEvents: "auto",
1121
1450
  // Enable hover
@@ -1127,72 +1456,72 @@ var CustomIconButton2 = (0, import_ui8.styled)(import_ui8.IconButton)(({ theme }
1127
1456
  height: "22px",
1128
1457
  width: "22px"
1129
1458
  }));
1130
- var TooltipWrapper = ({ children, total }) => /* @__PURE__ */ React10.createElement(
1131
- import_ui8.Tooltip,
1459
+ var TooltipWrapper = ({ children, total }) => /* @__PURE__ */ React12.createElement(
1460
+ import_ui9.Tooltip,
1132
1461
  {
1133
1462
  disableInteractive: true,
1134
1463
  placement: "top",
1135
- title: `${(0, import_i18n8.__)("Show {{number}} {{locations}}", "elementor").replace("{{number}}", total.toString()).replace(
1464
+ title: `${(0, import_i18n9.__)("Show {{number}} {{locations}}", "elementor").replace("{{number}}", total.toString()).replace(
1136
1465
  "{{locations}}",
1137
- total === 1 ? (0, import_i18n8.__)("location", "elementor") : (0, import_i18n8.__)("locations", "elementor")
1466
+ total === 1 ? (0, import_i18n9.__)("location", "elementor") : (0, import_i18n9.__)("locations", "elementor")
1138
1467
  )}`
1139
1468
  },
1140
- /* @__PURE__ */ React10.createElement("span", null, children)
1469
+ /* @__PURE__ */ React12.createElement("span", null, children)
1141
1470
  );
1142
- var InfoAlertMessage = ({ children }) => /* @__PURE__ */ React10.createElement(
1143
- import_ui8.Infotip,
1471
+ var InfoAlertMessage = ({ children }) => /* @__PURE__ */ React12.createElement(
1472
+ import_ui9.Infotip,
1144
1473
  {
1145
1474
  disableInteractive: true,
1146
1475
  placement: "top",
1147
1476
  color: "secondary",
1148
- content: /* @__PURE__ */ React10.createElement(import_editor_ui4.InfoAlert, { sx: { mt: 1 } }, (0, import_i18n8.__)("This class isn\u2019t being used yet.", "elementor"))
1477
+ content: /* @__PURE__ */ React12.createElement(import_editor_ui6.InfoAlert, { sx: { mt: 1 } }, (0, import_i18n9.__)("This class isn\u2019t being used yet.", "elementor"))
1149
1478
  },
1150
- /* @__PURE__ */ React10.createElement("span", null, children)
1479
+ /* @__PURE__ */ React12.createElement("span", null, children)
1151
1480
  );
1152
1481
 
1153
1482
  // src/components/class-manager/delete-confirmation-dialog.tsx
1154
- var React11 = __toESM(require("react"));
1483
+ var React13 = __toESM(require("react"));
1155
1484
  var import_react5 = require("react");
1156
- var import_icons7 = require("@elementor/icons");
1157
- var import_ui9 = require("@elementor/ui");
1158
- var import_i18n9 = require("@wordpress/i18n");
1485
+ var import_icons8 = require("@elementor/icons");
1486
+ var import_ui10 = require("@elementor/ui");
1487
+ var import_i18n10 = require("@wordpress/i18n");
1159
1488
  var context = (0, import_react5.createContext)(null);
1160
1489
  var DeleteConfirmationProvider = ({ children }) => {
1161
1490
  const [dialogProps, setDialogProps] = (0, import_react5.useState)(null);
1162
- const openDialog = (props) => {
1491
+ const openDialog2 = (props) => {
1163
1492
  setDialogProps(props);
1164
1493
  };
1165
- const closeDialog = () => {
1494
+ const closeDialog2 = () => {
1166
1495
  setDialogProps(null);
1167
1496
  };
1168
- return /* @__PURE__ */ React11.createElement(context.Provider, { value: { openDialog, closeDialog, dialogProps } }, children, !!dialogProps && /* @__PURE__ */ React11.createElement(DeleteConfirmationDialog, { ...dialogProps }));
1497
+ return /* @__PURE__ */ React13.createElement(context.Provider, { value: { openDialog: openDialog2, closeDialog: closeDialog2, dialogProps } }, children, !!dialogProps && /* @__PURE__ */ React13.createElement(DeleteConfirmationDialog, { ...dialogProps }));
1169
1498
  };
1170
1499
  var TITLE_ID = "delete-class-dialog";
1171
1500
  var DeleteConfirmationDialog = ({ label, id: id2 }) => {
1172
- const { closeDialog } = useDeleteConfirmation();
1501
+ const { closeDialog: closeDialog2 } = useDeleteConfirmation();
1173
1502
  const {
1174
1503
  data: { total, content }
1175
1504
  } = useCssClassUsageByID(id2);
1176
1505
  const onConfirm = () => {
1506
+ closeDialog2();
1177
1507
  deleteClass(id2);
1178
- closeDialog();
1179
1508
  };
1180
- const text = total && content.length ? (0, import_i18n9.__)(
1509
+ const text = total && content.length ? (0, import_i18n10.__)(
1181
1510
  "Will permanently remove it from your project and may affect the design across all elements using it. Used %1 times across %2 pages. This action cannot be undone.",
1182
1511
  "elementor"
1183
- ).replace("%1", total.toString()).replace("%2", content.length.toString()) : (0, import_i18n9.__)(
1512
+ ).replace("%1", total.toString()).replace("%2", content.length.toString()) : (0, import_i18n10.__)(
1184
1513
  "Will permanently remove it from your project and may affect the design across all elements using it. This action cannot be undone.",
1185
1514
  "elementor"
1186
1515
  );
1187
- return /* @__PURE__ */ React11.createElement(import_ui9.Dialog, { open: true, onClose: closeDialog, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React11.createElement(import_ui9.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React11.createElement(import_icons7.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n9.__)("Delete this class?", "elementor")), /* @__PURE__ */ React11.createElement(import_ui9.DialogContent, null, /* @__PURE__ */ React11.createElement(import_ui9.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n9.__)("Deleting", "elementor"), /* @__PURE__ */ React11.createElement(import_ui9.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), text)), /* @__PURE__ */ React11.createElement(import_ui9.DialogActions, null, /* @__PURE__ */ React11.createElement(import_ui9.Button, { color: "secondary", onClick: closeDialog }, (0, import_i18n9.__)("Not now", "elementor")), /* @__PURE__ */ React11.createElement(
1188
- import_ui9.Button,
1516
+ return /* @__PURE__ */ React13.createElement(import_ui10.Dialog, { open: true, onClose: closeDialog2, "aria-labelledby": TITLE_ID, maxWidth: "xs" }, /* @__PURE__ */ React13.createElement(import_ui10.DialogTitle, { id: TITLE_ID, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React13.createElement(import_icons8.AlertOctagonFilledIcon, { color: "error" }), (0, import_i18n10.__)("Delete this class?", "elementor")), /* @__PURE__ */ React13.createElement(import_ui10.DialogContent, null, /* @__PURE__ */ React13.createElement(import_ui10.DialogContentText, { variant: "body2", color: "textPrimary" }, (0, import_i18n10.__)("Deleting", "elementor"), /* @__PURE__ */ React13.createElement(import_ui10.Typography, { variant: "subtitle2", component: "span" }, "\xA0", label, "\xA0"), text)), /* @__PURE__ */ React13.createElement(import_ui10.DialogActions, null, /* @__PURE__ */ React13.createElement(import_ui10.Button, { color: "secondary", onClick: closeDialog2 }, (0, import_i18n10.__)("Not now", "elementor")), /* @__PURE__ */ React13.createElement(
1517
+ import_ui10.Button,
1189
1518
  {
1190
1519
  autoFocus: true,
1191
1520
  variant: "contained",
1192
1521
  color: "error",
1193
1522
  onClick: onConfirm
1194
1523
  },
1195
- (0, import_i18n9.__)("Delete", "elementor")
1524
+ (0, import_i18n10.__)("Delete", "elementor")
1196
1525
  )));
1197
1526
  };
1198
1527
  var useDeleteConfirmation = () => {
@@ -1204,14 +1533,14 @@ var useDeleteConfirmation = () => {
1204
1533
  };
1205
1534
 
1206
1535
  // src/components/class-manager/sortable.tsx
1207
- var React12 = __toESM(require("react"));
1208
- var import_icons8 = require("@elementor/icons");
1209
- var import_ui10 = require("@elementor/ui");
1210
- var SortableProvider = (props) => /* @__PURE__ */ React12.createElement(import_ui10.UnstableSortableProvider, { restrictAxis: true, variant: "static", dragPlaceholderStyle: { opacity: "1" }, ...props });
1211
- var SortableTrigger = (props) => /* @__PURE__ */ React12.createElement(StyledSortableTrigger, { ...props, role: "button", className: "class-item-sortable-trigger", "aria-label": "sort" }, /* @__PURE__ */ React12.createElement(import_icons8.GripVerticalIcon, { fontSize: "tiny" }));
1536
+ var React14 = __toESM(require("react"));
1537
+ var import_icons9 = require("@elementor/icons");
1538
+ var import_ui11 = require("@elementor/ui");
1539
+ var SortableProvider = (props) => /* @__PURE__ */ React14.createElement(import_ui11.UnstableSortableProvider, { restrictAxis: true, variant: "static", dragPlaceholderStyle: { opacity: "1" }, ...props });
1540
+ var SortableTrigger = (props) => /* @__PURE__ */ React14.createElement(StyledSortableTrigger, { ...props, role: "button", className: "class-item-sortable-trigger", "aria-label": "sort" }, /* @__PURE__ */ React14.createElement(import_icons9.GripVerticalIcon, { fontSize: "tiny" }));
1212
1541
  var SortableItem = ({ children, id: id2, ...props }) => {
1213
- return /* @__PURE__ */ React12.createElement(
1214
- import_ui10.UnstableSortableItem,
1542
+ return /* @__PURE__ */ React14.createElement(
1543
+ import_ui11.UnstableSortableItem,
1215
1544
  {
1216
1545
  ...props,
1217
1546
  id: id2,
@@ -1226,8 +1555,8 @@ var SortableItem = ({ children, id: id2, ...props }) => {
1226
1555
  isDragOverlay,
1227
1556
  isDragPlaceholder
1228
1557
  }) => {
1229
- return /* @__PURE__ */ React12.createElement(
1230
- import_ui10.Box,
1558
+ return /* @__PURE__ */ React14.createElement(
1559
+ import_ui11.Box,
1231
1560
  {
1232
1561
  ...itemProps,
1233
1562
  style: itemStyle,
@@ -1245,20 +1574,20 @@ var SortableItem = ({ children, id: id2, ...props }) => {
1245
1574
  triggerStyle,
1246
1575
  isDragPlaceholder
1247
1576
  }),
1248
- showDropIndication && /* @__PURE__ */ React12.createElement(SortableItemIndicator, { style: dropIndicationStyle })
1577
+ showDropIndication && /* @__PURE__ */ React14.createElement(SortableItemIndicator, { style: dropIndicationStyle })
1249
1578
  );
1250
1579
  }
1251
1580
  }
1252
1581
  );
1253
1582
  };
1254
- var StyledSortableTrigger = (0, import_ui10.styled)("div")(({ theme }) => ({
1583
+ var StyledSortableTrigger = (0, import_ui11.styled)("div")(({ theme }) => ({
1255
1584
  position: "absolute",
1256
1585
  left: 0,
1257
1586
  top: "50%",
1258
1587
  transform: `translate( -${theme.spacing(1.5)}, -50% )`,
1259
1588
  color: theme.palette.action.active
1260
1589
  }));
1261
- var SortableItemIndicator = (0, import_ui10.styled)(import_ui10.Box)`
1590
+ var SortableItemIndicator = (0, import_ui11.styled)(import_ui11.Box)`
1262
1591
  width: 100%;
1263
1592
  height: 1px;
1264
1593
  background-color: ${({ theme }) => theme.palette.text.primary};
@@ -1281,20 +1610,20 @@ var ClassItem = ({
1281
1610
  isEditing,
1282
1611
  error,
1283
1612
  getProps: getEditableProps
1284
- } = (0, import_editor_ui5.useEditable)({
1613
+ } = (0, import_editor_ui7.useEditable)({
1285
1614
  value: label,
1286
1615
  onSubmit: renameClass,
1287
1616
  validation: validateLabel
1288
1617
  });
1289
1618
  const [selectedCssUsage, setSelectedCssUsage] = (0, import_react6.useState)("");
1290
- const { openDialog } = useDeleteConfirmation();
1291
- const popupState = (0, import_ui11.usePopupState)({
1619
+ const { openDialog: openDialog2 } = useDeleteConfirmation();
1620
+ const popupState = (0, import_ui12.usePopupState)({
1292
1621
  variant: "popover",
1293
1622
  disableAutoFocus: true
1294
1623
  });
1295
1624
  const isSelected = (selectedCssUsage === id2 || selected || popupState.isOpen) && !disabled;
1296
- return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(import_ui11.Stack, { p: 0 }, /* @__PURE__ */ React13.createElement(
1297
- import_editor_ui5.WarningInfotip,
1625
+ return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(import_ui12.Stack, { p: 0 }, /* @__PURE__ */ React15.createElement(
1626
+ import_editor_ui7.WarningInfotip,
1298
1627
  {
1299
1628
  open: Boolean(error),
1300
1629
  text: error ?? "",
@@ -1302,7 +1631,7 @@ var ClassItem = ({
1302
1631
  width: itemRef.current?.getBoundingClientRect().width,
1303
1632
  offset: [0, -15]
1304
1633
  },
1305
- /* @__PURE__ */ React13.createElement(
1634
+ /* @__PURE__ */ React15.createElement(
1306
1635
  StyledListItemButton,
1307
1636
  {
1308
1637
  ref: itemRef,
@@ -1316,31 +1645,31 @@ var ClassItem = ({
1316
1645
  disabled,
1317
1646
  focusVisibleClassName: "visible-class-item"
1318
1647
  },
1319
- /* @__PURE__ */ React13.createElement(SortableTrigger, { ...sortableTriggerProps }),
1320
- /* @__PURE__ */ React13.createElement(Indicator, { isActive: isEditing, isError: !!error }, isEditing ? /* @__PURE__ */ React13.createElement(
1321
- import_editor_ui5.EditableField,
1648
+ /* @__PURE__ */ React15.createElement(SortableTrigger, { ...sortableTriggerProps }),
1649
+ /* @__PURE__ */ React15.createElement(Indicator, { isActive: isEditing, isError: !!error }, isEditing ? /* @__PURE__ */ React15.createElement(
1650
+ import_editor_ui7.EditableField,
1322
1651
  {
1323
1652
  ref: editableRef,
1324
- as: import_ui11.Typography,
1653
+ as: import_ui12.Typography,
1325
1654
  variant: "caption",
1326
1655
  ...getEditableProps()
1327
1656
  }
1328
- ) : /* @__PURE__ */ React13.createElement(import_editor_ui5.EllipsisWithTooltip, { title: label, as: import_ui11.Typography, variant: "caption" })),
1329
- /* @__PURE__ */ React13.createElement(import_ui11.Box, { className: "class-item-locator" }, /* @__PURE__ */ React13.createElement(CssClassUsageTrigger, { id: id2, onClick: setSelectedCssUsage })),
1330
- /* @__PURE__ */ React13.createElement(
1331
- import_ui11.Tooltip,
1657
+ ) : /* @__PURE__ */ React15.createElement(import_editor_ui7.EllipsisWithTooltip, { title: label, as: import_ui12.Typography, variant: "caption" })),
1658
+ /* @__PURE__ */ React15.createElement(import_ui12.Box, { className: "class-item-locator" }, /* @__PURE__ */ React15.createElement(CssClassUsageTrigger, { id: id2, onClick: setSelectedCssUsage })),
1659
+ /* @__PURE__ */ React15.createElement(
1660
+ import_ui12.Tooltip,
1332
1661
  {
1333
1662
  placement: "top",
1334
1663
  className: "class-item-more-actions",
1335
- title: (0, import_i18n10.__)("More actions", "elementor")
1664
+ title: (0, import_i18n11.__)("More actions", "elementor")
1336
1665
  },
1337
- /* @__PURE__ */ React13.createElement(import_ui11.IconButton, { size: "tiny", ...(0, import_ui11.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React13.createElement(import_icons9.DotsVerticalIcon, { fontSize: "tiny" }))
1666
+ /* @__PURE__ */ React15.createElement(import_ui12.IconButton, { size: "tiny", ...(0, import_ui12.bindTrigger)(popupState), "aria-label": "More actions" }, /* @__PURE__ */ React15.createElement(import_icons10.DotsVerticalIcon, { fontSize: "tiny" }))
1338
1667
  )
1339
1668
  )
1340
- )), /* @__PURE__ */ React13.createElement(
1341
- import_ui11.Menu,
1669
+ )), /* @__PURE__ */ React15.createElement(
1670
+ import_ui12.Menu,
1342
1671
  {
1343
- ...(0, import_ui11.bindMenu)(popupState),
1672
+ ...(0, import_ui12.bindMenu)(popupState),
1344
1673
  anchorOrigin: {
1345
1674
  vertical: "bottom",
1346
1675
  horizontal: "right"
@@ -1350,8 +1679,8 @@ var ClassItem = ({
1350
1679
  horizontal: "right"
1351
1680
  }
1352
1681
  },
1353
- /* @__PURE__ */ React13.createElement(
1354
- import_editor_ui5.MenuListItem,
1682
+ /* @__PURE__ */ React15.createElement(
1683
+ import_editor_ui7.MenuListItem,
1355
1684
  {
1356
1685
  sx: { minWidth: "160px" },
1357
1686
  onClick: () => {
@@ -1359,21 +1688,21 @@ var ClassItem = ({
1359
1688
  openEditMode();
1360
1689
  }
1361
1690
  },
1362
- /* @__PURE__ */ React13.createElement(import_ui11.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n10.__)("Rename", "elementor"))
1691
+ /* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "text.primary" } }, (0, import_i18n11.__)("Rename", "elementor"))
1363
1692
  ),
1364
- /* @__PURE__ */ React13.createElement(
1365
- import_editor_ui5.MenuListItem,
1693
+ /* @__PURE__ */ React15.createElement(
1694
+ import_editor_ui7.MenuListItem,
1366
1695
  {
1367
1696
  onClick: () => {
1368
1697
  popupState.close();
1369
- openDialog({ id: id2, label });
1698
+ openDialog2({ id: id2, label });
1370
1699
  }
1371
1700
  },
1372
- /* @__PURE__ */ React13.createElement(import_ui11.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n10.__)("Delete", "elementor"))
1701
+ /* @__PURE__ */ React15.createElement(import_ui12.Typography, { variant: "caption", sx: { color: "error.light" } }, (0, import_i18n11.__)("Delete", "elementor"))
1373
1702
  )
1374
1703
  ));
1375
1704
  };
1376
- var StyledListItemButton = (0, import_ui11.styled)(import_ui11.ListItemButton, {
1705
+ var StyledListItemButton = (0, import_ui12.styled)(import_ui12.ListItemButton, {
1377
1706
  shouldForwardProp: (prop) => !["showActions", "showSortIndicator"].includes(prop)
1378
1707
  })(
1379
1708
  ({ showActions, showSortIndicator }) => `
@@ -1402,7 +1731,7 @@ var StyledListItemButton = (0, import_ui11.styled)(import_ui11.ListItemButton, {
1402
1731
  }
1403
1732
  `
1404
1733
  );
1405
- var Indicator = (0, import_ui11.styled)(import_ui11.Box, {
1734
+ var Indicator = (0, import_ui12.styled)(import_ui12.Box, {
1406
1735
  shouldForwardProp: (prop) => !["isActive", "isError"].includes(prop)
1407
1736
  })(({ theme, isActive, isError }) => ({
1408
1737
  display: "flex",
@@ -1432,10 +1761,10 @@ var validateLabel = (newLabel) => {
1432
1761
  };
1433
1762
 
1434
1763
  // src/components/class-manager/not-found.tsx
1435
- var React14 = __toESM(require("react"));
1436
- var import_icons10 = require("@elementor/icons");
1437
- var import_ui12 = require("@elementor/ui");
1438
- var import_i18n11 = require("@wordpress/i18n");
1764
+ var React16 = __toESM(require("react"));
1765
+ var import_icons11 = require("@elementor/icons");
1766
+ var import_ui13 = require("@elementor/ui");
1767
+ var import_i18n12 = require("@wordpress/i18n");
1439
1768
  var getNotFoundType = (searchValue, filters, filteredClasses) => {
1440
1769
  const searchNotFound = filteredClasses.length <= 0 && searchValue.length > 1;
1441
1770
  const filterNotFound = filters && filters.length === 0;
@@ -1453,19 +1782,19 @@ var getNotFoundType = (searchValue, filters, filteredClasses) => {
1453
1782
  };
1454
1783
  var notFound = {
1455
1784
  filterAndSearch: {
1456
- mainText: (0, import_i18n11.__)("Sorry, nothing matched.", "elementor"),
1457
- sceneryText: (0, import_i18n11.__)("Try something else.", "elementor"),
1458
- icon: /* @__PURE__ */ React14.createElement(import_icons10.PhotoIcon, { color: "inherit", fontSize: "large" })
1785
+ mainText: (0, import_i18n12.__)("Sorry, nothing matched.", "elementor"),
1786
+ sceneryText: (0, import_i18n12.__)("Try something else.", "elementor"),
1787
+ icon: /* @__PURE__ */ React16.createElement(import_icons11.PhotoIcon, { color: "inherit", fontSize: "large" })
1459
1788
  },
1460
1789
  search: {
1461
- mainText: (0, import_i18n11.__)("Sorry, nothing matched", "elementor"),
1462
- sceneryText: (0, import_i18n11.__)("Clear your input and try something else.", "elementor"),
1463
- icon: /* @__PURE__ */ React14.createElement(import_icons10.PhotoIcon, { color: "inherit", fontSize: "large" })
1790
+ mainText: (0, import_i18n12.__)("Sorry, nothing matched", "elementor"),
1791
+ sceneryText: (0, import_i18n12.__)("Clear your input and try something else.", "elementor"),
1792
+ icon: /* @__PURE__ */ React16.createElement(import_icons11.PhotoIcon, { color: "inherit", fontSize: "large" })
1464
1793
  },
1465
1794
  filter: {
1466
- mainText: (0, import_i18n11.__)("Sorry, nothing matched that search.", "elementor"),
1467
- sceneryText: (0, import_i18n11.__)("Clear the filters and try something else.", "elementor"),
1468
- icon: /* @__PURE__ */ React14.createElement(import_icons10.ColorSwatchIcon, { color: "inherit", fontSize: "large" })
1795
+ mainText: (0, import_i18n12.__)("Sorry, nothing matched that search.", "elementor"),
1796
+ sceneryText: (0, import_i18n12.__)("Clear the filters and try something else.", "elementor"),
1797
+ icon: /* @__PURE__ */ React16.createElement(import_icons11.ColorSwatchIcon, { color: "inherit", fontSize: "large" })
1469
1798
  }
1470
1799
  };
1471
1800
  var NotFound = ({ notFoundType }) => {
@@ -1475,11 +1804,11 @@ var NotFound = ({ notFoundType }) => {
1475
1804
  } = useSearchAndFilters();
1476
1805
  switch (notFoundType) {
1477
1806
  case "filter":
1478
- return /* @__PURE__ */ React14.createElement(NotFoundLayout, { ...notFound.filter, onClear: onClearFilter });
1807
+ return /* @__PURE__ */ React16.createElement(NotFoundLayout, { ...notFound.filter, onClear: onClearFilter });
1479
1808
  case "search":
1480
- return /* @__PURE__ */ React14.createElement(NotFoundLayout, { ...notFound.search, searchValue: inputValue, onClear: onClearSearch });
1809
+ return /* @__PURE__ */ React16.createElement(NotFoundLayout, { ...notFound.search, searchValue: inputValue, onClear: onClearSearch });
1481
1810
  case "filterAndSearch":
1482
- return /* @__PURE__ */ React14.createElement(
1811
+ return /* @__PURE__ */ React16.createElement(
1483
1812
  NotFoundLayout,
1484
1813
  {
1485
1814
  ...notFound.filterAndSearch,
@@ -1491,8 +1820,8 @@ var NotFound = ({ notFoundType }) => {
1491
1820
  );
1492
1821
  }
1493
1822
  };
1494
- var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) => /* @__PURE__ */ React14.createElement(
1495
- import_ui12.Stack,
1823
+ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) => /* @__PURE__ */ React16.createElement(
1824
+ import_ui13.Stack,
1496
1825
  {
1497
1826
  color: "text.secondary",
1498
1827
  pt: 5,
@@ -1502,16 +1831,16 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
1502
1831
  justifySelf: "center"
1503
1832
  },
1504
1833
  icon,
1505
- /* @__PURE__ */ React14.createElement(
1506
- import_ui12.Box,
1834
+ /* @__PURE__ */ React16.createElement(
1835
+ import_ui13.Box,
1507
1836
  {
1508
1837
  sx: {
1509
1838
  width: "100%"
1510
1839
  }
1511
1840
  },
1512
- /* @__PURE__ */ React14.createElement(import_ui12.Typography, { align: "center", variant: "subtitle2", color: "inherit" }, mainText),
1513
- searchValue && /* @__PURE__ */ React14.createElement(
1514
- import_ui12.Typography,
1841
+ /* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "subtitle2", color: "inherit" }, mainText),
1842
+ searchValue && /* @__PURE__ */ React16.createElement(
1843
+ import_ui13.Typography,
1515
1844
  {
1516
1845
  variant: "subtitle2",
1517
1846
  color: "inherit",
@@ -1521,8 +1850,8 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
1521
1850
  justifyContent: "center"
1522
1851
  }
1523
1852
  },
1524
- /* @__PURE__ */ React14.createElement("span", null, "\u201C"),
1525
- /* @__PURE__ */ React14.createElement(
1853
+ /* @__PURE__ */ React16.createElement("span", null, "\u201C"),
1854
+ /* @__PURE__ */ React16.createElement(
1526
1855
  "span",
1527
1856
  {
1528
1857
  style: {
@@ -1533,11 +1862,11 @@ var NotFoundLayout = ({ onClear, searchValue, mainText, sceneryText, icon }) =>
1533
1862
  },
1534
1863
  searchValue
1535
1864
  ),
1536
- /* @__PURE__ */ React14.createElement("span", null, "\u201D.")
1865
+ /* @__PURE__ */ React16.createElement("span", null, "\u201D.")
1537
1866
  )
1538
1867
  ),
1539
- /* @__PURE__ */ React14.createElement(import_ui12.Typography, { align: "center", variant: "caption", color: "inherit" }, sceneryText),
1540
- /* @__PURE__ */ React14.createElement(import_ui12.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React14.createElement(import_ui12.Link, { color: "secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n11.__)("Clear & try again", "elementor")))
1868
+ /* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "caption", color: "inherit" }, sceneryText),
1869
+ /* @__PURE__ */ React16.createElement(import_ui13.Typography, { align: "center", variant: "caption", color: "inherit" }, /* @__PURE__ */ React16.createElement(import_ui13.Link, { color: "secondary", variant: "caption", component: "button", onClick: onClear }, (0, import_i18n12.__)("Clear & try again", "elementor")))
1541
1870
  );
1542
1871
 
1543
1872
  // src/components/class-manager/global-classes-list.tsx
@@ -1546,9 +1875,11 @@ var GlobalClassesList = ({ disabled }) => {
1546
1875
  search: { debouncedValue: searchValue }
1547
1876
  } = useSearchAndFilters();
1548
1877
  const cssClasses = useOrderedClasses();
1549
- const dispatch5 = (0, import_store16.__useDispatch)();
1878
+ const dispatch5 = (0, import_store18.__useDispatch)();
1550
1879
  const filters = useFilters();
1551
- const [classesOrder, reorderClasses] = useReorder();
1880
+ const [draggedItemId, setDraggedItemId] = React17.useState(null);
1881
+ const draggedItemLabel = cssClasses.find((cssClass) => cssClass.id === draggedItemId)?.label ?? "";
1882
+ const [classesOrder, reorderClasses] = useReorder(draggedItemId, setDraggedItemId, draggedItemLabel ?? "");
1552
1883
  const filteredCssClasses = useFilteredCssClasses();
1553
1884
  (0, import_react7.useEffect)(() => {
1554
1885
  const handler = (event) => {
@@ -1568,58 +1899,81 @@ var GlobalClassesList = ({ disabled }) => {
1568
1899
  return () => window.removeEventListener("keydown", handler);
1569
1900
  }, [dispatch5]);
1570
1901
  if (!cssClasses?.length) {
1571
- return /* @__PURE__ */ React15.createElement(EmptyState, null);
1902
+ return /* @__PURE__ */ React17.createElement(EmptyState, null);
1572
1903
  }
1573
1904
  const notFoundType = getNotFoundType(searchValue, filters, filteredCssClasses);
1574
1905
  if (notFoundType) {
1575
- return /* @__PURE__ */ React15.createElement(NotFound, { notFoundType });
1906
+ return /* @__PURE__ */ React17.createElement(NotFound, { notFoundType });
1576
1907
  }
1577
1908
  const isFiltersApplied = filters?.length || searchValue;
1578
1909
  const allowSorting = filteredCssClasses.length > 1 && !isFiltersApplied;
1579
- return /* @__PURE__ */ React15.createElement(DeleteConfirmationProvider, null, /* @__PURE__ */ React15.createElement(import_ui13.List, { sx: { display: "flex", flexDirection: "column", gap: 0.5 } }, /* @__PURE__ */ React15.createElement(
1910
+ return /* @__PURE__ */ React17.createElement(DeleteConfirmationProvider, null, /* @__PURE__ */ React17.createElement(import_ui14.List, { sx: { display: "flex", flexDirection: "column", gap: 0.5 } }, /* @__PURE__ */ React17.createElement(
1580
1911
  SortableProvider,
1581
1912
  {
1582
1913
  value: classesOrder,
1583
1914
  onChange: reorderClasses,
1584
1915
  disableDragOverlay: !allowSorting
1585
1916
  },
1586
- filteredCssClasses?.map(({ id: id2, label }) => /* @__PURE__ */ React15.createElement(SortableItem, { key: id2, id: id2 }, ({ isDragged, isDragPlaceholder, triggerProps, triggerStyle }) => /* @__PURE__ */ React15.createElement(
1587
- ClassItem,
1588
- {
1589
- id: id2,
1590
- label,
1591
- renameClass: (newLabel) => {
1592
- dispatch5(
1593
- slice.actions.update({
1594
- style: {
1595
- id: id2,
1596
- label: newLabel
1597
- }
1598
- })
1599
- );
1600
- },
1601
- selected: isDragged,
1602
- disabled: disabled || isDragPlaceholder,
1603
- sortableTriggerProps: { ...triggerProps, style: triggerStyle },
1604
- showSortIndicator: allowSorting
1917
+ filteredCssClasses?.map(({ id: id2, label }) => /* @__PURE__ */ React17.createElement(SortableItem, { key: id2, id: id2 }, ({ isDragged, isDragPlaceholder, triggerProps, triggerStyle }) => {
1918
+ if (isDragged && !draggedItemId) {
1919
+ setDraggedItemId(id2);
1605
1920
  }
1606
- )))
1921
+ return /* @__PURE__ */ React17.createElement(
1922
+ ClassItem,
1923
+ {
1924
+ id: id2,
1925
+ label,
1926
+ renameClass: (newLabel) => {
1927
+ trackGlobalClasses({
1928
+ event: "classRenamed",
1929
+ classId: id2,
1930
+ oldValue: label,
1931
+ newValue: newLabel,
1932
+ source: "class-manager"
1933
+ });
1934
+ dispatch5(
1935
+ slice.actions.update({
1936
+ style: {
1937
+ id: id2,
1938
+ label: newLabel
1939
+ }
1940
+ })
1941
+ );
1942
+ },
1943
+ selected: isDragged,
1944
+ disabled: disabled || isDragPlaceholder,
1945
+ sortableTriggerProps: {
1946
+ ...triggerProps,
1947
+ style: triggerStyle
1948
+ },
1949
+ showSortIndicator: allowSorting
1950
+ }
1951
+ );
1952
+ }))
1607
1953
  )));
1608
1954
  };
1609
- var EmptyState = () => /* @__PURE__ */ React15.createElement(import_ui13.Stack, { alignItems: "center", gap: 1.5, pt: 10, px: 0.5, maxWidth: "260px", margin: "auto" }, /* @__PURE__ */ React15.createElement(FlippedColorSwatchIcon, { fontSize: "large" }), /* @__PURE__ */ React15.createElement(StyledHeader, { variant: "subtitle2", component: "h2", color: "text.secondary" }, (0, import_i18n12.__)("There are no global classes yet.", "elementor")), /* @__PURE__ */ React15.createElement(import_ui13.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n12.__)(
1955
+ var EmptyState = () => /* @__PURE__ */ React17.createElement(import_ui14.Stack, { alignItems: "center", gap: 1.5, pt: 10, px: 0.5, maxWidth: "260px", margin: "auto" }, /* @__PURE__ */ React17.createElement(FlippedColorSwatchIcon, { fontSize: "large" }), /* @__PURE__ */ React17.createElement(StyledHeader, { variant: "subtitle2", component: "h2", color: "text.secondary" }, (0, import_i18n13.__)("There are no global classes yet.", "elementor")), /* @__PURE__ */ React17.createElement(import_ui14.Typography, { align: "center", variant: "caption", color: "text.secondary" }, (0, import_i18n13.__)(
1610
1956
  "CSS classes created in the editor panel will appear here. Once they are available, you can arrange their hierarchy, rename them, or delete them as needed.",
1611
1957
  "elementor"
1612
1958
  )));
1613
- var StyledHeader = (0, import_ui13.styled)(import_ui13.Typography)(({ theme, variant }) => ({
1959
+ var StyledHeader = (0, import_ui14.styled)(import_ui14.Typography)(({ theme, variant }) => ({
1614
1960
  "&.MuiTypography-root": {
1615
1961
  ...theme.typography[variant]
1616
1962
  }
1617
1963
  }));
1618
- var useReorder = () => {
1619
- const dispatch5 = (0, import_store16.__useDispatch)();
1964
+ var useReorder = (draggedItemId, setDraggedItemId, draggedItemLabel) => {
1965
+ const dispatch5 = (0, import_store18.__useDispatch)();
1620
1966
  const order = useClassesOrder();
1621
1967
  const reorder = (newIds) => {
1622
1968
  dispatch5(slice.actions.setOrder(newIds));
1969
+ if (draggedItemId) {
1970
+ trackGlobalClasses({
1971
+ event: "classManagerReorder",
1972
+ classId: draggedItemId,
1973
+ classTitle: draggedItemLabel
1974
+ });
1975
+ setDraggedItemId(null);
1976
+ }
1623
1977
  };
1624
1978
  return [order, reorder];
1625
1979
  };
@@ -1660,37 +2014,6 @@ function unblockPanelInteractions() {
1660
2014
  extendedWindow.$e?.components?.get?.("panel")?.unblockUserInteractions?.();
1661
2015
  }
1662
2016
 
1663
- // src/components/class-manager/save-changes-dialog.tsx
1664
- var React16 = __toESM(require("react"));
1665
- var import_react8 = require("react");
1666
- var import_icons11 = require("@elementor/icons");
1667
- var import_ui14 = require("@elementor/ui");
1668
- var TITLE_ID2 = "save-changes-dialog";
1669
- var SaveChangesDialog = ({ children, onClose }) => /* @__PURE__ */ React16.createElement(import_ui14.Dialog, { open: true, onClose, "aria-labelledby": TITLE_ID2, maxWidth: "xs" }, children);
1670
- var SaveChangesDialogTitle = ({ children }) => /* @__PURE__ */ React16.createElement(import_ui14.DialogTitle, { id: TITLE_ID2, display: "flex", alignItems: "center", gap: 1, sx: { lineHeight: 1 } }, /* @__PURE__ */ React16.createElement(import_icons11.AlertTriangleFilledIcon, { color: "secondary" }), children);
1671
- var SaveChangesDialogContent = ({ children }) => /* @__PURE__ */ React16.createElement(import_ui14.DialogContent, null, children);
1672
- var SaveChangesDialogContentText = (props) => /* @__PURE__ */ React16.createElement(import_ui14.DialogContentText, { variant: "body2", color: "textPrimary", display: "flex", flexDirection: "column", ...props });
1673
- var SaveChangesDialogActions = ({ actions }) => {
1674
- const [isConfirming, setIsConfirming] = (0, import_react8.useState)(false);
1675
- const { cancel, confirm, discard } = actions;
1676
- const onConfirm = async () => {
1677
- setIsConfirming(true);
1678
- await confirm.action();
1679
- setIsConfirming(false);
1680
- };
1681
- return /* @__PURE__ */ React16.createElement(import_ui14.DialogActions, null, cancel && /* @__PURE__ */ React16.createElement(import_ui14.Button, { variant: "text", color: "secondary", onClick: cancel.action }, cancel.label), discard && /* @__PURE__ */ React16.createElement(import_ui14.Button, { variant: "text", color: "secondary", onClick: discard.action }, discard.label), /* @__PURE__ */ React16.createElement(import_ui14.Button, { variant: "contained", color: "secondary", onClick: onConfirm, loading: isConfirming }, confirm.label));
1682
- };
1683
- SaveChangesDialog.Title = SaveChangesDialogTitle;
1684
- SaveChangesDialog.Content = SaveChangesDialogContent;
1685
- SaveChangesDialog.ContentText = SaveChangesDialogContentText;
1686
- SaveChangesDialog.Actions = SaveChangesDialogActions;
1687
- var useDialog = () => {
1688
- const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
1689
- const open = () => setIsOpen(true);
1690
- const close = () => setIsOpen(false);
1691
- return { isOpen, open, close };
1692
- };
1693
-
1694
2017
  // src/components/class-manager/class-manager-panel.tsx
1695
2018
  var id = "global-classes-manager";
1696
2019
  var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
@@ -1704,19 +2027,20 @@ var { panel, usePanelActions } = (0, import_editor_panels.__createPanel)({
1704
2027
  onClose: () => {
1705
2028
  (0, import_editor_v1_adapters3.changeEditMode)("edit");
1706
2029
  unblockPanelInteractions();
1707
- }
2030
+ },
2031
+ isOpenPreviousElement: true
1708
2032
  });
1709
2033
  function ClassManagerPanel() {
1710
2034
  const isDirty2 = useDirtyState();
1711
2035
  const { close: closePanel } = usePanelActions();
1712
- const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
2036
+ const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui8.useDialog)();
1713
2037
  const { mutateAsync: publish, isPending: isPublishing } = usePublish();
1714
2038
  const resetAndClosePanel = () => {
1715
- (0, import_store18.__dispatch)(slice.actions.resetToInitialState({ context: "frontend" }));
2039
+ (0, import_store20.__dispatch)(slice.actions.resetToInitialState({ context: "frontend" }));
1716
2040
  closeSaveChangesDialog();
1717
2041
  };
1718
2042
  usePreventUnload();
1719
- return /* @__PURE__ */ React17.createElement(import_editor_ui6.ThemeProvider, null, /* @__PURE__ */ React17.createElement(import_ui15.ErrorBoundary, { fallback: /* @__PURE__ */ React17.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React17.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React17.createElement(SearchAndFilterProvider, null, /* @__PURE__ */ React17.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React17.createElement(import_ui15.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React17.createElement(import_ui15.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React17.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React17.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), (0, import_i18n13.__)("Class Manager", "elementor")), /* @__PURE__ */ React17.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React17.createElement(
2043
+ return /* @__PURE__ */ React18.createElement(import_editor_ui8.ThemeProvider, null, /* @__PURE__ */ React18.createElement(import_ui15.ErrorBoundary, { fallback: /* @__PURE__ */ React18.createElement(ErrorBoundaryFallback, null) }, /* @__PURE__ */ React18.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React18.createElement(SearchAndFilterProvider, null, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { p: 1, pl: 2, width: "100%", direction: "row", alignItems: "center" }, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { width: "100%", direction: "row", gap: 1 }, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeaderTitle, { sx: { display: "flex", alignItems: "center", gap: 0.5 } }, /* @__PURE__ */ React18.createElement(FlippedColorSwatchIcon, { fontSize: "inherit" }), (0, import_i18n14.__)("Class Manager", "elementor")), /* @__PURE__ */ React18.createElement(TotalCssClassCounter, null)), /* @__PURE__ */ React18.createElement(
1720
2044
  CloseButton,
1721
2045
  {
1722
2046
  sx: { marginLeft: "auto" },
@@ -1729,7 +2053,7 @@ function ClassManagerPanel() {
1729
2053
  closePanel();
1730
2054
  }
1731
2055
  }
1732
- ))), /* @__PURE__ */ React17.createElement(
2056
+ ))), /* @__PURE__ */ React18.createElement(
1733
2057
  import_editor_panels.PanelBody,
1734
2058
  {
1735
2059
  sx: {
@@ -1738,9 +2062,9 @@ function ClassManagerPanel() {
1738
2062
  height: "100%"
1739
2063
  }
1740
2064
  },
1741
- /* @__PURE__ */ React17.createElement(import_ui15.Box, { px: 2, pb: 1 }, /* @__PURE__ */ React17.createElement(import_ui15.Stack, { direction: "row", justifyContent: "spaceBetween", gap: 0.5, sx: { pb: 0.5 } }, /* @__PURE__ */ React17.createElement(import_ui15.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React17.createElement(ClassManagerSearch, null)), /* @__PURE__ */ React17.createElement(CssClassFilter, null)), /* @__PURE__ */ React17.createElement(ActiveFilters, null)),
1742
- /* @__PURE__ */ React17.createElement(import_ui15.Divider, null),
1743
- /* @__PURE__ */ React17.createElement(
2065
+ /* @__PURE__ */ React18.createElement(import_ui15.Box, { px: 2, pb: 1 }, /* @__PURE__ */ React18.createElement(import_ui15.Stack, { direction: "row", justifyContent: "spaceBetween", gap: 0.5, sx: { pb: 0.5 } }, /* @__PURE__ */ React18.createElement(import_ui15.Box, { sx: { flexGrow: 1 } }, /* @__PURE__ */ React18.createElement(ClassManagerSearch, null)), /* @__PURE__ */ React18.createElement(CssClassFilter, null)), /* @__PURE__ */ React18.createElement(ActiveFilters, null)),
2066
+ /* @__PURE__ */ React18.createElement(import_ui15.Divider, null),
2067
+ /* @__PURE__ */ React18.createElement(
1744
2068
  import_ui15.Box,
1745
2069
  {
1746
2070
  px: 2,
@@ -1749,9 +2073,9 @@ function ClassManagerPanel() {
1749
2073
  overflowY: "auto"
1750
2074
  }
1751
2075
  },
1752
- /* @__PURE__ */ React17.createElement(GlobalClassesList, { disabled: isPublishing })
2076
+ /* @__PURE__ */ React18.createElement(GlobalClassesList, { disabled: isPublishing })
1753
2077
  )
1754
- ), /* @__PURE__ */ React17.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React17.createElement(
2078
+ ), /* @__PURE__ */ React18.createElement(import_editor_panels.PanelFooter, null, /* @__PURE__ */ React18.createElement(
1755
2079
  import_ui15.Button,
1756
2080
  {
1757
2081
  fullWidth: true,
@@ -1762,19 +2086,19 @@ function ClassManagerPanel() {
1762
2086
  disabled: !isDirty2,
1763
2087
  loading: isPublishing
1764
2088
  },
1765
- (0, import_i18n13.__)("Save changes", "elementor")
1766
- ))))), /* @__PURE__ */ React17.createElement(ClassManagerIntroduction, null), isSaveChangesDialogOpen && /* @__PURE__ */ React17.createElement(SaveChangesDialog, null, /* @__PURE__ */ React17.createElement(import_ui15.DialogHeader, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React17.createElement(SaveChangesDialog.Title, null, (0, import_i18n13.__)("You have unsaved changes", "elementor"))), /* @__PURE__ */ React17.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React17.createElement(SaveChangesDialog.ContentText, null, (0, import_i18n13.__)("You have unsaved changes in the Class Manager.", "elementor")), /* @__PURE__ */ React17.createElement(SaveChangesDialog.ContentText, null, (0, import_i18n13.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React17.createElement(
1767
- SaveChangesDialog.Actions,
2089
+ (0, import_i18n14.__)("Save changes", "elementor")
2090
+ ))))), /* @__PURE__ */ React18.createElement(ClassManagerIntroduction, null), isSaveChangesDialogOpen && /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog, null, /* @__PURE__ */ React18.createElement(import_ui15.DialogHeader, { onClose: closeSaveChangesDialog, logo: false }, /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.Title, null, (0, import_i18n14.__)("You have unsaved changes", "elementor"))), /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.Content, null, /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("You have unsaved changes in the Class Manager.", "elementor")), /* @__PURE__ */ React18.createElement(import_editor_ui8.SaveChangesDialog.ContentText, null, (0, import_i18n14.__)("To avoid losing your updates, save your changes before leaving.", "elementor"))), /* @__PURE__ */ React18.createElement(
2091
+ import_editor_ui8.SaveChangesDialog.Actions,
1768
2092
  {
1769
2093
  actions: {
1770
2094
  discard: {
1771
- label: (0, import_i18n13.__)("Discard", "elementor"),
2095
+ label: (0, import_i18n14.__)("Discard", "elementor"),
1772
2096
  action: () => {
1773
2097
  resetAndClosePanel();
1774
2098
  }
1775
2099
  },
1776
2100
  confirm: {
1777
- label: (0, import_i18n13.__)("Save & Continue", "elementor"),
2101
+ label: (0, import_i18n14.__)("Save & Continue", "elementor"),
1778
2102
  action: async () => {
1779
2103
  await publish();
1780
2104
  closeSaveChangesDialog();
@@ -1785,11 +2109,11 @@ function ClassManagerPanel() {
1785
2109
  }
1786
2110
  )));
1787
2111
  }
1788
- var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React17.createElement(import_ui15.IconButton, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React17.createElement(import_icons12.XIcon, { fontSize: "small" }));
1789
- var ErrorBoundaryFallback = () => /* @__PURE__ */ React17.createElement(import_ui15.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React17.createElement(import_ui15.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React17.createElement("strong", null, (0, import_i18n13.__)("Something went wrong", "elementor"))));
2112
+ var CloseButton = ({ onClose, ...props }) => /* @__PURE__ */ React18.createElement(import_ui15.IconButton, { size: "small", color: "secondary", onClick: onClose, "aria-label": "Close", ...props }, /* @__PURE__ */ React18.createElement(import_icons12.XIcon, { fontSize: "small" }));
2113
+ var ErrorBoundaryFallback = () => /* @__PURE__ */ React18.createElement(import_ui15.Box, { role: "alert", sx: { minHeight: "100%", p: 2 } }, /* @__PURE__ */ React18.createElement(import_ui15.Alert, { severity: "error", sx: { mb: 2, maxWidth: 400, textAlign: "center" } }, /* @__PURE__ */ React18.createElement("strong", null, (0, import_i18n14.__)("Something went wrong", "elementor"))));
1790
2114
  var usePreventUnload = () => {
1791
2115
  const isDirty2 = useDirtyState();
1792
- (0, import_react9.useEffect)(() => {
2116
+ (0, import_react8.useEffect)(() => {
1793
2117
  const handleBeforeUnload = (event) => {
1794
2118
  if (isDirty2) {
1795
2119
  event.preventDefault();
@@ -1815,7 +2139,7 @@ var usePublish = () => {
1815
2139
  var TotalCssClassCounter = () => {
1816
2140
  const filters = useFilters();
1817
2141
  const cssClasses = useClassesOrder();
1818
- return /* @__PURE__ */ React17.createElement(
2142
+ return /* @__PURE__ */ React18.createElement(
1819
2143
  import_ui15.Chip,
1820
2144
  {
1821
2145
  size: "small",
@@ -1825,11 +2149,17 @@ var TotalCssClassCounter = () => {
1825
2149
  };
1826
2150
 
1827
2151
  // src/components/class-manager/class-manager-button.tsx
2152
+ var trackGlobalClassesButton = () => {
2153
+ trackGlobalClasses({
2154
+ event: "classManagerOpened",
2155
+ source: "style-panel"
2156
+ });
2157
+ };
1828
2158
  var ClassManagerButton = () => {
1829
2159
  const document = (0, import_editor_documents5.__useActiveDocument)();
1830
2160
  const { open: openPanel } = usePanelActions();
1831
2161
  const { save: saveDocument } = (0, import_editor_documents5.__useActiveDocumentActions)();
1832
- const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = useDialog();
2162
+ const { open: openSaveChangesDialog, close: closeSaveChangesDialog, isOpen: isSaveChangesDialogOpen } = (0, import_editor_ui9.useDialog)();
1833
2163
  const { prefetchClassesUsage } = usePrefetchCssClassUsage();
1834
2164
  const { userCan } = (0, import_editor_styles_repository3.useUserStylesCapability)();
1835
2165
  const isUserAllowedToUpdateClass = userCan(globalClassesStylesProvider.getKey()).update;
@@ -1842,25 +2172,31 @@ var ClassManagerButton = () => {
1842
2172
  return;
1843
2173
  }
1844
2174
  openPanel();
2175
+ trackGlobalClassesButton();
2176
+ trackGlobalClasses({
2177
+ event: "classManagerOpened",
2178
+ source: "style-panel"
2179
+ });
1845
2180
  prefetchClassesUsage();
1846
2181
  };
1847
- return /* @__PURE__ */ React18.createElement(React18.Fragment, null, /* @__PURE__ */ React18.createElement(import_ui16.Tooltip, { title: (0, import_i18n14.__)("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React18.createElement(import_ui16.IconButton, { size: "tiny", onClick: handleOpenPanel, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React18.createElement(FlippedColorSwatchIcon, { fontSize: "tiny" }))), isSaveChangesDialogOpen && /* @__PURE__ */ React18.createElement(SaveChangesDialog, null, /* @__PURE__ */ React18.createElement(SaveChangesDialog.Title, null, (0, import_i18n14.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React18.createElement(SaveChangesDialog.Content, null, /* @__PURE__ */ React18.createElement(SaveChangesDialog.ContentText, { sx: { mb: 2 } }, (0, import_i18n14.__)(
2182
+ return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(import_ui16.Tooltip, { title: (0, import_i18n15.__)("Class Manager", "elementor"), placement: "top" }, /* @__PURE__ */ React19.createElement(import_ui16.IconButton, { size: "tiny", onClick: handleOpenPanel, sx: { marginInlineEnd: -0.75 } }, /* @__PURE__ */ React19.createElement(FlippedColorSwatchIcon, { fontSize: "tiny" }))), isSaveChangesDialogOpen && /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog, null, /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.Title, null, (0, import_i18n15.__)("You have unsaved changes", "elementor")), /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.Content, null, /* @__PURE__ */ React19.createElement(import_editor_ui9.SaveChangesDialog.ContentText, { sx: { mb: 2 } }, (0, import_i18n15.__)(
1848
2183
  "To open the Class Manager, save your page first. You can't continue without saving.",
1849
2184
  "elementor"
1850
- ))), /* @__PURE__ */ React18.createElement(
1851
- SaveChangesDialog.Actions,
2185
+ ))), /* @__PURE__ */ React19.createElement(
2186
+ import_editor_ui9.SaveChangesDialog.Actions,
1852
2187
  {
1853
2188
  actions: {
1854
2189
  cancel: {
1855
- label: (0, import_i18n14.__)("Stay here", "elementor"),
2190
+ label: (0, import_i18n15.__)("Stay here", "elementor"),
1856
2191
  action: closeSaveChangesDialog
1857
2192
  },
1858
2193
  confirm: {
1859
- label: (0, import_i18n14.__)("Save & Continue", "elementor"),
2194
+ label: (0, import_i18n15.__)("Save & Continue", "elementor"),
1860
2195
  action: async () => {
1861
2196
  await saveDocument();
1862
2197
  closeSaveChangesDialog();
1863
2198
  openPanel();
2199
+ trackGlobalClassesButton();
1864
2200
  prefetchClassesUsage();
1865
2201
  }
1866
2202
  }
@@ -1870,11 +2206,11 @@ var ClassManagerButton = () => {
1870
2206
  };
1871
2207
 
1872
2208
  // src/components/convert-local-class-to-global-class.tsx
1873
- var React19 = __toESM(require("react"));
2209
+ var React20 = __toESM(require("react"));
1874
2210
  var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
1875
- var import_editor_ui7 = require("@elementor/editor-ui");
2211
+ var import_editor_ui10 = require("@elementor/editor-ui");
1876
2212
  var import_ui17 = require("@elementor/ui");
1877
- var import_i18n15 = require("@wordpress/i18n");
2213
+ var import_i18n16 = require("@wordpress/i18n");
1878
2214
  var ConvertLocalClassToGlobalClass = (props) => {
1879
2215
  const localStyleData = props.styleDef;
1880
2216
  const handleConversion = () => {
@@ -1885,10 +2221,16 @@ var ConvertLocalClassToGlobalClass = (props) => {
1885
2221
  const newId = globalClassesStylesProvider.actions.create?.(newClassName, localStyleData.variants);
1886
2222
  if (newId) {
1887
2223
  props.successCallback(newId);
2224
+ trackGlobalClasses({
2225
+ classId: newId,
2226
+ event: "classCreated",
2227
+ source: "converted",
2228
+ classTitle: newClassName
2229
+ });
1888
2230
  }
1889
2231
  };
1890
- return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
1891
- import_editor_ui7.MenuListItem,
2232
+ return /* @__PURE__ */ React20.createElement(React20.Fragment, null, /* @__PURE__ */ React20.createElement(
2233
+ import_editor_ui10.MenuListItem,
1892
2234
  {
1893
2235
  disabled: !props.canConvert,
1894
2236
  onClick: handleConversion,
@@ -1901,8 +2243,8 @@ var ConvertLocalClassToGlobalClass = (props) => {
1901
2243
  }
1902
2244
  }
1903
2245
  },
1904
- (0, import_i18n15.__)("Convert to global class", "elementor")
1905
- ), /* @__PURE__ */ React19.createElement(import_ui17.Divider, null));
2246
+ (0, import_i18n16.__)("Convert to global class", "elementor")
2247
+ ), /* @__PURE__ */ React20.createElement(import_ui17.Divider, null));
1906
2248
  };
1907
2249
  function createClassName(prefix) {
1908
2250
  let i = 1;
@@ -1914,11 +2256,11 @@ function createClassName(prefix) {
1914
2256
  }
1915
2257
 
1916
2258
  // src/components/populate-store.tsx
1917
- var import_react10 = require("react");
1918
- var import_store20 = require("@elementor/store");
2259
+ var import_react9 = require("react");
2260
+ var import_store22 = require("@elementor/store");
1919
2261
  function PopulateStore() {
1920
- const dispatch5 = (0, import_store20.__useDispatch)();
1921
- (0, import_react10.useEffect)(() => {
2262
+ const dispatch5 = (0, import_store22.__useDispatch)();
2263
+ (0, import_react9.useEffect)(() => {
1922
2264
  Promise.all([apiClient.all("preview"), apiClient.all("frontend")]).then(
1923
2265
  ([previewRes, frontendRes]) => {
1924
2266
  const { data: previewData } = previewRes;
@@ -1941,64 +2283,292 @@ function PopulateStore() {
1941
2283
  return null;
1942
2284
  }
1943
2285
 
2286
+ // src/mcp-integration/index.ts
2287
+ var import_editor_mcp2 = require("@elementor/editor-mcp");
2288
+
2289
+ // src/mcp-integration/classes-resource.ts
2290
+ var import_editor_mcp = require("@elementor/editor-mcp");
2291
+ var GLOBAL_CLASSES_URI = "elementor://classes";
2292
+ var initClassesResource = () => {
2293
+ const { mcpServer } = (0, import_editor_mcp.getMCPByDomain)("classes");
2294
+ mcpServer.resource(
2295
+ "global-classes",
2296
+ GLOBAL_CLASSES_URI,
2297
+ {
2298
+ description: "Global classes list."
2299
+ },
2300
+ async () => {
2301
+ return {
2302
+ contents: [{ uri: GLOBAL_CLASSES_URI, text: localStorage["elementor-global-classes"] ?? {} }]
2303
+ };
2304
+ }
2305
+ );
2306
+ };
2307
+
2308
+ // src/mcp-integration/mcp-apply-unapply-global-classes.ts
2309
+ var import_editor_editing_panel = require("@elementor/editor-editing-panel");
2310
+ var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
2311
+ var import_schema = require("@elementor/schema");
2312
+ function initMcpApplyUnapplyGlobalClasses(server) {
2313
+ server.addTool({
2314
+ name: "list-all-global-classes",
2315
+ description: `List all classes applied to a specific element
2316
+
2317
+ ## When to use this tool:
2318
+ - When a user requests to see which classes or global classes exists.
2319
+ - When you need the list of global classes to allow the user to select from.
2320
+ - At least once before applying or unapplying a class, to ensure the class ID is correct.
2321
+
2322
+ `,
2323
+ outputSchema: {
2324
+ appliedClasses: import_schema.z.array(
2325
+ import_schema.z.object({
2326
+ id: import_schema.z.string().describe("The ID of the class"),
2327
+ label: import_schema.z.string().describe("The label of the class"),
2328
+ variants: import_schema.z.array(
2329
+ import_schema.z.object({
2330
+ meta: import_schema.z.object({
2331
+ breakpoint: import_schema.z.string().optional(),
2332
+ state: import_schema.z.string().optional()
2333
+ }),
2334
+ props: import_schema.z.record(import_schema.z.any())
2335
+ })
2336
+ )
2337
+ })
2338
+ )
2339
+ },
2340
+ handler: async () => {
2341
+ const globalClassesProvider = import_editor_styles_repository5.stylesRepository.getProviderByKey("global-classes");
2342
+ if (!globalClassesProvider) {
2343
+ throw new Error("Global classes provider not found");
2344
+ }
2345
+ const result = [];
2346
+ globalClassesProvider.actions.all().forEach((style) => {
2347
+ const { id: id2, label, variants } = style;
2348
+ result.push({
2349
+ id: id2,
2350
+ label,
2351
+ variants: variants.map((variant) => ({
2352
+ meta: {
2353
+ breakpoint: variant.meta.breakpoint,
2354
+ state: variant.meta.state
2355
+ },
2356
+ props: variant.props
2357
+ }))
2358
+ });
2359
+ });
2360
+ return { appliedClasses: result };
2361
+ }
2362
+ });
2363
+ server.addTool({
2364
+ schema: {
2365
+ classId: import_schema.z.string().describe("The ID of the class to apply"),
2366
+ elementId: import_schema.z.string().describe("The ID of the element to which the class will be applied")
2367
+ },
2368
+ name: "apply-global-class",
2369
+ description: `Apply a global class to the current element
2370
+
2371
+ ## When to use this tool:
2372
+ - When a user requests to apply a global class or a class to an element in the Elementor editor.
2373
+ - When you need to add a specific class to an element's applied classes.
2374
+
2375
+ ## Prerequisites:
2376
+ - Ensure you have the most up-to-date list of classes applied to the element to avoid duplicates. You can use the "list-applied-classes" tool to fetch the current classes.
2377
+ - Make sure you have the correct class ID that you want to apply.`,
2378
+ handler: async (params) => {
2379
+ const { classId, elementId } = params;
2380
+ const appliedClasses = (0, import_editor_editing_panel.doGetAppliedClasses)(elementId);
2381
+ (0, import_editor_editing_panel.doApplyClasses)(elementId, [...appliedClasses, classId]);
2382
+ return `Class ${classId} applied to element ${elementId} successfully.`;
2383
+ }
2384
+ });
2385
+ server.addTool({
2386
+ name: "unapply-global-class",
2387
+ schema: {
2388
+ classId: import_schema.z.string().describe("The ID of the class to unapply"),
2389
+ elementId: import_schema.z.string().describe("The ID of the element from which the class will be unapplied")
2390
+ },
2391
+ description: `Unapply a (global) class from the current element
2392
+
2393
+ ## When to use this tool:
2394
+ - When a user requests to unapply a global class or a class from an element in the Elementor editor.
2395
+ - When you need to remove a specific class from an element's applied classes.
2396
+
2397
+ ## Prerequisites:
2398
+ - Ensure you have the most up-to-date list of classes applied to the element to avoid errors. You can use the "list-global-classes" tool to fetch the all classes applied to all elements.
2399
+ - Make sure you have the correct class ID that you want to unapply.
2400
+
2401
+ <note>
2402
+ If the user want to unapply a class by it's name and not ID, please use the "list-global-classes" tool to get the class ID from the name first.
2403
+ </note>
2404
+ `,
2405
+ handler: async (params) => {
2406
+ const { classId, elementId } = params;
2407
+ const ok = (0, import_editor_editing_panel.doUnapplyClass)(elementId, classId);
2408
+ if (!ok) {
2409
+ throw new Error(`Class ${classId} is not applied to element ${elementId}, cannot unapply it.`);
2410
+ }
2411
+ return `Class ${classId} unapplied from element ${elementId} successfully.`;
2412
+ }
2413
+ });
2414
+ }
2415
+
2416
+ // src/mcp-integration/mcp-get-global-class-usages.ts
2417
+ var import_schema2 = require("@elementor/schema");
2418
+ function initMcpApplyGetGlobalClassUsages(reg) {
2419
+ const { addTool } = reg;
2420
+ const globalClassesUsageSchema = {
2421
+ usages: import_schema2.z.array(
2422
+ import_schema2.z.object({
2423
+ classId: import_schema2.z.string().describe(
2424
+ 'The ID of the class, not visible to the user. To retreive the name of the class, use the "list-global-classes" tool'
2425
+ ),
2426
+ usages: import_schema2.z.array(
2427
+ import_schema2.z.object({
2428
+ pageId: import_schema2.z.string().describe("The ID of the page where the class is used"),
2429
+ title: import_schema2.z.string().describe("The title of the page where the class is used"),
2430
+ total: import_schema2.z.number().describe("The number of times the class is used on this page"),
2431
+ elements: import_schema2.z.array(import_schema2.z.string()).describe("List of element IDs using this class on the page")
2432
+ })
2433
+ )
2434
+ })
2435
+ )
2436
+ };
2437
+ addTool({
2438
+ name: "get-global-class-usages",
2439
+ description: `Retreive the usage details of global classes within the Elementor editor, accross all pages.
2440
+
2441
+ ## Prequisites:
2442
+ - Use "list-global-classes" tool to be able to match class IDs to class names/labels.
2443
+
2444
+ ## When to use this tool:
2445
+ - When a user requests to see where a specific global class is being used accross the site.
2446
+ - When you need to manage or clean up unused global classes.
2447
+ - Before deleting a global class, to ensure it is not in use in any other pages.
2448
+ `,
2449
+ outputSchema: globalClassesUsageSchema,
2450
+ handler: async () => {
2451
+ const data = await fetchCssClassUsage();
2452
+ const result = {
2453
+ usages: []
2454
+ };
2455
+ Object.entries(data).forEach(
2456
+ ([classId, usageDetails]) => {
2457
+ const newEntry = {
2458
+ classId,
2459
+ usages: []
2460
+ };
2461
+ if (typeof usageDetails !== "number") {
2462
+ const { content } = usageDetails;
2463
+ content.forEach((detail) => {
2464
+ newEntry.usages.push({
2465
+ pageId: String(detail.pageId),
2466
+ title: detail.title,
2467
+ total: detail.total,
2468
+ elements: detail.elements
2469
+ });
2470
+ });
2471
+ result.usages.push(newEntry);
2472
+ }
2473
+ }
2474
+ );
2475
+ return result;
2476
+ }
2477
+ });
2478
+ }
2479
+
2480
+ // src/mcp-integration/index.ts
2481
+ var initMcpIntegration = () => {
2482
+ const reg = (0, import_editor_mcp2.getMCPByDomain)("classes");
2483
+ reg.setMCPDescription(
2484
+ "Tools for managing and applying Global CSS classes to elements within the Elementor editor."
2485
+ );
2486
+ initMcpApplyUnapplyGlobalClasses(reg);
2487
+ initMcpApplyGetGlobalClassUsages(reg);
2488
+ initClassesResource();
2489
+ };
2490
+
2491
+ // src/sync-with-document.tsx
2492
+ var import_react10 = require("react");
2493
+ var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
2494
+
1944
2495
  // src/sync-with-document-save.ts
1945
2496
  var import_editor_current_user2 = require("@elementor/editor-current-user");
1946
2497
  var import_editor_documents6 = require("@elementor/editor-documents");
1947
2498
  var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
1948
- var import_store22 = require("@elementor/store");
1949
- function syncWithDocumentSave() {
2499
+ var import_store24 = require("@elementor/store");
2500
+ function syncWithDocumentSave(panelActions) {
1950
2501
  const unsubscribe = syncDirtyState();
1951
- bindSaveAction();
2502
+ bindSaveAction(panelActions);
1952
2503
  return unsubscribe;
1953
2504
  }
1954
2505
  function syncDirtyState() {
1955
- return (0, import_store22.__subscribeWithSelector)(selectIsDirty, () => {
2506
+ return (0, import_store24.__subscribeWithSelector)(selectIsDirty, () => {
1956
2507
  if (!isDirty()) {
1957
2508
  return;
1958
2509
  }
1959
2510
  (0, import_editor_documents6.setDocumentModifiedStatus)(true);
1960
2511
  });
1961
2512
  }
1962
- function bindSaveAction() {
1963
- (0, import_editor_v1_adapters4.registerDataHook)("after", "document/save/save", (args) => {
2513
+ function bindSaveAction(panelActions) {
2514
+ (0, import_editor_v1_adapters4.registerDataHook)("dependency", "document/save/save", (args) => {
1964
2515
  const user = (0, import_editor_current_user2.getCurrentUser)();
1965
2516
  const canEdit = user?.capabilities.includes(UPDATE_CLASS_CAPABILITY_KEY);
1966
2517
  if (!canEdit) {
1967
- return;
2518
+ return true;
1968
2519
  }
1969
- return saveGlobalClasses({
1970
- context: args.status === "publish" ? "frontend" : "preview"
2520
+ saveGlobalClasses({
2521
+ context: args.status === "publish" ? "frontend" : "preview",
2522
+ onApprove: panelActions?.open
1971
2523
  });
2524
+ return true;
1972
2525
  });
1973
2526
  }
1974
2527
  function isDirty() {
1975
- return selectIsDirty((0, import_store22.__getState)());
2528
+ return selectIsDirty((0, import_store24.__getState)());
2529
+ }
2530
+
2531
+ // src/sync-with-document.tsx
2532
+ function SyncWithDocumentSave() {
2533
+ const panelActions = usePanelActions();
2534
+ (0, import_react10.useEffect)(() => {
2535
+ (0, import_editor_v1_adapters5.__privateListenTo)((0, import_editor_v1_adapters5.v1ReadyEvent)(), () => {
2536
+ syncWithDocumentSave(panelActions);
2537
+ });
2538
+ }, []);
2539
+ return null;
1976
2540
  }
1977
2541
 
1978
2542
  // src/init.ts
1979
2543
  function init() {
1980
- (0, import_store24.__registerSlice)(slice);
2544
+ (0, import_store26.__registerSlice)(slice);
1981
2545
  (0, import_editor_panels2.__registerPanel)(panel);
1982
- import_editor_styles_repository5.stylesRepository.register(globalClassesStylesProvider);
2546
+ import_editor_styles_repository6.stylesRepository.register(globalClassesStylesProvider);
1983
2547
  (0, import_editor.injectIntoLogic)({
1984
2548
  id: "global-classes-populate-store",
1985
2549
  component: PopulateStore
1986
2550
  });
1987
- (0, import_editor_editing_panel.injectIntoCssClassConvert)({
2551
+ (0, import_editor.injectIntoLogic)({
2552
+ id: "global-classes-sync-with-document",
2553
+ component: SyncWithDocumentSave
2554
+ });
2555
+ (0, import_editor.injectIntoLogic)({
2556
+ id: "global-classes-prefetch-css-class-usage",
2557
+ component: PrefetchCssClassUsage
2558
+ });
2559
+ (0, import_editor_editing_panel2.injectIntoCssClassConvert)({
1988
2560
  id: "global-classes-convert-from-local-class",
1989
2561
  component: ConvertLocalClassToGlobalClass
1990
2562
  });
1991
- (0, import_editor_editing_panel.injectIntoClassSelectorActions)({
2563
+ (0, import_editor_editing_panel2.injectIntoClassSelectorActions)({
1992
2564
  id: "global-classes-manager-button",
1993
2565
  component: ClassManagerButton
1994
2566
  });
1995
- (0, import_editor_editing_panel.registerStyleProviderToColors)(GLOBAL_CLASSES_PROVIDER_KEY, {
2567
+ (0, import_editor_editing_panel2.registerStyleProviderToColors)(GLOBAL_CLASSES_PROVIDER_KEY, {
1996
2568
  name: "global",
1997
2569
  getThemeColor: (theme) => theme.palette.global.dark
1998
2570
  });
1999
- (0, import_editor_v1_adapters5.__privateListenTo)((0, import_editor_v1_adapters5.v1ReadyEvent)(), () => {
2000
- syncWithDocumentSave();
2001
- });
2571
+ initMcpIntegration();
2002
2572
  }
2003
2573
  // Annotate the CommonJS export names for ESM import in node:
2004
2574
  0 && (module.exports = {