File "editor-styles-repository.min.js"
Full Path: /home/diablzlo/glucosebalnce.com/wp-content/plugins/elementor/assets/js/packages/editor-styles-repository/editor-styles-repository.min.js
File size: 4.99 KB
MIME-type: text/plain
Charset: utf-8
!function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},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,{ELEMENTS_BASE_STYLES_PROVIDER_KEY:function(){return V},ELEMENTS_STYLES_PROVIDER_KEY_PREFIX:function(){return w},ELEMENTS_STYLES_RESERVED_LABEL:function(){return E},createStylesProvider:function(){return b},init:function(){return x},isElementsStylesProvider:function(){return R},stylesRepository:function(){return r},useGetStylesRepositoryCreateAction:function(){return l},useProviders:function(){return s},useUserStylesCapability:function(){return a},validateStyleLabel:function(){return C}});const r=(()=>{const e=[],t=()=>e.slice(0).sort((e,t)=>e.priority>t.priority?-1:1);return{all:(e={})=>t().flatMap(t=>t.actions.all(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.getKey()===t)}})();var n=window.React;function s(){const[,e]=(0,n.useReducer)(e=>!e,!1);return(0,n.useEffect)(()=>r.subscribe(e),[]),r.getProviders()}var o=window.elementorV2.editorCurrentUser;const i={create:!0,delete:!0,update:!0,updateProps:!0},a=()=>{const{capabilities:e}=(0,o.useCurrentUserCapabilities)();return{userCan:t=>{const n=r.getProviderByKey(t);return n?.capabilities?Object.entries(n.capabilities).reduce((t,[r,n])=>({...t,[r]:e?.includes(n)??!0}),i):i}}};function l(){const{userCan:e}=a();return(0,n.useMemo)(()=>{const t=r.getProviders().map(t=>t.actions.create&&e(t.getKey()).create?[t,t.actions.create]:null).filter(Boolean);if(1===t.length)return t[0];if(0===t.length)return null;throw new Error("Multiple providers with create action found in styles repository.")},[])}var u=window.elementorV2.schema,c=window.wp.i18n,d=window.elementorV2.editorElements,m=window.elementorV2.editorV1Adapters,p=window.elementorV2.utils;const y=(0,p.createError)({code:"invalid_elements_style_provider_meta",message:"Invalid elements style provider meta."}),f=(0,p.createError)({code:"active_document_must_exist",message:"Active document must exist."}),g=1e4,_=10;function b({key:e,priority:t=_,limit:r=g,subscribe:n=()=>()=>{},labels:s,actions:o,capabilities:i}){return{getKey:"string"==typeof e?()=>e:e,priority:t,limit:r,capabilities:i,subscribe:n,labels:{singular:s?.singular??null,plural:s?.plural??null},actions:{all:o.all,get:o.get,resolveCssName:o.resolveCssName??(e=>e),create:o.create,delete:o.delete,update:o.update,updateProps:o.updateProps}}}const w="document-elements-",E="local",v=b({key:()=>{const e=(0,d.getCurrentDocumentId)();if(!e)throw new f;return`${w}${e}`},priority:50,subscribe:e=>(0,m.__privateListenTo)(d.styleRerenderEvents,()=>e()),actions:{all:(e={})=>{let t=(0,d.getElements)();return h(e)&&(t=t.filter(t=>t.id===e.elementId)),t.flatMap(e=>Object.values(e.model.get("styles")??{}))},get:(e,t={})=>{if(!h(t))throw new y({context:{meta:t}});return((0,d.getElementStyles)(t.elementId)??{})[e]??null},updateProps:(e,t={})=>{if(!h(t))throw new y({context:{meta:t}});(0,d.updateElementStyle)({elementId:t.elementId,styleId:e.id,meta:e.meta,props:e.props})}}});function h(e){return"elementId"in e&&"string"==typeof e.elementId&&!!e.elementId}const S=["container"],P=u.z.string().max(50,(0,c.__)("Class name is too long. Please keep it under 50 characters.","elementor")).regex(/^(|[^0-9].*)$/,(0,c.__)("Class names must start with a letter.","elementor")).regex(/^\S*$/,(0,c.__)("Class names can’t contain spaces.","elementor")).regex(/^(|[a-zA-Z0-9_-]+)$/,(0,c.__)("Class names can only use letters, numbers, dashes (-), and underscores (_).","elementor")).regex(/^(?!--).*/,(0,c.__)("Double hyphens are reserved for custom properties.","elementor")).regex(/^(?!-[0-9])/,(0,c.__)("Class names can’t start with a hyphen followed by a number.","elementor")).refine(e=>!S.includes(e),{message:(0,c.__)("This name is reserved and can’t be used. Try something more specific.","elementor")});function C(e,t){const n=new Set([E,...r.all().map(e=>e.label.toLowerCase())]),s=["create","rename"].includes(t),o=P.refine(e=>!(s&&e.length<2),{message:(0,c.__)("Class name is too short. Use at least 2 characters.","elementor")}).refine(e=>!(s&&n.has(e)),{message:(0,c.__)("This class name already exists. Please choose a unique name.","elementor")}).safeParse(e.toLowerCase());return o.success?{isValid:!0,errorMessage:null}:{isValid:!1,errorMessage:o.error.format()._errors[0]}}function R(e){return new RegExp(`^${w}\\d+$`).test(e)}const V="element-base-styles",I=b({key:V,actions:{all(){const e=(0,d.getWidgetsCache)();return Object.values(e??{}).flatMap(e=>Object.values(e.base_styles??{}))},get(e){return this.all().find(t=>t.id===e)??null}}});function x(){r.register(v),r.register(I)}(window.elementorV2=window.elementorV2||{}).editorStylesRepository=t}(),window.elementorV2.editorStylesRepository?.init?.();