. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),r?(0,s.cloneElement)(e,{ref:e=>{Ss(r,e),Ss(t,e)}}):(0,s.cloneElement)(e,{ref:t})}(a,n)}}(a);t[r]=()=>e}})),t}function Ss(e,t){"function"==typeof e?e(t):e.current=t}class ws{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const t=this.dropTarget;this.handlerId&&(t?e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions)):this.lastConnectedDropTarget=t)}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!ys(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=bs({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,ms(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function Os(){const{dragDropManager:e}=(0,s.useContext)(Ho);return Bi(null!=e,"Expected drag drop context"),e}let Cs=!1;class Es{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;Bi(!Cs,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Cs=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Cs=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class Ds{canDrop(){const e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){const e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){const e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}function Ns(e,t){const r=vs(e,t),a=function(){const e=Os();return(0,s.useMemo)((()=>new Es(e)),[e])}(),n=function(e){const t=Os(),r=(0,s.useMemo)((()=>new ws(t.getBackend())),[t]);return fs((()=>(r.dropTargetOptions=e||null,r.reconnect(),()=>r.disconnectDropTarget())),[e]),r}(r.options);return function(e,t,r){const a=Os(),n=function(e,t){const r=(0,s.useMemo)((()=>new Ds(e,t)),[t]);return(0,s.useEffect)((()=>{r.spec=e}),[e]),r}(e,t),i=function(e){const{accept:t}=e;return(0,s.useMemo)((()=>(Bi(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t])),[t])}(e);fs((function(){const[e,o]=function(e,t,r){const a=r.getRegistry(),n=a.addTarget(e,t);return[n,()=>a.removeTarget(n)]}(i,n,a);return t.receiveHandlerId(e),r.receiveHandlerId(e),o}),[a,t,n,r,i.map((e=>e.toString())).join("|")])}(r,a,n),[ps(r.collect,a,n),hs(n)]}function xs(e){return(0,s.useMemo)((()=>e.hooks.dragSource()),[e])}function Ts(e){return(0,s.useMemo)((()=>e.hooks.dragPreview()),[e])}class Is{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId?e?(t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),t):(this.lastConnectedDragSource=e,t):t}reconnectDragPreview(e=!1){const t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();r&&this.disconnectDragPreview(),this.handlerId&&(t?r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions)):this.lastConnectedDragPreview=t)}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!ys(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!ys(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=bs({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,ms(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,ms(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}let Ms=!1,ks=!1;class Ps{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){Bi(!Ms,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Ms=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ms=!1}}isDragging(){if(!this.sourceId)return!1;Bi(!ks,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ks=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{ks=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class _s{beginDrag(){const e=this.spec,t=this.monitor;let r=null;return r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{},null!=r?r:null}canDrag(){const e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){const r=this.spec,a=this.monitor,{isDragging:n}=r;return n?n(a):t===e.getSourceId()}endDrag(){const e=this.spec,t=this.monitor,r=this.connector,{end:a}=e;a&&a(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}function Rs(e,t){const r=vs(e,t);Bi(!r.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const a=function(){const e=Os();return(0,s.useMemo)((()=>new Ps(e)),[e])}(),n=function(e,t){const r=Os(),a=(0,s.useMemo)((()=>new Is(r.getBackend())),[r]);return fs((()=>(a.dragSourceOptions=e||null,a.reconnect(),()=>a.disconnectDragSource())),[a,e]),fs((()=>(a.dragPreviewOptions=t||null,a.reconnect(),()=>a.disconnectDragPreview())),[a,t]),a}(r.options,r.previewOptions);return function(e,t,r){const a=Os(),n=function(e,t,r){const a=(0,s.useMemo)((()=>new _s(e,t,r)),[t,r]);return(0,s.useEffect)((()=>{a.spec=e}),[e]),a}(e,t,r),i=function(e){return(0,s.useMemo)((()=>{const t=e.type;return Bi(null!=t,"spec.type must be defined"),t}),[e])}(e);fs((function(){if(null!=i){const[e,o]=function(e,t,r){const a=r.getRegistry(),n=a.addSource(e,t);return[n,()=>a.removeSource(n)]}(i,n,a);return t.receiveHandlerId(e),r.receiveHandlerId(e),o}}),[a,t,r,n,i])}(r,a,n),[ps(r.collect,a,n),xs(n),Ts(n)]}function Ls(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function As(e){var t=e.id,r=e.itemType,a=e.onDrop,n=e.getIndex,i=e.className,l=e.innerComponentProps,c=e.InnerComponent,u=y(Rs((function(){return{type:r,item:{id:t},collect:function(e){return{isDragging:e.isDragging()}}}}),[t]),2),g=u[0].isDragging,d=u[1],f=Ns((function(){return{accept:r,hover:function(e){var r=e.id;if(r!==t){var i=n(t);a(r,i)}}}}),[n,a]),p=y(f,2)[1],v=g?"0.2":1;return(0,s.createElement)("div",{ref:function(e){return d(p(e))},className:i,style:{opacity:v}},c&&(0,s.createElement)(c,function(e){for(var t=1;t
0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return r({type:"ADD_COLOR",payload:Object.assign({},Di,{slug:e,color:t})})},deleteColor:function(e){return r({type:"DELETE_COLOR",payload:e})},updateColorValue:function(e,t){return r({type:"UPDATE_COLOR_VALUE",payload:{slug:e,value:t}})},updateColorSlug:function(e,t){return r({type:"UPDATE_COLOR_SLUG",payload:{slug:e,value:t}})}}}(),r=t.colors,a=t.setColors,n=t.addColor,i=t.deleteColor,o=t.updateColorValue,c=t.updateColorSlug,u=y((0,l.useState)(!1),2),g=u[0],d=u[1],f=y((0,l.useState)(!1),2),p=f[0],v=f[1],h=y((0,l.useState)([]),2),b=h[0],S=h[1];(0,l.useEffect)((function(){var t=(0,mi.isObject)(e.value)?Object.values(e.value):e.value;a(t),d(!0)}),[]),(0,l.useEffect)((function(){var t,a;g&&(a=[],(t=r).length>0&&t.forEach((function(e){a.push({name:e.slug,slug:e.slug,color:"var(--"+e.slug+")"})})),window.sessionStorage.setItem("generateGlobalColors",JSON.stringify(a)),function(t){wp.customize.control(e.customizerSetting.id).setting.set(t);var r=":root {";t.length>0&&t.forEach((function(e){var t=e.slug.replace(" ","-").toLowerCase();r+="--"+t+": "+e.color+";"})),r+="}";var a=document.getElementById("generate-global-color-styles");a?a.innerHTML=r:document.body.insertAdjacentHTML("beforeend",'")}(r))}),[JSON.stringify(r),g]);var w=(0,l.useCallback)((function(){n(function e(t){var a="global-color-".concat(t+1);return-1===(0,mi.findIndex)(r,{slug:a})?a:e(t+1)}(r.length))}),[r.length]);return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"customize-control-notifications-container",ref:e.setNotificationContainer}),(0,s.createElement)("div",{className:"generate-color-manager-wrapper"},(0,s.createElement)("div",{className:"generate-color-manager--item"},(0,s.createElement)(Mi,{onClick:w,disabled:p})),(0,s.createElement)("div",{className:"generate-color-manager--item"},(0,s.createElement)(Ti,{id:"add-color",icon:p?"check":"reorder",text:p?(0,m.__)("Finish re-ordering","generatepress"):(0,m.__)("Re-order colors","generatepress"),onClick:function(e){e.preventDefault(),p&&(a(b),window.sessionStorage.setItem("generateGlobalColors",JSON.stringify(b))),v(!p)}}))),p?(0,s.createElement)(js,{listData:r,idKey:"slug",listClassName:"generate-color-manager-dnd-list",itemClassName:"generate-color-manager-dnd-list-item",InnerComponent:Bs,onChangeData:S}):(0,s.createElement)(Pi,{colors:r,onChangeColor:o,onChangeSlug:c,onClickDeleteColor:i}))}));wp.customize.controlConstructor["generate-color-manager-control"]=Vs;var Hs=function(e){var t=y((0,l.useState)(!1),2),r=t[0],a=t[1],n=function(){e.choices.sectionRedirect?wp.customize.section(e.choices.toggleId).focus():document.querySelectorAll('[data-toggleId="'+e.choices.toggleId+'"]').forEach((function(e){r?(e.style.display="",a(!1)):(e.style.display="block",a(!0))}))},i=e.choices.tooltipText?e.choices.tooltipText:(0,m.sprintf)((0,m.__)("Open %s Settings","generatepress"),e.choices.title),o=e.choices.sectionRedirect?"chevron-right":"chevron-down";return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"generate-customize-control-title"},!!e.choices.toggleId&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.Tooltip,{text:i},(0,s.createElement)(u.Button,{className:"generate-customize-control-title--label",onClick:n},e.choices.title)),(0,s.createElement)(u.Tooltip,{text:i},(0,s.createElement)(u.Button,{className:"generate-customize-control-title--toggle",onClick:n},xe(r?"chevron-up":o)))),!e.choices.toggleId&&(0,s.createElement)("h3",null,e.choices.title)))};function zs(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function Us(e){for(var t=1;t=i)&&Object.keys(a.O).every((function(e){return a.O[e](r[l])}))?r.splice(l--,1):(s=!1,i0&&e[u-1][2]>i;u--)e[u]=e[u-1];e[u]=[r,n,i]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},function(){var e={242:0,863:0};a.O.j=function(t){return 0===e[t]};var t=function(t,r){var n,i,o=r[0],s=r[1],l=r[2],c=0;if(o.some((function(t){return 0!==e[t]}))){for(n in s)a.o(s,n)&&(a.m[n]=s[n]);if(l)var u=l(a)}for(t&&t(r);c