/*! elementor-pro - v3.30.0 - 22-07-2025 */ (()=>{var e={40:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.replaceUtmPlaceholders=r.htmlDecodeTextContent=r.arrayToClassName=void 0;r.arrayToClassName=(e,r)=>e.filter((e=>"object"==typeof e?Object.entries(e)[0][1]:e)).map((e=>{const n="object"==typeof e?Object.entries(e)[0][0]:e;return r?r(n):n})).join(" ");r.htmlDecodeTextContent=e=>(new DOMParser).parseFromString(e,"text/html").documentElement.textContent;r.replaceUtmPlaceholders=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e&&r?(Object.keys(r).forEach((n=>{const o=new RegExp(`%%${n}%%`,"g");e=e.replace(o,r[n])})),e):e}},3842:(e,r,n)=>{"use strict";var o=n(2688),i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),s=n(6956),u=i(n(7971));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const App=e=>{const[r,n]=(0,a.useState)(!0);(0,a.useEffect)((()=>{if(!r){const r=setTimeout((()=>{e.onClose()}),500);return()=>clearTimeout(r)}}),[r]);return a.default.createElement(s.DirectionProvider,{rtl:e.isRTL},a.default.createElement(s.LocalizationProvider,null,a.default.createElement(s.ThemeProvider,{colorScheme:e.colorScheme},a.default.createElement(s.Dialog,{open:r,fullWidth:!0,maxWidth:"lg",TransitionComponent:s.Fade,transitionDuration:{enter:500,exit:500},sx:{"& .MuiDialog-paper":{height:"calc(100vh - 4rem)",maxHeight:775}}},a.default.createElement(u.default,{getControlValue:e.getControlValue,setControlValue:e.setControlValue,fetchData:e.fetchData,onClose:()=>{n(!1)},conditionsConfig:e.conditionsConfig,setCacheNoticeStatus:e.setCacheNoticeStatus})))))};App.propTypes={colorScheme:o.oneOf(["auto","light","dark"]),isRTL:o.bool,getControlValue:o.func.isRequired,setControlValue:o.func.isRequired,fetchData:o.func.isRequired,onClose:o.func.isRequired,conditionsConfig:o.object.isRequired,setCacheNoticeStatus:o.func.isRequired};r.default=App},19:(e,r,n)=>{"use strict";var o=n(2470).__,i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=i(n(1594)),s=i(n(3842));class DisplayConditionsBehavior extends Marionette.Behavior{ui(){const e=".eicon-flow.e-control-display-conditions";return{displayConditionsButton:e,displayConditionsPromoButton:`${e}-promo`}}events(){return{"click @ui.displayConditionsButton":"onClickControlButtonDisplayConditions","mouseenter @ui.displayConditionsPromoButton":"onHoverControlButtonDisplayConditions"}}onClickControlButtonDisplayConditions(e){e.stopPropagation(),this.mount()}onHoverControlButtonDisplayConditions(e){e.stopPropagation(),elementor.promotion.showDialog({title:o("Display Conditions","elementor-pro"),content:o("Upgrade to Elementor Pro Advanced to get the Display Conditions feature as well as additional professional and ecommerce widgets","elementor-pro"),targetElement:this.el,actionButton:{url:"https://go.elementor.com/go-pro-advanced-display-conditions/",text:o("Upgrade Now","elementor-pro"),classes:["elementor-button","go-pro"]}})}getRootElement(){let e=window.parent.document.getElementById("elementor-conditions__modal");return e||(e=document.createElement("div"),e.setAttribute("id","elementor-conditions__modal"),e)}mount(){const e=elementor?.getPreferences?.("ui_theme")||"auto",r=elementorCommon.config.isRTL,n=this.getRootElement();window.parent.document.body.appendChild(n),ReactDOM.render(a.default.createElement(s.default,{colorScheme:e,isRTL:r,getControlValue:this.getOption("getControlValue"),setControlValue:this.getOption("setControlValue"),fetchData:this.getOption("fetchData"),onClose:()=>this.unmount(n),conditionsConfig:this.getOption("conditionsConfig"),setCacheNoticeStatus:this.getOption("setCacheNoticeStatus")}),n)}unmount(e){ReactDOM.unmountComponentAtNode(e),e.remove()}}r.default=DisplayConditionsBehavior},5305:(e,r,n)=>{"use strict";var o=n(2688);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),a=n(2470),s=n(6956);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const CacheNotice=e=>{let{setCacheNoticeStatus:r}=e;const[n,o]=(0,i.useState)(!0);return i.default.createElement(s.Box,null,i.default.createElement(s.Collapse,{in:n,sx:{px:3}},i.default.createElement(s.Alert,{color:"info",severity:"error",variant:"standard",onClose:async()=>{await r()&&o(!1)},sx:{mt:3}},(0,a.__)("Keep in mind: Certain cache plugins can conflict with your display conditions. ","elementor-pro"),i.default.createElement(s.Link,{href:"https://go.elementor.com/app-display-conditions-cache-notice/",underline:"hover",color:"info.main",target:"_blank",sx:{"&:hover":{color:e=>e.palette.info.main}}},(0,a.__)("Learn more","elementor-pro")))))};CacheNotice.propTypes={setCacheNoticeStatus:o.func.isRequired};r.default=CacheNotice},7946:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=_interopRequireWildcard(n(1594)),a=_interopRequireWildcard(n(2688)),s=o(n(7976)),u=n(6956),c=o(n(7459)),f=o(n(6794)),p=o(n(678)),g=o(n(248)),C=n(3726),v=n(4934);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const ConditionsRepeaterRow=e=>{let{andConditionIndex:r,orConditionIndex:n}=e;const{selectedConditions:o,conditionsConfig:a,dispatch:_}=(0,s.default)(),{conditions:b,flattenedConditionOptions:x}=a,E=o[n][r],R=E?.condition,w=b[R]?.controls||{},P=Object.keys(w).length;return i.createElement(u.Container,{maxWidth:"md",sx:{display:"flex",gap:.5,mb:1,position:"relative"},className:`and-condition-repeater-row and-condition-${r}`},i.createElement(f.default,{id:"condition-select",value:E.condition||"",onChange:e=>(e=>{const o=e.target.value,i={condition:o,...(0,C.getConditionInitialState)(b,o)};_({type:v.ACTION_TYPES.CHANGE_CONDITION_TYPE,orConditionIndex:n,andConditionIndex:r,conditionToChange:i})})(e),controlCount:P},x.map((e=>{let{key:r,label:n,isGroup:o}=e;return o?i.createElement(u.ListSubheader,{key:r},i.createElement(p.default,{variant:"caption",controlCount:P},n)):i.createElement(u.MenuItem,{key:r,value:r},i.createElement(p.default,{controlCount:P},n))}))),Object.keys(w).map((e=>i.createElement(c.default,{key:e,controlKey:e,andConditionIndex:r,orConditionIndex:n,controlCount:P}))),i.createElement(g.default,{orConditionIndex:n,andConditionIndex:r}))};ConditionsRepeaterRow.propTypes={andConditionIndex:a.number.isRequired,orConditionIndex:a.number.isRequired};r.default=ConditionsRepeaterRow},5213:(e,r,n)=>{"use strict";var o=n(2688),i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=i(n(1594)),s=i(n(7976)),u=n(6956),c=i(n(7946));const ConditionsSelectors=e=>{let{orConditionIndex:r}=e;const{selectedConditions:n}=(0,s.default)(),o=n[r];return a.default.createElement(u.Box,{sx:{my:2,gap:1},className:`or-condition-repeater or-condition-${r}`},o.map(((e,n)=>a.default.createElement(c.default,{key:"or-condition-row-"+n,andConditionIndex:n,orConditionIndex:r}))))};ConditionsSelectors.propTypes={orConditionIndex:o.number.isRequired};r.default=ConditionsSelectors},2822:(e,r,n)=>{"use strict";var o=n(2470).__,i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),s=n(6956),u=i(n(7432)),c=i(n(174));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}r.default=e=>a.createElement(s.Box,{display:"flex",justifyContent:"center",alignItems:"flex-start",sx:{flex:1,overflow:"auto"}},a.createElement(s.Stack,{maxWidth:"md",width:"100%",justifyContent:"center",textAlign:"center",sx:{pt:5,pb:10,px:6}},a.createElement(u.default,{fontSize:"large",sx:{mb:1,mx:"auto"}}),a.createElement(s.Typography,{component:"h6",variant:"h6",color:"text.primary"},o("Set one or more conditions for this element","elementor-pro")),a.createElement(s.Typography,{variant:"body2",color:"text.tertiary",sx:{mb:4}},o("It will only appear on your website when all the conditions are met.","elementor-pro")," ",a.createElement(s.Link,{href:"https://go.elementor.com/app-display-conditions/",target:"_blank",rel:"noreferrer",color:"info.main",underline:"hover",sx:{"&:hover":{color:e=>e.palette.info.main}}},o("Learn more","elementor-pro"))),a.createElement(c.default,e)))},7971:(e,r,n)=>{"use strict";var o=n(2688),i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),s=n(4372),u=n(9148),c=n(6956),f=n(3726),p=i(n(1677)),g=i(n(799)),C=i(n(2822)),v=i(n(5305)),_=n(4934);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const Content=e=>{let{getControlValue:r,setControlValue:n,conditionsConfig:o,onClose:i,fetchData:b,setCacheNoticeStatus:x}=e;const E=r(),R={conditionsConfig:o,selectedConditions:E||[],fetchData:b},[w,P]=a.default.useState(!0),[j,T]=(0,a.useReducer)(s.conditionsReducer,R),[I,W]=(0,a.useState)(!1),{selectedConditions:q}=j;(0,a.useEffect)((()=>{I||W(!0)}),[q]),(0,a.useEffect)((()=>{W(!1)}),[]);const handleEmptyFieldsPerConditionSet=(e,r)=>{let n=!1,o=null;return e.forEach(((e,i)=>{const{condition:a}=e,s=getRequiredControlKeys(a);handleInvalidRequiredKeysPerCondition({requiredKeys:s,andCondition:e,orConditionIndex:r,andConditionIndex:i})&&!n&&(o=i,n=!0)})),{hasFoundInvalidConditionInConditionSet:n,invalidAndConditionIndex:o}},handleInvalidRequiredKeysPerCondition=e=>{let{requiredKeys:r,andCondition:n,orConditionIndex:i,andConditionIndex:a}=e;const{condition:s}=n;let u=!1;return r.forEach((e=>{const r=n[e],{type:c,variant:p=null}=o.conditions[s].controls[e];r?.length||(0,f.shouldEmptyValuePassValidation)(n.condition,n.comparator)||(u||(u=!0),T({type:_.ACTION_TYPES.SET_ERRORS,andConditionIndex:a,orConditionIndex:i,errors:{[e]:(0,f.getInvalidInputFeedback)(c,p,r,!0)}}))})),u},handleSave=()=>{const{hasFoundInvalidCondition:e,invalidOrConditionIndex:r,invalidAndConditionIndex:o}=(()=>{let e=!1,r=null,n=null;return q.forEach(((o,i)=>{const{hasFoundInvalidConditionInConditionSet:a,invalidAndConditionIndex:s}=handleEmptyFieldsPerConditionSet(o,i);a&&!e&&(e=!0,n=s,r=i)})),{hasFoundInvalidCondition:e,invalidOrConditionIndex:r,invalidAndConditionIndex:n}})();if(e){const e=`.or-condition-repeater.or-condition-${r} .and-condition-repeater-row.and-condition-${o}`,n=document.querySelector(e);setTimeout((()=>n?.scrollIntoView({behavior:"smooth"})),100)}else n([JSON.stringify(getSanitizedConditions())]),i()},getRequiredControlKeys=e=>{const{controls:r}=o.conditions[e];return Object.keys(r).filter((e=>r[e].required))},getSanitizedConditions=()=>q.map((e=>e.map((e=>{const r={...e};return delete r.errors,r}))));return a.default.createElement(a.default.Fragment,null,a.default.createElement(p.default,{onClose:i}),a.default.createElement(c.Divider,{orientation:"horizontal"}),o.show_cache_notice&&a.default.createElement(v.default,{setCacheNoticeStatus:x}),a.default.createElement(u.ConditionsContext.Provider,{value:{dispatch:T,...j}},a.default.createElement(C.default,{showConditions:w,setShowConditions:P})),a.default.createElement(c.Divider,{orientation:"horizontal"}),a.default.createElement(g.default,{onClickSaveButton:()=>handleSave(),showConditions:w,setShowConditions:P,isButtonDisabled:I}))};Content.propTypes={getControlValue:o.func.isRequired,setControlValue:o.func.isRequired,fetchData:o.func.isRequired,onClose:o.func.isRequired,conditionsConfig:o.object.isRequired,setCacheNoticeStatus:o.func.isRequired};r.default=Content},7459:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=_interopRequireWildcard(n(1594)),a=_interopRequireWildcard(n(2688)),s=o(n(7976)),u=o(n(4565)),c=o(n(6373)),f=o(n(6929)),p=o(n(5523)),g=o(n(6936)),C=o(n(6987)),v=n(4934),_=n(3726);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const ControlRenderer=e=>{let{controlKey:r,andConditionIndex:n,orConditionIndex:o,controlCount:a}=e;const{conditionsConfig:b,selectedConditions:x,dispatch:E}=(0,s.default)(),{conditions:R}=b,w=x[o][n],P=w.condition,{controls:j={}}=R[P],T=({}=j[r]),{options:I={}}=T;if("__settings"===r)return null;const extractControlPropsFromGlobals=e=>{const o=getControlValueRelatedProps(e),i=getControlInvalidInputRelatedProps(),s={controlKey:r,control:T,conditionIndex:n,condition:w,conditions:R,options:I,onChangeOption:handleChangeOption,controlCount:a};return(0,_.shouldDisableControl)(r,s.condition.comparator)&&(s.disabled=!0),{...o,...i,...s}},getControlValueRelatedProps=e=>{e=(0,_.getControlValue)(e,v.DEFAULT_CONTROL_VALUES[T.type]);const n=(0,_.getControlValue)(T?.default,Object.keys(I)[0]||e);return{defaultValue:n,value:(0,_.getControlValue)(w[r],n),placeholder:T?.placeholder||"",isMultiple:T?.multiple||!1}},getControlInvalidInputRelatedProps=()=>{const e=(w.errors||{})[r]||{},n=e.shouldShow&&e.message||"";return{errorMessage:n,shouldShowError:Boolean(n)}},handleChangeOption=e=>{const{type:i,variant:a}=j[r],s=(0,_.getInvalidInputFeedback)(i,a,e);E({type:v.ACTION_TYPES.CHANGE_CONTROL_VALUE,orConditionIndex:o,andConditionIndex:n,controlKey:r,value:e}),E({type:v.ACTION_TYPES.SET_ERRORS,andConditionIndex:n,orConditionIndex:o,errors:{[r]:s}})};switch(T.type){case v.CONTROL_TYPES.SELECT:return i.createElement(u.default,extractControlPropsFromGlobals());case v.CONTROL_TYPES.MULTIPLE_SELECT:return i.createElement(c.default,extractControlPropsFromGlobals());case v.CONTROL_TYPES.DATE_TIME:return(e=>{switch(e){case"date":return i.createElement(g.default,extractControlPropsFromGlobals());case"time":return i.createElement(C.default,extractControlPropsFromGlobals())}})(T?.variant);case v.CONTROL_TYPES.QUERY:return i.createElement(f.default,extractControlPropsFromGlobals())}return i.createElement(p.default,extractControlPropsFromGlobals())};ControlRenderer.propTypes={controlKey:a.string.isRequired,andConditionIndex:a.number.isRequired,orConditionIndex:a.number.isRequired,controlCount:a.number.isRequired};r.default=ControlRenderer},6373:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(n(8304)),a=_interopRequireWildcard(n(1594)),s=a,u=_interopRequireWildcard(n(2688)),c=n(6956),f=o(n(678));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const formatValue=e=>Array.isArray(e)?e:[e],AutocompleteControl=e=>{let{conditions:r,condition:n,controlKey:o,onChangeOption:u,options:p,value:g,shouldShowError:C,errorMessage:v,isMultiple:_,controlCount:b}=e;const[x,E]=(0,a.useState)(formatValue(g)),R=x?.length?"":r[n.condition].label||"";(0,a.useEffect)((()=>{E(formatValue(g))}),[n]);return s.createElement(c.Autocomplete,{multiple:_,id:`select-${o}`,value:x,options:Object.keys(p),getOptionLabel:e=>p[e],sx:{flex:1},ChipProps:{sx:{"&.MuiAutocomplete-tag":{maxWidth:"100px"}}},renderInput:e=>s.createElement(c.TextField,(0,i.default)({error:C,helperText:v},e,{placeholder:R,color:"secondary"})),ListboxProps:{sx:{maxHeight:280}},size:"small",onChange:(e,r)=>{return n=formatValue(r),u(n),void E(n);var n},renderOption:(e,r)=>s.createElement(c.Typography,(0,i.default)({component:"li"},e),s.createElement(f.default,{component:"span",variant:"inherit",noWrap:!0,controlCount:b},p[r])),forcePopupIcon:!Object.keys(p).length<=1})};AutocompleteControl.propTypes={conditions:u.object.isRequired,condition:u.object.isRequired,controlKey:u.string.isRequired,onChangeOption:u.func.isRequired,value:u.array.isRequired,options:u.object.isRequired,errorMessage:u.string.isRequired,shouldShowError:u.bool.isRequired,isMultiple:u.bool.isRequired,optionsStyles:u.object.isRequired,menuStyles:u.object.isRequired,controlCount:u.number.isRequired};r.default=AutocompleteControl},6936:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=_interopRequireWildcard(n(1594)),a=i,s=_interopRequireWildcard(n(2688)),u=n(6956),c=o(n(5285));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const f="MM-DD-YYYY",formattedValue=e=>(0,c.default)(e,f,!0).isValid()?(0,c.default)(e,f):null,DatePickerControl=e=>{let{condition:r,onChangeOption:n,controlKey:o,value:s,shouldShowError:p,errorMessage:g}=e;const[C,v]=(0,i.useState)(formattedValue(s));(0,i.useEffect)((()=>{v(formattedValue(s))}),[r]);return a.createElement(u.DatePicker,{value:C,sx:{flex:1},id:`select-${o}`,slotProps:{openPickerButton:{size:"small"},textField:{size:"small",color:"secondary",error:p,helperText:g}},onChange:e=>(e=>{(0,c.default)(e,f,!0).isValid()?(n(e.format(f)),v(formattedValue(e))):n("")})(e)})};DatePickerControl.propTypes={condition:s.object.isRequired,controlKey:s.string.isRequired,onChangeOption:s.func.isRequired,value:s.string,errorMessage:s.string.isRequired,shouldShowError:s.bool.isRequired};r.default=DatePickerControl},6929:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=_interopRequireWildcard(n(1594)),a=o(n(8304)),s=_interopRequireWildcard(n(2688)),u=n(2470),c=n(9148),f=n(6956),p=n(40),g=o(n(678));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const formatValue=e=>Array.isArray(e)?e:[e],QueryControl=e=>{let{conditions:r,condition:n,control:o,controlKey:s,onChangeOption:C,value:v,shouldShowError:_,errorMessage:b,isMultiple:x,controlCount:E}=e;const{fetchData:R}=(0,i.useContext)(c.ConditionsContext),[w,P]=(0,i.useState)(formatValue(v)),[j,T]=(0,i.useState)([]),[I,W]=(0,i.useState)(!1),q=w?.length?"":r[n.condition].label||"";(0,i.useEffect)((()=>{P(formatValue(v))}),[n]);return i.default.createElement(f.Autocomplete,{multiple:x,id:`select-${s}`,value:w,options:j,getOptionLabel:e=>e?e.text:"",isOptionEqualToValue:(e,r)=>e.id===r.id,filterOptions:e=>e,noOptionsText:(0,u.__)("No results","elementor-pro"),loading:I,loadingText:(0,u.__)("Searching...","elementor-pro"),size:"small",sx:{flex:1},ChipProps:{sx:{"&.MuiAutocomplete-tag":{maxWidth:"100px"}}},renderInput:e=>i.default.createElement(f.TextField,(0,a.default)({},e,{placeholder:q,color:"secondary",error:_,helperText:b,InputProps:{...e.InputProps,endAdornment:i.default.createElement(i.default.Fragment,null,I?i.default.createElement(f.CircularProgress,{color:"inherit",size:20}):null,e.InputProps.endAdornment)}})),ListboxProps:{sx:{maxHeight:280}},onChange:(e,r)=>{return C(n=r),void P(n);var n},onInputChange:(e,r)=>(async(e,r,n)=>{if(""===r)return void T([]);W(!0);const i=(await R(r,o)).filter((e=>(e.text=(0,p.htmlDecodeTextContent)(e.text),!n.some((r=>r?.id===e?.id)))));T(i),W(!1)})(0,r,w),renderOption:(e,r)=>i.default.createElement(f.Typography,(0,a.default)({component:"li"},e),i.default.createElement(g.default,{component:"span",variant:"inherit",noWrap:!0,controlCount:E},r.text))})};QueryControl.propTypes={conditions:s.object.isRequired,condition:s.object.isRequired,onChangeOption:s.func.isRequired,controlKey:s.string.isRequired,control:s.object.isRequired,value:s.array.isRequired,errorMessage:s.string.isRequired,shouldShowError:s.bool.isRequired,isMultiple:s.bool.isRequired,controlCount:s.number.isRequired};r.default=QueryControl},4565:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=_interopRequireWildcard(n(1594)),a=i,s=_interopRequireWildcard(n(2688)),u=n(6956),c=o(n(6794)),f=o(n(678));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const SelectControl=e=>{let{condition:r,control:n,controlKey:o,onChangeOption:s,options:p,value:g,controlCount:C}=e;const[v,_]=(0,i.useState)(g);(0,i.useEffect)((()=>{_(g)}),[r]);return a.createElement(c.default,{id:`select-${o}`,value:v,onChange:e=>{return r=e.target.value,s(r),void _(r);var r},disabled:Object.keys(p).length<=1,controlCount:C},Object.entries(p).map((e=>{let[r,o]=e;if(!o)return null;if("group"===o.type)return a.createElement(u.ListSubheader,{key:r},a.createElement(f.default,{controlCount:C},o.label));const i=n?.disabled_options?.includes(r);return a.createElement(u.MenuItem,{key:r,value:r,disabled:i,className:i&&"hidden"===n?.disabled_type?"elementor-hidden":""},a.createElement(f.default,{controlCount:C},o))})))};SelectControl.propTypes={condition:s.object.isRequired,control:s.object.isRequired,controlKey:s.string.isRequired,onChangeOption:s.func.isRequired,options:s.object.isRequired,value:s.string.isRequired,controlCount:s.number.isRequired};r.default=SelectControl},5523:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(n(8304)),a=_interopRequireWildcard(n(1594)),s=a,u=_interopRequireWildcard(n(2688)),c=n(6956),f=n(3726);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const TextFieldControl=e=>{let{condition:r,controlKey:n,control:o,onChangeOption:u,value:p,errorMessage:g,shouldShowError:C,placeholder:v,disabled:_}=e;const[b,x]=(0,a.useState)(p),{step:E=1,min:R=0,variant:w=null}=o,P="number"===w?{type:"number",inputProps:{step:E,min:R}}:{};(0,a.useEffect)((()=>{x(p)}),[r]);return s.createElement(c.TextField,(0,i.default)({},P,{sx:{flex:1},error:C,helperText:g,value:b,id:`text-${n}`,variant:"outlined",onChange:e=>((e,r)=>{let n=null;"number"===r&&(0,f.hasDecimalSeparator)(e)&&(n=Math.floor(parseFloat(e))),u(n??e.trim()),x(n??e)})(e.target.value,w),size:"small",color:"secondary",placeholder:v,disabled:_??!1}))};TextFieldControl.propTypes={condition:u.object.isRequired,controlKey:u.string.isRequired,control:u.object.isRequired,onChangeOption:u.func.isRequired,value:u.oneOfType([u.string,u.number]).isRequired,errorMessage:u.string.isRequired,shouldShowError:u.bool.isRequired,placeholder:u.string.isRequired,disabled:u.bool};r.default=TextFieldControl},6987:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=_interopRequireWildcard(n(1594)),a=i,s=_interopRequireWildcard(n(2688)),u=n(6956),c=o(n(5285));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}const f="HH:mm",p="MM-DD-YYYY "+f,TimePickerControl=e=>{let{condition:r,controlKey:n,onChangeOption:o,value:s,shouldShowError:g,errorMessage:C}=e;const v=(0,i.useRef)((x=s,(0,c.default)(x,f,!0).isValid()?(0,c.default)(x,f):null)),[_,b]=(0,i.useState)(v.current);var x;(0,i.useEffect)((()=>{b(v.current)}),[r]);return a.createElement(u.TimePicker,{sx:{flex:1},id:`select-${n}`,value:_,slotProps:{textField:{size:"small",error:g,helperText:C}},onChange:e=>(e=>{const r=(0,c.default)(e,p,!0).isValid()?e.format(p):"";o(r),v.current=e,b(e)})(e)})};TimePickerControl.propTypes={condition:s.object.isRequired,control:s.object.isRequired,controlKey:s.string.isRequired,onChangeOption:s.func.isRequired,value:s.string,errorMessage:s.string.isRequired,shouldShowError:s.bool.isRequired};r.default=TimePickerControl},6794:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(n(1594)),a=o(n(8304)),s=n(6956),u=n(3726),c=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(2688));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const ConditionSelect=e=>{let{controlCount:r,...n}=e;return i.default.createElement(s.Select,(0,a.default)({},n,{size:"small",sx:{flex:1,textAlign:"start",alignSelf:"flex-start",".MuiSelect-select .MuiTypography-root":{maxWidth:(0,u.getControlValueMaxWidth)(r)}},color:"secondary",MenuProps:{PaperProps:{sx:{maxHeight:280,"& .MuiListSubheader-root":{position:"initial"}}},classes:{paper:"e-conditions-select-menu"}}}))};ConditionSelect.propTypes={controlCount:c.number.isRequired};r.default=ConditionSelect},678:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(n(1594)),a=o(n(8304)),s=n(6956),u=n(3726),c=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(2688));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const ConditionSelectOption=e=>{let{controlCount:r,sx:n={},...o}=e;return i.default.createElement(s.Typography,(0,a.default)({noWrap:!0},o,{variant:o.variant||"inherit",sx:{maxWidth:(0,u.getSelectOptionMaxWidth)(r),...n}}))};ConditionSelectOption.propTypes={sx:c.object,isDropdownItem:c.bool,variant:c.string,controlCount:c.number.isRequired};r.default=ConditionSelectOption},799:(e,r,n)=>{"use strict";var o=n(2470).__,i=n(2688);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),s=n(6956);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const Footer=e=>{let{onClickSaveButton:r,isButtonDisabled:n}=e;return a.createElement(s.Stack,{direction:"row",justifyContent:"flex-end",sx:{py:1,px:3}},a.createElement(s.Button,{variant:"contained",className:"save-and-close-button",disabled:!n,onClick:r},o("Save & Close","elementor-pro")))};Footer.propTypes={onClickSaveButton:i.func,isButtonDisabled:i.bool.isRequired};r.default=Footer},1677:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(n(1594)),a=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(2688)),s=n(2470),u=n(6956),c=o(n(4448)),f=n(4048);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const Header=e=>{let{onClose:r}=e;return i.default.createElement(u.AppBar,{sx:{fontWeight:"normal"},color:"transparent",position:"relative"},i.default.createElement(u.Toolbar,{variant:"dense"},i.default.createElement(c.default,{sx:{mr:1}}),i.default.createElement(u.Typography,{component:"span",variant:"subtitle2",sx:{fontWeight:"bold",textTransform:"uppercase"}},(0,s.__)("Display Conditions","elementor-pro")),i.default.createElement(u.Stack,{direction:"row",spacing:1,alignItems:"center",sx:{ml:"auto"}},i.default.createElement(u.IconButton,{size:"small","aria-label":(0,s.__)("Close","elementor-pro"),onClick:r,sx:{"&.MuiButtonBase-root":{mr:-1}}},i.default.createElement(f.XIcon,null)))))};Header.propTypes={onClose:a.func.isRequired};r.default=Header},4448:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(n(8304)),a=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),s=n(6956);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}r.default=e=>a.createElement(s.SvgIcon,(0,i.default)({viewBox:"0 0 32 32"},e),a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.69648 24.8891C0.938383 22.2579 0 19.1645 0 16C0 11.7566 1.68571 7.68687 4.68629 4.68629C7.68687 1.68571 11.7566 0 16 0C19.1645 0 22.2579 0.938383 24.8891 2.69648C27.5203 4.45459 29.5711 6.95344 30.7821 9.87706C31.9931 12.8007 32.3099 16.0177 31.6926 19.1214C31.0752 22.2251 29.5514 25.0761 27.3137 27.3137C25.0761 29.5514 22.2251 31.0752 19.1214 31.6926C16.0177 32.3099 12.8007 31.9931 9.87706 30.7821C6.95344 29.5711 4.45459 27.5203 2.69648 24.8891ZM12.0006 9.33281H9.33437V22.6665H12.0006V9.33281ZM22.6657 9.33281H14.6669V11.9991H22.6657V9.33281ZM22.6657 14.6654H14.6669V17.3316H22.6657V14.6654ZM22.6657 20.0003H14.6669V22.6665H22.6657V20.0003Z"}))},7432:(e,r,n)=>{"use strict";var o=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var i=o(n(8304)),a=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),s=n(6956);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const u=a.forwardRef(((e,r)=>a.createElement(s.SvgIcon,(0,i.default)({viewBox:"0 0 24 24"},e,{ref:r}),a.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 3.75C10.3096 3.75 9.75 4.30964 9.75 5V7C9.75 7.69036 10.3096 8.25 11 8.25H13C13.6904 8.25 14.25 7.69036 14.25 7V5C14.25 4.30964 13.6904 3.75 13 3.75H11ZM12.75 9.75H13C14.5188 9.75 15.75 8.51878 15.75 7V5C15.75 3.48122 14.5188 2.25 13 2.25H11C9.48122 2.25 8.25 3.48122 8.25 5V7C8.25 8.51878 9.48122 9.75 11 9.75H11.25V11.25H8C7.27065 11.25 6.57118 11.5397 6.05546 12.0555C5.53973 12.5712 5.25 13.2707 5.25 14V14.25H5C3.48122 14.25 2.25 15.4812 2.25 17V19C2.25 20.5188 3.48122 21.75 5 21.75H7C8.51878 21.75 9.75 20.5188 9.75 19V17C9.75 15.4812 8.51878 14.25 7 14.25H6.75V14C6.75 13.6685 6.8817 13.3505 7.11612 13.1161C7.35054 12.8817 7.66848 12.75 8 12.75H16C16.3315 12.75 16.6495 12.8817 16.8839 13.1161C17.1183 13.3505 17.25 13.6685 17.25 14V14.25H17C15.4812 14.25 14.25 15.4812 14.25 17V19C14.25 20.5188 15.4812 21.75 17 21.75H19C20.5188 21.75 21.75 20.5188 21.75 19V17C21.75 15.4812 20.5188 14.25 19 14.25H18.75V14C18.75 13.2707 18.4603 12.5712 17.9445 12.0555C17.4288 11.5397 16.7293 11.25 16 11.25H12.75V9.75ZM17 15.75C16.3096 15.75 15.75 16.3096 15.75 17V19C15.75 19.6904 16.3096 20.25 17 20.25H19C19.6904 20.25 20.25 19.6904 20.25 19V17C20.25 16.3096 19.6904 15.75 19 15.75H17ZM5 15.75C4.30964 15.75 3.75 16.3096 3.75 17V19C3.75 19.6904 4.30964 20.25 5 20.25H7C7.69036 20.25 8.25 19.6904 8.25 19V17C8.25 16.3096 7.69036 15.75 7 15.75H5Z"})))),c=(0,s.styled)(u)((e=>{let{theme:r}=e;return{"& path":{fill:r.palette.text.primary}}}));r.default=c},174:(e,r,n)=>{"use strict";var o=n(2470).__,i=n(2688),a=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var s=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),u=n(6956),c=n(4048),f=a(n(5213)),p=a(n(7976)),g=n(3726),C=a(n(5513)),v=n(4934);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const OrRowGroup=e=>{let{showConditions:r,setShowConditions:n}=e;const{selectedConditions:i,conditionsConfig:a,dispatch:_}=(0,p.default)(),{conditions:b,conditionsByGroup:x}=a,E=i.length?o("Add condition group","elementor-pro"):o("Add Condition","elementor-pro");return s.default.createElement(u.Box,null,r&&i.map(((e,r)=>s.default.createElement(s.Fragment,{key:r},r>0&&s.default.createElement(C.default,null),s.default.createElement(f.default,{orConditionIndex:r})))),s.default.createElement(u.Button,{variant:"contained",className:"add-or-condition-button",color:"secondary",startIcon:s.default.createElement(c.PlusIcon,null),sx:{mt:1,mb:5},onClick:()=>(()=>{const e=(0,g.getDefaultActiveCondition)(x),r={condition:e,...(0,g.getConditionInitialState)(b,e)};_({type:v.ACTION_TYPES.ADD_OR_CONDITION,andCondition:r}),n(!0)})()},E))};OrRowGroup.propTypes={showConditions:i.bool.isRequired,setShowConditions:i.func.isRequired};r.default=OrRowGroup},5513:(e,r,n)=>{"use strict";var o=n(2470).__,i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=i(n(1594)),s=n(6956);r.default=()=>a.default.createElement(s.Divider,{sx:{px:3}},o("OR","elementor-pro"))},248:(e,r,n)=>{"use strict";var o=n(2688),i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var a=n(6956),s=n(2470),u=n(4048),c=function _interopRequireWildcard(e,r){if(!r&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(r);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&{}.hasOwnProperty.call(e,a)){var s=i?Object.getOwnPropertyDescriptor(e,a):null;s&&(s.get||s.set)?Object.defineProperty(o,a,s):o[a]=e[a]}return o.default=e,n&&n.set(e,o),o}(n(1594)),f=n(3726),p=i(n(7976)),g=n(4934);function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var r=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:r})(e)}const RowControls=e=>{let{orConditionIndex:r,andConditionIndex:n}=e;const{conditionsConfig:o,dispatch:i}=(0,p.default)(),{conditions:C,conditionsByGroup:v}=o;return c.createElement(a.Stack,{direction:"row",alignItems:"center",sx:{left:"100%",gap:.5,ml:-1,mt:"2.5px",position:"absolute"}},c.createElement(a.Button,{color:"secondary",variant:"outlined",sx:{px:1,minWidth:"unset"},className:"add-single-condition-button",onClick:()=>{const e=(0,f.getDefaultActiveCondition)(v),o={condition:e,...(0,f.getConditionInitialState)(C,e)};i({type:g.ACTION_TYPES.ADD_AND_CONDITION,andCondition:o,andConditionIndex:n,orConditionIndex:r})}},(0,s.__)("AND","elementor-pro")),c.createElement(a.IconButton,{color:"secondary","aria-label":(0,s.__)("Delete","elementor-pro"),className:"remove-single-condition-button",onClick:()=>{i({type:g.ACTION_TYPES.REMOVE_AND_CONDITION,andConditionIndex:n,orConditionIndex:r})}},c.createElement(u.XIcon,{fontSize:"small"})))};RowControls.propTypes={andConditionIndex:o.number.isRequired,orConditionIndex:o.number.isRequired};r.default=RowControls},9148:(e,r,n)=>{"use strict";var o=n(1594);Object.defineProperty(r,"__esModule",{value:!0}),r.ConditionsContext=void 0;r.ConditionsContext=o.createContext()},7976:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0;var o=n(1594),i=n(9148);r.default=function useConditions(){return(0,o.useContext)(i.ConditionsContext)}},9097:(e,r,n)=>{"use strict";var o=n(2470).__,i=n(6784);Object.defineProperty(r,"__esModule",{value:!0}),r.default=void 0,n(6281),n(5724);var a=i(n(19));class Module extends elementorModules.editor.utils.Module{pasteAction="paste";clearAction="clear";getDefaultSettings(){return{selectors:{icon:".eicon-flow.e-control-display-conditions"},controls:{displayConditions:"e_display_conditions",trigger:"e_display_conditions_trigger"}}}onElementorInit(){elementor.hooks.addFilter("controls/base/behaviors",this.registerControlBehavior),elementor.channels.editor.on("section:activated",this.highlightIconIfFilled),elementor.on("navigator:init",this.onNavigatorInit.bind(this));["widget","section","column","container"].forEach((e=>{elementor.hooks.addFilter(`elements/${e}/contextMenuGroups`,this.registerContextMenuGroups.bind(this))}))}onElementorInitComponents(){$e.commands.register("document/elements","paste-display-conditions",(e=>{this.tryContextMenuActions(e,this.pasteAction)})),$e.commands.register("document/elements","clear-display-conditions",(e=>{this.tryContextMenuActions(e,this.clearAction)}))}registerContextMenuGroups(e,r){const n=e.find((e=>"clipboard"===e.name));if(!n)return e;const i=n.actions.findIndex((e=>"pasteStyle"===e.name));return-1!==i&&n.actions.splice(i+1,0,{name:"pasteDisplayConditions",isEnabled:()=>this.isPasteDisplayConditionsEnabled(r),isVisible:()=>this.isPasteDisplayConditionsEnabled(r),title:o("Paste display conditions","elementor-pro"),callback:()=>$e.run("document/elements/paste-display-conditions",elementor.selection.getElements(r.getContainer()))}),n.actions.push({name:"clearDisplayConditions",isEnabled:()=>this.isClearDisplayConditionsEnabled(r),isVisible:()=>this.isClearDisplayConditionsEnabled(r),title:o("Clear display conditions","elementor-pro"),callback:()=>$e.run("document/elements/clear-display-conditions",elementor.selection.getElements(r.getContainer()))}),e}isPasteDisplayConditionsEnabled(e){const r=this.getSelectedElementDisplayCondition(e),n=!!JSON.parse(this.getDisplayConditionsFromClipboard()).length;return!r.length&&!elementor.selection.isMultiple()&&n}isClearDisplayConditionsEnabled(e){return this.getSelectedElementDisplayCondition(e).length&&!elementor.selection.isMultiple()}getSelectedElementDisplayCondition(e){return JSON.parse(e?.model?.getSetting(this.getSettings("controls").displayConditions)||"[]")}getDisplayConditionsFromClipboard(){const e=elementorCommon.storage.get("clipboard"),r=e?.elements||[];return 1!==r.length?"[]":r[0]?.settings?.e_display_conditions||"[]"}tryContextMenuActions(e,r){const n=e?.[0]||null,o=this.pasteAction===r?this.getDisplayConditionsFromClipboard():"";if(n){$e.run("document/elements/settings",{container:n,settings:{e_display_conditions:o}}),n.panel.refresh();try{const e=n.panel.getControlView(this.getSettings("controls").displayConditions),r=this.getEditorControlView(this.getSettings("controls").trigger).$el.find(this.getSettings("selectors").icon);this.highlightIcon(r,e)}catch(e){return!1}}}registerControlBehavior=(e,r)=>{if(this.getSettings("controls").trigger!==r.options.model.get("name"))return e;e||(e={});const n=this._getGroupedConditionKeys(elementor.config.displayConditions||{}),o=this._getFlattenedConditionOptions(n);return e.displayConditions={behaviorClass:a.default,getControlValue:()=>{const e=this.getEditorControlView(this.getSettings("controls").displayConditions);return e?this._getStructuredConditions(JSON.parse(e.getControlValue()||"[]")):[]},setControlValue:e=>{const r=this.getEditorControlView(this.getSettings("controls").displayConditions),n=this.getEditorControlView(this.getSettings("controls").trigger);if(r&&(e=e?.length&&"[]"!==e[0]?e:"",r.setValue(e),r.applySavedValue()),n.$el){const e=n.$el.find(this.getSettings("selectors").icon);this.highlightIcon(e,r)}},fetchData:async(e,r)=>{const n=await this.doAjaxRequest("pro_panel_posts_control_filter_autocomplete",{autocomplete:r.autocomplete,q:e});return n?.results??[]},setCacheNoticeStatus:async()=>{const e=await this.doAjaxRequest("display_conditions_set_cache_notice_status");return e&&(elementor.config.displayConditions.show_cache_notice=!1),e},conditionsConfig:{...elementor.config.displayConditions,conditionsByGroup:n,flattenedConditionOptions:o}},e};highlightIconIfFilled=(e,r)=>{if(!["section_advanced","_section_style","section_layout"].includes(e))return;const n=this.getEditorControlView(this.getSettings("controls").displayConditions);if(!n)return;const o=r.$childViewContainer.find(this.getSettings("selectors").icon);this.highlightIcon(o,n)};onNavigatorInit(){elementor.navigator.indicators.displayConditions={icon:"flow",title:o("Display Conditions","elementor-pro"),settingKeys:["e_display_conditions"],section:"e_display_conditions_trigger"}}highlightIcon=(e,r)=>{if(!e[0])return;const n=r.getControlValue()||"[]";("[]"!==n?this._getStructuredConditions(JSON.parse(n)):[]).length?e[0]?.classList?.add("filled"):e[0]?.classList?.remove("filled")};doAjaxRequest=(e,r)=>{try{return new Promise(((n,o)=>{elementorCommon.ajax.addRequest(e,{data:r,error:()=>o(),success:e=>{n(e)}})}))}catch(e){return!1}};_getStructuredConditions=e=>this._shouldConvertConditionsStructure(e)?[e]:e;_shouldConvertConditionsStructure=e=>e.length&&!Array.isArray(e[0]);_getGroupedConditionKeys=e=>Object.keys(e?.groups||{}).reduce(((r,n)=>{const o=this._getConditionKeyByGroup(e.conditions,n);return o.length&&(r[n]=o),r}),{});_getConditionKeyByGroup=(e,r)=>Object.keys(e).filter((n=>r===e[n].group));_getFlattenedConditionOptions=e=>{const{conditions:r={},groups:n={}}=elementor.config.displayConditions||{};return Object.entries(e).reduce(((e,o)=>{let[i,a]=o;const s=a.map((e=>({key:e,label:r[e].label,isGroup:!1})));return e.push({key:i,label:n[i].label,isGroup:!0},...s),e}),[])}}r.default=Module},4372:(e,r,n)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.conditionsReducer=void 0,n(5724);var o=n(4934);r.conditionsReducer=(e,r)=>{switch(r.type){case o.ACTION_TYPES.CHANGE_CONDITION_TYPE:return{...e,selectedConditions:_changeConditionType({...e,...r})};case o.ACTION_TYPES.CHANGE_CONTROL_VALUE:return{...e,selectedConditions:_changeControlValue({...e,...r})};case o.ACTION_TYPES.ADD_AND_CONDITION:return{...e,selectedConditions:_addAndCondition({...e,...r})};case o.ACTION_TYPES.ADD_OR_CONDITION:return{...e,selectedConditions:[...e.selectedConditions,[r.andCondition]]};case o.ACTION_TYPES.REMOVE_AND_CONDITION:return{...e,selectedConditions:_removeAndCondition({...e,...r})};case o.ACTION_TYPES.REMOVE_OR_CONDITION:return{...e,selectedConditions:e.selectedConditions.filter(((e,n)=>n!==r.orConditionIndex))};case o.ACTION_TYPES.SET_ERRORS:return{...e,selectedConditions:_setErrors({...e,...r})};default:return e}};const _changeConditionType=e=>{let{selectedConditions:r,conditionToChange:n,orConditionIndex:o,andConditionIndex:i}=e;const a=r[o].map(((e,r)=>r===i?n:{...e}));return r.map(((e,r)=>r===o?a:[...e]))},_changeControlValue=e=>{let{selectedConditions:r,orConditionIndex:n,andConditionIndex:o,controlKey:i,value:a}=e;const s=[...r[n]],u={...{...s[o]},[i]:a},c=s.map(((e,r)=>r===o?u:{...e}));return r.map(((e,r)=>r===n?c:[...e]))},_addAndCondition=e=>{let{selectedConditions:r,orConditionIndex:n,andConditionIndex:o,andCondition:i}=e;const a=r[n],s=a.reduce(((e,r,n)=>(e.push({...r}),(n===o||a.length===o&&a.length-1===n)&&e.push(i),e)),[]);return r.map(((e,r)=>r===n?s:[...e]))},_removeAndCondition=e=>{let{selectedConditions:r,orConditionIndex:n,andConditionIndex:o}=e;const i=r[n].reduce(((e,r,n)=>(n!==o&&e.push({...r}),e)),[]);return r.reduce(((e,r,o)=>(o===n&&i.length&&e.push(i),o!==n&&e.push([...r]),e)),[])},_setErrors=e=>{let{selectedConditions:r,orConditionIndex:n,andConditionIndex:o,errors:i}=e;const a=[...r[n]],s={...a[o]};return s.errors={...s.errors,...i},a[o]=s,r.map(((e,r)=>r===n?[...a]:[...e]))}},4934:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.DISABLED_CONTROL_CONFIG=r.DEFAULT_CONTROL_VALUES=r.CONTROL_TYPES=r.ACTION_TYPES=void 0;r.CONTROL_TYPES={MULTIPLE_SELECT:"select2",SELECT:"select",QUERY:"query",DATE_TIME:"date_time",TEXT_FIELD:"text"},r.DEFAULT_CONTROL_VALUES={select2:[],query:[],select:"",text:"",date_time:null},r.ACTION_TYPES={CHANGE_CONTROL_VALUE:"CHANGE_CONTROL_VALUE",SET_ERRORS:"SET_ERRORS",ADD_OR_CONDITION:"ADD_OR_CONDITION",CHANGE_CONDITION_TYPE:"CHANGE_CONDITION_TYPE",ADD_AND_CONDITION:"ADD_AND_CONDITION",REMOVE_AND_CONDITION:"REMOVE_AND_CONDITION",REMOVE_OR_CONDITION:"REMOVE_OR_CONDITION"},r.DISABLED_CONTROL_CONFIG={CONDITION_NAME:"dynamic_tags",CONTROL_NAME:"dynamic_tag_value",COMPARATORS:["is_empty","is_not_empty"]}},3726:(e,r,n)=>{"use strict";var o=n(2470).__;Object.defineProperty(r,"__esModule",{value:!0}),r.getControlDefaults=r.getConditionInitialState=void 0,r.getControlValue=function getControlValue(e,r){return void 0!==e?e:r},r.getControlValueMaxWidth=function getControlValueMaxWidth(e){return 3===e?190:135},r.getDefaultActiveCondition=function getDefaultActiveCondition(e){return Object.values(e)[0][0]},r.getInvalidInputFeedback=getInvalidInputFeedback,r.getSelectOptionMaxWidth=function getSelectOptionMaxWidth(e){return 3===e?200:150},r.hasDecimalSeparator=function hasDecimalSeparator(e){if(isNaN(parseFloat(e)))return!1;if(-1!==e.toString().indexOf("."))return!0;if(-1!==e.toString().indexOf(","))return!0},r.shouldCastToArray=shouldCastToArray,r.shouldDisableControl=function shouldDisableControl(e,r){return i.DISABLED_CONTROL_CONFIG.CONTROL_NAME===e&&i.DISABLED_CONTROL_CONFIG.COMPARATORS.includes(r)},r.shouldEmptyValuePassValidation=function shouldEmptyValuePassValidation(e,r){return i.DISABLED_CONTROL_CONFIG.CONDITION_NAME===e&&i.DISABLED_CONTROL_CONFIG.COMPARATORS.includes(r)},n(6281);var i=n(4934);function shouldCastToArray(e){return i.CONTROL_TYPES.MULTIPLE_SELECT===e||i.CONTROL_TYPES.QUERY===e}function getInvalidInputFeedback(e,r,n){let o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return n?.length?{}:{message:_getErrorMessage(e,r),shouldShow:o}}const getControlDefaults=(e,r)=>{const{type:n,variant:o=null,options:a}=r,s=r?.default||(a&&i.CONTROL_TYPES.MULTIPLE_SELECT!==n?Object.keys(a)[0]:i.DEFAULT_CONTROL_VALUES[n]),u=shouldCastToArray(n)&&!Array.isArray(s)?[s]:s;return{defaultValue:u,error:getInvalidInputFeedback(n,o,u)}};r.getControlDefaults=getControlDefaults;function _getErrorMessage(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return shouldCastToArray(e)?o("Select an option","elementor-pro"):i.CONTROL_TYPES.DATE_TIME===e?o("time"===r?"Select a time":"Select a date","elementor-pro"):o("Enter a value","elementor-pro")}r.getConditionInitialState=(e,r)=>{const{controls:n={}}=e?.[r]||{};return Object.keys(n).reduce(((e,r)=>{if("__settings"===r)return e;const{defaultValue:o,error:i}=getControlDefaults(0,n[r]);return e[r]=o,e.errors[r]=i,e}),{errors:{}})}},5285:function(e){e.exports=function(){"use strict";var e=1e3,r=6e4,n=36e5,o="millisecond",i="second",a="minute",s="hour",u="day",c="week",f="month",p="quarter",g="year",C="date",v="Invalid Date",_=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,x={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var r=["th","st","nd","rd"],n=e%100;return"["+e+(r[(n-20)%10]||r[n]||r[0])+"]"}},m=function(e,r,n){var o=String(e);return!o||o.length>=r?e:""+Array(r+1-o.length).join(n)+e},E={s:m,z:function(e){var r=-e.utcOffset(),n=Math.abs(r),o=Math.floor(n/60),i=n%60;return(r<=0?"+":"-")+m(o,2,"0")+":"+m(i,2,"0")},m:function t(e,r){if(e.date()1)return t(a[0])}else{var s=e.name;w[s]=e,o=s}return!n&&o&&(R=o),o||!n&&R},O=function(e,r){if(S(e))return e.clone();var n="object"==typeof r?r:{};return n.date=e,n.args=arguments,new I(n)},T=E;T.l=j,T.i=S,T.w=function(e,r){return O(e,{locale:r.$L,utc:r.$u,x:r.$x,$offset:r.$offset})};var I=function(){function M(e){this.$L=j(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[P]=!0}var x=M.prototype;return x.parse=function(e){this.$d=function(e){var r=e.date,n=e.utc;if(null===r)return new Date(NaN);if(T.u(r))return new Date;if(r instanceof Date)return new Date(r);if("string"==typeof r&&!/Z$/i.test(r)){var o=r.match(_);if(o){var i=o[2]-1||0,a=(o[7]||"0").substring(0,3);return n?new Date(Date.UTC(o[1],i,o[3]||1,o[4]||0,o[5]||0,o[6]||0,a)):new Date(o[1],i,o[3]||1,o[4]||0,o[5]||0,o[6]||0,a)}}return new Date(r)}(e),this.init()},x.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},x.$utils=function(){return T},x.isValid=function(){return!(this.$d.toString()===v)},x.isSame=function(e,r){var n=O(e);return this.startOf(r)<=n&&n<=this.endOf(r)},x.isAfter=function(e,r){return O(e){"use strict";var o=n(6441);function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction,e.exports=function(){function shim(e,r,n,i,a,s){if(s!==o){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function getShim(){return shim}shim.isRequired=shim;var e={array:shim,bigint:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return e.PropTypes=e,e}},2688:(e,r,n)=>{e.exports=n(362)()},6441:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},1594:e=>{"use strict";e.exports=React},4048:e=>{"use strict";e.exports=elementorV2.icons},6956:e=>{"use strict";e.exports=elementorV2.ui},2470:e=>{"use strict";e.exports=wp.i18n},8304:e=>{function _extends(){return e.exports=_extends=Object.assign?Object.assign.bind():function(e){for(var r=1;r{e.exports=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports},8120:(e,r,n)=>{"use strict";var o=n(1483),i=n(8761),a=TypeError;e.exports=function(e){if(o(e))return e;throw new a(i(e)+" is not a function")}},7095:(e,r,n)=>{"use strict";var o=n(1),i=n(5290),a=n(5835).f,s=o("unscopables"),u=Array.prototype;void 0===u[s]&&a(u,s,{configurable:!0,value:i(null)}),e.exports=function(e){u[s][e]=!0}},2293:(e,r,n)=>{"use strict";var o=n(1704),i=String,a=TypeError;e.exports=function(e){if(o(e))return e;throw new a(i(e)+" is not an object")}},6651:(e,r,n)=>{"use strict";var o=n(5599),i=n(3392),a=n(6960),createMethod=function(e){return function(r,n,s){var u=o(r),c=a(u);if(0===c)return!e&&-1;var f,p=i(s,c);if(e&&n!=n){for(;c>p;)if((f=u[p++])!=f)return!0}else for(;c>p;p++)if((e||p in u)&&u[p]===n)return e||p||0;return!e&&-1}};e.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},9273:(e,r,n)=>{"use strict";var o=n(382),i=n(4914),a=TypeError,s=Object.getOwnPropertyDescriptor,u=o&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}();e.exports=u?function(e,r){if(i(e)&&!s(e,"length").writable)throw new a("Cannot set read only .length");return e.length=r}:function(e,r){return e.length=r}},1278:(e,r,n)=>{"use strict";var o=n(4762),i=o({}.toString),a=o("".slice);e.exports=function(e){return a(i(e),8,-1)}},6726:(e,r,n)=>{"use strict";var o=n(5755),i=n(9497),a=n(4961),s=n(5835);e.exports=function(e,r,n){for(var u=i(r),c=s.f,f=a.f,p=0;p{"use strict";var o=n(382),i=n(5835),a=n(7738);e.exports=o?function(e,r,n){return i.f(e,r,a(1,n))}:function(e,r,n){return e[r]=n,e}},7738:e=>{"use strict";e.exports=function(e,r){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:r}}},7914:(e,r,n)=>{"use strict";var o=n(1483),i=n(5835),a=n(169),s=n(2095);e.exports=function(e,r,n,u){u||(u={});var c=u.enumerable,f=void 0!==u.name?u.name:r;if(o(n)&&a(n,f,u),u.global)c?e[r]=n:s(r,n);else{try{u.unsafe?e[r]&&(c=!0):delete e[r]}catch(e){}c?e[r]=n:i.f(e,r,{value:n,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return e}},2095:(e,r,n)=>{"use strict";var o=n(5578),i=Object.defineProperty;e.exports=function(e,r){try{i(o,e,{value:r,configurable:!0,writable:!0})}catch(n){o[e]=r}return r}},382:(e,r,n)=>{"use strict";var o=n(8473);e.exports=!o((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))},3145:(e,r,n)=>{"use strict";var o=n(5578),i=n(1704),a=o.document,s=i(a)&&i(a.createElement);e.exports=function(e){return s?a.createElement(e):{}}},1091:e=>{"use strict";var r=TypeError;e.exports=function(e){if(e>9007199254740991)throw r("Maximum allowed index exceeded");return e}},4741:e=>{"use strict";e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},9461:(e,r,n)=>{"use strict";var o=n(5578).navigator,i=o&&o.userAgent;e.exports=i?String(i):""},6477:(e,r,n)=>{"use strict";var o,i,a=n(5578),s=n(9461),u=a.process,c=a.Deno,f=u&&u.versions||c&&c.version,p=f&&f.v8;p&&(i=(o=p.split("."))[0]>0&&o[0]<4?1:+(o[0]+o[1])),!i&&s&&(!(o=s.match(/Edge\/(\d+)/))||o[1]>=74)&&(o=s.match(/Chrome\/(\d+)/))&&(i=+o[1]),e.exports=i},8612:(e,r,n)=>{"use strict";var o=n(5578),i=n(4961).f,a=n(9037),s=n(7914),u=n(2095),c=n(6726),f=n(8730);e.exports=function(e,r){var n,p,g,C,v,_=e.target,b=e.global,x=e.stat;if(n=b?o:x?o[_]||u(_,{}):o[_]&&o[_].prototype)for(p in r){if(C=r[p],g=e.dontCallGetSet?(v=i(n,p))&&v.value:n[p],!f(b?p:_+(x?".":"#")+p,e.forced)&&void 0!==g){if(typeof C==typeof g)continue;c(C,g)}(e.sham||g&&g.sham)&&a(C,"sham",!0),s(n,p,C,e)}}},8473:e=>{"use strict";e.exports=function(e){try{return!!e()}catch(e){return!0}}},274:(e,r,n)=>{"use strict";var o=n(8473);e.exports=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},1807:(e,r,n)=>{"use strict";var o=n(274),i=Function.prototype.call;e.exports=o?i.bind(i):function(){return i.apply(i,arguments)}},2048:(e,r,n)=>{"use strict";var o=n(382),i=n(5755),a=Function.prototype,s=o&&Object.getOwnPropertyDescriptor,u=i(a,"name"),c=u&&"something"===function something(){}.name,f=u&&(!o||o&&s(a,"name").configurable);e.exports={EXISTS:u,PROPER:c,CONFIGURABLE:f}},4762:(e,r,n)=>{"use strict";var o=n(274),i=Function.prototype,a=i.call,s=o&&i.bind.bind(a,a);e.exports=o?s:function(e){return function(){return a.apply(e,arguments)}}},1409:(e,r,n)=>{"use strict";var o=n(5578),i=n(1483);e.exports=function(e,r){return arguments.length<2?(n=o[e],i(n)?n:void 0):o[e]&&o[e][r];var n}},2564:(e,r,n)=>{"use strict";var o=n(8120),i=n(5983);e.exports=function(e,r){var n=e[r];return i(n)?void 0:o(n)}},5578:function(e,r,n){"use strict";var check=function(e){return e&&e.Math===Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof n.g&&n.g)||check("object"==typeof this&&this)||function(){return this}()||Function("return this")()},5755:(e,r,n)=>{"use strict";var o=n(4762),i=n(2347),a=o({}.hasOwnProperty);e.exports=Object.hasOwn||function hasOwn(e,r){return a(i(e),r)}},1507:e=>{"use strict";e.exports={}},2811:(e,r,n)=>{"use strict";var o=n(1409);e.exports=o("document","documentElement")},1799:(e,r,n)=>{"use strict";var o=n(382),i=n(8473),a=n(3145);e.exports=!o&&!i((function(){return 7!==Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},2121:(e,r,n)=>{"use strict";var o=n(4762),i=n(8473),a=n(1278),s=Object,u=o("".split);e.exports=i((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"===a(e)?u(e,""):s(e)}:s},7268:(e,r,n)=>{"use strict";var o=n(4762),i=n(1483),a=n(1831),s=o(Function.toString);i(a.inspectSource)||(a.inspectSource=function(e){return s(e)}),e.exports=a.inspectSource},4483:(e,r,n)=>{"use strict";var o,i,a,s=n(4644),u=n(5578),c=n(1704),f=n(9037),p=n(5755),g=n(1831),C=n(5409),v=n(1507),_="Object already initialized",b=u.TypeError,x=u.WeakMap;if(s||g.state){var E=g.state||(g.state=new x);E.get=E.get,E.has=E.has,E.set=E.set,o=function(e,r){if(E.has(e))throw new b(_);return r.facade=e,E.set(e,r),r},i=function(e){return E.get(e)||{}},a=function(e){return E.has(e)}}else{var R=C("state");v[R]=!0,o=function(e,r){if(p(e,R))throw new b(_);return r.facade=e,f(e,R,r),r},i=function(e){return p(e,R)?e[R]:{}},a=function(e){return p(e,R)}}e.exports={set:o,get:i,has:a,enforce:function(e){return a(e)?i(e):o(e,{})},getterFor:function(e){return function(r){var n;if(!c(r)||(n=i(r)).type!==e)throw new b("Incompatible receiver, "+e+" required");return n}}}},4914:(e,r,n)=>{"use strict";var o=n(1278);e.exports=Array.isArray||function isArray(e){return"Array"===o(e)}},1483:e=>{"use strict";var r="object"==typeof document&&document.all;e.exports=void 0===r&&void 0!==r?function(e){return"function"==typeof e||e===r}:function(e){return"function"==typeof e}},8730:(e,r,n)=>{"use strict";var o=n(8473),i=n(1483),a=/#|\.prototype\./,isForced=function(e,r){var n=u[s(e)];return n===f||n!==c&&(i(r)?o(r):!!r)},s=isForced.normalize=function(e){return String(e).replace(a,".").toLowerCase()},u=isForced.data={},c=isForced.NATIVE="N",f=isForced.POLYFILL="P";e.exports=isForced},5983:e=>{"use strict";e.exports=function(e){return null==e}},1704:(e,r,n)=>{"use strict";var o=n(1483);e.exports=function(e){return"object"==typeof e?null!==e:o(e)}},9557:e=>{"use strict";e.exports=!1},1423:(e,r,n)=>{"use strict";var o=n(1409),i=n(1483),a=n(4815),s=n(5022),u=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var r=o("Symbol");return i(r)&&a(r.prototype,u(e))}},6960:(e,r,n)=>{"use strict";var o=n(8324);e.exports=function(e){return o(e.length)}},169:(e,r,n)=>{"use strict";var o=n(4762),i=n(8473),a=n(1483),s=n(5755),u=n(382),c=n(2048).CONFIGURABLE,f=n(7268),p=n(4483),g=p.enforce,C=p.get,v=String,_=Object.defineProperty,b=o("".slice),x=o("".replace),E=o([].join),R=u&&!i((function(){return 8!==_((function(){}),"length",{value:8}).length})),w=String(String).split("String"),P=e.exports=function(e,r,n){"Symbol("===b(v(r),0,7)&&(r="["+x(v(r),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(r="get "+r),n&&n.setter&&(r="set "+r),(!s(e,"name")||c&&e.name!==r)&&(u?_(e,"name",{value:r,configurable:!0}):e.name=r),R&&n&&s(n,"arity")&&e.length!==n.arity&&_(e,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?u&&_(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var o=g(e);return s(o,"source")||(o.source=E(w,"string"==typeof r?r:"")),e};Function.prototype.toString=P((function toString(){return a(this)&&C(this).source||f(this)}),"toString")},1703:e=>{"use strict";var r=Math.ceil,n=Math.floor;e.exports=Math.trunc||function trunc(e){var o=+e;return(o>0?n:r)(o)}},5290:(e,r,n)=>{"use strict";var o,i=n(2293),a=n(5799),s=n(4741),u=n(1507),c=n(2811),f=n(3145),p=n(5409),g="prototype",C="script",v=p("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"<"+C+">"+e+""},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var r=e.parentWindow.Object;return e=null,r},NullProtoObject=function(){try{o=new ActiveXObject("htmlfile")}catch(e){}var e,r,n;NullProtoObject="undefined"!=typeof document?document.domain&&o?NullProtoObjectViaActiveX(o):(r=f("iframe"),n="java"+C+":",r.style.display="none",c.appendChild(r),r.src=String(n),(e=r.contentWindow.document).open(),e.write(scriptTag("document.F=Object")),e.close(),e.F):NullProtoObjectViaActiveX(o);for(var i=s.length;i--;)delete NullProtoObject[g][s[i]];return NullProtoObject()};u[v]=!0,e.exports=Object.create||function create(e,r){var n;return null!==e?(EmptyConstructor[g]=i(e),n=new EmptyConstructor,EmptyConstructor[g]=null,n[v]=e):n=NullProtoObject(),void 0===r?n:a.f(n,r)}},5799:(e,r,n)=>{"use strict";var o=n(382),i=n(3896),a=n(5835),s=n(2293),u=n(5599),c=n(3658);r.f=o&&!i?Object.defineProperties:function defineProperties(e,r){s(e);for(var n,o=u(r),i=c(r),f=i.length,p=0;f>p;)a.f(e,n=i[p++],o[n]);return e}},5835:(e,r,n)=>{"use strict";var o=n(382),i=n(1799),a=n(3896),s=n(2293),u=n(3815),c=TypeError,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,g="enumerable",C="configurable",v="writable";r.f=o?a?function defineProperty(e,r,n){if(s(e),r=u(r),s(n),"function"==typeof e&&"prototype"===r&&"value"in n&&v in n&&!n[v]){var o=p(e,r);o&&o[v]&&(e[r]=n.value,n={configurable:C in n?n[C]:o[C],enumerable:g in n?n[g]:o[g],writable:!1})}return f(e,r,n)}:f:function defineProperty(e,r,n){if(s(e),r=u(r),s(n),i)try{return f(e,r,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[r]=n.value),e}},4961:(e,r,n)=>{"use strict";var o=n(382),i=n(1807),a=n(7611),s=n(7738),u=n(5599),c=n(3815),f=n(5755),p=n(1799),g=Object.getOwnPropertyDescriptor;r.f=o?g:function getOwnPropertyDescriptor(e,r){if(e=u(e),r=c(r),p)try{return g(e,r)}catch(e){}if(f(e,r))return s(!i(a.f,e,r),e[r])}},2278:(e,r,n)=>{"use strict";var o=n(6742),i=n(4741).concat("length","prototype");r.f=Object.getOwnPropertyNames||function getOwnPropertyNames(e){return o(e,i)}},4347:(e,r)=>{"use strict";r.f=Object.getOwnPropertySymbols},4815:(e,r,n)=>{"use strict";var o=n(4762);e.exports=o({}.isPrototypeOf)},6742:(e,r,n)=>{"use strict";var o=n(4762),i=n(5755),a=n(5599),s=n(6651).indexOf,u=n(1507),c=o([].push);e.exports=function(e,r){var n,o=a(e),f=0,p=[];for(n in o)!i(u,n)&&i(o,n)&&c(p,n);for(;r.length>f;)i(o,n=r[f++])&&(~s(p,n)||c(p,n));return p}},3658:(e,r,n)=>{"use strict";var o=n(6742),i=n(4741);e.exports=Object.keys||function keys(e){return o(e,i)}},7611:(e,r)=>{"use strict";var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,i=o&&!n.call({1:2},1);r.f=i?function propertyIsEnumerable(e){var r=o(this,e);return!!r&&r.enumerable}:n},348:(e,r,n)=>{"use strict";var o=n(1807),i=n(1483),a=n(1704),s=TypeError;e.exports=function(e,r){var n,u;if("string"===r&&i(n=e.toString)&&!a(u=o(n,e)))return u;if(i(n=e.valueOf)&&!a(u=o(n,e)))return u;if("string"!==r&&i(n=e.toString)&&!a(u=o(n,e)))return u;throw new s("Can't convert object to primitive value")}},9497:(e,r,n)=>{"use strict";var o=n(1409),i=n(4762),a=n(2278),s=n(4347),u=n(2293),c=i([].concat);e.exports=o("Reflect","ownKeys")||function ownKeys(e){var r=a.f(u(e)),n=s.f;return n?c(r,n(e)):r}},3312:(e,r,n)=>{"use strict";var o=n(5983),i=TypeError;e.exports=function(e){if(o(e))throw new i("Can't call method on "+e);return e}},5409:(e,r,n)=>{"use strict";var o=n(7255),i=n(1866),a=o("keys");e.exports=function(e){return a[e]||(a[e]=i(e))}},1831:(e,r,n)=>{"use strict";var o=n(9557),i=n(5578),a=n(2095),s="__core-js_shared__",u=e.exports=i[s]||a(s,{});(u.versions||(u.versions=[])).push({version:"3.38.1",mode:o?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"})},7255:(e,r,n)=>{"use strict";var o=n(1831);e.exports=function(e,r){return o[e]||(o[e]=r||{})}},6029:(e,r,n)=>{"use strict";var o=n(6477),i=n(8473),a=n(5578).String;e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol("symbol detection");return!a(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&o&&o<41}))},3392:(e,r,n)=>{"use strict";var o=n(3005),i=Math.max,a=Math.min;e.exports=function(e,r){var n=o(e);return n<0?i(n+r,0):a(n,r)}},5599:(e,r,n)=>{"use strict";var o=n(2121),i=n(3312);e.exports=function(e){return o(i(e))}},3005:(e,r,n)=>{"use strict";var o=n(1703);e.exports=function(e){var r=+e;return r!=r||0===r?0:o(r)}},8324:(e,r,n)=>{"use strict";var o=n(3005),i=Math.min;e.exports=function(e){var r=o(e);return r>0?i(r,9007199254740991):0}},2347:(e,r,n)=>{"use strict";var o=n(3312),i=Object;e.exports=function(e){return i(o(e))}},2355:(e,r,n)=>{"use strict";var o=n(1807),i=n(1704),a=n(1423),s=n(2564),u=n(348),c=n(1),f=TypeError,p=c("toPrimitive");e.exports=function(e,r){if(!i(e)||a(e))return e;var n,c=s(e,p);if(c){if(void 0===r&&(r="default"),n=o(c,e,r),!i(n)||a(n))return n;throw new f("Can't convert object to primitive value")}return void 0===r&&(r="number"),u(e,r)}},3815:(e,r,n)=>{"use strict";var o=n(2355),i=n(1423);e.exports=function(e){var r=o(e,"string");return i(r)?r:r+""}},8761:e=>{"use strict";var r=String;e.exports=function(e){try{return r(e)}catch(e){return"Object"}}},1866:(e,r,n)=>{"use strict";var o=n(4762),i=0,a=Math.random(),s=o(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++i+a,36)}},5022:(e,r,n)=>{"use strict";var o=n(6029);e.exports=o&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3896:(e,r,n)=>{"use strict";var o=n(382),i=n(8473);e.exports=o&&i((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4644:(e,r,n)=>{"use strict";var o=n(5578),i=n(1483),a=o.WeakMap;e.exports=i(a)&&/native code/.test(String(a))},1:(e,r,n)=>{"use strict";var o=n(5578),i=n(7255),a=n(5755),s=n(1866),u=n(6029),c=n(5022),f=o.Symbol,p=i("wks"),g=c?f.for||f:f&&f.withoutSetter||s;e.exports=function(e){return a(p,e)||(p[e]=u&&a(f,e)?f[e]:g("Symbol."+e)),p[e]}},6281:(e,r,n)=>{"use strict";var o=n(8612),i=n(6651).includes,a=n(8473),s=n(7095);o({target:"Array",proto:!0,forced:a((function(){return!Array(1).includes()}))},{includes:function includes(e){return i(this,e,arguments.length>1?arguments[1]:void 0)}}),s("includes")},5724:(e,r,n)=>{"use strict";var o=n(8612),i=n(2347),a=n(6960),s=n(9273),u=n(1091);o({target:"Array",proto:!0,arity:1,forced:n(8473)((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function push(e){var r=i(this),n=a(r),o=arguments.length;u(n+o);for(var c=0;c{"use strict";new(__webpack_require__(6784)(__webpack_require__(9097)).default)})()})();/** * External dependencies */ import { __ } from '@wordpress/i18n'; import EditProductLink from '@woocommerce/editor-components/edit-product-link'; import { useProductDataContext } from '@woocommerce/shared-context'; import classnames from 'classnames'; import { Disabled, PanelBody, ToggleControl, Notice, } from '@wordpress/components'; import { InspectorControls } from '@wordpress/block-editor'; import { productSupportsAddToCartForm } from '@woocommerce/base-utils'; /** * Internal dependencies */ import './style.scss'; import Block from './block'; import withProductSelector from '../shared/with-product-selector'; import { BLOCK_TITLE, BLOCK_ICON } from './constants'; const Edit = ( { attributes, setAttributes } ) => { const { product } = useProductDataContext(); const { className, showFormElements } = attributes; return (
{ productSupportsAddToCartForm( product ) ? ( setAttributes( { showFormElements: ! showFormElements, } ) } /> ) : ( { __( 'This product does not support the block based add to cart form. A link to the product page will be shown instead.', 'woocommerce' ) } ) }
); }; export default withProductSelector( { icon: BLOCK_ICON, label: BLOCK_TITLE, description: __( 'Choose a product to display its add to cart form.', 'woocommerce' ), } )( Edit ); /** * List block tracker for UUID-aware list editing and serialization. * * Dependencies: wp.blocks, SFE.ElementPrep * Exposes: SFE.ListBlockTracker */ (function() { 'use strict'; window.MWP = window.MWP || {}; window.MWP.SFE = window.MWP.SFE || {}; const SFE = window.MWP.SFE; SFE.ManagerData = SFE.ManagerData || {}; const { createBlock, serialize: serializeBlocks } = window.wp?.blocks || {}; const UUID_ATTR_KEYS = ['mwpSfeUuid', 'mwpSfeUuidShadow']; const LIST_ITEM_TEXT_ATTR = 'data-mwp-sfe-list-item-text'; const LIST_ITEM_TEXT_CLASS = 'mwp-sfe-list-item-text'; const PLACEHOLDER_ATTR = 'data-rich-text-placeholder'; const LIST_ID_ATTR = 'data-list-id'; const LIST_ITEM_ID_ATTR = 'data-item-id'; const LIST_RUNTIME_UUID_ATTR = 'data-mwp-sfe-list-runtime-uuid'; const LIST_ITEM_RUNTIME_UUID_ATTR = 'data-mwp-sfe-list-item-runtime-uuid'; /** * Return whether one node is a nested list element. * * @param {Node|null} node Candidate DOM node. * @returns {boolean} True when the node is a nested list. */ function isNestedListNode(node) { return !!( node && node.nodeType === Node.ELEMENT_NODE && (node.tagName === 'UL' || node.tagName === 'OL') ); } /** * Return whether one node is ignorable formatting whitespace between list * structures. * * Pretty-printed block markup often leaves direct `\n` text nodes between a * list item's own text and its nested child list. Those nodes should not be * moved into the direct text surface because they become visible editing * artifacts once wrapped. * * @param {Node|null} node Candidate DOM node. * @returns {boolean} True when the node is ignorable whitespace. */ function isIgnorableListWhitespaceNode(node) { return !!( node && node.nodeType === Node.TEXT_NODE && String(node.textContent || '') .replace(/\uFEFF/g, '') .replace(/\u00A0/g, ' ') .trim() .length === 0 ); } /** * Return the direct inline text surface for one list item. * * @param {HTMLLIElement|null} liElement Candidate list item. * @returns {HTMLElement|null} Existing direct text surface, if any. */ function getDirectItemTextSurface(liElement) { if (!liElement || liElement.nodeType !== Node.ELEMENT_NODE || liElement.tagName !== 'LI') { return null; } return Array.from(liElement.children || []).find(child => ( child && child.nodeType === Node.ELEMENT_NODE && child.getAttribute(LIST_ITEM_TEXT_ATTR) === '1' )) || null; } /** * Return the DOM attribute name that stores one session-scoped runtime UUID. * * Runtime UUIDs are distinct from the existing serialization/attr UUIDs. They * exist only while the editor session is open so external callers can point at * the current live list cursor/target without having to manage shifting paths. * * @param {string} type Supported runtime identity type. * @returns {string} Attribute name, or an empty string for invalid types. */ function getRuntimeUuidAttributeName(type) { if (type === 'list') { return LIST_RUNTIME_UUID_ATTR; } if (type === 'item') { return LIST_ITEM_RUNTIME_UUID_ATTR; } return ''; } /** * Normalize one runtime UUID candidate. * * @param {*} value Candidate runtime UUID. * @returns {string} Trimmed runtime UUID, or an empty string. */ function normalizeRuntimeUuid(value) { return String(value || '').trim(); } /** * Return whether one element matches the requested runtime-identity type. * * @param {Element|null} element Candidate DOM element. * @param {string} type Supported runtime identity type. * @returns {boolean} True when the element matches the type. */ function isRuntimeIdentityElement(element, type) { if (!element || element.nodeType !== Node.ELEMENT_NODE) { return false; } if (type === 'list') { return element.tagName === 'UL' || element.tagName === 'OL'; } if (type === 'item') { return element.tagName === 'LI'; } return false; } /** * Return one tracked element by runtime UUID from the live DOM. * * This intentionally queries the current DOM first instead of trusting only a * cached map so history restores and other structural replacements can keep * runtime UUID resolution stable as long as the attributes remain present. * * @param {Object|null} tracker Active list tracker. * @param {string} runtimeUuid Session-scoped runtime UUID. * @param {string} type Supported runtime identity type. * @returns {Element|null} Matching live DOM element. */ function findElementByRuntimeUuid(tracker, runtimeUuid, type) { const normalizedRuntimeUuid = normalizeRuntimeUuid(runtimeUuid); const attrName = getRuntimeUuidAttributeName(type); if ( !tracker?.listElement || !normalizedRuntimeUuid || !attrName || !isRuntimeIdentityElement(tracker.listElement, 'list') ) { return null; } if ( type === 'list' && tracker.listElement.getAttribute(attrName) === normalizedRuntimeUuid ) { return tracker.listElement; } try { const selector = `[${attrName}="${CSS.escape(normalizedRuntimeUuid)}"]`; return tracker.listElement.querySelector(selector); } catch (error) { const escapedUuid = normalizedRuntimeUuid.replace(/"/g, '\\"'); return tracker.listElement.querySelector(`[${attrName}="${escapedUuid}"]`); } } /** * Return every direct text surface currently attached to one list item. * * Merge/delete flows can temporarily move multiple direct text surfaces into * the same list item. The shared list normalizer must collapse them back to * one canonical surface before placeholder syncing or serialization. * * @param {HTMLLIElement|null} liElement Candidate list item. * @returns {HTMLElement[]} Direct text surfaces in DOM order. */ function getAllDirectItemTextSurfaces(liElement) { if (!liElement || liElement.nodeType !== Node.ELEMENT_NODE || liElement.tagName !== 'LI') { return []; } return Array.from(liElement.children || []).filter(child => ( child && child.nodeType === Node.ELEMENT_NODE && child.getAttribute(LIST_ITEM_TEXT_ATTR) === '1' )); } /** * Return whether one node is only placeholder/caret scaffolding. * * Duplicate direct text surfaces may carry empty placeholder anchors or * caret `
` nodes. Those artifacts should be dropped when collapsing * duplicate surfaces instead of being concatenated into visible stacks. * * @param {Node|null} node Candidate DOM node. * @returns {boolean} True when the node is redundant placeholder UI. */ function isRedundantSurfaceArtifact(node) { if (!node) { return true; } if (isIgnorableListWhitespaceNode(node)) { return true; } if (node.nodeType === Node.TEXT_NODE) { return String(node.textContent || '') .replace(/\uFEFF/g, '') .replace(/\u00A0/g, ' ') .trim() .length === 0; } if (node.nodeType !== Node.ELEMENT_NODE) { return false; } if (node.tagName === 'BR') { return true; } return !!node.hasAttribute?.(PLACEHOLDER_ATTR); } /** * Ensure one list item owns one direct inline text surface. * * The root list remains the single live editor host, but this wrapper gives * schema/ABE flows one stable DOM surface per list item's own text content. * * @param {HTMLLIElement|null} liElement Candidate list item. * @returns {HTMLElement|null} Ensured direct text surface. */ function ensureDirectItemTextSurface(liElement) { if (!liElement || liElement.nodeType !== Node.ELEMENT_NODE || liElement.tagName !== 'LI') { return null; } let surface = getDirectItemTextSurface(liElement); if (!surface) { surface = document.createElement('span'); surface.setAttribute(LIST_ITEM_TEXT_ATTR, '1'); surface.classList.add(LIST_ITEM_TEXT_CLASS); liElement.insertBefore( surface, Array.from(liElement.childNodes || []).find(isNestedListNode) || null ); } getAllDirectItemTextSurfaces(liElement) .filter(candidate => candidate && candidate !== surface) .forEach(duplicateSurface => { Array.from(duplicateSurface.childNodes || []).forEach(node => { if (isRedundantSurfaceArtifact(node)) { node.remove(); return; } surface.appendChild(node); }); duplicateSurface.remove(); }); const childNodes = Array.from(liElement.childNodes || []); childNodes.forEach(node => { if ( node && node !== surface && !isNestedListNode(node) && isIgnorableListWhitespaceNode(node) ) { node.remove(); } }); const movableNodes = childNodes.filter(node => { if (!node || node === surface || isNestedListNode(node)) { return false; } if (isIgnorableListWhitespaceNode(node)) { return false; } return !( node.nodeType === Node.ELEMENT_NODE && node.getAttribute?.(LIST_ITEM_TEXT_ATTR) === '1' ); }); movableNodes.forEach(node => surface.appendChild(node)); return surface; } /** * Clone list attrs while optionally stripping plugin UUID ownership. * * The outermost core/list is the only persisted UUID owner for an entire * list tree. Nested core/list blocks are structural children of that root. * If we preserve a nested list UUID here, one accidental assignment can be * re-serialized forever and split a single logical list into multiple * history/edit targets. Keep this guard unless the ownership model changes * everywhere else in PHP and JS at the same time. * * @param {Object} attrs Parsed Gutenberg attrs. * @param {boolean} allowUuidOwnership True for the root list only. * @returns {Object} Safe cloned attrs. */ function cloneListAttrs(attrs, allowUuidOwnership = true) { const clonedAttrs = JSON.parse(JSON.stringify(attrs || {})); if (allowUuidOwnership) { return clonedAttrs; } UUID_ATTR_KEYS.forEach(key => delete clonedAttrs[key]); return clonedAttrs; } /** * Return the direct list-item children for one list element. * * @param {HTMLElement|null} listElement Candidate list element. * @returns {HTMLLIElement[]} Direct child list items. */ function getDirectListItems(listElement) { if (!listElement || listElement.nodeType !== Node.ELEMENT_NODE) { return []; } return Array.from(listElement.children || []).filter(child => child.tagName === 'LI'); } /** * Normalize one path-like value into zero-based list indexes. * * Supported inputs: * - `0_1_2` * - `1.2.3` * - arrays of integers * * @param {string|Array|null} pathValue Candidate path value. * @returns {number[]|null} Parsed zero-based indexes. */ function normalizePathIndexes(pathValue) { if (Array.isArray(pathValue)) { const indexes = pathValue.map(value => Number.parseInt(value, 10)); return indexes.every(Number.isInteger) && indexes.every(index => index >= 0) ? indexes : null; } const raw = typeof pathValue === 'string' ? pathValue.trim() : ''; if (!raw) { return []; } const separator = raw.includes('.') ? '.' : '_'; const parts = raw.split(separator).filter(Boolean); if (!parts.length) { return []; } const indexes = parts.map(part => Number.parseInt(part, 10)); if (!indexes.every(Number.isInteger)) { return null; } if (separator === '.') { return indexes.every(index => index > 0) ? indexes.map(index => index - 1) : null; } return indexes.every(index => index >= 0) ? indexes : null; } /** * Convert one zero-based path index list into public path metadata. * * @param {number[]} indexes Zero-based indexes. * @returns {{path: string, pathLabel: string, depth: number}} Path metadata. */ function buildPathMeta(indexes) { const safeIndexes = Array.isArray(indexes) ? indexes.filter(Number.isInteger) : []; return { path: safeIndexes.join('_'), pathLabel: safeIndexes.map(index => index + 1).join('.'), depth: Math.max(0, safeIndexes.length - 1), }; } /** * Return the direct child list element for one list item. * * @param {HTMLLIElement|null} listItem Candidate list item. * @returns {HTMLElement|null} Direct nested list, if present. */ function getDirectChildList(listItem) { if (!listItem || listItem.nodeType !== Node.ELEMENT_NODE || listItem.tagName !== 'LI') { return null; } return Array.from(listItem.children || []).find(child => ( child.tagName === 'UL' || child.tagName === 'OL' )) || null; } /** * Return the preferred nested list tag for one list item. * * @param {Object|null} tracker Active list tracker. * @param {HTMLLIElement} listItem Parent list item. * @returns {string} `UL` or `OL`. */ function getPreferredChildListTagName(tracker, listItem) { const directChildList = getDirectChildList(listItem); if (directChildList) { return directChildList.tagName; } const parentList = listItem?.parentElement; if (parentList && (parentList.tagName === 'UL' || parentList.tagName === 'OL')) { return parentList.tagName; } return tracker?.listElement?.tagName === 'OL' ? 'OL' : 'UL'; } /** * Return one direct child list for a list item, creating it only when needed. * * Outdent can promote one item and then re-home its trailing siblings beneath * that promoted item. When the promoted item already owns a child list, those * siblings must be appended into the existing list so the DOM mirrors native * editor behavior instead of creating duplicate sibling list wrappers. * * @param {Object|null} tracker Active list tracker. * @param {HTMLLIElement} listItem Parent list item. * @param {string} preferredTagName Fallback list tag name. * @returns {HTMLElement|null} Direct child list element. */ function ensureDirectChildList(tracker, listItem, preferredTagName = '') { if (!listItem || listItem.nodeType !== Node.ELEMENT_NODE || listItem.tagName !== 'LI') { return null; } let childList = getDirectChildList(listItem); if (childList) { return childList; } childList = document.createElement( preferredTagName || getPreferredChildListTagName(tracker, listItem) ); childList.classList.add('wp-block-list'); listItem.appendChild(childList); return childList; } /** * Remove empty nested list wrappers up the ancestry chain. * * The root list element is never removed, even when it becomes empty. * * @param {Object|null} tracker Active list tracker. * @param {HTMLElement|null} startList First candidate nested list. * @returns {void} */ function cleanupEmptyAncestorLists(tracker, startList) { let currentList = startList; while ( currentList && currentList !== tracker?.listElement && currentList.nodeType === Node.ELEMENT_NODE && (currentList.tagName === 'UL' || currentList.tagName === 'OL') && !getDirectListItems(currentList).length ) { const parentItem = currentList.parentElement?.tagName === 'LI' ? currentList.parentElement : null; currentList.remove(); currentList = parentItem ? parentItem.parentElement : null; } } /** * Build one new list item element from a structural operation payload. * * @param {Object|null} operation Candidate operation payload. * @returns {HTMLLIElement} New list item element. */ function buildListItemFromOperation(operation) { const li = document.createElement('li'); const directSurface = ensureDirectItemTextSurface(li); const runtimeUuid = normalizeRuntimeUuid( operation?.itemUuid ?? operation?.newItemUuid ); const html = typeof operation?.contentHtml === 'string' ? operation.contentHtml : (typeof operation?.html === 'string' ? operation.html : ''); const text = typeof operation?.contentText === 'string' ? operation.contentText : (typeof operation?.text === 'string' ? operation.text : ''); if (html) { directSurface.innerHTML = html; } else if (text) { directSurface.textContent = text; } if (runtimeUuid) { li.setAttribute(LIST_ITEM_RUNTIME_UUID_ATTR, runtimeUuid); } return li; } /** * Copy one donor item's structural/style attributes onto the destination list * item while preserving the destination runtime UUID. * * Native Enter list splitting happens inside the browser's contenteditable * engine, so the new sibling inherits the source `li` element's attributes * such as class and style automatically. API-driven insert/move operations * should mirror that behavior by cloning the donor item's `li` attributes, * except for the session-scoped runtime UUID which must stay unique. * * @param {HTMLLIElement|null} listItem Destination list item. * @param {HTMLLIElement|null} donorItem Style/structure donor item. * @returns {void} */ function copyDonorItemAttributes(listItem, donorItem) { if ( !listItem || listItem.nodeType !== Node.ELEMENT_NODE || listItem.tagName !== 'LI' || !donorItem || donorItem.nodeType !== Node.ELEMENT_NODE || donorItem.tagName !== 'LI' ) { return; } const destinationRuntimeUuid = normalizeRuntimeUuid( listItem.getAttribute(LIST_ITEM_RUNTIME_UUID_ATTR) ); Array.from(listItem.attributes || []).forEach(attr => { if (attr?.name === LIST_ITEM_RUNTIME_UUID_ATTR) { return; } listItem.removeAttribute(attr.name); }); Array.from(donorItem.attributes || []).forEach(attr => { if (attr?.name === LIST_ITEM_RUNTIME_UUID_ATTR) { return; } listItem.setAttribute(attr.name, attr.value); }); if (destinationRuntimeUuid) { listItem.setAttribute(LIST_ITEM_RUNTIME_UUID_ATTR, destinationRuntimeUuid); } } /** * Reassign one list item's structural ID from its destination styling * context. * * When an explicit target item is known, its structural `data-item-id` * becomes the style donor for insert-before, insert-after, move-before, and * move-after commands. This keeps the inheritance rule simple and matches the * public API's explicit `targetItemUuid` model. * * For internal list-path insert/move cases that do not resolve through one * target item, fall back to the local destination neighbors. If there is no * neighboring item at all, clear the structural ID so the next tracker rebuild * seeds a fresh item identity instead of accidentally preserving source attrs. * * @param {HTMLLIElement|null} listItem Destination list item. * @param {HTMLLIElement|null} targetItem Explicit style donor item. * @returns {string} Applied structural ID or an empty string. */ function inheritDestinationItemId(listItem, targetItem = null) { if (!listItem || listItem.nodeType !== Node.ELEMENT_NODE || listItem.tagName !== 'LI') { return ''; } const explicitTargetItem = targetItem && targetItem.nodeType === Node.ELEMENT_NODE && targetItem.tagName === 'LI' ? targetItem : null; const previousItem = listItem.previousElementSibling?.tagName === 'LI' ? listItem.previousElementSibling : null; const nextItem = listItem.nextElementSibling?.tagName === 'LI' ? listItem.nextElementSibling : null; const inheritedId = normalizeRuntimeUuid( explicitTargetItem?.getAttribute(LIST_ITEM_ID_ATTR) || previousItem?.getAttribute(LIST_ITEM_ID_ATTR) || nextItem?.getAttribute(LIST_ITEM_ID_ATTR) ); if (inheritedId) { listItem.setAttribute(LIST_ITEM_ID_ATTR, inheritedId); return inheritedId; } listItem.removeAttribute(LIST_ITEM_ID_ATTR); return ''; } /** * Apply one remove-list-item operation. * * @param {Object|null} tracker Active list tracker. * @param {HTMLLIElement} listItem Target list item. * @returns {boolean} True when the mutation applied. */ function applyRemoveListItemOperation(tracker, listItem) { if (!tracker?.listElement || !listItem) { return false; } const oldParentList = listItem.parentElement; listItem.remove(); cleanupEmptyAncestorLists(tracker, oldParentList); return true; } /** * Apply one indent-list-item operation. * * @param {Object|null} tracker Active list tracker. * @param {HTMLLIElement} listItem Target list item. * @returns {boolean} True when the mutation applied. */ function applyIndentListItemOperation(tracker, listItem) { if (!tracker?.listElement || !listItem) { return false; } const previousItem = listItem.previousElementSibling?.tagName === 'LI' ? listItem.previousElementSibling : null; if (!previousItem) { return false; } const nestedList = ensureDirectChildList(tracker, previousItem); nestedList.appendChild(listItem); return true; } /** * Apply one outdent-list-item operation. * * @param {Object|null} tracker Active list tracker. * @param {HTMLLIElement} listItem Target list item. * @returns {boolean} True when the mutation applied. */ function applyOutdentListItemOperation(tracker, listItem) { if (!tracker?.listElement || !listItem) { return false; } const parentList = listItem.parentElement; const parentItem = parentList?.parentElement?.tagName === 'LI' ? parentList.parentElement : null; if (!parentList || !parentItem) { return false; } const ancestorList = parentItem.parentElement; const followingSiblings = []; let next = listItem.nextElementSibling; while (next) { followingSiblings.push(next); next = next.nextElementSibling; } ancestorList.insertBefore(listItem, parentItem.nextElementSibling); if (followingSiblings.length) { const nestedList = ensureDirectChildList(tracker, listItem, parentList.tagName); followingSiblings.forEach(sibling => nestedList.appendChild(sibling)); } cleanupEmptyAncestorLists(tracker, parentList); return true; } /** * Apply one toggle-list-type operation. * * @param {Object|null} tracker Active list tracker. * @param {Object} rawOperation Structural operation payload. * @param {Object} options Apply-operation options. * @returns {boolean} True when the mutation applied. */ function applyToggleListTypeOperation(tracker, rawOperation, options = {}) { if (!tracker?.listElement) { return false; } const listPath = rawOperation.listPath ?? rawOperation.list_path ?? ''; const targetList = getListByPath(tracker, listPath); const editorHost = options?.editorHost && typeof options.editorHost.changeListType === 'function' ? options.editorHost : null; const requestedType = targetList ? ( normalizeListTypeTagName( rawOperation.value ?? rawOperation.listType ?? rawOperation.list_type ?? rawOperation.ordered ) || (targetList.tagName === 'OL' ? 'UL' : 'OL') ) : ''; if ( !targetList || !requestedType || targetList.tagName === requestedType || !editorHost ) { return false; } const nextList = editorHost.changeListType(targetList, requestedType.toLowerCase(), { saveHistory: options.saveHistory !== false, restoreCursor: options.restoreCursor !== false, }); return !!nextList; } /** * Apply one update-list-item-text operation. * * @param {HTMLLIElement} listItem Target list item. * @param {Object} rawOperation Structural operation payload. * @returns {boolean} True when the mutation applied. */ function applyUpdateListItemTextOperation(listItem, rawOperation) { if (!listItem) { return false; } const directSurface = ensureDirectItemTextSurface(listItem); const html = typeof rawOperation?.contentHtml === 'string' ? rawOperation.contentHtml : (typeof rawOperation?.html === 'string' ? rawOperation.html : ''); const text = typeof rawOperation?.contentText === 'string' ? rawOperation.contentText : (typeof rawOperation?.text === 'string' ? rawOperation.text : ''); if (!directSurface) { return false; } directSurface.innerHTML = ''; if (html) { directSurface.innerHTML = html; } else if (text) { directSurface.textContent = text; } return true; } /** * Insert one new list item relative to explicit before/after/list anchors. * * @param {Object|null} tracker Active list tracker. * @param {Object} rawOperation Structural operation payload. * @param {Object} trackerApi List tracker API surface. * @returns {boolean} True when the mutation applied. */ function applyInsertListItemOperation(tracker, rawOperation, trackerApi) { if (!tracker?.listElement || !trackerApi) { return false; } const beforePath = rawOperation.beforePath ?? rawOperation.before_path ?? ''; const afterPath = rawOperation.afterPath ?? rawOperation.after_path ?? ''; const listPath = rawOperation.listPath ?? rawOperation.list_path ?? ''; const beforeItem = trackerApi.getItemByPath(tracker, beforePath); const afterItem = trackerApi.getItemByPath(tracker, afterPath); const newListItem = buildListItemFromOperation(rawOperation); if (beforeItem?.parentElement) { beforeItem.parentElement.insertBefore(newListItem, beforeItem); copyDonorItemAttributes(newListItem, beforeItem); inheritDestinationItemId(newListItem, beforeItem); return true; } if (afterItem?.parentElement) { afterItem.parentElement.insertBefore(newListItem, afterItem.nextElementSibling); copyDonorItemAttributes(newListItem, afterItem); inheritDestinationItemId(newListItem, afterItem); return true; } const targetList = getListByPath(tracker, listPath); if (!targetList) { return false; } const position = typeof rawOperation.position === 'string' ? rawOperation.position.trim().toLowerCase() : 'append'; if (position === 'prepend' && targetList.firstElementChild) { targetList.insertBefore(newListItem, targetList.firstElementChild); } else { targetList.appendChild(newListItem); } inheritDestinationItemId(newListItem); return true; } /** * Move one existing list item relative to explicit before/after/list anchors. * * @param {Object|null} tracker Active list tracker. * @param {HTMLLIElement} listItem Target list item. * @param {Object} rawOperation Structural operation payload. * @param {Object} trackerApi List tracker API surface. * @returns {boolean} True when the mutation applied. */ function applyMoveListItemOperation(tracker, listItem, rawOperation, trackerApi) { if (!tracker?.listElement || !listItem || !trackerApi) { return false; } const beforePath = rawOperation.beforePath ?? rawOperation.before_path ?? ''; const afterPath = rawOperation.afterPath ?? rawOperation.after_path ?? ''; const listPath = rawOperation.listPath ?? rawOperation.list_path ?? ''; const beforeItem = trackerApi.getItemByPath(tracker, beforePath); const afterItem = trackerApi.getItemByPath(tracker, afterPath); const oldParentList = listItem.parentElement; let didApply = false; if (beforeItem && beforeItem !== listItem && !listItem.contains(beforeItem)) { beforeItem.parentElement.insertBefore(listItem, beforeItem); copyDonorItemAttributes(listItem, beforeItem); inheritDestinationItemId(listItem, beforeItem); didApply = true; } else if (afterItem && afterItem !== listItem && !listItem.contains(afterItem)) { afterItem.parentElement.insertBefore(listItem, afterItem.nextElementSibling); copyDonorItemAttributes(listItem, afterItem); inheritDestinationItemId(listItem, afterItem); didApply = true; } else if (typeof listPath === 'string') { const targetList = getListByPath(tracker, listPath); const ownerItem = targetList?.parentElement?.tagName === 'LI' ? targetList.parentElement : null; if (targetList && ownerItem !== listItem && !listItem.contains(ownerItem || null)) { const position = typeof rawOperation.position === 'string' ? rawOperation.position.trim().toLowerCase() : 'append'; if (position === 'prepend' && targetList.firstElementChild) { targetList.insertBefore(listItem, targetList.firstElementChild); } else { targetList.appendChild(listItem); } inheritDestinationItemId(listItem); didApply = true; } } if (didApply) { cleanupEmptyAncestorLists(tracker, oldParentList); } return didApply; } /** * Resolve one tracked list element from a list-path payload. * * The root list lives at the empty path. Nested lists are addressed by the * tree path of the parent item that owns that child list. * * @param {Object|null} tracker Active list tracker. * @param {string|Array} pathValue Root-empty list path or parent-item path. * @returns {HTMLElement|null} Matching list element. */ function getListByPath(tracker, pathValue) { if (!tracker?.listElement) { return null; } if ( pathValue === '' || pathValue === null || typeof pathValue === 'undefined' || (Array.isArray(pathValue) && !pathValue.length) || (typeof pathValue === 'string' && !pathValue.trim()) ) { return tracker.listElement; } const parentItem = ListBlockTracker.getItemByPath(tracker, pathValue); return parentItem ? getDirectChildList(parentItem) : null; } /** * Normalize one requested list-type value to a DOM tag name. * * @param {*} value Candidate list-type value. * @returns {string} `OL`, `UL`, or an empty string. */ function normalizeListTypeTagName(value) { if (value === true) { return 'OL'; } if (value === false) { return 'UL'; } const normalized = String(value || '').trim().toLowerCase(); if (normalized === 'ordered' || normalized === 'ol' || normalized === 'true') { return 'OL'; } if (normalized === 'unordered' || normalized === 'ul' || normalized === 'false') { return 'UL'; } return ''; } const ListBlockTracker = { active: null, /** * Initialize tracker for a list element * @param {HTMLElement} listElement - The UL or OL element * @param {Object} originalBlock - The complete WordPress block structure */ init(listElement, originalBlock = {}) { if (!createBlock || !serializeBlocks) { console.error('wp.blocks not available'); } const tracker = { listElement, originalBlock: JSON.parse(JSON.stringify(originalBlock)), uuidMap: new Map(), // uuid -> {type, attrs, element} domMap: new WeakMap(), // element -> uuid runtimeUuidMap: new Map(), // runtimeUuid -> {type, element} runtimeDomMap: new WeakMap() // element -> runtimeUuid }; // Attach tracker to element to avoid singleton issues listElement._mwpListTracker = tracker; // Build UUID tracking from DOM and original block structure this.buildFromDOM(tracker, listElement, originalBlock); this.active = tracker; return tracker; }, /** * Build UUID mappings from DOM and original block structure * Assigns UUIDs to all lists and list items, mapping to their original attrs */ buildFromDOM(tracker, listElement, originalBlock) { const previousEntries = tracker.uuidMap instanceof Map ? new Map(tracker.uuidMap) : new Map(); const previousRuntimeEntries = tracker.runtimeUuidMap instanceof Map ? new Map(tracker.runtimeUuidMap) : new Map(); tracker.uuidMap.clear(); tracker.domMap = new WeakMap(); tracker.runtimeUuidMap.clear(); tracker.runtimeDomMap = new WeakMap(); tracker.listElement = listElement; this.syncEditableTextSurfaces(listElement); this.registerRuntimeIdentity( tracker, listElement, 'list', previousRuntimeEntries ); // Assign UUID to root list and map to original attrs const rootUuid = this.getOrCreateUuid(listElement, 'list'); const previousRootEntry = previousEntries.get(rootUuid); tracker.uuidMap.set(rootUuid, { type: 'list', attrs: previousRootEntry?.attrs ? cloneListAttrs(previousRootEntry.attrs, true) : cloneListAttrs(originalBlock.attrs || {}, true), element: listElement }); tracker.domMap.set(listElement, rootUuid); // Recursively process list structure this.processListRecursive( tracker, listElement, originalBlock.innerBlocks || [], previousEntries, previousRuntimeEntries ); }, /** * Recursively process list items and nested lists, assigning UUIDs */ processListRecursive( tracker, listElement, originalItems, previousEntries = new Map(), previousRuntimeEntries = new Map() ) { const items = getDirectListItems(listElement); items.forEach((li, index) => { this.syncEditableTextSurfaces(li); const originalItem = originalItems[index] || {}; this.registerRuntimeIdentity( tracker, li, 'item', previousRuntimeEntries ); const itemUuid = this.getOrCreateUuid(li, 'item'); const previousItemEntry = previousEntries.get(itemUuid); // Map UUID to original item attrs tracker.uuidMap.set(itemUuid, { type: 'item', attrs: previousItemEntry?.attrs ? JSON.parse(JSON.stringify(previousItemEntry.attrs || {})) : JSON.parse(JSON.stringify(originalItem.attrs || {})), element: li }); tracker.domMap.set(li, itemUuid); // Handle nested lists const nestedList = getDirectChildList(li); if (nestedList) { const originalNested = originalItem.innerBlocks?.[0] || {}; this.registerRuntimeIdentity( tracker, nestedList, 'list', previousRuntimeEntries ); const nestedUuid = this.getOrCreateUuid(nestedList, 'list'); const previousNestedEntry = previousEntries.get(nestedUuid); // Map nested list attrs without plugin UUID ownership. // The tracker still needs a temporary DOM identity for list // editing, but persisting mwpSfeUuid* on nested lists would // fracture one logical list into multiple save/history roots. tracker.uuidMap.set(nestedUuid, { type: 'list', attrs: previousNestedEntry?.attrs ? cloneListAttrs(previousNestedEntry.attrs, false) : cloneListAttrs(originalNested.attrs || {}, false), element: nestedList }); tracker.domMap.set(nestedList, nestedUuid); // Recurse into nested list this.processListRecursive( tracker, nestedList, originalNested.innerBlocks || [], previousEntries, previousRuntimeEntries ); } }); }, /** * Register one list or list-item runtime identity on the tracker. * * @param {Object} tracker Active list tracker. * @param {Element} element Live list or list-item element. * @param {string} type Supported runtime identity type. * @param {Map} previousRuntimeEntries Previous runtime entry map. * @returns {string} Resolved runtime UUID. */ registerRuntimeIdentity( tracker, element, type, previousRuntimeEntries = new Map() ) { const runtimeUuid = this.getOrCreateRuntimeUuid( tracker, element, type, previousRuntimeEntries ); if (!runtimeUuid) { return ''; } tracker.runtimeUuidMap.set(runtimeUuid, { type, element, }); tracker.runtimeDomMap.set(element, runtimeUuid); return runtimeUuid; }, /** * Return whether one runtime UUID is already owned by a different element. * * Native contenteditable list splitting can clone DOM attributes from the * source item into the newly created sibling. When that happens, the new * runtime UUID must be reseeded so each live cursor target stays unique. * * @param {Object} tracker Active list tracker. * @param {string} runtimeUuid Candidate runtime UUID. * @param {Element|null} element Element requesting that UUID. * @returns {boolean} True when the UUID belongs elsewhere. */ isRuntimeUuidClaimedByDifferentElement(tracker, runtimeUuid, element) { const normalizedRuntimeUuid = normalizeRuntimeUuid(runtimeUuid); if (!tracker?.runtimeUuidMap || !normalizedRuntimeUuid) { return false; } const existingEntry = tracker.runtimeUuidMap.get(normalizedRuntimeUuid); return !!(existingEntry?.element && existingEntry.element !== element); }, /** * Get the inherited structural ID for an element or seed it from the * runtime UUID when it does not exist yet. * * Structural IDs may be intentionally copied by native list splitting so * related items can retain style inheritance. They are not treated as * unique runtime cursor identifiers. */ getOrCreateUuid(element, type) { const attrName = type === 'list' ? LIST_ID_ATTR : LIST_ITEM_ID_ATTR; let uuid = element.getAttribute(attrName); if (!uuid) { uuid = normalizeRuntimeUuid( element.getAttribute( type === 'list' ? LIST_RUNTIME_UUID_ATTR : LIST_ITEM_RUNTIME_UUID_ATTR ) ) || this.generateTempUuid(); element.setAttribute(attrName, uuid); } return uuid; }, /** * Return the existing runtime UUID for one element or create one. * * Caller-supplied runtime UUIDs win for newly created items/lists. When an * element already belongs to the previous tracker build, its existing * runtime UUID is preserved so API references remain stable across rebuilds. * * @param {Object} tracker Active list tracker. * @param {Element} element Live list or list-item element. * @param {string} type Supported runtime identity type. * @param {Map} previousRuntimeEntries Previous runtime entry map. * @returns {string} Session-scoped runtime UUID. */ getOrCreateRuntimeUuid( tracker, element, type, previousRuntimeEntries = new Map() ) { const attrName = getRuntimeUuidAttributeName(type); if (!attrName || !isRuntimeIdentityElement(element, type)) { return ''; } let runtimeUuid = normalizeRuntimeUuid(element.getAttribute(attrName)); if (!runtimeUuid) { for (const [candidateUuid, entry] of previousRuntimeEntries.entries()) { if (entry?.element === element && entry.type === type) { runtimeUuid = normalizeRuntimeUuid(candidateUuid); break; } } } if (this.isRuntimeUuidClaimedByDifferentElement(tracker, runtimeUuid, element)) { runtimeUuid = ''; } if (!runtimeUuid) { runtimeUuid = this.generateTempUuid(); } element.setAttribute(attrName, runtimeUuid); return runtimeUuid; }, /** * Generate a RFC4122 version 4 UUID */ generateTempUuid() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { const r = Math.random() * 16 | 0; const v = c === 'x' ? r : (r & 0x3 | 0x8); return v.toString(16); }); }, /** * Return the zero-based tree path for one list item inside the tracked list. * * @param {Object} tracker Active list tracker. * @param {HTMLLIElement} listItem Candidate list item. * @returns {number[]|null} Zero-based indexes, or null on failure. */ getPathIndexesForItem(tracker, listItem) { if ( !tracker?.listElement || !listItem || listItem.nodeType !== Node.ELEMENT_NODE || listItem.tagName !== 'LI' || !tracker.listElement.contains(listItem) ) { return null; } const indexes = []; let currentItem = listItem; while (currentItem && tracker.listElement.contains(currentItem)) { const parentList = currentItem.parentElement; if (!parentList || (parentList.tagName !== 'UL' && parentList.tagName !== 'OL')) { return null; } const siblingItems = getDirectListItems(parentList); const itemIndex = siblingItems.indexOf(currentItem); if (itemIndex < 0) { return null; } indexes.unshift(itemIndex); const nextItem = parentList.closest('li'); if (!nextItem || !tracker.listElement.contains(nextItem)) { break; } currentItem = nextItem; } return indexes.length ? indexes : null; }, /** * Return the direct list item currently living at one tree path. * * @param {Object} tracker Active list tracker. * @param {string|Array} pathValue Zero-based path value. * @returns {HTMLLIElement|null} Matching list item. */ getItemByPath(tracker, pathValue) { const indexes = normalizePathIndexes(pathValue); if (!tracker?.listElement || !Array.isArray(indexes) || !indexes.length) { return null; } let currentList = tracker.listElement; let currentItem = null; for (let index = 0; index < indexes.length; index++) { const itemIndex = indexes[index]; const siblingItems = getDirectListItems(currentList); currentItem = siblingItems[itemIndex] || null; if (!currentItem) { return null; } if (index === indexes.length - 1) { return currentItem; } currentList = getDirectChildList(currentItem); if (!currentList) { return null; } } return currentItem; }, /** * Resolve one list element back to its public list path. * * The root list is addressed as an empty string. Nested child lists are * addressed by the path of the parent list item that owns them. * * @param {Object|null} tracker Active list tracker. * @param {HTMLElement|null} listElement Candidate list element. * @returns {string} Root-relative list path. */ getPathForList(tracker, listElement) { if (!tracker) tracker = this.active; if (!tracker?.listElement || !listElement || listElement.nodeType !== Node.ELEMENT_NODE) { return ''; } if (listElement === tracker.listElement) { return ''; } const parentItem = ( listElement.parentElement && listElement.parentElement.tagName === 'LI' ) ? listElement.parentElement : null; if (!parentItem) { return ''; } const indexes = this.getPathIndexesForItem(tracker, parentItem); return Array.isArray(indexes) ? indexes.join('_') : ''; }, /** * Return one tracked list item by runtime UUID. * * @param {Object|null} tracker Active list tracker. * @param {string} runtimeUuid Session-scoped item UUID. * @returns {HTMLLIElement|null} Matching list item. */ getItemByRuntimeUuid(tracker, runtimeUuid) { if (!tracker) tracker = this.active; const element = findElementByRuntimeUuid(tracker, runtimeUuid, 'item'); return element && element.tagName === 'LI' ? element : null; }, /** * Return one tracked list by runtime UUID. * * @param {Object|null} tracker Active list tracker. * @param {string} runtimeUuid Session-scoped list UUID. * @returns {HTMLElement|null} Matching list element. */ getListByRuntimeUuid(tracker, runtimeUuid) { if (!tracker) tracker = this.active; const element = findElementByRuntimeUuid(tracker, runtimeUuid, 'list'); return isListElementForRuntimeLookup(element) ? element : null; }, /** * Return the runtime UUID for one tracked list item. * * @param {Object|null} tracker Active list tracker. * @param {HTMLLIElement} listItem Live list item. * @returns {string} Session-scoped item UUID. */ getRuntimeUuidForItem(tracker, listItem) { if (!tracker) tracker = this.active; if (!tracker?.listElement || !listItem || listItem.tagName !== 'LI') { return ''; } return normalizeRuntimeUuid( listItem.getAttribute(LIST_ITEM_RUNTIME_UUID_ATTR) || tracker.runtimeDomMap?.get(listItem) ); }, /** * Return the runtime UUID for one tracked list. * * @param {Object|null} tracker Active list tracker. * @param {HTMLElement} listElement Live list element. * @returns {string} Session-scoped list UUID. */ getRuntimeUuidForList(tracker, listElement) { if (!tracker) tracker = this.active; if (!tracker?.listElement || !isListElementForRuntimeLookup(listElement)) { return ''; } return normalizeRuntimeUuid( listElement.getAttribute(LIST_RUNTIME_UUID_ATTR) || tracker.runtimeDomMap?.get(listElement) ); }, /** * Parse current DOM list structure to WordPress block format * Uses UUID to preserve original attrs, updates only content and ordered * * @param {HTMLElement} listElement Live UL/OL element. * @param {Object} tracker Active list tracker. * @param {boolean} allowUuidOwnership True only for the outermost * core/list. Nested lists must * serialize without persisted * plugin UUID attrs. */ parseListToBlock(listElement, tracker, allowUuidOwnership = true) { const isOrdered = listElement.tagName === 'OL'; const uuid = listElement.getAttribute(LIST_ID_ATTR); let attrs = { ordered: isOrdered }; if (uuid && tracker && tracker.uuidMap.has(uuid)) { const original = tracker.uuidMap.get(uuid); const originalAttrs = (Array.isArray(original.attrs) || !original.attrs) ? {} : cloneListAttrs(original.attrs, allowUuidOwnership); attrs = { ...originalAttrs, ordered: isOrdered }; } const listItems = Array.from(listElement.children).filter(el => el.tagName === 'LI'); const innerBlocks = listItems.map(li => this.parseListItemToBlock(li, tracker)); return createBlock('core/list', attrs, innerBlocks); }, /** * Parse a list item to WordPress block format * Preserves original attrs if UUID exists */ parseListItemToBlock(liElement, tracker) { const uuid = liElement.getAttribute(LIST_ITEM_ID_ATTR); let attrs = {}; if (uuid && tracker && tracker.uuidMap.has(uuid)) { const original = tracker.uuidMap.get(uuid); attrs = JSON.parse(JSON.stringify(original.attrs || {})); } // Recurse into nested list using the live element before cloning const innerBlocks = []; const nestedListEl = liElement.querySelector(':scope > ul, :scope > ol'); if (nestedListEl) { innerBlocks.push(this.parseListToBlock(nestedListEl, tracker, false)); } const clone = liElement.cloneNode(true); const directSurface = clone.querySelector(`:scope > [${LIST_ITEM_TEXT_ATTR}="1"]`); let content = ''; if (directSurface) { const cleanedSurface = this.cleanElement(directSurface); content = cleanedSurface.innerHTML.trim(); } else { const nestedInClone = clone.querySelector(':scope > ul, :scope > ol'); if (nestedInClone) nestedInClone.remove(); const cleaned = this.cleanElement(clone); content = cleaned.innerHTML.trim(); } return createBlock('core/list-item', { ...attrs, content }, innerBlocks); }, /** * Clean element using ElementPrep * Removes editing artifacts while preserving UUIDs and content */ cleanElement(element) { if (SFE.ElementPrep) { return SFE.ElementPrep.clean(element, { removeIdentity: true, removeControls: true, clone: false // Already working with a clone }); } console.error('ElementPrep not found'); return element; }, /** * Serialize the current list structure to WordPress block format * Preserves all original attrs, updates only content and ordered */ serialize(tracker) { if (!tracker) tracker = this.active; if (!tracker) return null; const block = this.parseListToBlock(tracker.listElement, tracker); return serializeBlocks([block]); }, /** * Update the tracker's element reference * Used when the list element is replaced (e.g., OL to UL conversion) */ updateElement(tracker, newElement) { if (!tracker) tracker = this.active; if (!tracker) return; // Ensure new element keeps the tracker reference newElement._mwpListTracker = tracker; this.syncEditableTextSurfaces(newElement); tracker.listElement = newElement; // Update element references in uuidMap tracker.uuidMap.forEach((value, key) => { if (value.type === 'list') { const newEl = newElement.querySelector(`[${LIST_ID_ATTR}="${key}"]`) || (newElement.getAttribute(LIST_ID_ATTR) === key ? newElement : null); if (newEl) { value.element = newEl; } } else if (value.type === 'item') { const newEl = newElement.querySelector(`[${LIST_ITEM_ID_ATTR}="${key}"]`); if (newEl) { value.element = newEl; } } }); tracker.runtimeUuidMap.forEach((value, key) => { if (value.type === 'list') { const newEl = this.getListByRuntimeUuid(tracker, key); if (newEl) { value.element = newEl; tracker.runtimeDomMap.set(newEl, key); } } else if (value.type === 'item') { const newEl = this.getItemByRuntimeUuid(tracker, key); if (newEl) { value.element = newEl; tracker.runtimeDomMap.set(newEl, key); } } }); }, /** * Return one tree-aware structural snapshot for the active list. * * @param {Object|null} tracker Active list tracker. * @returns {Object|null} Lightweight structure snapshot. */ getStructure(tracker) { if (!tracker) tracker = this.active; if (!tracker?.listElement) { return null; } const buildListNode = (listElement, listPath = '', parentIndexes = []) => ({ listUuid: this.getRuntimeUuidForList(tracker, listElement), listPath, ordered: listElement.tagName === 'OL', items: getDirectListItems(listElement).map((listItem, index) => { const indexes = [ ...parentIndexes, index ]; const pathMeta = buildPathMeta(indexes); const directSurface = ensureDirectItemTextSurface(listItem); const nestedList = getDirectChildList(listItem); return { itemUuid: this.getRuntimeUuidForItem(tracker, listItem), path: pathMeta.path, pathLabel: pathMeta.pathLabel, depth: pathMeta.depth, contentHtml: directSurface ? directSurface.innerHTML.trim() : '', childList: nestedList ? buildListNode(nestedList, pathMeta.path, indexes) : null, }; }), }); return buildListNode(tracker.listElement, '', []); }, /** * Apply one primitive structural list operation against the live tracked * DOM. * * Public API calls are translated into this lower-level operation set by * the shared schema executor so the tracker only needs to understand the * canonical primitive mutation layer. * * Supported primitive kinds: * - `insert_list_item` * - `remove_list_item` * - `move_list_item` * - `indent_list_item` * - `outdent_list_item` * - `update_list_item_text` * - `toggle_list_type` * * @param {Object|null} tracker Active list tracker. * @param {Object} rawOperation Structural operation payload. * @returns {Object|null} Result summary when applied. */ applyOperation(tracker, rawOperation, options = {}) { if (!tracker) tracker = this.active; if (!tracker?.listElement || !rawOperation || typeof rawOperation !== 'object') { return null; } const kind = typeof rawOperation.kind === 'string' ? rawOperation.kind.trim().toLowerCase() : ''; const path = rawOperation.path ?? rawOperation.itemPath ?? rawOperation.item_path ?? ''; const listItem = this.getItemByPath(tracker, path); let didApply = false; if (kind === 'remove_list_item' && listItem) { didApply = applyRemoveListItemOperation(tracker, listItem); } else if (kind === 'indent_list_item' && listItem) { didApply = applyIndentListItemOperation(tracker, listItem); } else if (kind === 'outdent_list_item' && listItem) { didApply = applyOutdentListItemOperation(tracker, listItem); } else if (kind === 'toggle_list_type') { didApply = applyToggleListTypeOperation(tracker, rawOperation, options); } else if (kind === 'update_list_item_text' && listItem) { didApply = applyUpdateListItemTextOperation(listItem, rawOperation); } else if (kind === 'insert_list_item') { didApply = applyInsertListItemOperation(tracker, rawOperation, this); } else if (kind === 'move_list_item' && listItem) { didApply = applyMoveListItemOperation(tracker, listItem, rawOperation, this); } if (!didApply) { return null; } this.syncEditableTextSurfaces(tracker.listElement); this.buildFromDOM(tracker, tracker.listElement, tracker.originalBlock || {}); return { kind, structure: this.getStructure(tracker), }; }, /** * Ensure every list item in one tree has one direct text surface. * * @param {HTMLElement|null} rootElement Candidate list root or list item. * @returns {HTMLElement|null} Normalized root element. */ syncEditableTextSurfaces(rootElement) { if (!rootElement || rootElement.nodeType !== Node.ELEMENT_NODE) { return null; } if (rootElement.tagName === 'LI') { ensureDirectItemTextSurface(rootElement); Array.from(rootElement.children || []) .filter(child => isNestedListNode(child)) .forEach(childList => this.syncEditableTextSurfaces(childList)); return rootElement; } if (rootElement.tagName !== 'UL' && rootElement.tagName !== 'OL') { return rootElement; } Array.from(rootElement.children || []) .filter(child => child.tagName === 'LI') .forEach(li => this.syncEditableTextSurfaces(li)); return rootElement; }, /** * Ensure runtime UUID attributes are unique within one live list tree. * * Native contenteditable list splitting can clone `li` and nested list * attributes verbatim before FrontEdit regains control. This pass reseeds only the * session-scoped runtime UUID attributes so freshly created structures become * distinct live API/editor targets immediately, while leaving `data-item-id` * and `data-list-id` untouched for their separate responsibilities. * * @param {HTMLElement|null} rootElement Candidate list root. * @returns {HTMLElement|null} Normalized root element. */ ensureUniqueRuntimeUuids(rootElement) { if ( !rootElement || rootElement.nodeType !== Node.ELEMENT_NODE || (rootElement.tagName !== 'UL' && rootElement.tagName !== 'OL') ) { return rootElement || null; } const seenListRuntimeUuids = new Set(); const seenItemRuntimeUuids = new Set(); const collectLists = [ rootElement, ...Array.from(rootElement.querySelectorAll('ul, ol')) ]; const collectItems = Array.from(rootElement.querySelectorAll('li')); collectLists.forEach(listElement => { const runtimeUuid = normalizeRuntimeUuid( listElement.getAttribute(LIST_RUNTIME_UUID_ATTR) ); if (!runtimeUuid) { return; } if (seenListRuntimeUuids.has(runtimeUuid)) { listElement.setAttribute(LIST_RUNTIME_UUID_ATTR, this.generateTempUuid()); return; } seenListRuntimeUuids.add(runtimeUuid); }); collectItems.forEach(listItem => { const runtimeUuid = normalizeRuntimeUuid( listItem.getAttribute(LIST_ITEM_RUNTIME_UUID_ATTR) ); if (!runtimeUuid) { return; } if (seenItemRuntimeUuids.has(runtimeUuid)) { listItem.setAttribute(LIST_ITEM_RUNTIME_UUID_ATTR, this.generateTempUuid()); return; } seenItemRuntimeUuids.add(runtimeUuid); }); return rootElement; }, /** * Ensure one live list tree has the required structural IDs and runtime UUIDs. * * On first editor activation, list elements may not yet have either identity * attribute family. Seed both from one generated UUID per element so the * initial history snapshot captures stable targeting data. Later native list * splits may intentionally copy the structural IDs; in those cases this pass * preserves the structural IDs and only reseeds duplicated runtime UUIDs. * * @param {HTMLElement|null} rootElement Candidate list root. * @returns {HTMLElement|null} Normalized root element. */ ensureIdentityAttributes(rootElement) { if ( !rootElement || rootElement.nodeType !== Node.ELEMENT_NODE || (rootElement.tagName !== 'UL' && rootElement.tagName !== 'OL') ) { return rootElement || null; } const syncIdentityPair = (element, structuralAttrName, runtimeAttrName) => { if (!element || element.nodeType !== Node.ELEMENT_NODE) { return; } let structuralId = normalizeRuntimeUuid( element.getAttribute(structuralAttrName) ); let runtimeUuid = normalizeRuntimeUuid( element.getAttribute(runtimeAttrName) ); if (!structuralId && !runtimeUuid) { runtimeUuid = this.generateTempUuid(); structuralId = runtimeUuid; } else if (!runtimeUuid) { runtimeUuid = structuralId; } else if (!structuralId) { structuralId = runtimeUuid; } element.setAttribute(structuralAttrName, structuralId); element.setAttribute(runtimeAttrName, runtimeUuid); }; syncIdentityPair(rootElement, LIST_ID_ATTR, LIST_RUNTIME_UUID_ATTR); Array.from(rootElement.querySelectorAll('ul, ol')).forEach(listElement => { syncIdentityPair(listElement, LIST_ID_ATTR, LIST_RUNTIME_UUID_ATTR); }); Array.from(rootElement.querySelectorAll('li')).forEach(listItem => { syncIdentityPair(listItem, LIST_ITEM_ID_ATTR, LIST_ITEM_RUNTIME_UUID_ATTR); }); return this.ensureUniqueRuntimeUuids(rootElement); }, getDirectItemTextSurface, normalizePathIndexes, buildPathMeta, getRuntimeUuidAttributeName, getListRuntimeUuidAttributeName() { return LIST_RUNTIME_UUID_ATTR; }, getListItemRuntimeUuidAttributeName() { return LIST_ITEM_RUNTIME_UUID_ATTR; }, getListIdAttributeName() { return LIST_ID_ATTR; }, getListItemIdAttributeName() { return LIST_ITEM_ID_ATTR; }, /** * Destroy tracker and clean up */ destroy(tracker) { if (!tracker) tracker = this.active; if (!tracker) return; tracker.uuidMap.clear(); tracker.runtimeUuidMap.clear(); if (tracker.listElement) { delete tracker.listElement._mwpListTracker; } if (this.active === tracker) this.active = null; } }; /** * Return whether one element is a live list node for runtime lookup helpers. * * @param {Element|null} element Candidate DOM element. * @returns {boolean} True when the element is `UL` or `OL`. */ function isListElementForRuntimeLookup(element) { return !!( element && element.nodeType === Node.ELEMENT_NODE && (element.tagName === 'UL' || element.tagName === 'OL') ); } // Expose globally SFE.ListBlockTracker = ListBlockTracker; })(); Beyond Each Spin Lies Hidden Momentum – Studieo7 Aesthetics
Free Delivery on orders over $200. Don’t miss discount.

What Are You Looking For?

webstudieo September 18, 2026 No Comments

Beyond Each Spin Lies Hidden Momentum

There is something strangely electric about the moment a reel begins its dance. The symbols blur, the lights flash, and for that brief second, time seems to stretch. It is not just a game of chance — it is a subtle interplay between anticipation, strategy, and the quiet mechanics that govern every outcome. Many players think of slots as pure luck, but those who have spent long evenings watching the reels know there is more at play. The real secret lies not in what you see, but in the momentum that builds between spins. For those looking to explore this world with a fresh perspective, onlyspinsca.net offers a glimpse into how that momentum can shape the entire experience.

Imagine standing at the edge of a vast machine, each pull of the lever or tap of the button setting off a chain reaction. The numbers, the symbols, the paylines — they are all part of a larger rhythm. What most people miss is that this rhythm is not random in the way you might think. Behind every spin, there is an algorithm, a seed, and a carefully calibrated system designed to keep the experience balanced. It is like a heartbeat: sometimes fast, sometimes slow, but always there.

The first thing to understand is that each spin resets the clock. A slot machine does not remember your last play. It does not care if you won or lost. But you remember. That memory creates a kind of momentum — not in the machine, but in your own mind. The way you react to a near miss, the thrill of a small win, the frustration of a dry spell — all of these emotions build up. Smart players learn to ride that wave without letting it tip them over. They know that the true game is not the spin itself, but the space between spins.

The Architecture of a Single Turn

Let us strip away the flash and focus on the bones. Every slot game is built around a random number generator, or RNG, that churns out thousands of results per second. When you press the button, it captures the outcome at that exact moment. This is where the hidden momentum really begins. The RNG does not pause; it keeps moving. So your spin is just a snapshot of an endless stream of numbers. That stream has no memory, but it has continuity. The next spin will come from a new point in that stream, and the one after that from another.

This is why some players swear by timing their spins. They believe that if you wait for a certain pattern or a gap in the stream, you can tilt the odds slightly in your favor. The truth is more nuanced: the RNG is so fast and so consistent that timing is mostly an illusion. Yet the illusion itself has power. When you feel you have control, you play differently. You become more deliberate, more patient. That patience is a form of momentum — a quiet force that can keep you in the game longer and help you avoid rash decisions.

Patterns in the Noise

There is no shortage of theories about hot and cold streaks. Some players track every win and loss, looking for clusters of good luck. Others change games after every few spins. The data, however, tells a different story. Each spin is independent, but the human brain is wired to see patterns where none exist. That is not a weakness — it is a survival instinct. In the world of slots, that instinct can work for you or against you. The key is to recognize it without being ruled by it.

Consider this: if you play a slot with a high volatility, you may experience long stretches without a win, followed by a sudden spike. That spike feels like momentum, but it is really just the distribution of payouts over time. Low volatility games, on the other hand, offer frequent small wins that keep the energy steady. Both have their own kind of rhythm. Choosing between them is not about luck — it is about understanding which rhythm matches your own personality.

“The spin itself is fleeting. The momentum is what lasts — the feeling, the strategy, the quiet choices you make between turns.”

Key Elements That Shape the Experience

To truly grasp the hidden momentum, look at the elements that define a slot session. These are not just technical details — they are the invisible threads that connect one spin to the next.

  • Volatility level: Determines the size and frequency of wins. High volatility means bigger but rarer payouts, while low volatility offers smaller but more consistent returns.
  • Return to Player (RTP): A theoretical percentage that indicates how much of the wagered money is returned over a long period. It is not a per-session guarantee.
  • Bet size and strategy: Adjusting your bet can change the pace of play. A smaller bet extends your session, while a larger bet amplifies the emotional swings.
  • Game features: Free spins, multipliers, wilds, and bonuses add layers of complexity. Each feature can shift the momentum dramatically in a single turn.
  • Personal mindset: How you handle wins and losses directly influences your next move. Staying level-headed protects your bankroll and your enjoyment.

A Comparative Look at Two Slot Styles

To make this more concrete, here is a comparison of two different slot approaches. The differences are not just in the numbers — they change the entire rhythm of play.

Feature High Volatility Slot Low Volatility Slot
Win frequency Low High
Win size Large, occasional Small, regular
Session length Can be short if unlucky Typically longer
Emotional impact Dramatic highs and lows Steady, gentle flow
Best for Players who enjoy risk and patience Players who prefer steady action
Hidden momentum Builds slowly, hits hard Builds gently, sustains engagement

Each style creates its own kind of momentum. The high volatility slot demands patience and resilience. The low volatility slot rewards consistency and calm. Neither is better — they are simply different textures of the same experience.

Frequently Asked Questions

What exactly is “hidden momentum” in slots?

It refers to the psychological and mechanical buildup that happens between spins. While each spin is technically independent, your reactions, strategies, and the game’s volatility create a rhythm that influences how you play over time.

Can I predict when a slot will pay out?

No. Slots use random number generators that make each outcome independent. No pattern or timing can reliably predict a win. The only certainty is that the game is designed to pay out a theoretical percentage over millions of spins.

Does the number of players on a slot affect my chances?

No. Online slots are not influenced by how many people are playing. The RNG works the same for every session, regardless of traffic.

Should I change slots after a few losses?

That is a personal choice. Changing slots may help reset your mindset, but it does not affect the actual odds. Each game operates independently.

What is the most important factor for enjoying slots?

Understanding that slots are entertainment, not a guaranteed way to make money. Managing your bankroll, choosing games that fit your style, and playing for the experience itself are the keys to a positive session.

Why do I sometimes feel like I am on a hot streak?

That feeling is likely a combination of natural variance and your brain’s pattern-seeking instinct. A few wins in a row can create a sense of momentum, but statistically, each spin is still random.

In the end, the hidden momentum of each spin is not about winning or losing — it is about the journey. The quiet tension before the reels stop, the small decisions you make in the quiet moments, the way you choose to react to every outcome. That is where the real game lies. Beyond each spin, there is a current waiting to be felt.