File "editor-elements.min.js"

Full Path: /home/fresvfqn/waterdamagerestorationandrepairsmithtown.com/wp-content/plugins/elementor/assets/js/packages/editor-elements/editor-elements.min.js
File size: 11.76 KB
MIME-type: text/plain
Charset: utf-8

!function(){"use strict";var e={d:function(t,n){for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},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,{ELEMENT_STYLE_CHANGE_EVENT:function(){return x},createElement:function(){return E},createElementStyle:function(){return J},createElements:function(){return v},deleteElement:function(){return y},deleteElementStyle:function(){return M},duplicateElement:function(){return w},duplicateElements:function(){return I},generateElementId:function(){return j},getAnchoredAncestorId:function(){return G},getAnchoredDescendantId:function(){return B},getContainer:function(){return o},getCurrentDocumentId:function(){return P},getElementLabel:function(){return R},getElementSetting:function(){return s},getElementSettings:function(){return i},getElementStyles:function(){return h},getElements:function(){return H},getLinkInLinkRestriction:function(){return q},getSelectedElements:function(){return m},getWidgetsCache:function(){return c},isElementAnchored:function(){return W},removeElements:function(){return _},replaceElement:function(){return L},selectElement:function(){return r},shouldCreateNewLocalStyle:function(){return k},styleRerenderEvents:function(){return V},updateElementSettings:function(){return N},updateElementStyle:function(){return D},useElementChildren:function(){return f},useElementSetting:function(){return l},useElementSettings:function(){return d},useElementType:function(){return u},useParentElement:function(){return p},useSelectedElement:function(){return a}});var n=window.elementorV2.editorV1Adapters;function o(e){const t=window,n=t.elementor?.getContainer?.(e);return n??null}const r=e=>{try{const t=o(e);(0,n.__privateRunCommand)("document/elements/select",{container:t})}catch{}},s=(e,t)=>{const n=o(e);return n?.settings?.get(t)??null},i=(e,t)=>Object.fromEntries(t.map(t=>[t,s(e,t)])),l=(e,t)=>(0,n.__privateUseListenTo)((0,n.commandEndEvent)("document/elements/set-settings"),()=>s(e,t),[e,t]),d=(e,t)=>(0,n.__privateUseListenTo)((0,n.commandEndEvent)("document/elements/set-settings"),()=>t.reduce((t,n)=>{const o=s(e,n);return null!==o&&(t[n]=o),t},{}),[e,...t]);function c(){const e=window;return e?.elementor?.widgetsCache||null}function u(e){return(0,n.__privateUseListenTo)((0,n.commandEndEvent)("editor/documents/load"),()=>{if(!e)return null;const t=c(),n=t?.[e];return n?.atomic_controls&&n?.atomic_props_schema?{key:e,controls:n.atomic_controls,propsSchema:n.atomic_props_schema,dependenciesPerTargetMapping:n.dependencies_per_target_mapping??{},title:n.title}:null},[e])}function m(){const e=window;return(e.elementor?.selection?.getElements?.()??[]).reduce((e,t)=>{const n=t.model.get("widgetType")||t.model.get("elType");return n&&e.push({id:t.model.get("id"),type:n}),e},[])}function a(){const e=(0,n.__privateUseListenTo)([(0,n.commandEndEvent)("document/elements/select"),(0,n.commandEndEvent)("document/elements/deselect"),(0,n.commandEndEvent)("document/elements/select-all"),(0,n.commandEndEvent)("document/elements/deselect-all")],m),[t]=e,o=u(t?.type);return 1===e.length&&o?{element:t,elementType:o}:{element:null,elementType:null}}function p(e){return(0,n.__privateUseListenTo)([(0,n.commandEndEvent)("document/elements/create")],()=>{if(!e)return null;const t=window,n=t?.elementor?.getContainer?.(e);return n?n.parent:null},[e])}function f(e,t){return(0,n.__privateUseListenTo)([(0,n.v1ReadyEvent)(),(0,n.commandEndEvent)("document/elements/create"),(0,n.commandEndEvent)("document/elements/delete"),(0,n.commandEndEvent)("document/elements/update"),(0,n.commandEndEvent)("document/elements/set-settings")],()=>{const n=o(e),r=t.reduce((e,t)=>(e[t]=[],e),{});return n?.children?.forEachRecursive?.(({model:e,id:t})=>{const n=e.get("elType");n&&n in r&&r[n].push({id:t})}),r},[e])}function E({containerId:e,model:t,options:r}){const s=o(e);if(!s)throw new Error(`Container with ID "${e}" not found`);return(0,n.__privateRunCommandSync)("document/elements/create",{container:s,model:t,options:{edit:!1,...r}})}function w({elementId:e,options:t={}}){const n=o(e);if(!n)throw new Error(`Element with ID "${e}" not found`);if(!n.parent)throw new Error(`Element with ID "${e}" has no parent container`);const r=n.parent,s=n.model.toJSON(),i=n.view?._index??0,l=!1!==t.clone?i+1:void 0;return E({containerId:r.id,model:s,options:{at:l,...t}})}var g=window.wp.i18n;function y({elementId:e,options:t={}}){const r=o(e);if(!r)throw new Error(`Element with ID "${e}" not found`);(0,n.__privateRunCommand)("document/elements/delete",{container:r,options:t})}const v=({elements:e,title:t,subtitle:r=(0,g.__)("Item added","elementor")})=>(0,n.undoable)({do:({elements:e})=>{const t=[];return e.forEach(e=>{const{options:n,...o}=e,r=E({...o,options:{...n,useHistory:!1}}),s=r.id;t.push({elementId:s,model:r.model?.toJSON()||{},createParams:{...e}})}),{createdElements:t}},undo:(e,{createdElements:t})=>{[...t].reverse().forEach(({elementId:e})=>{y({elementId:e,options:{useHistory:!1}})})},redo:(e,{createdElements:t})=>{const n=[];return t.forEach(({createParams:e,model:t})=>{const r=E({containerId:e.containerId,model:t,options:{...e.options,useHistory:!1}}).id,s=o(r);s&&n.push({elementId:r,model:s.model.toJSON(),createParams:e})}),{createdElements:n}}},{title:t,subtitle:r})({elements:e}),I=({elementIds:e,title:t,subtitle:r=(0,g.__)("Item duplicated","elementor"),onCreate:s})=>(0,n.undoable)({do:({elementIds:e})=>{const t=e.reduce((e,t)=>{const n=o(t);if(n?.parent){const n=w({elementId:t,options:{useHistory:!1,clone:!0}});e.push({id:n.id,model:n.model.toJSON(),originalElementId:t,modelToRestore:n.model.toJSON(),parentContainerId:n.parent?.id,at:n.view?._index})}return e},[]);return{duplicatedElements:s?.(t)??t}},undo:(e,{duplicatedElements:t})=>{[...t].reverse().forEach(({id:e})=>{y({elementId:e,options:{useHistory:!1}})})},redo:(e,{duplicatedElements:t})=>{const n=t.reduce((e,t)=>{if(t.modelToRestore&&t.parentContainerId){const n=E({containerId:t.parentContainerId,model:t.modelToRestore,options:{useHistory:!1,clone:!1,at:t.at}});e.push({id:n.id,model:n.model.toJSON(),originalElementId:t.originalElementId,modelToRestore:t.modelToRestore,parentContainerId:t.parentContainerId,at:t.at})}return e},[]);return{duplicatedElements:s?.(n)??n}}},{title:t,subtitle:r})({elementIds:e}),_=({elementIds:e,title:t,subtitle:r=(0,g.__)("Item removed","elementor")})=>(0,n.undoable)({do:({elementIds:e})=>{const t=[];return e.forEach(e=>{const n=o(e);if(n){const o=n.model.toJSON(),r=n.parent,s=n.view?._index??0;t.push({elementId:e,model:o,parent:r??null,at:s})}}),e.forEach(e=>{y({elementId:e,options:{useHistory:!1}})}),{elementIds:e,removedElements:t}},undo:(e,{removedElements:t})=>{[...t].reverse().forEach(({model:e,parent:t,at:n})=>{t&&e&&E({containerId:t.id,model:e,options:{useHistory:!1,at:n}})})},redo:(e,{elementIds:t,removedElements:n})=>(t.forEach(e=>{y({elementId:e,options:{useHistory:!1}})}),{elementIds:t,removedElements:n})},{title:t,subtitle:r})({elementIds:e}),h=e=>{const t=o(e);return t?.model.get("styles")||null};var S=window.elementorV2.utils;const b=(0,S.createError)({code:"element_not_found",message:"Element not found."}),C=(0,S.createError)({code:"style_not_found",message:"Style not found."}),T=(0,S.createError)({code:"element_type_not_exists",message:"Element type does not exist."}),O=(0,S.createError)({code:"element_label_not_exists",message:"Element label does not exist."});function R(e){const t=o(e),n=t?.model.get("widgetType")||t?.model.get("elType");if(!n)throw new T({context:{elementId:e}});const r=c()?.[n]?.title;if(!r)throw new O({context:{elementType:n}});return r}function H(e){const t=e?o(e):function(){const e=window;return e.elementor?.documents?.getCurrent?.()?.container??null}();if(!t)return[];const n=[...t.model.get("elements")??[]].flatMap(e=>H(e.get("id")));return[t,...n]}function P(){const e=window;return e.elementor?.documents?.getCurrentId?.()??null}const N=({id:e,props:t,withHistory:r=!0})=>{const s={container:o(e),settings:{...t}};r?(0,n.__privateRunCommandSync)("document/elements/settings",s):(0,n.__privateRunCommandSync)("document/elements/set-settings",s,{internal:!0})},j=()=>{const e=window;return e.elementorCommon?.helpers?.getUniqueId?.()??`el-${Date.now()}-${Math.random().toString(36).substring(2,9)}`},L=({currentElement:e,newElement:t,withHistory:n=!0})=>{const r=o(e.id)?.parent;if(!r)throw new Error(`Parent not found for element ${e.id}. Cannot replace element.`);const s=r.children?.findIndex(t=>t.id===e.id);if(void 0===s||-1===s)throw new Error(`Element ${e.id} not found in parent container. Cannot replace element.`);E({containerId:r.id,model:t,options:{at:s,useHistory:n}}),y({elementId:e.id,options:{useHistory:n}})},x="elementor/editor-v2/editor-elements/style",V=[(0,n.commandEndEvent)("document/elements/create"),(0,n.commandEndEvent)("document/elements/duplicate"),(0,n.commandEndEvent)("document/elements/import"),(0,n.commandEndEvent)("document/elements/paste"),(0,n.windowEvent)(x)];var A=window.elementorV2.editorProps,U=window.elementorV2.editorStyles;function $(e,t){const r=o(e);if(!r)throw new b({context:{elementId:e}});const s=Object.keys(r.model.get("styles")??{}),i=function(e,t){const n=structuredClone(e.model.get("styles"))??{},o=Object.entries(t(n)).map(([e,t])=>(t.variants=function(e){return e.variants.filter(({props:e,custom_css:t})=>Object.keys(e).length>0||t?.raw)}(t),[e,t])).filter(([,e])=>!function(e){return 0===e.variants.length}(e)),r=Object.fromEntries(o);return e.model.set("styles",r),r}(r,t);return function(e,{oldIds:t,newIds:n}){const o=t.filter(e=>!n.includes(e)),r=structuredClone(function(e){return Object.entries(e.settings.toJSON()).filter(e=>{const[,t]=e;return A.classesPropTypeUtil.isValid(t)})}(e));r.forEach(([,e])=>{e.value=e.value.filter(e=>!o.includes(e))}),N({id:e.id,props:Object.fromEntries(r),withHistory:!1})}(r,{oldIds:s,newIds:Object.keys(i)}),window.dispatchEvent(new CustomEvent(x)),(0,n.__privateRunCommandSync)("document/save/set-is-modified",{status:!0},{internal:!0}),i}function J({styleId:e,elementId:t,classesProp:n,label:o,meta:r,props:i,custom_css:l=null,additionalVariants:d=[]}){let c=e;return $(t,e=>{c??=(0,U.generateId)(`e-${t}-`,Object.keys(e));const u=[{meta:r,props:i,custom_css:l},...d];return e[c]={id:c,label:o,type:"class",variants:u},function(e,t,n){const o=s(e,t),r=A.classesPropTypeUtil.create(e=>[...e??[],n],{base:o});N({id:e,props:{[t]:r},withHistory:!1})}(t,n,c),e}),c}function k(e){return!e?.styleId&&!e?.provider}function D(e){$(e.elementId,t=>{const n=t[e.styleId];if(!n)throw new C({context:{styleId:e.styleId}});const o=(0,U.getVariantByMeta)(n,e.meta),r=("custom_css"in e?e.custom_css:o?.custom_css)??null;return o?(o.props=(0,A.mergeProps)(o.props,e.props),o.custom_css=r?.raw?r:null):n.variants.push({meta:e.meta,props:e.props,custom_css:r}),t})}function M(e,t){$(e,e=>(delete e[t],e))}function q(e){const t=B(e);if(t)return{shouldRestrict:!0,reason:"descendant",elementId:t};const n=G(e);return n?{shouldRestrict:!0,reason:"ancestor",elementId:n}:{shouldRestrict:!1}}function B(e){const t=F(e);if(!t)return null;for(const n of Array.from(t.querySelectorAll("a"))){const t=z(n);if(t!==e)return t}return null}function G(e){const t=F(e);if(!t||null===t.parentElement)return null;const n=t.parentElement.closest("a");return n?z(n):null}function W(e){const t=F(e);return!!t&&(!!K(t.tagName)||Y(t))}function Y(e){for(const t of e.children)if(!Q(t)){if(K(t.tagName))return!0;if(Y(t))return!0}return!1}function z(e){return e.closest("[data-id]")?.dataset.id||null}function F(e){try{return o(e)?.view?.el||null}catch{return null}}function K(e){return"a"===e.toLowerCase()}function Q(e){return e.hasAttribute("data-id")}(window.elementorV2=window.elementorV2||{}).editorElements=t}(),window.elementorV2.editorElements?.init?.();