File: /home/lgooir/.trash/elementor/assets/js/packages/editor-global-classes/editor-global-classes.min.js
!function(){"use strict";var e={d:function(t,n){for(var a in n)e.o(n,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:n[a]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{init:function(){return xt}});var n=window.elementorV2.editor,a=window.elementorV2.editorEditingPanel,l=window.elementorV2.editorPanels,r=window.elementorV2.editorStylesRepository,o=window.elementorV2.store,s=window.React,i=window.elementorV2.editorDocuments,c=window.elementorV2.editorUi,d=window.elementorV2.ui,m=window.wp.i18n,u=window.elementorV2.editorStyles,p=window.elementorV2.editorV1Adapters;const h="elementor_global_classes_update_class";var g=window.elementorV2.utils;const y=(0,g.createError)({code:"global_class_not_found",message:"Global class not found."}),f=(0,g.createError)({code:"global_class_label_already_exists",message:"Class with this name already exists."});var b=window.elementorV2.editorProps;function E({value:e,next:t,prev:n}){return{value:e,prev:n||null,next:t||null}}class v{static registry={};static get(e){return v.registry[e]||(v.registry[e]=new v(e)),v.registry[e]}first=null;current=null;constructor(e){this.namespace=e}transform(e){return JSON.parse(JSON.stringify(e))}reset(){this.first=this.current=null}prev(){return this.current&&this.current!==this.first?(this.current=this.current.prev,this.current?.value||null):null}isLast(){return!this.current||!this.current.next}next(e){if(e){if(!this.current)return this.first=E({value:this.transform(e)}),this.current=this.first,this.current.value;const t=E({value:this.transform(e),prev:this.current});return this.current.next=t,this.current=t,this.current.value}return this.current&&this.current.next?(this.current=this.current.next,this.current.value):null}}const _=v.get("global-classes"),x="globalClasses",w=(0,o.__createSlice)({name:x,initialState:{data:{items:{},order:[]},initialData:{frontend:{items:{},order:[]},preview:{items:{},order:[]}},isDirty:!1},reducers:{load(e,{payload:{frontend:t,preview:n}}){e.initialData.frontend=t,e.initialData.preview=n,e.data=n,e.isDirty=!1},add(e,{payload:t}){_.next(e.data),e.data.items[t.id]=t,e.data.order.unshift(t.id),e.isDirty=!0},delete(e,{payload:t}){_.next(e.data),e.data.items=Object.fromEntries(Object.entries(e.data.items).filter(([e])=>e!==t)),e.data.order=e.data.order.filter(e=>e!==t),e.isDirty=!0},setOrder(e,{payload:t}){_.next(e.data),e.data.order=t,e.isDirty=!0},update(e,{payload:t}){_.next(e.data);const n={...e.data.items[t.style.id],...t.style};e.data.items[t.style.id]=n,e.isDirty=!0},updateMultiple(e,{payload:t}){_.next(e.data),Object.entries(t).forEach(([t,{modified:n}])=>{e.data.items[t].label=n}),e.isDirty=!1},updateProps(e,{payload:t}){const n=e.data.items[t.id];if(!n)throw new y({context:{styleId:t.id}});_.next(e.data);const a=(0,u.getVariantByMeta)(n,t.meta);let l=("custom_css"in t?t.custom_css:a?.custom_css)??null;l=l?.raw?l:null,a?(a.props=(0,b.mergeProps)(a.props,t.props),a.custom_css=l,n.variants=S(n)):n.variants.push({meta:t.meta,props:t.props,custom_css:l}),e.isDirty=!0},reset(e,{payload:{context:t}}){"frontend"===t&&(_.reset(),e.initialData.frontend=e.data,e.isDirty=!1),e.initialData.preview=e.data},undo(e){_.isLast()&&_.next(e.data);const t=_.prev();t?(e.data=t,e.isDirty=!0):e.data=e.initialData.preview},resetToInitialState(e,{payload:{context:t}}){_.reset(),e.data=e.initialData[t],e.isDirty=!1},redo(e){const t=_.next();_.isLast()&&_.prev(),t&&(e.data=t,e.isDirty=!0)}}}),S=e=>e.variants.filter(({props:e,custom_css:t})=>Object.keys(e).length||t?.raw),C=e=>e[x].data,D=e=>e[x].initialData.frontend,I=e=>e[x].initialData.preview,T=(0,o.__createSelector)(C,({order:e})=>e),P=(0,o.__createSelector)(C,({items:e})=>e),k=e=>e[x].isDirty,O=(0,o.__createSelector)(P,T,(e,t)=>t.map(t=>e[t])),z=(e,t)=>e[x].data.items[t]??null,M=(0,o.__createSelector)(C,({items:e})=>Object.values(e).filter(e=>0===e.variants.length)),B="global-classes",j=(0,r.createStylesProvider)({key:B,priority:30,limit:100,labels:{singular:(0,m.__)("class","elementor"),plural:(0,m.__)("classes","elementor")},subscribe:e=>A(e),capabilities:(()=>{if((0,p.isExperimentActive)("global_classes_should_enforce_capabilities"))return{update:h,create:h,delete:h,updateProps:h}})(),actions:{all:()=>O((0,o.__getState)()),get:e=>z((0,o.__getState)(),e),resolveCssName:e=>z((0,o.__getState)(),e)?.label??e,create:(e,t=[])=>{const n=P((0,o.__getState)());if(Object.values(n).map(e=>e.label).includes(e))throw new f({context:{label:e}});const a=Object.keys(n),l=(0,u.generateId)("g-",a);return(0,o.__dispatch)(w.actions.add({id:l,type:"class",label:e,variants:t})),l},update:e=>{(0,o.__dispatch)(w.actions.update({style:e}))},delete:e=>{(0,o.__dispatch)(w.actions.delete(e))},updateProps:e=>{(0,o.__dispatch)(w.actions.updateProps({id:e.id,meta:e.meta,props:e.props}))},updateCustomCss:e=>{(0,o.__dispatch)(w.actions.updateProps({id:e.id,meta:e.meta,custom_css:e.custom_css,props:{}}))}}}),A=e=>{let t=C((0,o.__getState)());return(0,o.__subscribeWithSelector)(e=>e.globalClasses,n=>{e(t.items,n.data.items),t=n.data})};var L=window.elementorV2.query,W=window.elementorV2.httpClient;const V="/global-classes",F="elementor/v1",$=`${V}/usage`,U={usage:()=>(0,W.httpService)().get(`${F}${$}`),all:(e="preview")=>(0,W.httpService)().get(`${F}${V}`,{params:{context:e}}),publish:e=>(0,W.httpService)().put("elementor/v1"+V,e,{params:{context:"frontend"}}),saveDraft:e=>(0,W.httpService)().put("elementor/v1"+V,e,{params:{context:"preview"}})},G={DUPLICATED_LABEL:"DUPLICATED_LABEL"},R=async()=>{return e=(await U.usage()).data.data,Object.entries(e).reduce((e,[t,n])=>(e[t]={content:n||[],total:n.reduce((e,t)=>e+(t?.total||0),0)},e),{});var e},q="css-classes-usage";var H=window.elementorV2.icons;const N=()=>(0,o.__useSelector)(T),Y=()=>(0,o.__useSelector)(k),K=(0,s.createContext)(void 0),Q={empty:!1,onThisPage:!1,unused:!1},J=({children:e})=>{const[t,n]=s.useState(Q),{debouncedValue:a,inputValue:l,handleChange:r}=(0,g.useDebounceState)({delay:300,initialValue:(()=>{const e=localStorage.getItem("elementor-global-classes-search");return e?(localStorage.removeItem("elementor-global-classes-search"),e):""})()});return s.createElement(K.Provider,{value:{search:{debouncedValue:a,inputValue:l,handleChange:r,onClearSearch:()=>{r("")}},filters:{filters:t,setFilters:n,onClearFilter:()=>{n(Q)}}}},e)},X=()=>{const e=(0,s.useContext)(K);if(!e)throw new Error("useSearchContext must be used within a SearchContextProvider");return e},Z=()=>(0,L.useQuery)({queryKey:[q],queryFn:R,refetchOnMount:!1,refetchOnWindowFocus:!0}),ee={empty:[],onThisPage:[],unused:[]},te=()=>{const e=(0,i.__useActiveDocument)(),t=(0,o.__useSelector)(M),{data:n,isLoading:a}=Z(),l=(()=>{const e=(0,o.__useSelector)(P);return Object.keys(e)})(),r=(0,s.useMemo)(()=>t.map(({id:e})=>e),[t]),c=(0,s.useMemo)(()=>n&&e?((e,t)=>{const n=[];for(const a in e)e[a].content.forEach(e=>{+e.pageId===t&&n.push(a)});return n})(n,e.id):[],[n,e]),d=(0,s.useMemo)(()=>n?((e,t)=>{const n=new Set(e);return t.filter(e=>!n.has(e))})(Object.keys(n),l):[],[n,l]);return!a&&n&&e?{onThisPage:c,unused:d,empty:r}:ee},ne=()=>{const{filters:{filters:e}}=X(),t=te();return(0,s.useMemo)(()=>{const n=Object.entries(e).filter(([,e])=>e);return 0===n.length?null:n.reduce((e,[n],a)=>{const l=t[n]||[];return 0===a?l:e.filter(e=>l.includes(e))},[])},[e,t])},ae="DUP_",le=({modifiedLabels:e,onApprove:t})=>s.createElement(s.Fragment,null,s.createElement(d.DialogHeader,{logo:!1},s.createElement(d.Box,{display:"flex",alignItems:"center",gap:1},s.createElement(d.Icon,{color:"secondary"},s.createElement(H.InfoCircleFilledIcon,{fontSize:"medium"})),s.createElement(d.Typography,{variant:"subtitle1"},(0,m.__)("We've published your page and updated class names.","elementor")))),s.createElement(d.DialogContent,null,s.createElement(d.Stack,{spacing:2,direction:"column"},s.createElement(d.Typography,{variant:"body2"},(0,m.__)("Some new classes used the same names as existing ones. To prevent conflicts, we added the prefix","elementor"),s.createElement("strong",null," ",ae)),s.createElement(d.Box,null,s.createElement(d.Box,{sx:{width:"100%",display:"flex",gap:2,alignItems:"flex-start"}},s.createElement(d.Typography,{variant:"subtitle2",sx:{fontWeight:"bold",flex:1,flexShrink:1,flexGrow:1,minWidth:0}},(0,m.__)("Before","elementor")),s.createElement(d.Typography,{variant:"subtitle2",sx:{minWidth:"200px",fontWeight:"bold",flexShrink:0,flexGrow:0,width:"200px",maxWidth:"200px"}},(0,m.__)("After","elementor"))),s.createElement(d.Divider,{sx:{mt:.5,mb:.5}}),s.createElement(d.Stack,{direction:"column",gap:.5,sx:{pb:2}},Object.values(e).map(({original:e,modified:t},n)=>s.createElement(d.Box,{key:n,sx:{width:"100%",display:"flex",gap:2,alignItems:"flex-start"}},s.createElement(d.Box,{sx:{flex:1,flexShrink:1,flexGrow:1,minWidth:0}},s.createElement(c.EllipsisWithTooltip,{title:e},s.createElement(d.Typography,{variant:"body2",sx:{color:"text.secondary"}},e))),s.createElement(d.Box,{sx:{minWidth:"200px",flexShrink:0,flexGrow:0,width:"200px",maxWidth:"200px"}},s.createElement(c.EllipsisWithTooltip,{title:t},s.createElement(d.Typography,{variant:"body2",sx:{color:"text.primary"}},t)))))),s.createElement(d.Box,null,s.createElement(d.Alert,{severity:"info",size:"small",color:"secondary"},s.createElement("strong",null,(0,m.__)("Your designs and classes are safe.","elementor")),(0,m.__)("Only the prefixes were added.Find them in Class Manager by searching","elementor"),s.createElement("strong",null,ae)))))),s.createElement(d.DialogActions,null,s.createElement(d.Button,{color:"secondary",variant:"text",onClick:()=>{localStorage.setItem("elementor-global-classes-search",ae),t?.(),(0,c.closeDialog)()}},(0,m.__)("Go to Class Manager","elementor")),s.createElement(d.Button,{color:"secondary",variant:"contained",onClick:c.closeDialog},(0,m.__)("Done","elementor"))));async function re({context:e,onApprove:t}){const n=C((0,o.__getState)()),a="preview"===e?U.saveDraft:U.publish,l="preview"===e?I:D,r=await a({items:n.items,order:n.order,changes:oe(n,l((0,o.__getState)()))});(0,o.__dispatch)(w.actions.reset({context:e})),r?.data?.data?.code===G.DUPLICATED_LABEL&&((0,o.__dispatch)(w.actions.updateMultiple(r.data.data.modifiedLabels)),(0,c.openDialog)({component:s.createElement(le,{modifiedLabels:r.data.data.modifiedLabels||[],onApprove:t})}))}function oe(e,t){const n=Object.keys(e.items),a=Object.keys(t.items);return{added:n.filter(e=>!a.includes(e)),deleted:a.filter(e=>!n.includes(e)),modified:n.filter(n=>n in t.items&&(0,g.hash)(e.items[n])!==(0,g.hash)(t.items[n]))}}const se=({tooltipText:e,sx:t})=>{const{filters:{onClearFilter:n}}=X();return s.createElement(d.Tooltip,{title:e,placement:"top",disableInteractive:!0},s.createElement(d.Box,null,s.createElement(ie,{"aria-label":e,size:"tiny",onClick:n,sx:t},s.createElement(H.BrushBigIcon,{fontSize:"tiny"}))))},ie=(0,d.styled)(d.IconButton)(({theme:e})=>({"&.Mui-disabled":{pointerEvents:"auto","&:hover":{color:e.palette.action.disabled}}})),ce={unused:(0,m.__)("Unused","elementor"),empty:(0,m.__)("Empty","elementor"),onThisPage:(0,m.__)("On this page","elementor")},de=()=>{const{filters:{filters:e,setFilters:t}}=X(),n=te(),a=e=>{t(t=>({...t,[e]:!t[e]}))};return s.createElement(d.MenuList,null,s.createElement(d.MenuItem,{onClick:()=>a("unused")},s.createElement(me,{label:ce.unused,checked:e.unused,suffix:s.createElement(d.Chip,{size:"tiny",sx:{ml:"auto"},label:n.unused.length})})),s.createElement(d.MenuItem,{onClick:()=>a("empty")},s.createElement(me,{label:ce.empty,checked:e.empty,suffix:s.createElement(d.Chip,{size:"tiny",sx:{ml:"auto"},label:n.empty.length})})),s.createElement(d.MenuItem,{onClick:()=>a("onThisPage")},s.createElement(me,{label:ce.onThisPage,checked:e.onThisPage,suffix:s.createElement(d.Chip,{size:"tiny",sx:{ml:"auto"},label:n.onThisPage.length})})))},me=({label:e,suffix:t,checked:n})=>s.createElement(d.Stack,{direction:"row",alignItems:"center",gap:.5,flex:1},s.createElement(d.Checkbox,{size:"small",checked:n,sx:{padding:0,color:"text.tertiary","&.Mui-checked":{color:"text.tertiary"}}}),s.createElement(d.Typography,{variant:"caption",sx:{color:"text.secondary"}},e),t),ue=()=>{const{filters:{filters:e,setFilters:t}}=X(),n=Object.keys(e).filter(t=>e[t]),a=n.length>0;return s.createElement(d.Stack,{direction:"row",alignItems:"center",justifyContent:"space-between"},s.createElement(d.Stack,{direction:"row",gap:.5,alignItems:"center",flexWrap:"wrap"},n.map(e=>s.createElement(d.Chip,{key:e,label:ce[e],onDelete:()=>(e=>{t(t=>({...t,[e]:!1}))})(e),sx:pe,size:"tiny"}))),a&&s.createElement(se,{tooltipText:(0,m.__)("Clear Filters","elementor"),sx:{margin:"0 0 auto auto"}}))},pe={"& .MuiChip-deleteIcon":{display:"none",transition:"opacity 0.2s"},"&:hover .MuiChip-deleteIcon":{display:"block"}};function he(){return he=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},he.apply(null,arguments)}const ge=()=>{const{filters:{filters:e}}=X(),t=(0,d.usePopupState)({variant:"popover",disableAutoFocus:!0}),n=Object.values(e).some(e=>e);return s.createElement(s.Fragment,null,s.createElement(d.Tooltip,{title:(0,m.__)("Filters","elementor"),placement:"top"},s.createElement(d.ToggleButton,he({value:"filter",size:"tiny",selected:t.isOpen},(0,d.bindToggle)(t)),s.createElement(H.FilterIcon,{fontSize:"tiny"}))),s.createElement(d.Popover,he({sx:{maxWidth:"344px"},anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:-21}},(0,d.bindPopover)(t)),s.createElement(c.PopoverHeader,{actions:n?[s.createElement(se,{key:"clear-all-button",tooltipText:(0,m.__)("Clear all","elementor")})]:[],onClose:t.close,title:(0,m.__)("Filters","elementor"),icon:s.createElement(H.FilterIcon,{fontSize:"tiny"})}),s.createElement(d.Divider,{sx:{borderWidth:"1px 0 0 0"}}),s.createElement(c.PopoverBody,{width:344,height:125},s.createElement(de,null))))},ye=()=>{const{search:{inputValue:e,handleChange:t}}=X();return s.createElement(d.Stack,{direction:"row",gap:.5,sx:{width:"100%"}},s.createElement(d.Box,{sx:{flexGrow:1}},s.createElement(d.TextField,{role:"search",fullWidth:!0,size:"tiny",value:e,placeholder:(0,m.__)("Search","elementor"),onChange:e=>t(e.target.value),InputProps:{startAdornment:s.createElement(d.InputAdornment,{position:"start"},s.createElement(H.SearchIcon,{fontSize:"tiny"}))}})))};var fe=window.elementorV2.editorCurrentUser;const be=()=>{const[e,t]=(0,fe.useSuppressedMessage)("global-class-manager"),[n,a]=(0,s.useState)(!e);return s.createElement(c.IntroductionModal,{open:n,title:(0,m.__)("Class Manager","elementor"),handleClose:e=>{e||t(),a(!1)}},s.createElement(d.Image,{sx:{width:"100%",aspectRatio:"16 / 9"},src:"https://assets.elementor.com/packages/v1/images/class-manager-intro.svg",alt:""}),s.createElement(Ee,null))},Ee=()=>s.createElement(d.Box,{p:3},s.createElement(d.Typography,{variant:"body2"},(0,m.__)("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.","elementor")),s.createElement("br",null),s.createElement(d.Typography,{variant:"body2"},(0,m.__)("Remember, when editing an item within a specific class, any changes you make will apply across all elements in that class.","elementor")));let ve=!1;function _e(){return _e=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},_e.apply(null,arguments)}const xe=({sx:e,...t})=>s.createElement(H.ColorSwatchIcon,_e({sx:{transform:"rotate(90deg)",...e}},t)),we=()=>(0,o.__useSelector)(O),Se={total:0,content:[]},Ce=e=>{const{data:t,...n}=Z();return{...n,data:t?.[e]??Se}},De={"wp-post":{label:(0,m.__)("Post","elementor"),icon:s.createElement(H.PostTypeIcon,{fontSize:"inherit"})},"wp-page":{label:(0,m.__)("Page","elementor"),icon:s.createElement(H.PagesIcon,{fontSize:"inherit"})},popup:{label:(0,m.__)("Popup","elementor"),icon:s.createElement(H.PopupTemplateIcon,{fontSize:"inherit"})},header:{label:(0,m.__)("Header","elementor"),icon:s.createElement(H.HeaderTemplateIcon,{fontSize:"inherit"})},footer:{label:(0,m.__)("Footer","elementor"),icon:s.createElement(H.FooterTemplateIcon,{fontSize:"inherit"})}},Ie=({cssClassID:e,onClose:t})=>{const{data:n}=Ce(e),a=(0,i.__useOpenDocumentInNewTab)(),l=n?.content.map(({title:e,elements:t,pageId:n,type:a})=>({type:"item",value:n,label:e,secondaryText:t.length.toString(),docType:a}))??[];return s.createElement(s.Fragment,null,s.createElement(c.PopoverHeader,{icon:s.createElement(H.CurrentLocationIcon,{fontSize:"tiny"}),title:s.createElement(d.Stack,{flexDirection:"row",gap:1,alignItems:"center"},s.createElement(d.Box,{"aria-label":"header-title"},(0,m.__)("Locator","elementor")),s.createElement(d.Box,null,s.createElement(d.Chip,{sx:{lineHeight:1},size:"tiny",label:n.total}))),onClose:t}),s.createElement(d.Divider,null),s.createElement(c.PopoverBody,{width:300},s.createElement(c.PopoverMenuList,{onSelect:e=>a(+e),items:l,onClose:()=>{},menuListTemplate:Te,menuItemContentTemplate:e=>s.createElement(d.Stack,{flexDirection:"row",flex:1,alignItems:"center"},s.createElement(d.Box,{display:"flex",sx:{pr:1}},s.createElement(d.Tooltip,{disableInteractive:!0,title:De?.[e.docType]?.label??e.docType,placement:"top"},s.createElement(d.Icon,{fontSize:"small"},De?.[e.docType]?.icon||s.createElement(H.PagesIcon,{fontSize:"inherit"})))),s.createElement(d.Box,{sx:{pr:.5,maxWidth:"173px"},display:"flex"},s.createElement(c.EllipsisWithTooltip,{title:e.label,as:d.Typography,variant:"caption",maxWidth:"173px",sx:{lineHeight:1}})),s.createElement(H.ExternalLinkIcon,{className:"hover-only-icon",fontSize:"tiny"}),s.createElement(d.Chip,{sx:{ml:"auto"},size:"tiny",label:e.secondaryText}))})))},Te=(0,d.styled)(d.MenuList)(({theme:e})=>({"& > li":{display:"flex",cursor:"pointer",height:32,width:"100%"},'& > [role="option"]':{...e.typography.caption,lineHeight:"inherit",padding:e.spacing(.5,1,.5,2),textOverflow:"ellipsis",position:"absolute",top:0,left:0,opacity:1,".hover-only-icon":{color:e.palette.text.disabled,opacity:0},"&:hover":{borderRadius:e.spacing(.5),backgroundColor:e.palette.action.hover,".hover-only-icon":{color:e.palette.text.disabled,opacity:1}}},width:"100%",position:"relative"}));function Pe(){return Pe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Pe.apply(null,arguments)}const ke=({id:e,onClick:t})=>{const{data:{total:n},isLoading:a}=Ce(e),l=(0,d.usePopupState)({variant:"popover",popupId:"css-class-usage-popover"});if(a)return null;const r=0!==n?ze:Me;return s.createElement(s.Fragment,null,s.createElement(d.Box,{position:"relative"},s.createElement(r,{total:n},s.createElement(Oe,Pe({disabled:0===n,size:"tiny"},(0,d.bindTrigger)(l),{onClick:a=>{0!==n&&((0,d.bindTrigger)(l).onClick(a),t(e))}}),s.createElement(H.CurrentLocationIcon,{fontSize:"tiny"})))),s.createElement(d.Box,null,s.createElement(d.Popover,Pe({anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:15,horizontal:-50}},(0,d.bindPopover)(l),{onClose:()=>{(0,d.bindPopover)(l).onClose(),t("")}}),s.createElement(Ie,{onClose:l.close,"aria-label":"css-class-usage-popover",cssClassID:e}))))},Oe=(0,d.styled)(d.IconButton)(({theme:e})=>({"&.Mui-disabled":{pointerEvents:"auto","&:hover":{color:e.palette.action.disabled}},height:"22px",width:"22px"})),ze=({children:e,total:t})=>s.createElement(d.Tooltip,{disableInteractive:!0,placement:"top",title:`${(0,m.__)("Show {{number}} {{locations}}","elementor").replace("{{number}}",t.toString()).replace("{{locations}}",1===t?(0,m.__)("location","elementor"):(0,m.__)("locations","elementor"))}`},s.createElement("span",null,e)),Me=({children:e})=>s.createElement(d.Infotip,{disableInteractive:!0,placement:"top",color:"secondary",content:s.createElement(c.InfoAlert,{sx:{mt:1}},(0,m.__)("This class isn’t being used yet.","elementor"))},s.createElement("span",null,e)),Be=(0,s.createContext)(null),je=({children:e})=>{const[t,n]=(0,s.useState)(null);return s.createElement(Be.Provider,{value:{openDialog:e=>{n(e)},closeDialog:()=>{n(null)},dialogProps:t}},e,!!t&&s.createElement(Le,t))},Ae="delete-class-dialog",Le=({label:e,id:t})=>{const{closeDialog:n}=We(),{data:{total:a,content:l}}=Ce(t),r=a&&l.length?(0,m.__)("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.","elementor").replace("%1",a.toString()).replace("%2",l.length.toString()):(0,m.__)("Will permanently remove it from your project and may affect the design across all elements using it. This action cannot be undone.","elementor");return s.createElement(d.Dialog,{open:!0,onClose:n,"aria-labelledby":Ae,maxWidth:"xs"},s.createElement(d.DialogTitle,{id:Ae,display:"flex",alignItems:"center",gap:1,sx:{lineHeight:1}},s.createElement(H.AlertOctagonFilledIcon,{color:"error"}),(0,m.__)("Delete this class?","elementor")),s.createElement(d.DialogContent,null,s.createElement(d.DialogContentText,{variant:"body2",color:"textPrimary"},(0,m.__)("Deleting","elementor"),s.createElement(d.Typography,{variant:"subtitle2",component:"span"}," ",e," "),r)),s.createElement(d.DialogActions,null,s.createElement(d.Button,{color:"secondary",onClick:n},(0,m.__)("Not now","elementor")),s.createElement(d.Button,{autoFocus:!0,variant:"contained",color:"error",onClick:()=>{(e=>{(0,o.__dispatch)(w.actions.delete(e)),ve=!0})(t),n()}},(0,m.__)("Delete","elementor"))))},We=()=>{const e=(0,s.useContext)(Be);if(!e)throw new Error("useDeleteConfirmation must be used within a DeleteConfirmationProvider");return e};function Ve(){return Ve=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Ve.apply(null,arguments)}const Fe=e=>s.createElement(d.UnstableSortableProvider,Ve({restrictAxis:!0,variant:"static",dragPlaceholderStyle:{opacity:"1"}},e)),$e=e=>s.createElement(Ge,Ve({},e,{role:"button",className:"class-item-sortable-trigger","aria-label":"sort"}),s.createElement(H.GripVerticalIcon,{fontSize:"tiny"})),Ue=({children:e,id:t,...n})=>s.createElement(d.UnstableSortableItem,Ve({},n,{id:t,render:({itemProps:t,isDragged:n,triggerProps:a,itemStyle:l,triggerStyle:r,dropIndicationStyle:o,showDropIndication:i,isDragOverlay:c,isDragPlaceholder:m})=>s.createElement(d.Box,Ve({},t,{style:l,component:"li",role:"listitem",sx:{backgroundColor:c?"background.paper":void 0}}),e({itemProps:t,isDragged:n,triggerProps:a,itemStyle:l,triggerStyle:r,isDragPlaceholder:m}),i&&s.createElement(Re,{style:o}))})),Ge=(0,d.styled)("div")(({theme:e})=>({position:"absolute",left:0,top:"50%",transform:`translate( -${e.spacing(1.5)}, -50% )`,color:e.palette.action.active})),Re=(0,d.styled)(d.Box)`
width: 100%;
height: 1px;
background-color: ${({theme:e})=>e.palette.text.primary};
`;function qe(){return qe=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},qe.apply(null,arguments)}const He=({id:e,label:t,renameClass:n,selected:a,disabled:l,sortableTriggerProps:r,showSortIndicator:o})=>{const i=(0,s.useRef)(null),{ref:u,openEditMode:p,isEditing:h,error:g,getProps:y}=(0,c.useEditable)({value:t,onSubmit:n,validation:Qe}),[f,b]=(0,s.useState)(""),{openDialog:E}=We(),v=(0,d.usePopupState)({variant:"popover",disableAutoFocus:!0}),_=(f===e||a||v.isOpen)&&!l;return s.createElement(s.Fragment,null,s.createElement(d.Stack,{p:0},s.createElement(c.WarningInfotip,{open:Boolean(g),text:g??"",placement:"bottom",width:i.current?.getBoundingClientRect().width,offset:[0,-15]},s.createElement(Ne,{ref:i,dense:!0,disableGutters:!0,showSortIndicator:o,showActions:_||h,shape:"rounded",onDoubleClick:p,selected:_,disabled:l,focusVisibleClassName:"visible-class-item"},s.createElement($e,r),s.createElement(Ye,{isActive:h,isError:!!g},h?s.createElement(c.EditableField,qe({ref:u,as:d.Typography,variant:"caption"},y())):s.createElement(c.EllipsisWithTooltip,{title:t,as:d.Typography,variant:"caption"})),s.createElement(d.Box,{className:"class-item-locator"},s.createElement(ke,{id:e,onClick:b})),s.createElement(d.Tooltip,{placement:"top",className:"class-item-more-actions",title:(0,m.__)("More actions","elementor")},s.createElement(d.IconButton,qe({size:"tiny"},(0,d.bindTrigger)(v),{"aria-label":"More actions"}),s.createElement(H.DotsVerticalIcon,{fontSize:"tiny"})))))),s.createElement(d.Menu,qe({},(0,d.bindMenu)(v),{anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"}}),s.createElement(c.MenuListItem,{sx:{minWidth:"160px"},onClick:()=>{v.close(),p()}},s.createElement(d.Typography,{variant:"caption",sx:{color:"text.primary"}},(0,m.__)("Rename","elementor"))),s.createElement(c.MenuListItem,{onClick:()=>{v.close(),E({id:e,label:t})}},s.createElement(d.Typography,{variant:"caption",sx:{color:"error.light"}},(0,m.__)("Delete","elementor")))))},Ne=(0,d.styled)(d.ListItemButton,{shouldForwardProp:e=>!["showActions","showSortIndicator"].includes(e)})(({showActions:e,showSortIndicator:t})=>`\n min-height: 36px;\n\n &.visible-class-item {\n box-shadow: none !important;\n }\n\n .class-item-locator {\n visibility: hidden;\n }\n\n .class-item-sortable-trigger {\n visibility: ${t&&e?"visible":"hidden"};\n }\n\n &:hover:not(:disabled) {\n .class-item-locator {\n visibility: visible;\n }\n\n .class-item-sortable-trigger {\n visibility: ${t?"visible":"hidden"};\n }\n }\n `),Ye=(0,d.styled)(d.Box,{shouldForwardProp:e=>!["isActive","isError"].includes(e)})(({theme:e,isActive:t,isError:n})=>({display:"flex",width:"100%",flexGrow:1,borderRadius:e.spacing(.5),border:Ke({isActive:t,isError:n,theme:e}),padding:`0 ${e.spacing(1)}`,marginLeft:t?e.spacing(1):0,minWidth:0})),Ke=({isActive:e,isError:t,theme:n})=>t?`2px solid ${n.palette.error.main}`:e?`2px solid ${n.palette.secondary.main}`:"none",Qe=e=>{const t=(0,r.validateStyleLabel)(e,"rename");return t.isValid?null:t.errorMessage};function Je(){return Je=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},Je.apply(null,arguments)}const Xe={filterAndSearch:{mainText:(0,m.__)("Sorry, nothing matched.","elementor"),sceneryText:(0,m.__)("Try something else.","elementor"),icon:s.createElement(H.PhotoIcon,{color:"inherit",fontSize:"large"})},search:{mainText:(0,m.__)("Sorry, nothing matched","elementor"),sceneryText:(0,m.__)("Clear your input and try something else.","elementor"),icon:s.createElement(H.PhotoIcon,{color:"inherit",fontSize:"large"})},filter:{mainText:(0,m.__)("Sorry, nothing matched that search.","elementor"),sceneryText:(0,m.__)("Clear the filters and try something else.","elementor"),icon:s.createElement(H.ColorSwatchIcon,{color:"inherit",fontSize:"large"})}},Ze=({notFoundType:e})=>{const{search:{onClearSearch:t,inputValue:n},filters:{onClearFilter:a}}=X();switch(e){case"filter":return s.createElement(et,Je({},Xe.filter,{onClear:a}));case"search":return s.createElement(et,Je({},Xe.search,{searchValue:n,onClear:t}));case"filterAndSearch":return s.createElement(et,Je({},Xe.filterAndSearch,{onClear:()=>{a(),t()}}))}},et=({onClear:e,searchValue:t,mainText:n,sceneryText:a,icon:l})=>s.createElement(d.Stack,{color:"text.secondary",pt:5,alignItems:"center",gap:1,overflow:"hidden",justifySelf:"center"},l,s.createElement(d.Box,{sx:{width:"100%"}},s.createElement(d.Typography,{align:"center",variant:"subtitle2",color:"inherit"},n),t&&s.createElement(d.Typography,{variant:"subtitle2",color:"inherit",sx:{display:"flex",width:"100%",justifyContent:"center"}},s.createElement("span",null,"“"),s.createElement("span",{style:{maxWidth:"80%",overflow:"hidden",textOverflow:"ellipsis"}},t),s.createElement("span",null,"”."))),s.createElement(d.Typography,{align:"center",variant:"caption",color:"inherit"},a),s.createElement(d.Typography,{align:"center",variant:"caption",color:"inherit"},s.createElement(d.Link,{color:"secondary",variant:"caption",component:"button",onClick:e},(0,m.__)("Clear & try again","elementor")))),tt=({disabled:e})=>{const{search:{debouncedValue:t}}=X(),n=we(),a=(0,o.__useDispatch)(),l=ne(),[r,i]=lt(),c=rt();if((0,s.useEffect)(()=>{const e=e=>{if("z"===e.key&&(e.ctrlKey||e.metaKey)){if(e.stopImmediatePropagation(),e.preventDefault(),e.shiftKey)return void a(w.actions.redo());a(w.actions.undo())}};return window.addEventListener("keydown",e,{capture:!0}),()=>window.removeEventListener("keydown",e)},[a]),!n?.length)return s.createElement(nt,null);const m=((e,t,n)=>{const a=n.length<=0&&e.length>1,l=t&&0===t.length;return a&&l?"filterAndSearch":a?"search":l?"filter":void 0})(t,l,c);if(m)return s.createElement(Ze,{notFoundType:m});const u=l?.length||t,p=c.length>1&&!u;return s.createElement(je,null,s.createElement(d.List,{sx:{display:"flex",flexDirection:"column",gap:.5}},s.createElement(Fe,{value:r,onChange:i,disableDragOverlay:!p},c?.map(({id:t,label:n})=>s.createElement(Ue,{key:t,id:t},({isDragged:l,isDragPlaceholder:r,triggerProps:o,triggerStyle:i})=>s.createElement(He,{id:t,label:n,renameClass:e=>{a(w.actions.update({style:{id:t,label:e}}))},selected:l,disabled:e||r,sortableTriggerProps:{...o,style:i},showSortIndicator:p}))))))},nt=()=>s.createElement(d.Stack,{alignItems:"center",gap:1.5,pt:10,px:.5,maxWidth:"260px",margin:"auto"},s.createElement(xe,{fontSize:"large"}),s.createElement(at,{variant:"subtitle2",component:"h2",color:"text.secondary"},(0,m.__)("There are no global classes yet.","elementor")),s.createElement(d.Typography,{align:"center",variant:"caption",color:"text.secondary"},(0,m.__)("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.","elementor"))),at=(0,d.styled)(d.Typography)(({theme:e,variant:t})=>({"&.MuiTypography-root":{...e.typography[t]}})),lt=()=>{const e=(0,o.__useDispatch)();return[N(),t=>{e(w.actions.setOrder(t))}]},rt=()=>{const e=we(),{search:{debouncedValue:t}}=X(),n=ne(),a=(0,s.useMemo)(()=>e.map(e=>({...e,lowerLabel:e.label.toLowerCase()})),[e]),l=(0,s.useMemo)(()=>t.length>1?a.filter(e=>e.lowerLabel.includes(t.toLowerCase())):e,[t,e,a]);return(0,s.useMemo)(()=>n&&n.length>0?l.filter(e=>n.includes(e.id)):l,[l,n])};function ot(){return ot=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},ot.apply(null,arguments)}const st="global-classes-manager",{panel:it,usePanelActions:ct}=(0,l.__createPanel)({id:st,component:function(){const e=Y(),{close:t}=ct(),{open:n,close:a,isOpen:r}=(0,c.useDialog)(),{mutateAsync:i,isPending:u}=pt();return ut(),s.createElement(c.ThemeProvider,null,s.createElement(d.ErrorBoundary,{fallback:s.createElement(mt,null)},s.createElement(l.Panel,null,s.createElement(J,null,s.createElement(l.PanelHeader,null,s.createElement(d.Stack,{p:1,pl:2,width:"100%",direction:"row",alignItems:"center"},s.createElement(d.Stack,{width:"100%",direction:"row",gap:1},s.createElement(l.PanelHeaderTitle,{sx:{display:"flex",alignItems:"center",gap:.5}},s.createElement(xe,{fontSize:"inherit"}),(0,m.__)("Class Manager","elementor")),s.createElement(ht,null)),s.createElement(dt,{sx:{marginLeft:"auto"},disabled:u,onClose:()=>{e?n():t()}}))),s.createElement(l.PanelBody,{sx:{display:"flex",flexDirection:"column",height:"100%"}},s.createElement(d.Box,{px:2,pb:1},s.createElement(d.Stack,{direction:"row",justifyContent:"spaceBetween",gap:.5,sx:{pb:.5}},s.createElement(d.Box,{sx:{flexGrow:1}},s.createElement(ye,null)),s.createElement(ge,null)),s.createElement(ue,null)),s.createElement(d.Divider,null),s.createElement(d.Box,{px:2,sx:{flexGrow:1,overflowY:"auto"}},s.createElement(tt,{disabled:u}))),s.createElement(l.PanelFooter,null,s.createElement(d.Button,{fullWidth:!0,size:"small",color:"global",variant:"contained",onClick:i,disabled:!e,loading:u},(0,m.__)("Save changes","elementor")))))),s.createElement(be,null),r&&s.createElement(c.SaveChangesDialog,null,s.createElement(d.DialogHeader,{onClose:a,logo:!1},s.createElement(c.SaveChangesDialog.Title,null,(0,m.__)("You have unsaved changes","elementor"))),s.createElement(c.SaveChangesDialog.Content,null,s.createElement(c.SaveChangesDialog.ContentText,null,(0,m.__)("You have unsaved changes in the Class Manager.","elementor")),s.createElement(c.SaveChangesDialog.ContentText,null,(0,m.__)("To avoid losing your updates, save your changes before leaving.","elementor"))),s.createElement(c.SaveChangesDialog.Actions,{actions:{discard:{label:(0,m.__)("Discard","elementor"),action:()=>{(0,o.__dispatch)(w.actions.resetToInitialState({context:"frontend"})),a()}},confirm:{label:(0,m.__)("Save & Continue","elementor"),action:async()=>{await i(),a(),t()}}}})))},allowedEditModes:["edit",st],onOpen:()=>{(0,p.changeEditMode)(st),function(){const e=window;e.$e?.components?.get?.("panel")?.blockUserInteractions?.()}()},onClose:()=>{(0,p.changeEditMode)("edit"),function(){const e=window;e.$e?.components?.get?.("panel")?.unblockUserInteractions?.()}()},isOpenPreviousElement:!0}),dt=({onClose:e,...t})=>s.createElement(d.IconButton,ot({size:"small",color:"secondary",onClick:e,"aria-label":"Close"},t),s.createElement(H.XIcon,{fontSize:"small"})),mt=()=>s.createElement(d.Box,{role:"alert",sx:{minHeight:"100%",p:2}},s.createElement(d.Alert,{severity:"error",sx:{mb:2,maxWidth:400,textAlign:"center"}},s.createElement("strong",null,(0,m.__)("Something went wrong","elementor")))),ut=()=>{const e=Y();(0,s.useEffect)(()=>{const t=t=>{e&&t.preventDefault()};return window.addEventListener("beforeunload",t),()=>{window.removeEventListener("beforeunload",t)}},[e])},pt=()=>(0,L.useMutation)({mutationFn:()=>re({context:"frontend"}),onSuccess:async()=>{(0,i.setDocumentModifiedStatus)(!1),ve&&await(async()=>{await(()=>{const e=(0,i.getCurrentDocument)();return(0,i.getV1DocumentsManager)().invalidateCache(),(0,p.__privateRunCommand)("editor/documents/switch",{id:e?.id,shouldScroll:!1,shouldNavigateToDefaultRoute:!1})})(),ve=!1})()}}),ht=()=>{const e=ne(),t=N();return s.createElement(d.Chip,{size:"small",label:e?`${e.length} / ${t?.length}`:t?.length})},gt=()=>{const e=(0,i.__useActiveDocument)(),{open:t}=ct(),{save:n}=(0,i.__useActiveDocumentActions)(),{open:a,close:l,isOpen:o}=(0,c.useDialog)(),{prefetchClassesUsage:u}=function(){const e=(0,L.useQueryClient)();return{prefetchClassesUsage:()=>e.prefetchQuery({queryKey:[q],queryFn:R})}}(),{userCan:p}=(0,r.useUserStylesCapability)();return p(j.getKey()).update?s.createElement(s.Fragment,null,s.createElement(d.Tooltip,{title:(0,m.__)("Class Manager","elementor"),placement:"top"},s.createElement(d.IconButton,{size:"tiny",onClick:()=>{e?.isDirty?a():(t(),u())},sx:{marginInlineEnd:-.75}},s.createElement(xe,{fontSize:"tiny"}))),o&&s.createElement(c.SaveChangesDialog,null,s.createElement(c.SaveChangesDialog.Title,null,(0,m.__)("You have unsaved changes","elementor")),s.createElement(c.SaveChangesDialog.Content,null,s.createElement(c.SaveChangesDialog.ContentText,{sx:{mb:2}},(0,m.__)("To open the Class Manager, save your page first. You can't continue without saving.","elementor"))),s.createElement(c.SaveChangesDialog.Actions,{actions:{cancel:{label:(0,m.__)("Stay here","elementor"),action:l},confirm:{label:(0,m.__)("Save & Continue","elementor"),action:async()=>{await n(),l(),t(),u()}}}}))):null},yt=e=>{const t=e.styleDef;return s.createElement(s.Fragment,null,s.createElement(c.MenuListItem,{disabled:!e.canConvert,onClick:()=>{const n=function(e){let t=1,n=`${e}${t}`;for(;!(0,r.validateStyleLabel)(n,"create").isValid;)n=`${e}${++t}`;return n}("converted-class-");if(!t)throw new Error("Style definition is required for converting local class to global class.");const a=j.actions.create?.(n,t.variants);a&&e.successCallback(a)},dense:!0,sx:{"&.Mui-focusVisible":{border:"none",boxShadow:"none !important",backgroundColor:"transparent"}}},(0,m.__)("Convert to global class","elementor")),s.createElement(d.Divider,null))};function ft(){const e=(0,o.__useDispatch)();return(0,s.useEffect)(()=>{Promise.all([U.all("preview"),U.all("frontend")]).then(([t,n])=>{const{data:a}=t,{data:l}=n;e(w.actions.load({preview:{items:a.data,order:a.meta.order},frontend:{items:l.data,order:l.meta.order}}))})},[e]),null}var bt=window.elementorV2.editorMcp,Et=window.elementorV2.schema;const vt=()=>{const e=(0,bt.getMCPByDomain)("element_classes");var t;e.setMCPDescription("Tools for managing and applying Global CSS classes to elements within the Elementor editor."),(t=e).addTool({name:"list-all-global-classes",description:"List all classes applied to a specific element\n\n## When to use this tool:\n- When a user requests to see which classes or global classes exists.\n- When you need the list of global classes to allow the user to select from.\n\n## Prerequisites:\n- Ensure you have the correct element ID for which you want to list the applied classes.\n",outputSchema:{appliedClasses:Et.z.array(Et.z.object({id:Et.z.string().describe("The ID of the class"),label:Et.z.string().describe("The label of the class")}))},handler:async()=>{const e=r.stylesRepository.getProviderByKey("global-classes");if(!e)throw new Error("Global classes provider not found");const t=[];return e.actions.all().forEach(e=>{const{id:n,label:a}=e;t.push({id:n,label:a})}),{appliedClasses:t}}}),t.addTool({schema:{classId:Et.z.string().describe("The ID of the class to apply"),elementId:Et.z.string().describe("The ID of the element to which the class will be applied")},name:"apply-global-class",description:'Apply a global class to the current element\n\n## When to use this tool:\n- When a user requests to apply a global class or a class to an element in the Elementor editor.\n- When you need to add a specific class to an element\'s applied classes.\n\n## Prerequisites:\n- 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.\n- Make sure you have the correct class ID that you want to apply.',handler:async e=>{const{classId:t,elementId:n}=e,l=(0,a.doGetAppliedClasses)(n);return(0,a.doApplyClasses)(n,[...l,t]),`Class ${t} applied to element ${n} successfully.`}}),t.addTool({name:"unapply-global-class",schema:{classId:Et.z.string().describe("The ID of the class to unapply"),elementId:Et.z.string().describe("The ID of the element from which the class will be unapplied")},description:'Unapply a (global) class from the current element\n\n## When to use this tool:\n- When a user requests to unapply a global class or a class from an element in the Elementor editor.\n- When you need to remove a specific class from an element\'s applied classes.\n\n## Prerequisites:\n- 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.\n- Make sure you have the correct class ID that you want to unapply.\n\n<note>\nIf 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.\n</note>\n',handler:async e=>{const{classId:t,elementId:n}=e;if(!(0,a.doUnapplyClass)(n,t))throw new Error(`Class ${t} is not applied to element ${n}, cannot unapply it.`);return`Class ${t} unapplied from element ${n} successfully.`}}),function(e){const{addTool:t}=e;t({name:"get-global-class-usages",description:'Retreive the usage details of global classes within the Elementor editor, accross all pages.\n\n## Prequisites:\n- Use "list-global-classes" tool to be able to match class IDs to class names/labels.\n\n## When to use this tool:\n- When a user requests to see where a specific global class is being used accross the site.\n- When you need to manage or clean up unused global classes.\n- Before deleting a global class, to ensure it is not in use in any other pages.\n',outputSchema:{usages:Et.z.array(Et.z.object({classId:Et.z.string().describe('The ID of the class, not visible to the user. To retreive the name of the class, use the "list-global-classes" tool'),usages:Et.z.array(Et.z.object({pageId:Et.z.string().describe("The ID of the page where the class is used"),title:Et.z.string().describe("The title of the page where the class is used"),total:Et.z.number().describe("The number of times the class is used on this page"),elements:Et.z.array(Et.z.string()).describe("List of element IDs using this class on the page")}))}))},handler:async()=>{const e=await R(),t={usages:[]};return Object.entries(e).forEach(([e,n])=>{const a={classId:e,usages:[]};if("number"!=typeof n){const{content:e}=n;e.forEach(e=>{a.usages.push({pageId:String(e.pageId),title:e.title,total:e.total,elements:e.elements})}),t.usages.push(a)}}),t}})}(e)};function _t(){const e=ct();return(0,s.useEffect)(()=>{(0,p.__privateListenTo)((0,p.v1ReadyEvent)(),()=>{!function(e){const t=(0,o.__subscribeWithSelector)(k,()=>{k((0,o.__getState)())&&(0,i.setDocumentModifiedStatus)(!0)});(function(e){(0,p.registerDataHook)("after","document/save/save",t=>{const n=(0,fe.getCurrentUser)(),a=n?.capabilities.includes(h);a&&re({context:"publish"===t.status?"frontend":"preview",onApprove:e?.open})})})(e)}(e)})},[]),null}function xt(){(0,o.__registerSlice)(w),(0,l.__registerPanel)(it),r.stylesRepository.register(j),(0,n.injectIntoLogic)({id:"global-classes-populate-store",component:ft}),(0,n.injectIntoLogic)({id:"global-classes-sync-with-document",component:_t}),(0,a.injectIntoCssClassConvert)({id:"global-classes-convert-from-local-class",component:yt}),(0,a.injectIntoClassSelectorActions)({id:"global-classes-manager-button",component:gt}),(0,a.registerStyleProviderToColors)(B,{name:"global",getThemeColor:e=>e.palette.global.dark}),vt()}(window.elementorV2=window.elementorV2||{}).editorGlobalClasses=t}(),window.elementorV2.editorGlobalClasses?.init?.();