%PDF- %PDF-
Direktori : /home/tradesc/www/relax/wp-content/plugins/elementor-pro/assets/js/ |
Current File : /home/tradesc/www/relax/wp-content/plugins/elementor-pro/assets/js/custom-code.min.js |
/*! elementor-pro - v3.25.0 - 20-11-2024 */ (()=>{var e={9804:(e,t,n)=>{"use strict";var o=n(1594);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BaseContext=void 0;class BaseContext extends o.Component{constructor(e){super(e),this.state={action:{current:null,loading:!1,error:null,errorMeta:{}},updateActionState:this.updateActionState.bind(this),resetActionState:this.resetActionState.bind(this)}}executeAction(e,t){return this.updateActionState({current:e,loading:!0,error:null,errorMeta:{}}),t().then((e=>(this.resetActionState(),Promise.resolve(e)))).catch((t=>(this.updateActionState({current:e,loading:!1,error:t.message,errorMeta:t}),Promise.reject(t))))}updateActionState(e){return this.setState((t=>({action:{...t.action,...e}})))}resetActionState(){this.updateActionState({current:null,loading:!1,error:null,errorMeta:{}})}}t.BaseContext=BaseContext;t.default=BaseContext},4737:(e,t,n)=>{"use strict";var o=n(2688),i=n(2470).__,s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Context=t.ConditionsProvider=void 0;var r=s(n(1594)),a=s(n(8067)),d=s(n(2075)),u=s(n(9804)),l=n(5559);const c=t.Context=r.default.createContext();class ConditionsProvider extends u.default{static propTypes={children:o.any.isRequired,currentTemplate:o.object.isRequired,onConditionsSaved:o.func.isRequired,validateConflicts:o.bool};static defaultProps={validateConflicts:!0};static actions={FETCH_CONFIG:"fetch-config",SAVE:"save",CHECK_CONFLICTS:"check-conflicts"};conditionsConfig=null;constructor(e){super(e),this.state={...this.state,conditionsFetched:!1,conditions:{},updateConditionItemState:this.updateConditionItemState.bind(this),removeConditionItemInState:this.removeConditionItemInState.bind(this),createConditionItemInState:this.createConditionItemInState.bind(this),findConditionItemInState:this.findConditionItemInState.bind(this),saveConditions:this.saveConditions.bind(this)}}componentDidMount(){this.executeAction(ConditionsProvider.actions.FETCH_CONFIG,(()=>d.default.create())).then((e=>this.conditionsConfig=e)).then(this.normalizeConditionsState.bind(this)).then((()=>{this.setSubIdTitles.bind(this),this.setState({conditionsFetched:!0})}))}componentDidUpdate(e,t){!t.conditionsFetched&&this.state.conditionsFetched&&this.setSubIdTitles()}saveConditions(){const e=Object.values(this.state.conditions).map((e=>e.forDb()));return this.executeAction(ConditionsProvider.actions.SAVE,(()=>$e.data.update(l.TemplatesConditions.signature,{conditions:e},{id:this.props.currentTemplate.id}))).then((()=>{const e=Object.values(this.state.conditions).map((e=>e.forContext()));this.props.onConditionsSaved(this.props.currentTemplate.id,{conditions:e,instances:this.conditionsConfig.calculateInstances(Object.values(this.state.conditions)),isActive:!(!Object.keys(this.state.conditions).length||"publish"!==this.props.currentTemplate.status)})}))}checkConflicts(e){return this.executeAction(ConditionsProvider.actions.CHECK_CONFLICTS,(()=>$e.data.get(l.TemplatesConditionsConflicts.signature,{post_id:this.props.currentTemplate.id,condition:e.clone().toString()}))).then((t=>this.updateConditionItemState(e.id,{conflictErrors:Object.values(t.data)},!1)))}fetchSubIdsTitles(e){return new Promise((t=>elementorCommon.ajax.loadObjects({action:"query_control_value_titles",ids:_.isArray(e.subId)?e.subId:[e.subId],data:{get_titles:e.subIdAutocomplete,unique_id:elementorCommon.helpers.getUniqueId()},success(e){t(e)}})))}normalizeConditionsState(){this.updateConditionsState((()=>this.props.currentTemplate.conditions.reduce(((e,t)=>{const n=new a.default({...t,default:this.props.currentTemplate.defaultCondition,options:this.conditionsConfig.getOptions(),subOptions:this.conditionsConfig.getSubOptions(t.name),subIdAutocomplete:this.conditionsConfig.getSubIdAutocomplete(t.sub),subIdOptions:t.subId?[{value:t.subId,label:""}]:[]});return{...e,[n.id]:n}}),{}))).then((()=>{Object.values(this.state.conditions).forEach((e=>this.checkConflicts(e)))}))}setSubIdTitles(){return Object.values(this.state.conditions).forEach((e=>{if(e.subId)return this.fetchSubIdsTitles(e).then((t=>this.updateConditionItemState(e.id,{subIdOptions:[{label:Object.values(t)[0],value:e.subId}]},!1)))}))}updateConditionItemState(e,t,n=!0){t.name&&(t.subOptions=this.conditionsConfig.getSubOptions(t.name)),(t.sub||t.name)&&(t.subIdAutocomplete=this.conditionsConfig.getSubIdAutocomplete(t.sub),t.subIdOptions=[]),this.updateConditionsState((n=>{const o=n[e];return{...n,[e]:o.clone().set(t)}})).then((()=>{n&&this.checkConflicts(this.findConditionItemInState(e))}))}removeConditionItemInState(e){this.updateConditionsState((t=>{const n={...t};return delete n[e],n}))}createConditionItemInState(e=!0){const t=this.props.currentTemplate.defaultCondition,n=new a.default({name:t,default:t,options:this.conditionsConfig.getOptions(),subOptions:this.conditionsConfig.getSubOptions(t),subIdAutocomplete:this.conditionsConfig.getSubIdAutocomplete("")});this.updateConditionsState((e=>({...e,[n.id]:n}))).then((()=>{e&&this.checkConflicts(n)}))}findConditionItemInState(e){return Object.values(this.state.conditions).find((t=>t.id===e))}updateConditionsState(e){return new Promise((t=>this.setState((t=>({conditions:e(t.conditions)})),t)))}render(){if(this.state.action.current===ConditionsProvider.actions.FETCH_CONFIG){if(this.state.error)return r.default.createElement("h3",null,i("Error:","elementor-pro")," ",this.state.error);if(this.state.loading)return r.default.createElement("h3",null,i("Loading","elementor-pro"),"...")}return r.default.createElement(c.Provider,{value:this.state},this.props.children)}}t.ConditionsProvider=ConditionsProvider;t.default=ConditionsProvider},8067:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class Condition{id=elementorCommon.helpers.getUniqueId();default="";type="include";name="";sub="";subId="";options=[];subOptions=[];subIdAutocomplete=[];subIdOptions=[];conflictErrors=[];constructor(e){this.set(e)}set(e){return Object.assign(this,e),this}clone(){return Object.assign(new Condition,this)}remove(e){return Array.isArray(e)||(e=[e]),e.forEach((e=>{delete this[e]})),this}only(e){Array.isArray(e)||(e=[e]);const t=Object.keys(this).filter((t=>!e.includes(t)));return this.remove(t),this}toJson(){return JSON.stringify(this)}toString(){return this.forDb().filter((e=>e)).join("/")}forDb(){return[this.type,this.name,this.sub,this.subId]}forContext(){return{type:this.type,name:this.name,sub:this.sub,subId:this.subId}}}t.default=Condition},2075:(e,t,n)=>{"use strict";var o=n(2470).__;Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ConditionsConfig=void 0;var i=n(5559);class ConditionsConfig{static instance;config=null;constructor(e){this.config=e}static create(){return ConditionsConfig.instance?Promise.resolve(ConditionsConfig.instance):$e.data.get(i.ConditionsConfig.signature,{},{refresh:!0}).then((e=>(ConditionsConfig.instance=new ConditionsConfig(e.data),ConditionsConfig.instance)))}getOptions(){return this.getSubOptions("general",!0).map((({label:e,value:t})=>({label:e,value:t})))}getSubOptions(e,t=!1){const n=this.config[e];return n?[{label:n.all_label,value:t?e:""},...n.sub_conditions.map((e=>{const t=this.config[e];return{label:t.label,value:e,children:t.sub_conditions.length?this.getSubOptions(e,!0):null}}))]:[]}getSubIdAutocomplete(e){const t=this.config[e];if(!t||"object"!=typeof t.controls)return{};const n=Object.values(t.controls);return n?.[0]?.autocomplete?n[0].autocomplete:{}}calculateInstances(e){let t=e.reduce(((e,t)=>{if("exclude"===t.type)return e;const n=t.sub||t.name,o=this.config[n];if(!o)return e;const i=t.subId?`${o.label} #${t.subId}`:o.all_label;return{...e,[n]:i}}),{});return 0===Object.keys(t).length&&(t=[o("No instances","elementor-pro")]),t}}t.ConditionsConfig=ConditionsConfig;t.default=ConditionsConfig},7952:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ConditionsConfig=void 0;class ConditionsConfig extends $e.modules.CommandData{static signature="site-editor/conditions-config";static getEndpointFormat(){return"site-editor/conditions-config/{id}"}}t.ConditionsConfig=ConditionsConfig;t.default=ConditionsConfig},5559:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"ConditionsConfig",{enumerable:!0,get:function(){return i.ConditionsConfig}}),Object.defineProperty(t,"Templates",{enumerable:!0,get:function(){return o.Templates}}),Object.defineProperty(t,"TemplatesConditions",{enumerable:!0,get:function(){return s.TemplatesConditions}}),Object.defineProperty(t,"TemplatesConditionsConflicts",{enumerable:!0,get:function(){return r.TemplatesConditionsConflicts}});var o=n(7636),i=n(7952),s=n(9591),r=n(7821)},7821:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.TemplatesConditionsConflicts=void 0;class TemplatesConditionsConflicts extends $e.modules.CommandData{static signature="site-editor/templates-conditions-conflicts";static getEndpointFormat(){return`${TemplatesConditionsConflicts.signature}/{id}`}}t.TemplatesConditionsConflicts=TemplatesConditionsConflicts;t.default=TemplatesConditionsConflicts},9591:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.TemplatesConditions=void 0;class TemplatesConditions extends $e.modules.CommandData{static signature="site-editor/templates-conditions";static getEndpointFormat(){return"site-editor/templates-conditions/{id}"}}t.TemplatesConditions=TemplatesConditions;t.default=TemplatesConditions},7636:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Templates=void 0;class Templates extends $e.modules.CommandData{static signature="site-editor/templates";static getEndpointFormat(){return"site-editor/templates/{id}"}}t.Templates=Templates;t.default=Templates},2239:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var r=i?Object.getOwnPropertyDescriptor(e,s):null;r&&(r.get||r.set)?Object.defineProperty(o,s,r):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}(n(5559));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:t})(e)}class Component extends $e.modules.ComponentBase{static namespace="site-editor";getNamespace(){return this.constructor.namespace}defaultData(){return this.importCommands(o)}}t.default=Component},7010:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(5206),i=n(1594),s=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var r=i?Object.getOwnPropertyDescriptor(e,s):null;r&&(r.get||r.set)?Object.defineProperty(o,s,r):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}(n(2688));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:t})(e)}const ConditionButtonPortal=e=>{const[t,n]=(0,i.useState)(!1),s=document.getElementById("portal-root");return(0,i.useEffect)((()=>{n(!!s)}),[s]),t?(0,o.createPortal)(e.children,s):null};ConditionButtonPortal.propTypes={children:s.oneOfType([s.node,s.string])};t.default=ConditionButtonPortal},7624:(e,t,n)=>{"use strict";var o=n(2470).__,i=n(2688),s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=ConditionConflicts;var r=s(n(1594)),a=n(7401);function ConditionConflicts(e){if(!e.conflicts.length)return"";const t=e.conflicts.map((e=>r.default.createElement(a.Button,{key:e.template_id,target:"_blank",url:e.edit_url,text:e.template_title})));return r.default.createElement(a.Text,{className:"e-site-editor-conditions__conflict",variant:"sm"},o("Elementor recognized that you have set this location for other templates: ","elementor-pro")," ",t)}ConditionConflicts.propTypes={conflicts:i.array.isRequired}},1360:(e,t,n)=>{"use strict";var o=n(2688),i=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=ConditionName;var s=i(n(1594)),r=n(7401);function ConditionName(e){if("general"!==e.default)return"";return s.default.createElement("div",{className:"e-site-editor-conditions__input-wrapper"},s.default.createElement(r.Select,{options:e.options,value:e.name,onChange:t=>e.updateConditions(e.id,{name:t.target.value,sub:"",subId:""})}))}ConditionName.propTypes={updateConditions:o.func.isRequired,id:o.string.isRequired,name:o.string.isRequired,options:o.array.isRequired,default:o.string.isRequired},ConditionName.defaultProps={name:""}},2943:(e,t,n)=>{"use strict";var o=n(2470).__,i=n(2688),s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=ConditionSubId;var r=s(n(1594)),a=n(7401);function ConditionSubId(e){const t=r.default.useMemo((()=>Object.keys(e.subIdAutocomplete).length?function getSettings(e){return{allowClear:!1,placeholder:o("All","elementor-pro"),dir:elementorCommon.config.isRTL?"rtl":"ltr",ajax:{transport:(t,n,o)=>elementorCommon.ajax.addRequest("pro_panel_posts_control_filter_autocomplete",{data:{q:t.data.q,autocomplete:e},success:n,error:o}),data:e=>({q:e.term,page:e.page}),cache:!0},escapeMarkup:e=>e,minimumInputLength:1}}(e.subIdAutocomplete):null),[e.subIdAutocomplete]);if(!e.sub||!t)return"";return r.default.createElement("div",{className:"e-site-editor-conditions__input-wrapper"},r.default.createElement(a.Select2,{onChange:t=>e.updateConditions(e.id,{subId:t.target.value}),value:e.subId,settings:t,options:e.subIdOptions}))}ConditionSubId.propTypes={subIdAutocomplete:i.object,id:i.string.isRequired,sub:i.string,subId:i.string,updateConditions:i.func,subIdOptions:i.array},ConditionSubId.defaultProps={subId:"",subIdOptions:[]}},2437:(e,t,n)=>{"use strict";var o=n(2688),i=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=ConditionSub;var s=i(n(1594)),r=n(7401);function ConditionSub(e){if("general"===e.name||!e.subOptions.length)return"";return s.default.createElement("div",{className:"e-site-editor-conditions__input-wrapper"},s.default.createElement(r.Select,{options:e.subOptions,value:e.sub,onChange:t=>e.updateConditions(e.id,{sub:t.target.value,subId:""})}))}ConditionSub.propTypes={updateConditions:o.func.isRequired,id:o.string.isRequired,name:o.string.isRequired,sub:o.string.isRequired,subOptions:o.array.isRequired},ConditionSub.defaultProps={sub:"",subOptions:{}}},1303:(e,t,n)=>{"use strict";var o=n(2470).__,i=n(2688),s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=ConditionType;var r=s(n(1594)),a=n(7401);function ConditionType(e){const t=r.default.createRef(),n=[{label:o("Include","elementor-pro"),value:"include"},{label:o("Exclude","elementor-pro"),value:"exclude"}];return r.default.useEffect((()=>{t.current.setAttribute("data-elementor-condition-type",e.type)})),r.default.createElement("div",{className:"e-site-editor-conditions__input-wrapper e-site-editor-conditions__input-wrapper--condition-type",ref:t},r.default.createElement(a.Select,{options:n,value:e.type,onChange:t=>{e.updateConditions(e.id,{type:t.target.value})}}))}ConditionType.propTypes={updateConditions:i.func.isRequired,id:i.string.isRequired,type:i.string.isRequired},ConditionType.defaultProps={type:""}},8927:(e,t,n)=>{"use strict";var o=n(2470).__,i=n(2688),s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=ConditionsRows;var r=s(n(1594)),a=s(n(8304)),d=n(4737),u=n(7401),l=s(n(1303)),c=s(n(1360)),p=s(n(2437)),f=s(n(2943)),m=s(n(7624)),C=s(n(7010));function ConditionsRows(e){const{conditions:t,createConditionItemInState:n,updateConditionItemState:i,removeConditionItemInState:s,saveConditions:h,action:b,resetActionState:_}=r.default.useContext(d.Context),g=Object.values(t).map((e=>r.default.createElement("div",{key:e.id},r.default.createElement("div",{className:"e-site-editor-conditions__row"},r.default.createElement("div",{className:`e-site-editor-conditions__row-controls ${e.conflictErrors.length&&"e-site-editor-conditions__row-controls--error"}`},r.default.createElement(l.default,(0,a.default)({},e,{updateConditions:i})),r.default.createElement("div",{className:"e-site-editor-conditions__row-controls-inner"},r.default.createElement(c.default,(0,a.default)({},e,{updateConditions:i})),r.default.createElement(p.default,(0,a.default)({},e,{updateConditions:i})),r.default.createElement(f.default,(0,a.default)({},e,{updateConditions:i})))),r.default.createElement(u.Button,{className:"e-site-editor-conditions__remove-condition",text:o("Delete","elementor-pro"),icon:"eicon-close",hideText:!0,onClick:()=>s(e.id)})),r.default.createElement(m.default,{conflicts:e.conflictErrors})))),SaveButton=()=>r.default.createElement(u.Button,{variant:"contained",color:"primary",size:"lg",hideText:v,icon:v?"eicon-loading eicon-animation-spin":"",text:o("Save & Close","elementor-pro"),onClick:()=>h().then(e.onAfterSave)}),v=b.current===d.ConditionsProvider.actions.SAVE&&b.loading;return r.default.createElement(r.default.Fragment,null,b.error&&r.default.createElement(u.Dialog,{text:b.error,dismissButtonText:o("Go Back","elementor-pro"),dismissButtonOnClick:_,approveButtonText:o("Learn More","elementor-pro"),approveButtonColor:"link",approveButtonUrl:"https://go.elementor.com/app-theme-builder-conditions-load-issue",approveButtonTarget:"_target"}),r.default.createElement("div",{className:"e-site-editor-conditions__rows"},g),r.default.createElement("div",{className:"e-site-editor-conditions__add-button-container"},r.default.createElement(u.Button,{className:"e-site-editor-conditions__add-button",variant:"contained",size:"lg",text:o("Add Condition","elementor-pro"),onClick:n})),r.default.createElement("div",{className:"e-site-editor-conditions__footer"},e?.loadPortal?r.default.createElement(C.default,null,r.default.createElement(SaveButton,null)):r.default.createElement(SaveButton,null)))}ConditionsRows.propTypes={onAfterSave:i.func,loadPortal:i.bool}},9212:(e,t,n)=>{"use strict";var o=n(2470).__,i=n(2688),s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=ConditionsModal;var r=function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=_getRequireWildcardCache(t);if(n&&n.has(e))return n.get(e);var o={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in e)if("default"!==s&&{}.hasOwnProperty.call(e,s)){var r=i?Object.getOwnPropertyDescriptor(e,s):null;r&&(r.get||r.set)?Object.defineProperty(o,s,r):o[s]=e[s]}return o.default=e,n&&n.set(e,o),o}(n(1594)),a=n(7401),d=s(n(12)),u=s(n(2075));function _getRequireWildcardCache(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(_getRequireWildcardCache=function(e){return e?n:t})(e)}function ConditionsModal(){const[e,t]=(0,r.useState)(!1),[n,i]=(0,r.useState)({conditions:null,instances:null}),s=(0,r.useRef)(!1),l=elementorProAdmin.customCode.post,c=(0,r.useMemo)((()=>({$form:jQuery("#post"),$formConditions:jQuery("<input />"),$publishButton:jQuery("#publish"),title:{$label:jQuery("#title-prompt-text"),$input:jQuery("#title")}})),[]),onPostSubmit=()=>{const{title:e}=c;e.$input.attr("value").length||(e.$label.addClass("screen-reader-text"),e.$input.attr("value",o("Elementor Custom-Code #","elementor-pro")+elementorProAdmin.customCode.post.ID))},onPublishClick=n=>{if("auto-draft"===l.post_status&&!e&&!s.current){n.preventDefault();const e=[{name:"general",sub:"",subId:"",type:"include"}];i((t=>({...t,conditions:e}))),t(!0)}};return(0,r.useEffect)((()=>{(async()=>{const e=await u.default.create();$e.data.get("site-editor/templates-conditions",{id:l.ID},{refresh:!0}).then((t=>{const n=Object.values(t.data).map((e=>({type:e.type,name:e.name,sub:e.sub_name,subId:e.sub_id}))),o=Object.values(e.calculateInstances(n)).join(",");i((e=>({...e,conditions:n,instances:o})))}))})(),c.$publishButton.on("click",onPublishClick),c.$form.on("submit",onPostSubmit)}),[]),l&&n.conditions?r.default.createElement(r.default.Fragment,null,r.default.createElement(a.Text,{tag:"span",className:"post-conditions-display"},r.default.createElement("b",null,n.instances+" ")),r.default.createElement(a.Button,{onClick:()=>t(!0),text:o("Edit","elementor"),variant:"underlined"}),r.default.createElement(a.ModalProvider,{show:e,setShow:t,title:o("Publish Settings","elementor"),icon:"eps-app__logo eicon-elementor"},r.default.createElement(a.CssGrid,{columns:1,spacing:700},r.default.createElement("section",null,r.default.createElement(d.default,{id:l.ID,status:l.post_status,conditions:n.conditions,onConditionsSaved:e=>{const n=e.conditions,o=Object.values(e.instances).join(","),{$form:r,$formConditions:a,$publishButton:d}=c;s.current=!0,i((e=>({...e,conditions:n,instances:o}))),"auto-draft"!==l.post_status&&"draft"!==l.post_status||a.attr("type","hidden").attr("name","_conditions").attr("value",JSON.stringify(n)).appendTo(r),d.trigger("click"),t(!1)},onAfterSave:()=>{}}))))):r.default.createElement(r.default.Fragment,null,r.default.createElement(a.Text,{tag:"span"},o("Loading","elementor")),r.default.createElement(a.Icon,{className:"spinner"}))}ConditionsModal.propTypes={children:i.object}},12:(e,t,n)=>{"use strict";var o=n(2470).__,i=n(2688),s=n(6784);Object.defineProperty(t,"__esModule",{value:!0}),t.default=Conditions;var r=s(n(1594)),a=n(7401),d=s(n(4737)),u=s(n(8927));function Conditions(e){const t={...e,defaultCondition:"general"};return r.default.createElement("section",{className:"e-site-editor-conditions"},r.default.createElement("div",{className:"e-site-editor-conditions__header"},r.default.createElement("img",{className:"e-site-editor-conditions__header-image",src:`${elementorAppProConfig.baseUrl}/modules/theme-builder/assets/images/conditions-tab.svg`,alt:o("Conditions","elementor-pro")}),r.default.createElement(a.Heading,{variant:"h1",tag:"h1"},o("Where Do You Want to Display Your Code?","elementor-pro")),r.default.createElement(a.Text,{variant:"md"},o("Set the conditions that determine where your code snippet is used throughout your site.","elementor-pro"),r.default.createElement("br",null),o("For example, choose 'Entire Site' to display the code snippet across your site.","elementor-pro"))),r.default.createElement(d.default,{validateConflicts:!1,currentTemplate:t,onConditionsSaved:(t,n)=>{$e.data.setCache($e.components.get("site-editor"),"site-editor/templates-conditions",{id:t},n.conditions),e.onConditionsSaved(n)}},r.default.createElement(u.default,{onAfterSave:e.onAfterSave,loadPortal:!1})))}Conditions.propTypes={id:i.number,status:i.string.isRequired,conditions:i.array,onConditionsSaved:i.func,onAfterSave:i.func.isRequired},Conditions.defaultProps={conditions:[],onConditionsSaved:()=>{}}},362:(e,t,n)=>{"use strict";var o=n(6441);function emptyFunction(){}function emptyFunctionWithReset(){}emptyFunctionWithReset.resetWarningCache=emptyFunction,e.exports=function(){function shim(e,t,n,i,s,r){if(r!==o){var a=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 a.name="Invariant Violation",a}}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,t,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},5206:e=>{"use strict";e.exports=ReactDOM},1755:e=>{"use strict";e.exports=__UNSTABLE__elementorAI.App},7401:e=>{"use strict";e.exports=elementorAppPackages.appUi},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 t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,_extends.apply(this,arguments)}e.exports=_extends,e.exports.__esModule=!0,e.exports.default=e.exports},6784:e=>{e.exports=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}},e.exports.__esModule=!0,e.exports.default=e.exports}},t={};function __webpack_require__(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,__webpack_require__),i.exports}(()=>{"use strict";var e=__webpack_require__(2470).__,t=__webpack_require__(6784);var n=t(__webpack_require__(1594)),o=t(__webpack_require__(2239)),i=t(__webpack_require__(9212)),s=t(__webpack_require__(1755));class CustomCode extends elementorModules.Module{constructor(){super(),jQuery(this.initialize.bind(this))}initialize(){$e.components.register(new o.default),ReactDOM.render(n.default.createElement(i.default,null),document.querySelector(".post-conditions")),this.addTipsyToFields(),this.addDescription(),this.addLocationChangeHandler(),this.addOpenAIButton(),this.setOptionsPlacementVisibility("elementor_body_end"===jQuery("#location").val())}addTipsyToFields(){jQuery(".elementor-field-label i[data-info]").tipsy({title(){return this.getAttribute("data-info")},gravity:()=>"s"})}addDescription(){const t="<p>"+e("Manage and create all of your custom code here.<br />Organize all of your custom code and incorporate code snippets in your site. Add tracking codes, meta titles, and other scripts. Set display conditions, locations, and priority all from one place.","elementor-pro")+' <a target="_blank" href="https://go.elementor.com/wp-dash-custom-code">'+e("Learn more","elementor-pro")+"</a></p>";jQuery(t).insertBefore(".wp-header-end")}addLocationChangeHandler(){jQuery("#location").on("change",(e=>{this.setOptionsPlacementVisibility("elementor_body_end"===e.target.value)}))}addOpenAIButton(){const t=jQuery(`<button class="e-ai-button"><i class="eicon-ai"></i> ${e("Code with AI","elementor-pro")}</button>`);t.on("click",(e=>{e.preventDefault();const t=elementorCommon.config.isRTL,o=document.createElement("div");document.body.append(o),ReactDOM.render(n.default.createElement(s.default,{type:"code",getControlValue:()=>document.querySelector(".CodeMirror").CodeMirror.getValue(),setControlValue:e=>document.querySelector(".CodeMirror").CodeMirror.setValue(e),additionalOptions:{codeLanguage:"html"},onClose:()=>{ReactDOM.unmountComponentAtNode(o),o.parentNode.removeChild(o)},isRTL:t}),o)})),jQuery(".elementor-field.location.elementor-field-select").after(t)}setOptionsPlacementVisibility(e){jQuery(".elementor-custom-code-options-placement").toggleClass("show",e)}}elementorProAdmin.customCode=new CustomCode})()})();