/*! For license information please see editor-styles-repository.js.LICENSE.txt */
!function(){"use strict";var e={react:function(e){e.exports=window.React},"@elementor/editor-elements":function(e){e.exports=window.elementorV2.editorElements},"@elementor/editor-v1-adapters":function(e){e.exports=window.elementorV2.editorV1Adapters},"@elementor/utils":function(e){e.exports=window.elementorV2.utils}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};!function(){r.r(n),r.d(n,{ELEMENTS_STYLES_PROVIDER_KEY:function(){return d},stylesRepository:function(){return s},useCreateActionsByProvider:function(){return u},useProviders:function(){return l}});var e=r("react"),t=r("@elementor/editor-elements"),o=r("@elementor/editor-v1-adapters"),i=r("@elementor/utils"),s=(()=>{const e=[],t=()=>e.slice(0).sort(((e,t)=>e.priority>t.priority?-1:1));return{all:(e={})=>t().flatMap((t=>t.actions.get(e))),register:t=>{e.push(t)},subscribe:t=>{const r=e.map((e=>e.subscribe(t)));return()=>{r.forEach((e=>e()))}},getProviders:t,getProviderByKey:t=>e.find((e=>e.key===t))}})();function l(){const[,t]=(0,e.useReducer)((e=>!e),!1);return(0,e.useEffect)((()=>s.subscribe(t)),[]),s.getProviders()}function u(){return(0,e.useMemo)((()=>s.getProviders().map((e=>e.actions.create?[e,e.actions.create]:null)).filter((e=>!!e))),[])}var a=(0,i.createError)({code:"invalid_elements_style_provider_meta",message:"Invalid elements style provider meta."}),d="elements",c={key:d,priority:50,actions:{get:(e={})=>{let r=(0,t.getElements)();return m(e)&&(r=r.filter((t=>t.id===e.elementId))),r.flatMap((e=>Object.values(e.model.get("styles")??{})))},getById:(e,r={})=>{if(!m(r))throw new a({context:{meta:r}});return((0,t.getElementStyles)(r.elementId)??{})[e]??null},updateProps:(e,r={})=>{if(!m(r))throw new a({context:{meta:r}});(0,t.updateElementStyle)({elementId:r.elementId,styleId:e.id,meta:e.meta,props:e.props})}},subscribe:e=>(0,o.__privateListenTo)(t.styleRerenderEvents,e)};function m(e){return"elementId"in e&&"string"==typeof e.elementId&&!!e.elementId}var p={key:"element-base-styles",priority:10,actions:{get:()=>{const e=(0,t.getWidgetsCache)();return Object.values(e??{}).flatMap((e=>e.base_styles??[]))}},subscribe:()=>()=>{}};s.register(c),s.register(p)}(),(window.elementorV2=window.elementorV2||{}).editorStylesRepository=n}();