编辑文件:index.js
(()=>{var e={3390(e,t,a){var n,l=Object.create,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,o=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,d=(e,t,a,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let l of r(t))c.call(e,l)||l===a||s(e,l,{get:()=>t[l],enumerable:!(n=i(t,l))||n.enumerable});return e},m=(e,t,a)=>(a=null!=e?l(o(e)):{},d(!t&&e&&e.__esModule?a:s(a,"default",{value:e,enumerable:!0}),e)),u={};((e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})})(u,{AdminHeader:()=>Al,Analytics:()=>zl,BasicInput:()=>Y,BasicInputUI:()=>V,BlockBuilder:()=>$a,BlockBuilderUI:()=>Ma,ButtonInput:()=>M,ButtonInputUI:()=>E,CalendarInput:()=>oe,CalendarInputUI:()=>re,Card:()=>Jt,ChoiceToggle:()=>pe,ChoiceToggleUI:()=>ue,ColorSettingInput:()=>be,ColorSettingInputUI:()=>xe,Column:()=>ql,ComponentStatusView:()=>Gl,Container:()=>jl,CopyToClipboard:()=>Ka,CopyToClipboardUI:()=>Wa,CountryCodes:()=>Wn,DynamicRowSetting:()=>Bl,EmailsInputUI:()=>Sn,EventCalendar:()=>Ue,EventCalendarUI:()=>qe,ExpandablePanel:()=>kt,ExpandablePanelUI:()=>Ct,FileInput:()=>Et,FileInputUI:()=>Tt,FormGroup:()=>nt,FormGroupWrapper:()=>st,FormViewer:()=>cl,GuidedTourProvider:()=>Fl,HeaderSearch:()=>pl,InfoItem:()=>Wl,ItemList:()=>ct,ItemListUI:()=>ot,Log:()=>Ga,MapProviderUI:()=>Fa,Modules:()=>xl,MultiCheckBox:()=>sa,MultiCheckBoxUI:()=>la,MultiInputTable:()=>Qa,MultiInputTableUI:()=>Xa,NavigatorHeader:()=>vl,NestedComponent:()=>nn,NestedComponentUI:()=>an,Notice:()=>Qe,NoticeManager:()=>Je,NoticeReceiver:()=>et,Popup:()=>F,PopupUI:()=>P,PrePostText:()=>rn,PrePostTextUI:()=>sn,RandomInputKeyGeneratorUI:()=>Nn,RenderComponent:()=>Yn,Section:()=>un,SectionUI:()=>mn,SelectInput:()=>z,SelectInputUI:()=>K,SequentialTaskExecutor:()=>In,SequentialTaskExecutorUI:()=>$n,SettingMetaBox:()=>Na,SettingProvider:()=>Ql,SettingsNavigator:()=>wl,ShortCodeTable:()=>gn,ShortCodeTableUI:()=>hn,Skeleton:()=>Ie,TableCard:()=>Ps,Tabs:()=>_a,TabsUI:()=>wa,TextArea:()=>ca,TextAreaUI:()=>oa,Tooltip:()=>D,filterSettingByIds:()=>Os,getApiLink:()=>b,getApiResponse:()=>g,getAvailableSettings:()=>Rs,getDefaultSettings:()=>Bs,getSettingById:()=>qs,getSettingsByPriority:()=>Fs,htmlToBlocks:()=>rs,initializeModules:()=>Gn,isActiveSetting:()=>Us,renderBlocksToHTML:()=>as,sendApiResponse:()=>x,useModules:()=>Hn,useOutsideClick:()=>Kn,useSetting:()=>es}),e.exports=(n=u,d(s({},"__esModule",{value:!0}),n));var p=m(a(1609)),h=m(a(3743)),g=async(e,t={})=>{try{return(await h.default.get(e,t)).data}catch(t){return console.error(`❌ Error fetching data from ${e}`,t),null}},x=async(e,t,a,n={})=>{try{const l={headers:{"X-WP-Nonce":e.nonce,...n.headers},...n};return(await h.default.post(t,a,l)).data}catch(e){return console.error(`❌ Error sending data to ${t}`,e),null}},b=(e,t,a,n)=>`${n||e.apiUrl}/${a||e.restUrl}/${t}`,f=a(6609),j=m(a(3743)),y=a(1609),v=a(1609),N=a(5139),C=m(a(1609)),k=m(a(8145)),w=m(a(4335)),_=a(1609),S=m(a(3743)),A=a(790),T=({btn:e,index:t})=>{const[a,n]=(0,_.useState)(!1);var l;const s={...e.style?{button_background_color:(l=e.style).backgroundColor,button_text_color:l.color,button_border_color:l.borderColor,button_border_radious:l.borderRadius,button_font_size:l.fontSize,button_font_width:Number(l.fontWeight),button_border_size:l.borderWidth,button_padding_top:l.paddingTop,button_padding_right:l.paddingRight,button_padding_bottom:l.paddingBottom,button_padding_left:l.paddingLeft,button_margin_top:l.marginTop,button_margin_right:l.marginRight,button_margin_bottom:l.marginBottom,button_margin_left:l.marginLeft}:{},...e.customStyle||{}},i=`${s.button_padding_top}rem ${s.button_padding_right}rem ${s.button_padding_bottom}rem ${s.button_padding_left}rem`,r=`${s.button_margin_top}rem ${s.button_margin_right}rem ${s.button_margin_bottom}rem ${s.button_margin_left}rem`,o={border:a?`${s.button_border_size}rem solid ${s.button_border_color_onhover}`:`${s.button_border_size}rem solid ${s.button_border_color}`,backgroundColor:a?s.button_background_color_onhover:s.button_background_color,color:a?s.button_text_color_onhover:s.button_text_color,borderRadius:`${s.button_border_radious}rem`,fontSize:`${s.button_font_size}rem`,fontWeight:s.button_font_width,margin:r,padding:i};return(0,A.jsx)("button",{className:`admin-btn btn-${e.color||"purple-bg"}`,onClick:e.onClick,disabled:e.disabled,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),style:o,children:e.children||(0,A.jsxs)(A.Fragment,{children:[e.icon&&(0,A.jsx)("i",{className:`adminfont-${e.icon}`}),s.button_text||e.text]})},t)},E=({buttons:e,wrapperClass:t="",position:a=""})=>{const n=Array.isArray(e)?e:[e],l="buttons-wrapper"+(t?` ${t}`:"");return(0,A.jsx)("div",{className:l,"data-position":a,children:n.map((e,t)=>(0,A.jsx)(T,{btn:e,index:t},t))})},M={render:({field:e,onChange:t,canAccess:a})=>{const[n,l]=(0,_.useState)(""),s={color:e.color||"purple-bg",style:e.style,customStyle:e.customStyle},i=Array.isArray(e.options)&&e.options.length>0?e.options.map(e=>({...s,text:e.label,onClick:e.onClick,disabled:e.disabled,icon:e.icon})):[{...s,text:e.text||e.placeholder||e.name||"Click",disabled:e.disabled,onClick:e.onClick||(()=>{a&&("open_modal"!==e.action?e.redirect_url?window.open(e.redirect_url,"_self"):e.apilink?(0,S.default)({url:b(Un,String(e.apilink)),method:e.method??"GET",headers:{"X-WP-Nonce":Un.nonce},..."GET"===e.method&&{params:{key:e.key}},..."POST"===e.method&&{data:{key:e.key,action:e.action||[]}}}).then(e=>{if(e.data.message){const t=e?.data?.message;l(t)}}):t(!0):window.dispatchEvent(new CustomEvent("multivendorx:action",{detail:{type:"open_modal",key:e.key}})))}),icon:e.icon}];return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(E,{wrapperClass:e.wrapperClass||"",buttons:i,position:e.position||"left"}),n&&(0,A.jsx)("div",{className:"api-message",children:n})]})},validate:(e,t)=>e.required&&!t?`${e.label} is required`:null},$=a(1609),I=a(790),D=({text:e,children:t,position:a="top",withOutArrow:n=!1,className:l=""})=>(0,I.jsxs)("div",{className:`tooltip-wrapper ${a} ${n?"with-out-arrow":""} ${l}`,children:[t,(0,I.jsx)("span",{className:"tooltip-name",children:e})]}),L=a(790),P=(0,$.forwardRef)(({position:e="slide-right-to-left",open:t,toggleIcon:a,tooltipName:n="Menu",tooltipPosition:l="bottom",width:s=14,height:i="fit-content",className:r="",showBackdrop:o=!0,onOpen:c,onClose:d,children:m,header:u,footer:p},h)=>{const[g,x]=(0,$.useState)(!1),b=(0,$.useRef)(null),f=void 0!==t,j=f?t:g,y=()=>{f||x(!1),d?.()};Kn(b,()=>{j&&y()});const v={minWidth:"number"==typeof s?`${s}rem`:s,height:"number"==typeof i?`${i}rem`:i};return(0,L.jsxs)("div",{className:`popup ${r} ${j?"popup-open":""}`,children:[a&&(0,L.jsx)(D,{text:n,position:l,className:j?"hidden":"",children:(0,L.jsx)("i",{onClick:e=>{e.stopPropagation(),j?y():(f||x(!0),c?.())},className:`popup-icon adminfont-${a}`})}),o&&j&&(0,L.jsx)("div",{className:"popup-backdrop",onClick:y}),j&&(0,L.jsxs)("div",{className:"popup-content",style:v,"data-position":e,onClick:e=>e.stopPropagation(),ref:h,children:[u&&(0,L.jsxs)("div",{className:"popup-header",children:[(0,L.jsxs)("div",{className:"popup-title",children:[u.icon&&(0,L.jsx)("i",{className:`adminfont-${u.icon}`}),u.title]}),u.description&&(0,L.jsx)("div",{className:"desc",children:u.description})]}),"menu-dropdown"!=e&&(0,L.jsx)("i",{onClick:y,className:"close-icon adminfont-close"}),(0,L.jsx)("div",{className:"popup-body",children:m}),p&&(0,L.jsx)("div",{className:"popup-footer",children:p})]})]})}),F={render:({field:e})=>(0,L.jsx)(P,{position:e.position,toggleIcon:e.toggleIcon,tooltipName:e.tooltipName,width:e.width,height:e.height,className:e.className,showBackdrop:e.showBackdrop,open:e.open,onClose:e.onClose,onOpen:e.onOpen,header:e.header,footer:e.footer,children:e.children})},O=a(790),B={select:{type:"single-select",isMulti:!1,isCreatable:!1,Component:k.default},dropdown:{type:"single-select",isMulti:!1,isCreatable:!1,Component:k.default},"single-select":{type:"single-select",isMulti:!1,isCreatable:!1,Component:k.default},"multi-select":{type:"multi-select",isMulti:!0,isCreatable:!1,Component:k.default},"single-creatable":{type:"creatable",isMulti:!1,isCreatable:!0,Component:w.default},"creatable-multi":{type:"creatable-multi",isMulti:!0,isCreatable:!0,Component:w.default}},R={type:"single-select",isMulti:!1,isCreatable:!1,Component:k.default},q=(e,t,a)=>{const n=new Map(t.map(e=>[e.value,e])),l=(Array.isArray(e)?e:null!=e&&""!==e?[e]:[]).map(e=>n.get(e)??{value:e,label:e});return a?l:l[0]??null},U=(e,t,a)=>({control:(n,l)=>({...n,borderColor:"var(--border-color)",boxShadow:l.isFocused?"var(--box-shadow-theme)":"none",backgroundColor:t||"var(--background-white)",color:a||"var(--text-color)",minHeight:"2.213rem",...e?{}:{height:"2.213rem",maxHeight:"2.213rem"},paddingTop:0,paddingBottom:0,width:"100%",margin:0,"&:active":{color:"var(--color-primary)"},":hover":{borderColor:"var(--border-color)"}}),valueContainer:t=>({...t,margin:0,paddingTop:e?"0.125rem":0,paddingBottom:e?"0.125rem":0,backgroundColor:"transparent",flexWrap:e?"wrap":"nowrap"}),option:(e,t)=>({...e,fontSize:"0.95rem",backgroundColor:t.isSelected?"var(--background-primary)":t.isFocused?"var(--background-color)":"var(--background-white)",color:t.isSelected?"var(--text-color)":"var(--themeColor)",cursor:"pointer"}),menu:e=>({...e,borderRadius:4,marginTop:0}),multiValue:e=>({...e,backgroundColor:"var(--background-primary)",margin:"0.125rem"}),multiValueLabel:e=>({...e,color:"var(--color-primary)",padding:"0 0.25rem"}),multiValueRemove:e=>({...e,color:"var(--color-primary)",":hover":{backgroundColor:"var(--color-primary)",color:"var(--background-white)"}})}),W={MenuList:e=>{const{menuContent:t,keepMenuOpenOnMenuContentClick:a}=e.selectProps;return(0,O.jsxs)(k.components.MenuList,{...e,children:[e.children,t&&(0,O.jsx)("div",{className:"select-menu-content",onMouseDown:e=>{a&&(e.preventDefault(),e.stopPropagation())},children:t})]})},NoOptionsMessage:e=>(0,O.jsx)(k.components.NoOptionsMessage,{...e,children:(0,O.jsx)("span",{className:"no-options",children:e.selectProps.noOptionsText??"No options available"})}),ValueContainer:e=>{const{children:t,getValue:a,selectProps:{maxVisibleItems:n,onOverflowClick:l,__isExpanded:s,__setIsExpanded:i}}=e;if(!n)return(0,O.jsx)(k.components.ValueContainer,{...e,children:t});const r=a().length,o=s?r:n,c=Math.max(0,r-o),d=C.default.Children.toArray(t),m=d[d.length-1],u=d.slice(0,-1).slice(0,o);return(0,O.jsxs)(k.components.ValueContainer,{...e,children:[u,c>0&&(0,O.jsxs)("span",{className:"admin-badge blue overflow-badge",onMouseDown:e=>{e.preventDefault(),e.stopPropagation(),l?l():i?.(!s)},role:"button",tabIndex:0,title:`${c} more selected`,children:["+",c]}),m]})}},K=({type:e,options:t,value:a,onChange:n,maxVisibleItems:l,onOverflowClick:s,isClearable:i=!1,name:r,placeholder:o,inputClass:c,wrapperClass:d,size:m,menuContent:u,keepMenuOpenOnMenuContentClick:p,noOptionsText:h,selectDeselect:g,selectDeselectLabel:x="Select / Deselect All",onSelectDeselectAll:b,formatCreateLabel:f=e=>`Add "${e}"`,disabled:j=!1,enableOverflowPopup:y=!1,popupTitle:v,popupWidth:N,background:k,color:w})=>{const[_,S]=C.default.useState(!1),[A,T]=C.default.useState(!1),{isMulti:M,Component:$}=B[e]??R,I=$,D=t.map((e,t)=>({value:e.value,label:e.label??e.value,index:t})),L={name:r,placeholder:o,className:`${c??""} select-wrapper`,classNamePrefix:"select-prefix",value:q(a,D,M),options:D,isMulti:M,isDisabled:j,isClearable:i,onChange:e=>n(((e,t)=>t?e.map(e=>e.value):e?.value??"")(e??(M?[]:null),M)),components:W,formatCreateLabel:f,onOverflowClick:()=>{y?T(!0):s?.()},__isExpanded:_,__setIsExpanded:S,menuContent:u,keepMenuOpenOnMenuContentClick:p,noOptionsText:h,menuPortalTarget:document.body,menuPosition:"fixed",styles:{...U(M,k,w),menuPortal:e=>({...e,zIndex:99})}},F="number"==typeof m?`${m}rem`:m;return(0,O.jsxs)("div",{className:`form-select-field ${d??""}`,style:{width:F??""},children:[g&&(0,O.jsx)(E,{position:"left",buttons:[{text:x,color:"purple",onClick:e=>{e.preventDefault(),b?.(e)}}]}),(0,O.jsx)(I,{...L,maxVisibleItems:l}),y&&(0,O.jsx)(P,{position:"lightbox",open:A,onClose:()=>T(!1),className:"select-popup",showBackdrop:!0,width:N??28,header:{title:v??r??"Selected Items",showCloseButton:!0},children:(0,O.jsx)(I,{...L})})]})},z={render:({field:e,value:t,onChange:a,canAccess:n,settings:l})=>{const{type:s}=B[e.type]??R;let i=e.options||[];const r=Array.isArray(i)?i.map(e=>({value:String(e.value),label:e.label??String(e.value)})):Object.entries(i||{}).map(([e,t])=>({value:String(e),label:String(t)}));return(0,O.jsx)(K,{type:s,name:e.key,inputClass:e.className,wrapperClass:e.wrapperClass,size:e.size,placeholder:e.placeholder,maxVisibleItems:e.maxVisibleItems,isClearable:e.isClearable,selectDeselect:e.selectDeselect,selectDeselectLabel:"Select / Deselect All",options:r,value:(o=t,Array.isArray(o)?o.length&&"object"==typeof o[0]&&"value"in o[0]?o.map(e=>String(e.value)):o.map(String):null!=o&&""!==o?String(o):void 0),onChange:e=>{n&&JSON.stringify(e)!==JSON.stringify(t)&&a(e)},menuContent:e.menuContent,keepMenuOpenOnMenuContentClick:e.keepMenuOpenOnMenuContentClick,noOptionsText:e.noOptionsText,formatCreateLabel:e.formatCreateLabel,disabled:!n,enableOverflowPopup:e.enableOverflowPopup,popupTitle:e.popupTitle,popupWidth:e.popupWidth});var o},validate:(e,t)=>e.required&&(!t||Array.isArray(t)&&0===t.length)?`${e.label} is required`:null},H=a(1609),G=a(790),V=(0,H.forwardRef)(({id:e,type:t="text",name:a="basic-input",placeholder:n,value:l,required:s=!1,inputClass:i,inputLabel:r,wrapperClass:o,disabled:c=!1,readOnly:d=!1,size:m,minNumber:u,maxNumber:p,onChange:h,onClick:g,onMouseOver:x,onMouseOut:b,onFocus:f,onBlur:j,onKeyDown:y,rangeUnit:v,preText:N,postText:C,multiple:k},w)=>{const _="number"==typeof m?`${m}rem`:m;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)("div",{className:`setting-form-input input-wrapper ${o||""} `,style:{width:_||""},children:[N&&(0,G.jsx)("span",{className:"pre",dangerouslySetInnerHTML:{__html:N}}),(0,G.jsx)("input",{ref:w,id:e,className:`basic-input ${i??""}`,type:t,name:a,placeholder:n,min:"number"===t||"range"===t?u:void 0,max:"number"===t||"range"===t?p:void 0,value:l,onChange:e=>h(e.target.value),onClick:g,onMouseOver:x,onMouseOut:b,onFocus:f,onBlur:j,onKeyDown:y,disabled:c,readOnly:d,required:s,multiple:k,autoComplete:"off"}),"color"===t&&(0,G.jsxs)("label",{htmlFor:"",className:"color-value",children:[r&&(0,G.jsxs)("span",{className:"title",children:[" ",r," "]}),l??""]}),C&&(0,G.jsx)("span",{className:"parameter",dangerouslySetInnerHTML:{__html:C}})]}),"range"===t&&(0,G.jsxs)("output",{className:"settings-metabox-description",children:[l??"",v]})]})}),Y={render:({field:e,value:t,onChange:a,canAccess:n})=>(0,G.jsx)(V,{wrapperClass:e.wrapperClass,inputClass:e.class,id:e.id,name:e.name,type:e.type,placeholder:e.placeholder,inputLabel:e.inputLabel,rangeUnit:e.rangeUnit,minNumber:e.minNumber??0,maxNumber:e.maxNumber??50,preText:e.preText,postText:e.postText,value:t,size:e.size,multiple:e.multiple,readOnly:e.readOnly,onChange:e=>{n&&a(e)}}),validate:(e,t)=>e.required&&!t?.[e.key]?`${e.label} is required`:null},Z=a(790),J=[{id:1,key:"address_1",label:"Address Line 1",type:"text",placeholder:"Address Line 1",required:!0},{id:2,key:"address_2",label:"Address Line 2",type:"text",placeholder:"Address Line 2",required:!1},{id:3,key:"city",label:"City",type:"text",placeholder:"City",required:!0},{id:4,key:"country",label:"Country",type:"select",options:["India","USA","UK","Canada"],required:!1},{id:5,key:"state",label:"State",type:"select",options:["Karnataka","Maharashtra","Delhi","Tamil Nadu"],required:!1},{id:6,key:"postcode",label:"Postal Code",type:"text",placeholder:"Postal Code",required:!0}],X=({formField:e,opendInput:t,setOpendInput:a})=>{const[n,l]=(0,v.useState)(e.fields?.length?e.fields:"form"===e.context?J:[]);(0,v.useEffect)(()=>{e.fields?.length?l(e.fields):e.fields?.length||"form"!==e.context?l([]):l(J)},[e.fields,e.context]);const s={text:e=>(0,Z.jsxs)("div",{className:"address-field-item",children:[(0,Z.jsx)("label",{className:"field-label",children:e.label}),(0,Z.jsx)(V,{placeholder:e.placeholder})]}),select:e=>(0,Z.jsxs)("div",{className:"address-field-item",children:[(0,Z.jsx)("label",{className:"field-label",children:e.label}),(0,Z.jsx)(K,{type:"single-select",options:e.options?.map(e=>({value:e,label:e}))||[]})]})};return n.length?(0,Z.jsx)(N.ReactSortable,{list:n,setList:e=>{l(e)},handle:".drag-handle",animation:150,group:{name:`address-${e.id}`,pull:!1,put:!1},className:"address-fields",children:n.map(n=>(0,Z.jsxs)("div",{className:"form-field "+(t?.id===n.id?"active":""),onClick:t=>{t.stopPropagation(),a({...n,readonly:e.readonly,parentId:e.id})},children:[(0,Z.jsx)("div",{className:"meta-menu",children:(0,Z.jsx)("span",{className:"admin-badge blue drag-handle",children:(0,Z.jsx)("i",{className:"admin-font adminfont-drag"})})}),s[n.type]?.(n)]},n.id))}):null},Q={render:({field:e})=>{const[t,a]=(0,v.useState)(null);return(0,Z.jsx)(X,{formField:e,opendInput:t,setOpendInput:a})}},ee=a(1609),te=m(a(4985)),ae=m(a(728)),ne=a(790),le=(e,t="MMMM DD YYYY")=>e?e.selectedDates&&e.selectedDates.length>0?e.selectedDates.map(e=>new te.DateObject({date:e,format:t})):[new te.DateObject({date:e.startDate,format:t}),new te.DateObject({date:e.endDate,format:t})]:null,se=({setValue:e,pickerRef:t,format:a,onClose:n})=>{const l=new Date,s=e=>{const t=new Date(e),a=t.getDay();return t.setDate(t.getDate()-a+(0===a?-6:1)),t},i=e=>{const t=s(e);return t.setDate(t.getDate()+6),t},r=e=>new Date(e.getFullYear(),e.getMonth(),1),o=e=>new Date(e.getFullYear(),e.getMonth()+1,0),c=l=>{const s=l.map(e=>new te.DateObject({date:e,format:a}));e(1===s.length?s[0]:s),t.current?.closeCalendar(),n?.(),closeDropdown?.()},d=new Date(l.getFullYear(),l.getMonth(),l.getDate()-1),m=new Date(s(l).getFullYear(),s(l).getMonth(),s(l).getDate()-7),u=i(m),p=new Date(l.getFullYear(),l.getMonth()-1,1),h=o(p),g=s(l),x=r(l),b=(e=>{const t=e.getMonth(),a=3*Math.floor(t/3);return new Date(e.getFullYear(),a,1)})(l),f=new Date(l.getFullYear(),0,1);return(0,ne.jsxs)("div",{className:"range-picker-wrapper",children:[(0,ne.jsx)("div",{onClick:()=>c([l]),children:"Today"}),(0,ne.jsx)("div",{onClick:()=>c([d]),children:"Yesterday"}),(0,ne.jsx)("div",{onClick:()=>c([s(l),i(l)]),children:"This Week"}),(0,ne.jsx)("div",{onClick:()=>c([m,u]),children:"Last Week"}),(0,ne.jsx)("div",{onClick:()=>c([r(l),o(l)]),children:"This Month"}),(0,ne.jsx)("div",{onClick:()=>c([p,h]),children:"Last Month"}),(0,ne.jsx)("div",{onClick:()=>c([g,l]),children:"Week to date"}),(0,ne.jsx)("div",{onClick:()=>c([x,l]),children:"Month to date"}),(0,ne.jsx)("div",{onClick:()=>c([b,l]),children:"Quarter to date"}),(0,ne.jsx)("div",{onClick:()=>c([f,l]),children:"Year to date"})]})},ie=({commonProps:e,showInput:t,inputClass:a,format:n,getDisplayValue:l,presetsProps:s})=>{const[i,r]=(0,ee.useState)(0),[o,c]=(0,ee.useState)(!1),d=(0,ee.useRef)(null),m=(0,ee.useRef)(null),u=(0,ee.useRef)(null),[p,h]=(0,ee.useState)(!1),g=()=>{if(!m.current||!u.current)return;const e=m.current.getBoundingClientRect(),t=u.current.offsetHeight,a=window.innerHeight-e.bottom,n=e.top;h(a<t&&n>t)};(0,ee.useEffect)(()=>{if(!o)return;const e=()=>{requestAnimationFrame(g)},t=e=>{m.current&&(m.current.contains(e.target)||c(!1))};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),document.addEventListener("mousedown",t),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),document.removeEventListener("mousedown",t)}},[o]);const x={...e,onChange:t=>{e.onChange(t),(Array.isArray(t)&&2===t.length||t instanceof te.DateObject)&&c(!1)}},b=[{label:"Presets",content:(0,ne.jsx)(se,{...s,closeDropdown:()=>c(!1)})},{label:"Custom",content:(0,ne.jsx)(te.Calendar,{className:t?"input-calendar":"calendar-wrapper",...e,...x,ref:d})}];return t?(0,ne.jsxs)("div",{className:"settings-calender",ref:m,children:[(0,ne.jsx)("input",{className:`basic-input calender-input ${a||""}`,onFocus:()=>{c(!0)},readOnly:!0,name:"calendar-input",value:l?l():"",placeholder:n}),o&&(0,ne.jsxs)("div",{ref:u,className:"calendar-tabs-container "+(p?"open-upward":"open-downward"),children:[(0,ne.jsx)("div",{className:"tabs-wrapper",children:(0,ne.jsx)("div",{className:"tabs-item",children:b.map((e,t)=>(0,ne.jsx)("div",{className:"tab "+(t===i?"active-tab":""),onClick:()=>r(t),children:e.label},t))})}),(0,ne.jsx)("div",{className:"calendar-tab-content",children:b[i].content})]})]}):(0,ne.jsx)("div",{className:"settings-calender",ref:m,children:(0,ne.jsxs)("div",{className:"calendar-tabs-container",children:[(0,ne.jsx)("div",{className:"tabs-wrapper",children:(0,ne.jsx)("div",{className:"tabs-item",children:b.map((e,t)=>(0,ne.jsx)("div",{className:"tab "+(t===i?"active-tab":""),onClick:()=>r(t),children:e.label},t))})}),(0,ne.jsx)("div",{className:"calendar-tab-content",children:b[i].content})]})})},re=({inputClass:e,format:t="MMMM DD YYYY",value:a,onChange:n,multiple:l=!1,showInput:s=!0,numberOfMonths:i=1,fullYear:r,maxFutureMonths:o,showCompare:c=!1,calendar:d=!1,minDate:m,disabledDates:u=[]})=>{const p=(0,ee.useRef)(null),h=(e=>{if(void 0!==e){const t=new Date;return t.setMonth(t.getMonth()+e),t}return new Date})(o),[g,x]=(0,ee.useState)(le(a,t));(0,ee.useEffect)(()=>{x(le(a,t))},[a,t]);const b=e=>{if(x(e),l){if(e){const t=Array.isArray(e)?e.map(e=>e.toDate()):[e.toDate()];n?.({selectedDates:t})}}else if(Array.isArray(e)&&2===e.length){const[t,a]=e;n?.({startDate:t.toDate(),endDate:a.toDate()}),p.current?.closeCalendar?.()}else if(e instanceof te.DateObject){const t=e.toDate();n?.({startDate:t,endDate:t}),p.current?.closeCalendar?.()}},f=new Map(u.map(e=>{const t=new Date(e.date);return t.setHours(0,0,0,0),[t.toDateString(),e.description]})),j=[];l&&j.push((0,ne.jsx)(ae.default,{},"date-panel"));const y={ref:p,value:g,format:t,range:!l&&!d,numberOfMonths:i,sort:!0,onChange:b,maxDate:h,minDate:m,multiple:l,plugins:j,fullYear:r,mapDays:({date:e})=>{const t=e.toDate();t.setHours(0,0,0,0);const a=f.get(t.toDateString());return a?{disabled:!0,title:a,className:"disabled-date"}:{}}},v=e=>{const t=new Date(e);return t.setFullYear(t.getFullYear()-1),t},N=e=>(e instanceof Date?e:new Date(e)).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),C=()=>{if(!a?.startDate)return"";const e=a.startDate,t=a.endDate||a.startDate,n=e===t,l=n?N(e):`${N(e)} ~ ${N(t)}`;if(!c)return l;const s=v(e),i=v(t);return`${l} vs ${n?N(s):`${N(s)} ~ ${N(i)}`}`};return d?(0,ne.jsx)("div",{className:"settings-calender",children:s?(0,ne.jsx)(te.default,{...y,className:e,placeholder:t,render:(e,t)=>(0,ne.jsx)("input",{className:"calender-input",onFocus:t,readOnly:!0,name:"calendar-input",value:C()})}):(0,ne.jsx)(te.Calendar,{className:"calendar-wrapper calendar",...y})}):(0,ne.jsx)(ie,{commonProps:y,showInput:s,inputClass:e,format:t,getDisplayValue:C,presetsProps:{setValue:b,pickerRef:p,format:t,onClose:()=>p.current?.closeCalendar()}})},oe={render:({field:e,value:t,onChange:a})=>(0,ne.jsx)(re,{inputClass:e.inputClass,format:e.format,calendar:e.calendar??!1,multiple:e.multiple??!1,showInput:e.showInput,numberOfMonths:e.numberOfMonths,fullYear:e.fullYear,value:t,onChange:a,maxFutureMonths:e.maxFutureMonths,showCompare:e.showCompare})},ce=a(1609),de=a(1609),me=a(790),ue=({options:e,wrapperClass:t,value:a,key:n,onChange:l,iconEnable:s=!1,custom:i,width:r,multiSelect:o=!1,modules:c,onBlocked:d})=>{const m=(0,de.useId)(),u=n?`${n}_${m}`:m;return(0,me.jsx)(me.Fragment,{children:(0,me.jsx)("div",{className:`choice-toggle-container ${t||""}`,children:(0,me.jsx)("div",{className:"choice-toggle-wrapper "+(i?"custom":""),children:e.map(e=>{const t=o?Array.isArray(a)&&a.includes(e.value):a===e.value,n=!!e.proSetting,m=`${u}_${e.key}`;return(0,me.jsxs)("div",{role:"button",tabIndex:0,className:"toggle-option",style:i&&r?{width:r}:{},children:[(0,me.jsx)("input",{className:"choice-toggle-form-input",type:o?"checkbox":"radio",id:m,name:u,value:e.value,checked:t,readOnly:!0,onClick:()=>((e,t)=>{if(!(e=>e.proSetting&&!Un.khali_dabba?(d?.("pro"),!0):e.moduleEnabled&&!c.includes(e.moduleEnabled)?(d?.("module",e.moduleEnabled),!0):!(!e.requiredPlugin||(Un.active_plugins||[]).includes(e.requiredPlugin)||(d?.("plugin",e),0)))(t))if(o){const t=Array.isArray(a)?a:[];let n;n=t.includes(e)?t.filter(t=>t!==e):[...t,e],l(n)}else l(e)})(e.value,e)}),(0,me.jsxs)("label",{htmlFor:m,children:[(0,me.jsx)("span",{children:s?(0,me.jsx)("i",{className:e.value}):e.img?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("img",{src:e.img}),e.label]}):e.icon?(0,me.jsxs)(me.Fragment,{children:[(0,me.jsx)("i",{className:`adminfont-${e.icon} `}),e.label]}):e.label}),e.desc&&(0,me.jsx)("div",{className:"des",children:e.desc}),e.customHtml&&(0,me.jsx)("div",{className:"choice-toggle-custom-wrapper",dangerouslySetInnerHTML:{__html:e.customHtml}})]}),!e.proSetting&&e.moduleEnabled&&!c.includes(e.moduleEnabled)&&(0,me.jsxs)("span",{className:"admin-pro-tag module",children:[(0,me.jsx)("i",{className:`adminfont-${e.moduleEnabled}`}),(p=e.moduleEnabled,p.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")),(0,me.jsx)("i",{className:"adminfont-lock"})]}),n&&!Un.khali_dabba&&(0,me.jsxs)("span",{className:"admin-pro-tag",children:[(0,me.jsx)("i",{className:"adminfont-pro-tag"}),"Pro"]})]},e.key);var p})})})})},pe={render:({field:e,value:t,onChange:a,canAccess:n,modules:l,onBlocked:s})=>(0,me.jsx)(ue,{wrapperClass:e.wrapperClass,iconEnable:e.iconEnable,custom:e.custom,width:e.width,multiSelect:e.multiSelect,canAccess:n,modules:l,onBlocked:s,options:Array.isArray(e.options)?e.options.map(e=>({...e,value:String(e.value)})):[],value:e.multiSelect?Array.isArray(t)?t:t?[String(t)]:[]:String(t??e.defaultValue??""),onChange:e=>{n&&a(e)}},e.key),validate:(e,t)=>e.required&&!t?.[e.key]?`${e.label} is required`:null},he=a(5607),ge=a(790),xe=e=>{const{filedKey:t,templateSelector:a=!1,predefinedOptions:n=[],images:l=[],templates:s=[],value:i,onChange:r,showPdfButton:o}=e,c=i?.selectedPalette||(n[0]?.value??""),d=i?.colors||{},[m,u]=(0,ce.useState)(i?.templateKey||s?.[0]?.key),p=(0,ce.useMemo)(()=>s?.find(e=>e.key===m),[s,m]),h=p?.pdf,g=e=>{r?.({target:{name:t,value:e}})},x="templates"===c?"templates":"custom"===c?"custom":"predefined",[b,f]=(0,ce.useState)(x),[j,y]=(0,ce.useState)(c),[v,N]=(0,ce.useState)(d),[C,k]=(0,ce.useState)({colorPrimary:"#FF5959",colorSecondary:"#FADD3A",colorAccent:"#49BEB6",colorSupport:"#075F63",...d}),[w,_]=(0,ce.useState)(l?.[0]?.img||null);(0,ce.useEffect)(()=>{if("custom"!==j){const e=n.find(e=>e.value===j);N(e?.colors||{})}},[j,n]),(0,ce.useEffect)(()=>{const e=i?.selectedPalette;if(!e)return;const t=l.find(t=>t.value===e);t?.img&&_(t.img)},[i?.selectedPalette,l]);const S=e=>{const t=e.target.value;y(t),f("custom"===t?"custom":"predefined");const a=n.find(e=>e.value===t),l="custom"===t?C:a?.colors||{};N(l),g({selectedPalette:t,colors:l})};return(0,ge.jsxs)("div",{className:"color-settings-wrapper",children:[(s?.length??0)>1&&!a&&(0,ge.jsx)("div",{className:e.wrapperClass,children:(0,ge.jsxs)("div",{className:"form-group-setting-wrapper",children:[(0,ge.jsx)("label",{children:"Select Template"}),(0,ge.jsx)(K,{name:"dashboard_template",options:s.map(e=>({label:e.label,value:e.key})),value:m,onChange:e=>{var t;e&&!Array.isArray(e)&&(t=e.value,u(t),g({templateKey:t,colors:C}))}})]})}),(0,ge.jsxs)("div",{className:"color-setting",children:[n.length>0&&(0,ge.jsxs)("div",{className:"color-palette-wrapper",children:[(0,ge.jsxs)("div",{className:"form-group-setting-wrapper",children:[(0,ge.jsx)("label",{children:"Color Palette"}),(0,ge.jsx)(ue,{options:[{key:"predefined",value:"predefined",label:"Pre-defined"},{key:"custom",value:"custom",label:"Custom"}],value:b,onChange:e=>{const t=Array.isArray(e)?e[0]:e;if("predefined"===t){f("predefined");const e=n[0]?.value??"";y(e);const t=n.find(t=>t.value===e),a=t?.colors||{};N(a),g({selectedPalette:e,colors:a})}"templates"===t&&(f("templates"),y("templates"),N(C),g({templateKey:m||m,colors:C})),"custom"===t&&(f("custom"),y("custom"),N(C),g({selectedPalette:"custom",colors:C}))}})]}),(0,ge.jsxs)("div",{className:"color-palette",children:["predefined"===b&&(0,ge.jsx)(ge.Fragment,{children:n.map(t=>{const a=j===t.value;return(0,ge.jsxs)("div",{className:"palette",children:[(0,ge.jsx)("input",{className:e.inputClass,id:`${e.idPrefix}-${t.key}`,type:"radio",name:"vendor_color_scheme_picker",checked:a,value:t.value,onChange:S}),(0,ge.jsxs)("label",{htmlFor:`${e.idPrefix}-${t.key}`,children:[t.colors&&(0,ge.jsx)("div",{className:"color",children:Object.values(t.colors).map((e,t)=>(0,ge.jsx)("div",{style:{backgroundColor:e}},t))}),t.image&&(0,ge.jsx)("div",{className:"color",children:(0,ge.jsx)("img",{src:t.image,alt:""})}),(0,ge.jsx)("span",{children:t.label})]})]},t.key)})}),"custom"===b&&(0,ge.jsx)(ge.Fragment,{children:Object.entries(C).map(([e,t])=>(0,ge.jsx)(V,{type:"color",value:t,inputLabel:e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase()),onChange:t=>((e,t)=>{const a={...C,[e]:t};k(a),N(a),y("custom"),f("custom"),g({selectedPalette:"custom",colors:a})})(e,t)}))})]})]}),a&&(0,ge.jsx)("div",{className:"template-list image-list",children:s.map(e=>(0,ge.jsx)("div",{className:"image-thumbnail template-thumbnail "+(m===e.key?"active":""),onClick:()=>{u(e.key),f("templates"),y("templates"),g({templateKey:e.key,colors:C})},children:(0,ge.jsx)("label",{children:e.label})},e.key))}),p&&(0,ge.jsx)("div",{className:"preview-wrapper",children:(0,ge.jsx)(p.component,{colors:{colorPrimary:v.colorPrimary??C.colorPrimary,colorSecondary:v.colorSecondary??C.colorSecondary,colorAccent:v.colorAccent??C.colorAccent,colorSupport:v.colorSupport??C.colorSupport},isPreview:!0})})]}),l.length>0&&(0,ge.jsxs)("div",{className:"color-setting",children:[(0,ge.jsx)("div",{className:"image-list",children:l&&l.map(e=>(0,ge.jsxs)("div",{className:"image-thumbnail "+(j===e.value?"active":""),onClick:()=>{const t=e.value||"";y(t),_(e.img||null),f("predefined");const a=n.find(e=>e.value===t);g({selectedPalette:t,colors:a?.colors||{}})},children:[(0,ge.jsx)("img",{src:e.img,alt:e.label}),(0,ge.jsx)("label",{children:e.label})]},e.key))}),(0,ge.jsx)("div",{className:"image-preview",children:w&&(0,ge.jsx)("img",{src:w,alt:"Selected Template"})})]}),o&&h&&(0,ge.jsx)(he.PDFDownloadLink,{document:(0,ge.jsx)(h,{colors:v}),fileName:`invoice-${m}.pdf`,children:({loading:e})=>e?"Generating PDF…":"Download PDF"})]})},be={render:({field:e,value:t,onChange:a,canAccess:n})=>(0,ge.jsx)(xe,{filedKey:e.key,wrapperClass:"form-group-color-setting",inputClass:"setting-form-input",predefinedOptions:e.predefinedOptions??[],images:e.images??[],value:t,templates:e.templates,onChange:e=>{n&&a(e.target.value)},templateSelector:e.templateSelector??!1,idPrefix:"color-setting",showPdfButton:e.showPdfButton??!1}),validate:()=>null},fe=(e,t)=>`${t[`${e}Top`]??0}rem ${t[`${e}Right`]??0}rem ${t[`${e}Bottom`]??0}rem ${t[`${e}Left`]??0}rem`,je=e=>e?{backgroundColor:e.backgroundColor,color:e.color}:{},ye=e=>e?{padding:fe("padding",e),margin:fe("margin",e)}:{},ve=e=>e?{borderWidth:void 0!==e.borderWidth?`${e.borderWidth}rem`:void 0,borderColor:e.borderColor,borderStyle:e.borderStyle,borderRadius:void 0!==e.borderRadius?`${e.borderRadius}rem`:void 0}:{},Ne=e=>e?{textAlign:e.textAlign,fontSize:void 0!==e.fontSize?`${e.fontSize}rem`:void 0,fontFamily:e.fontFamily,lineHeight:e.lineHeight,fontWeight:e.fontWeight,textDecoration:e.textDecoration}:{},Ce=e=>e?{width:e.width,height:e.height}:{},ke=e=>e?{justifyContent:e.justifyContent}:{},we=(e,t={})=>{if(!e)return{};const{includeText:a=!0,includeDimensions:n=!0}=t;return{...je(e),...ye(e),...ve(e),...a?Ne(e):{},...n?Ce(e):{},...ke(e)}},_e=a(790),Se=({field:e,onChange:t,editable:a=!0})=>{if(!e)return null;const n={...we(e.style,{includeText:!0}),textAlign:e.style?.textAlign||"left",display:"block",width:"100%"},l=a=>{"heading"===e.type||"title"===e.type?t({text:a.currentTarget.textContent||""}):t({html:a.currentTarget.innerHTML})};if("heading"===e.type||"title"===e.type){const t=`h${e.level||2}`;return(0,_e.jsx)(t,{className:"email-heading",style:n,contentEditable:a,suppressContentEditableWarning:!0,onBlur:l,children:e.text||"Heading Text"})}return"form"===e.context?(0,_e.jsxs)("label",{className:"terms-checkbox",children:[(0,_e.jsx)("input",{type:"checkbox",checked:e.checked||!1}),(0,_e.jsx)("div",{className:"email-text",style:n,contentEditable:a,suppressContentEditableWarning:!0,onBlur:e=>{t({html:e.currentTarget.innerHTML})},dangerouslySetInnerHTML:{__html:e.html||'I agree to the <a href="#">Terms & Conditions</a>'}})]}):(0,_e.jsx)("div",{className:"email-text",style:n,contentEditable:a,suppressContentEditableWarning:!0,onBlur:l,dangerouslySetInnerHTML:{__html:e.html||"This is a demo text"}})},Ae={render:({field:e,onChange:t})=>e?(0,_e.jsx)(Se,{field:e,onChange:e=>{t(e)},editable:!0}):null},Te=a(1609),Ee=m(a(3743)),Me=m(a(318)),$e=a(790),Ie=({variant:e="text",width:t="100%",height:a=1,className:n=""})=>{const l=e=>"number"==typeof e?`${e}rem`:e,s={width:l(t),height:l(a)};return(0,$e.jsx)("span",{className:`skeleton skeleton-${e} ${n}`,style:s})},De=a(790),Le=({apilink:e,onChange:t})=>{const[a,n]=(0,Te.useState)([]),[l,s]=(0,Te.useState)(null),[i,r]=(0,Te.useState)(""),[o,c]=(0,Te.useState)(""),[d,m]=(0,Te.useState)(!0),u=(0,Te.useRef)(null);Kn(u,()=>s(null)),(0,Te.useEffect)(()=>{m(!0),(0,Ee.default)({url:b(Un,e),method:"GET",headers:{"X-WP-Nonce":Un.nonce},params:{menuOnly:!0}}).then(e=>{const t=e.data,a=Object.entries(t).map(([e,t])=>[e,{...t,visible:!1!==t.visible}]);n(a),m(!1)})},[e]);const p=e=>{n(e),t(Object.fromEntries(e))},h=(e,t)=>{const n=a.map(([a,n])=>a===e?[a,t(n)]:[a,n]);p(n)},g=([e,t],n)=>{const d="dashboard"===e;return(0,De.jsxs)("div",{"data-index":n,className:"menu-item",children:[l===e?(0,De.jsx)("div",{className:"edit-menu",ref:u,children:(0,De.jsxs)("div",{className:"name-wrapper",children:[(0,De.jsx)(V,{type:"text",value:i,onChange:t=>{const a=t;r(a),h(e,e=>({...e,name:a}))}}),!d&&(0,De.jsx)(V,{type:"text",value:o,onChange:t=>{const n=((e,t)=>{const n=e.toLowerCase().replace(/[^a-z0-9-]/g,"").trim();if(!n)return"";const l=a.filter(([e])=>e!==t).map(([,e])=>e.slug);let s=n,i=1;for(;l.includes(s);)s=`${n}${i++}`;return s})(t,e);c(n),n&&h(e,e=>({...e,slug:n}))}})]})}):(0,De.jsxs)("div",{className:"main-menu",style:{opacity:!1===t.visible?.5:1},children:[(0,De.jsxs)("div",{className:"name-wrapper",children:[!d&&(0,De.jsx)("i",{className:"adminfont-drag"}),(0,De.jsx)("i",{className:`adminfont-${t.icon}`}),(0,De.jsxs)("div",{className:"name",children:[t.name,!d&&(0,De.jsx)("code",{children:t.slug})]})]}),!d&&(0,De.jsxs)("div",{className:"edit-icon",children:[!1!==t.visible&&(0,De.jsx)("i",{className:"adminfont-edit",onClick:()=>((e,t)=>{s(e),r(t.name),c(t.slug)})(e,t)}),(0,De.jsx)("i",{className:"adminfont-eye"+(!1===t.visible?"-blocked":""),onClick:()=>(e=>{h(e,e=>({...e,visible:!1===e.visible}))})(e)})]})]}),t.submenu?.length>0&&(0,De.jsx)(Me.default,{nodeSelector:".sub-menu",onDragEnd:(t,a)=>((e,t,a)=>{h(e,e=>{const n=[...e.submenu],l=n.splice(t,1)[0];return n.splice(a,0,l),{...e,submenu:n}})})(e,t,a),children:(0,De.jsx)("ul",{children:t.submenu.map((a,n)=>{const o=`${e}-sub-${n}`;return(0,De.jsx)("li",{className:"sub-menu",style:{opacity:!1===t.visible?.5:1},children:l===o?(0,De.jsx)(V,{ref:u,type:"text",value:i,onChange:t=>{const a=t;r(a),((e,t)=>{h(e,e=>{const n=[...e.submenu];return n[t]=(l=n[t],{...l,name:a}),{...e,submenu:n};var l})})(e,n)}}):(0,De.jsxs)(De.Fragment,{children:[(0,De.jsx)("i",{className:"adminfont-drag"}),a.name,(0,De.jsx)("i",{className:"adminfont-edit",onClick:()=>{s(o),r(a.name)}})]})},n)})})})]},e)};return d?(0,De.jsx)("div",{className:"endpoints-wrapper",children:[...Array(10).keys()].map(e=>(0,De.jsx)("div",{className:"endpoint drag-row",children:(0,De.jsx)("div",{className:"menu-item",children:(0,De.jsx)(Ie,{height:2.813})})},e))}):(0,De.jsx)("div",{className:"endpoints-wrapper",children:(0,De.jsx)(Me.default,{nodeSelector:".drag-row",handleSelector:".drag-handle",onDragEnd:(e,t)=>{const n=[...a],l=n.splice(e,1)[0];n.splice(t,0,l),p(n)},children:a.map(([e,t],a)=>(0,De.jsx)("div",{className:"endpoint drag-row",children:"dashboard"===e?g([e,t],a):(0,De.jsx)("div",{className:"drag-handle menu-wrapper",children:g([e,t],a)})},e))})})},Pe={render:({field:e,onChange:t,canAccess:a})=>(0,De.jsx)(Le,{name:e.key,apilink:String(e.apiLink),onChange:e=>{a&&t(e)}}),validate:()=>null},Fe=a(1609),Oe=a(4985),Be=a(790),Re=e=>`${e.year}-${String(e.month.number).padStart(2,"0")}-${String(e.day).padStart(2,"0")}`,qe=({wrapperClass:e="",format:t="MMMM DD YYYY",value:a={},onChange:n,onMonthChange:l,onEventClick:s,NumberOfMonth:i=1,fullYear:r})=>{const[o,c]=(0,Fe.useState)(null),d=a;return o&&d[Re(o)],(0,Be.jsx)("div",{className:`settings-event-calendar ${e}`,children:(0,Be.jsx)(Oe.Calendar,{format:t,numberOfMonths:i,fullYear:r,onMonthChange:l,mapDays:({date:e})=>{const t=d[Re(e)]||[];return{children:(0,Be.jsxs)("div",{className:"sd",children:[(0,Be.jsx)("span",{className:"date",children:e.day}),(0,Be.jsx)("div",{className:"events-container",children:t.map(t=>(0,Be.jsx)("div",{className:"event",title:t.title,onClick:a=>{s&&s(t,e)},children:(0,Be.jsx)("div",{className:"name",children:t.title.length>20?`${t.title.substring(0,20)}...`:t.title})},t.id))})]})}}})})},Ue={render:({field:e,value:t,onChange:a})=>(0,Be.jsx)(qe,{...e,value:t,onChange:a})},We=a(1609),Ke=m(a(3743)),ze=a(1609),He=a(790),Ge="zyra_app_notices_v1",Ve=[],Ye=new Set,Ze=()=>{(()=>{const e=Date.now(),t=Ve.filter(t=>"number"==typeof t.expiresAt&&t.expiresAt>e);0===t.length?localStorage.removeItem(Ge):localStorage.setItem(Ge,JSON.stringify(t))})(),Ye.forEach(e=>e([...Ve]))};"undefined"!=typeof window&&(Ve=(()=>{if("undefined"==typeof window)return[];try{const e=localStorage.getItem(Ge);if(!e)return[];const t=Date.now();return JSON.parse(e).filter(e=>"number"==typeof e.expiresAt&&e.expiresAt>t)}catch{return[]}})());var Je={subscribe:e=>(Ye.add(e),e([...Ve]),()=>Ye.delete(e)),add(e,t){const a=e.uniqueKey||Date.now().toString();if(Ve.some(e=>e.uniqueKey===a))return;let n;n=void 0!==t?t:"float"===e.position?2e3:"lifetime";const l="lifetime"===n?void 0:Date.now()+n;Ve.push({...e,uniqueKey:a,expiresAt:l}),l&&"number"==typeof n&&setTimeout(()=>{Je.remove(a)},n),Ze()},remove(e){Ve=Ve.filter(t=>t.uniqueKey!==e),Ze()},clearSession(){Ve=Ve.filter(e=>e.expiresAt),Ze()}},Xe=(e,t)=>(0,He.jsxs)(He.Fragment,{children:[(0,He.jsx)("i",{className:`admin-font adminfont-${e.type}`}),(0,He.jsxs)("div",{className:"notice-details",style:{"--total-items":Array.isArray(e.message)?e.message.length:1,"--step-time":"4s","--banner-duration":4*(Array.isArray(e.message)?e.message.length:1)+"s"},children:[e.title&&(0,He.jsx)("div",{className:"notice-text",children:e.title}),Array.isArray(e.message)?(0,He.jsxs)(He.Fragment,{children:[e.message.map((t,a)=>(0,He.jsxs)("div",{className:"notice-desc",style:{animationDelay:4*a+"s"},children:[(0,He.jsx)("span",{dangerouslySetInnerHTML:{__html:t}}),e.actionLabel&&(0,He.jsx)("div",{className:"banner-btn",onClick:e.onAction,children:e.actionLabel})]},a)),t&&(0,He.jsx)("i",{className:"close-icon adminfont-close",onClick:()=>((e,t="banner_dismissed")=>{localStorage.setItem(t,"true"),Je.remove(e)})(e.uniqueKey,e.dismissStorageKey)})]}):e.message&&(0,He.jsx)("div",{className:"notice-desc",dangerouslySetInnerHTML:{__html:e.message}})]})]}),Qe=({uniqueKey:e,title:t,dismissStorageKey:a,message:n,type:l="success",displayPosition:s="notice",actionLabel:i,onAction:r,validity:o})=>{const[c,d]=(0,ze.useState)(!0);if((0,ze.useEffect)(()=>{"inline"!==s&&"inline-notice"!==s&&(Je.add({uniqueKey:e,title:t,message:n,type:l,position:s,actionLabel:i,onAction:r,dismissStorageKey:a},o),d(!1))},[]),!["inline","inline-notice"].includes(s)||!c||!t&&!n)return null;const m={uniqueKey:e||"inline",dismissStorageKey:a,title:t,message:n,type:l,position:"notice",actionLabel:i,onAction:r};return(0,He.jsx)("div",{className:`ui-notice type-${l} display-${s}`,children:Xe(m,()=>d(!1))})},et=({position:e})=>{const[t,a]=(0,ze.useState)([]);return(0,ze.useEffect)(()=>Je.subscribe(t=>{a(t.filter(t=>t.position===e))}),[e]),t.length?(0,He.jsx)("div",{className:`receiver receiver-${e}`,children:t.map(e=>(0,He.jsx)("div",{className:`ui-notice type-${e.type} display-${e.position}`,children:Xe(e,()=>Je.remove(e.uniqueKey))},e.uniqueKey))}):null},tt={render:({field:e})=>{const t={uniqueKey:e.uniqueKey||e.key,title:e.title,message:e.message,type:e.noticeType||"info",position:"notice",actionLabel:e.actionLabel,onAction:e.onAction};return(0,He.jsx)("div",{className:`ui-notice type-${t.type} display-${t.position}`,children:Xe(t)})}},at=a(790),nt=({label:e,desc:t="",icon:a,iconRight:n,htmlFor:l="",children:s,className:i="",labelDes:r,cols:o=12,row:c=!1,notice:d,noticeType:m="error"})=>(0,at.jsxs)("div",{className:`form-group ${c?"row":""} ${i}`,"data-cols":o,children:[e&&(0,at.jsxs)("label",{className:"settings-form-label",htmlFor:l,children:[(0,at.jsxs)("div",{className:"title",children:[a&&(0,at.jsx)("i",{className:`adminfont-${a} ${a} form-icon`}),e,n&&(0,at.jsx)("i",{className:`adminfont-${n} form-icon`})]}),r&&(0,at.jsx)("div",{className:"settings-metabox-description",children:r})]}),(0,at.jsxs)("div",{className:"settings-input-content",children:[s,d&&(0,at.jsx)(Qe,{type:m,message:d,displayPosition:"inline"}),t&&(0,at.jsx)(at.Fragment,{children:"string"==typeof t?(0,at.jsx)("div",{className:"settings-metabox-description",dangerouslySetInnerHTML:{__html:t}}):(0,at.jsxs)("div",{className:"settings-metabox-description",children:[" ",t," "]})})]})]}),lt=a(790),st=({children:e,className:t=""})=>(0,lt.jsx)("div",{className:`form-group-wrapper ${t}`,children:e}),it=m(a(1609)),rt=a(790),ot=({items:e,background:t,border:a,className:n,onItemClick:l,loading:s=!1,skeletonCount:i=5})=>{const[r,o]=it.default.useState("price-list"===n);return s?(0,rt.jsx)("div",{className:`item-list ${n||"default"}`,children:Array.from({length:i}).map((e,t)=>(0,rt.jsxs)("div",{className:"item",children:[(0,rt.jsx)(Ie,{variant:"circular",width:2,height:2}),(0,rt.jsxs)("div",{className:"details",children:[(0,rt.jsx)(Ie,{width:"60%",height:.75}),(0,rt.jsx)(Ie,{width:"40%",height:.625})]})]},t))}):(0,rt.jsxs)("div",{className:`item-list ${n||"default"} ${r?"expanded":""}`,children:[e&&e.map(e=>(0,rt.jsx)(it.default.Fragment,{children:e.link?(0,rt.jsxs)("a",{href:e.link,target:e.targetBlank?"_blank":"_self",className:`item ${t?"background":""} ${a?"border":""} ${e.className||""}`,onClick:t=>{t.stopPropagation(),e.action&&e.action(e,t),l&&l(e)},children:[e.icon&&(0,rt.jsx)("i",{className:`item-icon adminfont-${e.icon}`}),e.title]}):(0,rt.jsxs)("div",{className:`item ${t?"background":""} ${a?"border":""} ${e.className||""}`,onClick:()=>{e.action?.(e),l&&l(e)},children:[e.icon&&(0,rt.jsx)("i",{className:`item-icon adminfont-${e.icon}`}),e.img&&(0,rt.jsx)("img",{src:e.img,alt:e.title||"item image"}),(0,rt.jsxs)("div",{className:"details",children:[(0,rt.jsx)("div",{className:"item-title",dangerouslySetInnerHTML:{__html:e.title}}),e.value&&(0,rt.jsx)("div",{className:"value",children:e.value}),e.desc&&(0,rt.jsx)("div",{className:"desc",children:e.desc})]}),"notification"===n&&(0,rt.jsxs)(rt.Fragment,{children:[(0,rt.jsx)("i",{className:"check-icon adminfont-check green-color",onClick:t=>{t.stopPropagation(),e.onApprove?.(e)}}),(0,rt.jsx)("i",{className:"check-icon adminfont-cross red-color",onClick:t=>{t.stopPropagation(),e.onReject?.(e)}})]}),e.tags&&(0,rt.jsx)("div",{className:"tags",children:"string"==typeof e.tags?(0,rt.jsx)("div",{dangerouslySetInnerHTML:{__html:e.tags}}):e.tags})]})},e.id)),"price-list"===n&&(0,rt.jsx)("div",{className:"more-btn-wrapper",children:(0,rt.jsx)("span",{className:"more-btn",onClick:e=>{e.stopPropagation(),o(e=>!e)},children:r?(0,rt.jsxs)(rt.Fragment,{children:["More ",(0,rt.jsx)("i",{className:"adminfont-arrow-down"})]}):(0,rt.jsxs)(rt.Fragment,{children:["Less ",(0,rt.jsx)("i",{className:"adminfont-arrow-up"})]})})})]})},ct={render:({field:e,value:t,onChange:a,canAccess:n})=>{const l=Array.isArray(t)?t:e.items||[];return(0,rt.jsx)(ot,{items:l,className:e.className,background:e.background,border:e.border,loading:e.loading,onItemClick:e=>{n&&(e.action&&e.action(e),a?.(e))}})}},dt=a(790),mt=(0,We.createContext)(null),ut=(0,We.createContext)(null),pt=()=>{const e=(0,We.useContext)(mt);if(!e)throw new Error("usePanel must be used within PanelProvider");return e},ht=()=>{const e=(0,We.useContext)(ut);if(!e)throw new Error("usePanelItem must be used within PanelItemProvider");return e},gt=(e,t)=>{switch(t.type){case"SET_METHODS":return{...e,methods:t.methods};case"SET_ACTIVE_TAB":return{...e,activeTab:t.id};case"SET_WIZARD_INDEX":return{...e,wizardIndex:t.index};case"SET_PROGRESS":return{...e,progress:t.progress};case"SET_OPEN_DROPDOWN":return{...e,openDropdown:t.id};case"SET_ICON_DROPDOWN":return{...e,iconDropdown:t.id};case"START_EDIT":return{...e,editId:t.id,editField:t.field,editTitle:t.title||"",editDesc:t.desc||""};case"UPDATE_EDIT_TITLE":return{...e,editTitle:t.title};case"UPDATE_EDIT_DESC":return{...e,editDesc:t.desc};case"COMMIT_EDIT":case"CANCEL_EDIT":return{...e,editId:null,editField:null,editTitle:"",editDesc:""};case"ADD_METHOD":return{...e,methods:[...e.methods,t.method],activeTab:t.method.id};case"DELETE_METHOD":return{...e,methods:e.methods.filter(e=>e.id!==t.id),activeTab:e.activeTab===t.id?null:e.activeTab};default:return e}},xt=e=>"button"!==e.type&&"notice"!==e.type,bt=(e,t)=>{if(!t.length)return e;const a=new Set((e.formFields??[]).map(e=>e.key));return{...e,formFields:[...e.formFields??[],...t.filter(e=>!a.has(e.key))]}},ft=(e,t,a)=>!(!e.isCustom||a?.editableFields&&!1===a.editableFields[t]),jt=()=>{const{state:e,dispatch:t,addNewTemplate:a,titleRef:n,descRef:l,iconPicker:s,handleChange:i,commitEdit:r,isWizardMode:o,editTitleShow:c}=pt(),{method:d,methodValue:m,isOpen:u,isOn:p,hasFields:h,icon:g,title:x,desc:b,showMandatoryBadge:f}=ht(),j=e.editId===d.id,y=e.editField,v=e.editTitle,N=e.editDesc,C=e.iconDropdown,k=d.disableBtn&&!d.isCustom||o&&d.isWizardMode||!0===a?.showMandatoryCheckbox;return(0,dt.jsxs)("div",{className:"expandable-header",children:[k&&(0,dt.jsx)("div",{className:"toggle-icon",children:(!0===a?.showMandatoryCheckbox||(o&&d.isWizardMode?h:h&&p))&&(0,dt.jsx)("i",{className:"adminfont-"+(u?"keyboard-arrow-down":"pagination-right-arrow"),onClick:()=>t({type:"SET_ACTIVE_TAB",id:u?null:d.id})})}),(0,dt.jsx)("div",{className:"header-details "+(k?"toggle":""),onClick:()=>{const e=window.event?.target;e?.closest(".editable-title, .editable-description, .inline-edit-icon, .mandatory-checkbox-field")||t({type:"SET_ACTIVE_TAB",id:u?null:d.id})},children:(0,dt.jsxs)("div",{className:"details-wrapper",children:[g&&(0,dt.jsxs)("div",{className:"expandable-header-icon",ref:C===d.id?s:null,onClick:e=>{d.iconEnable&&t({type:"SET_ICON_DROPDOWN",id:C===d.id?null:d.id})},children:[(0,dt.jsx)("i",{className:`adminfont-${g} icon`}),d.iconEnable&&C!==d.id&&(0,dt.jsx)("i",{className:"adminfont-edit edit-icon"}),d.iconEnable&&C===d.id&&(0,dt.jsx)("div",{className:"icon-options-list",onClick:e=>e.stopPropagation(),children:(d.iconOptions??a?.iconOptions??[]).map(e=>(0,dt.jsx)("button",{type:"button",className:"icon-option "+(g===e?"selected":""),onClick:()=>{i(d.id,"icon",e),t({type:"SET_ICON_DROPDOWN",id:null})},title:e,children:(0,dt.jsx)("i",{className:`adminfont-${e}`})},e))})]}),(0,dt.jsxs)("div",{className:"expandable-header-info",children:[(0,dt.jsxs)("div",{className:"title-wrapper",children:[j&&"title"===y&&ft(d,"title",a)?(0,dt.jsx)(V,{ref:n,value:v,onChange:e=>t({type:"UPDATE_EDIT_TITLE",title:e}),onKeyDown:e=>"Enter"===e.key&&r(),onClick:e=>e.stopPropagation()}):(0,dt.jsxs)("span",{className:"title "+(ft(d,"title",a)?"editable-title":""),onClick:e=>{ft(d,"title",a)&&t({type:"START_EDIT",id:d.id,field:"title",title:m.title||d.label||""})},title:ft(d,"title",a)?"Click to edit":void 0,children:[x,ft(d,"title",a)&&(0,dt.jsx)("i",{className:"adminfont-edit inline-edit-icon"})]}),d.disableBtn&&!d.isCustom&&(0,dt.jsx)("div",{className:"panel-badges",children:(0,dt.jsx)("div",{className:"admin-badge "+(p?"green":"red"),children:p?"Active":"Inactive"})}),(d.mandatory||f)&&(0,dt.jsx)("div",{className:"admin-badge red",children:"Mandatory"})]}),(0,dt.jsxs)("div",{className:"panel-description",children:[c&&(0,dt.jsxs)("b",{children:[" ",x,": "]}),j&&"description"===y&&ft(d,"description",a)?(0,dt.jsx)("textarea",{ref:l,className:"description-edit",value:N,onChange:e=>t({type:"UPDATE_EDIT_DESC",desc:e.target.value}),onKeyDown:e=>"Enter"===e.key&&e.ctrlKey&&r(),onClick:e=>e.stopPropagation(),rows:3}):(0,dt.jsxs)("div",{className:ft(d,"description",a)?"editable-description":void 0,onClick:e=>{ft(d,"description",a)&&t({type:"START_EDIT",id:d.id,field:"description",desc:m.description||d.desc||""})},title:ft(d,"description",a)?"Click to edit":void 0,children:[(0,dt.jsx)("span",{dangerouslySetInnerHTML:{__html:b}}),ft(d,"description",a)&&(0,dt.jsx)("i",{className:"adminfont-edit inline-edit-icon"})]})]})]})]})}),(0,dt.jsx)(yt,{})]})},yt=()=>{const{state:e,dispatch:t,handleChange:a,handleDelete:n,canDelete:l}=pt(),{method:s,isOn:i,isOpen:r,hasFields:o,price:c,cntFlds:d,idx:m}=ht();return(0,dt.jsxs)("div",{className:"right-section",children:[c&&(0,dt.jsxs)("span",{className:"price-field",children:[c.price,c.unit&&(0,dt.jsx)("span",{className:"desc",children:c.unit})]}),(0,dt.jsxs)("ul",{className:"settings-btn",children:[s.isCustom&&!s.hideDeleteBtn&&l()&&(0,dt.jsx)(E,{buttons:[{icon:"delete",text:"Delete",color:"red",onClick:()=>n(s.id)}]}),s.disableBtn&&!s.isCustom&&(i?o&&(0,dt.jsx)(E,{buttons:[{icon:"setting",text:"Settings",color:"purple",onClick:()=>t({type:"SET_ACTIVE_TAB",id:r?null:s.id})}]}):(0,dt.jsx)("li",{onClick:()=>a(s.id,"enable",!0),children:(0,dt.jsxs)("span",{className:"admin-btn btn-purple-bg",children:[(0,dt.jsx)("i",{className:"adminfont-eye"})," Enable"]})})),s.isCustom&&s.disableBtn&&(i?(0,dt.jsx)(E,{buttons:[{icon:"eye-blocked",text:"Hide",color:"purple",onClick:()=>a(s.id,"enable",!1)}]}):(0,dt.jsx)("li",{onClick:()=>a(s.id,"enable",!0),children:(0,dt.jsxs)("span",{className:"admin-btn btn-purple-bg",children:[(0,dt.jsx)("i",{className:"adminfont-eye"})," Show"]})})),!s.disableBtn&&s.countBtn&&d.length>0&&(()=>{const t=(e.progress[m]||0)===d.length;return(0,dt.jsxs)("div",{className:"admin-badge "+(t?"green":"red"),children:[(0,dt.jsx)("i",{className:"adminfont-"+(t?"check":"error")}),t?"Complete":`${e.progress[m]||0} of ${d.length} done`]})})()]}),!s.isCustom&&i&&(0,dt.jsx)("div",{className:"icon-wrapper",children:(0,dt.jsx)(P,{position:"menu-dropdown",toggleIcon:"more-vertical",tooltipName:"Settings",children:(0,dt.jsx)(ot,{items:[...s.disableBtn&&o?[{id:"settings",title:"Settings",icon:"setting",action:(e,a)=>{a?.stopPropagation(),t({type:"SET_ACTIVE_TAB",id:r?null:s.id}),t({type:"SET_OPEN_DROPDOWN",id:null})}}]:[],{id:"disable",title:"Disable",icon:"eye-blocked",className:"delete",action:(e,n)=>{n?.stopPropagation(),a(s.id,"enable",!1),t({type:"SET_OPEN_DROPDOWN",id:null})}}]})})})]})},vt=()=>{const{isWizardMode:e,renderField:t,shouldRender:a,handleChange:n,addNewTemplate:l}=pt(),{method:s,isOpen:i,isOn:r}=ht(),o=!0===l?.showMandatoryCheckbox,c=Boolean(s.formFields?.length)||o,d=!0===l?.showMandatoryCheckbox;return(c||d)&&i&&(r||s.isCustom||s.openForm||o)?(0,dt.jsx)("div",{className:`${s.wrapperClass??""} expandable-panel open`.trim(),children:(0,dt.jsxs)(st,{children:[d&&(0,dt.jsx)(nt,{row:!0,label:"Mandatory",desc:"Mark this item as mandatory",children:(0,dt.jsx)("input",{type:"checkbox",checked:s.mandatory||!1,onChange:e=>{const t=e.target.checked;n(s.id,"mandatory",t)},onClick:e=>e.stopPropagation()})}),s.formFields?.map(n=>e&&"wizardButtons"===n.key?null:(Array.isArray(n.dependent)?n.dependent.every(e=>a(e,s.id)):!n.dependent||a(n.dependent,s.id))?(0,dt.jsxs)(nt,{row:!0,label:"notice"!==n.type?n.label:void 0,desc:n.desc,labelDes:n.settingDescription,htmlFor:n.name,children:[n.beforeElement&&t(s.id,n.beforeElement),t(s.id,n)]},n.key):null)]})}):null},Nt=({method:e,idx:t})=>{const{state:a,value:n,addNewTemplate:l}=pt(),s=(0,We.useRef)(null),i=n[e.id]??{},r=!0===l?.showMandatoryCheckbox,o=e.isCustom?!1!==i.enable:Boolean(i.enable),c=a.activeTab===e.id,d=Boolean(e.formFields?.length)||r,m=i.icon||e.icon,u=(e=>{const{price:t,unit:a}=e;return null==t||""===t?null:{price:"number"==typeof t?`$${t.toFixed(2)}`:`$${t}`,unit:a?String(a):""}})(i),p=i.title||e.label,h=i.description||e.desc,g=e.formFields?.filter(xt)??[],x=e.formFields?.some(e=>!0===e.mandatory)??!1,b=e.mandatory||x;(0,We.useEffect)(()=>{if(c&&s.current){const e=s.current.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:e-20,behavior:"smooth"})}},[c]);const f={method:e,methodValue:i,idx:t,isOn:o,isOpen:c,hasFields:d,icon:m,title:p,desc:h,price:u,cntFlds:g,showMandatoryBadge:b};return(0,dt.jsx)(ut.Provider,{value:f,children:(0,dt.jsxs)("div",{ref:s,className:["expandable-item",e.disableBtn&&!o?"disable":"",e.openForm?"open":""].filter(Boolean).join(" "),children:[(0,dt.jsx)(jt,{}),(0,dt.jsx)(vt,{})]})})},Ct=({methods:e,value:t,onChange:a,apilink:n,isWizardMode:l=!1,canAccess:s,addNewBtn:i,addNewTemplate:r,min:o,onBlocked:c,editTitleShow:d})=>{const m=r?.formFields??[],[u,p]=(0,We.useReducer)(gt,{methods:e.map(e=>e.isCustom?bt(e,m):e),activeTab:(()=>{const t=e.find(e=>!0===e.openForm);return t?t.id:null})(),wizardIndex:0,progress:[],openDropdown:null,iconDropdown:null,editId:null,editField:null,editTitle:"",editDesc:""}),h=(0,We.useRef)(null),g=(0,We.useRef)(null),x=(0,We.useRef)(null),f=(0,We.useCallback)((e,n,l)=>{"wizardButtons"!==n&&a({...t,[e]:{...t[e]??{},[n]:l}})},[a,t]),j=(0,We.useCallback)(()=>{u.editId&&"title"===u.editField&&u.editTitle.trim()&&f(u.editId,"title",u.editTitle.trim()),u.editId&&"description"===u.editField&&f(u.editId,"description",u.editDesc),p({type:"COMMIT_EDIT"})},[u.editId,u.editField,u.editTitle,u.editDesc,f]),y=(0,We.useCallback)(()=>void 0===o||u.methods.filter(e=>e.isCustom).length>o,[o,u.methods]),v=(0,We.useCallback)(()=>{if(!s||!r)return;const e=(r.label??"item").trim().toLowerCase().replace(/\s+/g,"_")+Math.floor(1e4*Math.random()),n={id:e,icon:r.icon??"",label:r.label??"New Item",desc:r.desc??"",iconEnable:r.iconEnable??!1,iconOptions:r.iconOptions??[],connected:!1,isCustom:!0,disableBtn:r.disableBtn??!1,formFields:r.formFields?.map(e=>({...e}))??[]},l=bt(n,m);p({type:"ADD_METHOD",method:l});const i={isCustom:!0,title:n.label,description:n.desc,label:n.label,desc:n.desc};r.icon&&(i.icon=r.icon),n.formFields?.forEach(e=>{i[e.key]=""}),a({...t,[e]:i})},[s,r,m,a,t]),N=(0,We.useCallback)(e=>{if(!y())return;p({type:"DELETE_METHOD",id:e});const n={...t};delete n[e],a(n)},[y,a,t]),C=(0,We.useCallback)(()=>{n&&Un?.nonce&&(0,Ke.default)({url:b(Un,n),method:"POST",headers:{"X-WP-Nonce":Un.nonce},data:{setupWizard:!0,value:t}}).catch(console.error)},[n,t]),k=(e,a,n=null)=>{const l=t[a]?.[e];return Array.isArray(l)?null===n?l.length>0:l.includes(n):null===n?Boolean(l):l===n},w=(0,We.useCallback)((e,t)=>{const{wizardIndex:a,methods:n}=u,l=n.length-1;if("back"===e){if(0===a)return;const e=a-1,t=n[e];return p({type:"SET_WIZARD_INDEX",index:e}),void p({type:"SET_ACTIVE_TAB",id:t.id})}if(C(),a<l){const e=a+1,t=n[e];return p({type:"SET_WIZARD_INDEX",index:e}),void p({type:"SET_ACTIVE_TAB",id:t.id})}t&&window.open(t,"_self")},[u.wizardIndex,u.methods,C]),_=(0,We.useCallback)((e,a)=>{const n=zn[a.type];if(!n)return null;const i=n.render,r=t[e]?.[a.key],o=t=>f(e,a.key,t);if("button"===a.type&&l&&Array.isArray(a.options)){const e={back:e=>({...e,text:e.label,color:"red",onClick:()=>w("back")}),next:e=>({...e,text:e.label,color:"purple",onClick:()=>w("next",e.redirect)}),skip:e=>({...e,text:e.label,color:"blue",onClick:()=>window.open(Un?.site_url,"_self")})},t=a.options.map(t=>{const a=e[t.action];return a?a(t):t});return(0,dt.jsx)(i,{field:{...a,options:t},value:r,onChange:o,canAccess:s,onBlocked:c})}return(0,dt.jsx)(i,{field:a,value:r,onChange:o,canAccess:s})},[t,f,l,u.wizardIndex,u.methods,s,C]);(0,We.useEffect)(()=>{"title"===u.editField&&(h.current?.focus(),h.current?.select()),"description"===u.editField&&(g.current?.focus(),g.current?.select())},[u.editId,u.editField]),(0,We.useEffect)(()=>{if(!u.editId)return;const e=e=>{"Escape"!==e.key?"Enter"!==e.key||"title"!==u.editField&&!e.ctrlKey||j():p({type:"CANCEL_EDIT"})};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u.editId,u.editField,j]),(0,We.useEffect)(()=>{if(!u.editId)return;const e=e=>{const t=e.target;h.current?.contains(t)||g.current?.contains(t)||j()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u.editId,j]),(0,We.useEffect)(()=>{if(!u.openDropdown)return;const e=()=>p({type:"SET_OPEN_DROPDOWN",id:null});return document.addEventListener("click",e),()=>document.removeEventListener("click",e)},[u.openDropdown]),(0,We.useEffect)(()=>{if(!u.iconDropdown)return;const e=e=>{x.current&&!x.current.contains(e.target)&&p({type:"SET_ICON_DROPDOWN",id:null})},t=e=>{"Escape"===e.key&&p({type:"SET_ICON_DROPDOWN",id:null})};return document.addEventListener("mousedown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",t)}},[u.iconDropdown]),(0,We.useEffect)(()=>{if(!l)return;const e=u.methods.map(e=>{const a=t[e.id]??{};return(e.formFields?.filter(xt)??[]).filter(e=>{return null!=(t=a[e.key])&&("string"==typeof t?""!==t.trim():!Array.isArray(t)||t.length>0);var t}).length});p({type:"SET_PROGRESS",progress:e})},[t,u.methods,l]),(0,We.useEffect)(()=>{const e=new Map(Object.entries(t).map(([e,t])=>[e,{id:e,...t}])),a=(()=>{const t=new Map(u.methods.map(e=>[e.id,e]));return e.forEach((e,a)=>{const n=t.get(a);t.set(a,{...n,...e,disableBtn:e.disableBtn??n?.disableBtn??(!!e.isCustom&&(r?.disableBtn??!1)),iconEnable:e.iconEnable??n?.iconEnable??(!!e.isCustom&&r?.iconEnable),iconOptions:e.iconOptions??n?.iconOptions??(e.isCustom?r?.iconOptions:[])})}),Array.from(t.values()).map(e=>e.isCustom?bt(e,m):e)})();JSON.stringify(a)!==JSON.stringify(u.methods)&&p({type:"SET_METHODS",methods:a})},[t,r,m]);const S={state:u,dispatch:p,value:t,isWizardMode:l,canAccess:s,addNewTemplate:r,tplFields:m,titleRef:h,descRef:g,iconPicker:x,handleChange:f,handleDelete:N,canDelete:y,renderField:_,commitEdit:j,shouldRender:(e,t)=>!(!0===e.set&&!k(e.key,t)||!1===e.set&&k(e.key,t)||void 0!==e.value&&!k(e.key,t,e.value)),editTitleShow:d??!1},A=l?u.methods.slice(0,u.wizardIndex+1):u.methods;return(0,dt.jsxs)(mt.Provider,{value:S,children:[(0,dt.jsxs)("div",{className:"expandable-panel-group",children:[A.map((e,t)=>(0,dt.jsx)(Nt,{method:e,idx:t},e.id)),i&&(0,dt.jsx)(E,{buttons:[{icon:"plus",text:"Add New",color:"purple",onClick:v}]})]}),l&&(()=>{const e=u.methods[u.wizardIndex],t=e?.formFields?.find(e=>"wizardButtons"===e.key);return t?_(e.id,t):null})()]})},kt={render:({field:e,value:t,onChange:a,canAccess:n})=>(0,dt.jsx)(Ct,{name:e.key,apilink:String(e.apiLink),methods:e.modal??[],addNewBtn:e.addNewBtn,addNewTemplate:e.addNewTemplate,min:e.min,value:t||{},onChange:e=>{n&&a(e)},canAccess:n},e.key),validate:()=>null},wt=a(1609),_t=a(790),St=e=>e&&e.split("/").pop()?.split("?")[0]||"File",At=e=>null!==(e.includes("#")?e.split("#")[1]:e).match(/\.(jpg|jpeg|png|gif|webp|svg|bmp)$/i),Tt=e=>{const t=(0,wt.useRef)(null),[a,n]=(0,wt.useState)([]),[l,s]=(0,wt.useState)(0),[i,r]=(0,wt.useState)(!1);(0,wt.useEffect)(()=>{const t=e.imageSrc;if(!t||Array.isArray(t)&&0===t.length)return void n([]);const a=(Array.isArray(t)?t:[t]).filter(Boolean).map(e=>"string"==typeof e?{url:e}:e);n(a),s(0)},[e.imageSrc]);const o=t=>{n(t),e.onChange?.(e.multiple?t:t[0]||"")},c=()=>{if(!wp?.media)return t.current?.click();const n=wp.media({title:"Select or Upload File",button:{text:"Use this file"},multiple:e.multiple&&!i});n.on("select",()=>{const t=n.state().get("selection").toJSON().map(e=>({id:e.id,url:e.url}));let s;i?(s=[...a],s[l]=t[0],r(!1)):s=e.multiple?[...a,...t]:[t[0]],o(s)}),n.open()},d=e=>{const t=a[e],n=t?.url;n?.startsWith("blob:")&&URL.revokeObjectURL(n.split("#")[0]);const i=a.filter((t,a)=>a!==e);o(i),l>=i.length&&s(Math.max(0,i.length-1))},m=a[l]?.url,u=m&&At(m),p=m;return(0,_t.jsxs)(_t.Fragment,{children:[(0,_t.jsx)("div",{className:`file-uploader ${e.wrapperClass||""} ${e.size||""}`.trim(),style:{backgroundImage:u?`url(${p})`:"none"},children:0===a.length?(0,_t.jsxs)(_t.Fragment,{children:[(0,_t.jsx)("i",{className:"upload-icon adminfont-cloud-upload"}),(0,_t.jsx)("input",{ref:t,className:e.inputClass,id:e.id,type:"hidden",name:e.name||"file-input",placeholder:e.placeholder,accept:e.accept,onChange:n=>{const c=n.target.files;if(!c?.length)return;const d=Array.from(c).map(e=>({url:`${URL.createObjectURL(e)}#${e.name}`}));let m;i?(m=[...a],m[l]?.startsWith("blob:")&&URL.revokeObjectURL(m[l].split("#")[0]),m[l]=d[0],r(!1)):(m=e.multiple?[...a,...d]:[d[0]],s(m.length-1)),o(m),t.current&&(t.current.value="")},onClick:e.onClick,onMouseOver:e.onMouseOver,onMouseOut:e.onMouseOut,onFocus:e.onFocus,onBlur:e.onBlur,multiple:e.multiple}),(0,_t.jsx)("span",{className:"title",children:"Drag and drop your file here"}),(0,_t.jsx)("span",{children:"Or"}),(0,_t.jsx)(E,{buttons:[{text:e.openUploader||"Upload File",color:"purple",onClick:c}]})]}):(0,_t.jsxs)(_t.Fragment,{children:[!u&&(0,_t.jsxs)(_t.Fragment,{children:[(0,_t.jsx)("i",{className:"upload-icon adminfont-attachment"}),(0,_t.jsx)("span",{className:"title",children:St(m)})]}),(0,_t.jsx)("div",{className:"overlay",children:(0,_t.jsxs)("div",{className:"button-wrapper",children:[(0,_t.jsx)(E,{buttons:[{text:"Remove",color:"red",onClick:()=>d(l)}]}),(0,_t.jsx)(E,{buttons:[{text:"Replace",color:"purple",onClick:()=>{r(!0),c()}}]})]})})]})}),e.multiple&&a.length>0&&(0,_t.jsx)("div",{className:"uploaded-image",children:a.map((t,a)=>{const n=(e=>{if(!e)return"";const t=e.trim();return t&&(t.startsWith("blob:")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../"))?t:""})(t.url),i=a===l;return(0,_t.jsxs)("div",{className:"image "+(i?"active":""),onClick:()=>s(a),children:[At(t.url)?(0,_t.jsx)("img",{src:n,alt:`preview-${a}`,width:e.imageWidth||80,height:e.imageHeight||80}):(0,_t.jsxs)("div",{children:[(0,_t.jsx)("i",{className:"adminfont-attachment"}),(0,_t.jsx)("span",{children:St(t.url).substring(0,12)})]}),(0,_t.jsx)("i",{className:"adminfont-close close-btn",onClick:e=>{e.stopPropagation(),d(a)}})]},a)})})]})},Et={render:({field:e,value:t,onChange:a,canAccess:n,appLocalizer:l})=>(0,_t.jsx)(Tt,{inputClass:e.class,imageSrc:t||"",imageWidth:e.width,imageHeight:e.height,openUploader:l?.open_uploader,name:e.name,accept:e.accept,multiple:e.multiple,size:e.size,onChange:e=>n&&a(e)}),validate:()=>null},Mt=m(a(1609)),$t=m(a(1609)),It=a(5139),Dt=a(790),Lt=Date.now(),Pt=(e,t)=>{const a=++Lt,{fixedName:n,placeholder:l,label:s,context:i,options:r}=t||{},o={id:a,type:e,name:n&&""!==n.trim()?n:`${e}_${a}`,label:s,placeholder:l,context:i,options:r};return"columns"===e&&(o.layout="2-50",o.columns=[[],[]]),o},Ft=(e,t,a=[])=>{const n=(e=>{if(!e)return e;const t=a.filter(t=>t.fixedName?.startsWith(e));return t.length>0?`${e} ${t.length+1}`:e})(e.fixedName);return e?.id&&e?.type?"columns"!==e.type||Array.isArray(e.columns)?{...e,fixedName:n}:{...e,fixedName:n,layout:e.layout??"2-50",columns:[[],[]]}:e?.value?{...Pt(e.value,{fixedName:n,placeholder:e.placeholder,label:e.label,options:e.options,context:t}),...e,fixedName:n}:Pt("text",{label:"Text",fixedName:n??"Text",context:t})},Ot=(e,t)=>{if(!e?.type)return(0,Dt.jsx)("div",{children:"Invalid block"});if("radio"==e?.type)return(0,Dt.jsx)("div",{className:"radio-group",children:e.options?.map((a,n)=>(0,Dt.jsxs)("label",{className:"radio-option",children:[(0,Dt.jsx)("input",{type:"radio",name:e.name||`radio-${e.id}`,value:a.value,checked:e.value===a.value,onChange:()=>t({id:e.id,value:a.value})}),a.label]},n))});const a=zn[e.type]?.render;return a?(0,Dt.jsx)(a,{field:{...e,name:e.name||`${e.type}-${e.id}`},onChange:t}):(0,Dt.jsxs)("div",{children:["Unknown type: ",e.type]})},Bt=({block:e,onChange:t,onSelect:a,onDelete:n,isActive:l,showMeta:s=!0,isColumnChild:i})=>(0,Dt.jsxs)("div",{className:`form-field ${l?"active":""} ${i?"column-child":""}`,onClick:a,children:[s&&(0,Dt.jsxs)("section",{className:"meta-menu",children:[(0,Dt.jsx)("span",{className:"drag-handle admin-badge blue",children:(0,Dt.jsx)("i",{className:"adminfont-drag"})}),n&&(0,Dt.jsx)("span",{className:"admin-badge red",onClick:e=>{e.stopPropagation(),n(e)},children:(0,Dt.jsx)("i",{className:"adminfont-delete"})})]}),(0,Dt.jsxs)("section",{className:"form-field-container-wrapper",children:[e.label&&"title"!==e.type&&"button"!==e.type&&(0,Dt.jsx)("label",{className:"settings-form-label",children:(0,Dt.jsx)("div",{className:"title",children:e.label})}),Ot(e,t)]})]}),Rt=Bt,qt=a(1609),Ut=a(5139),Wt=e=>{switch(e){case"1":return 1;case"2-50":case"2-66":default:return 2;case"3":return 3;case"4":return 4}},Kt=a(790),zt=e=>Array.isArray(e.columns)&&e.columns.length>0?e.columns.map(e=>Array.isArray(e)?[...e]:[]):[[],[]],Ht=({block:e,parentIndex:t,isActive:a,groupName:n,openBlock:l,setOpenBlock:s,onColumnSetList:i,onChildSelect:r,selectedLocation:o,onChildMutate:c,onSelect:d,onDelete:m,showMeta:u=!0})=>{const p=(0,qt.useCallback)(t=>{c({...e,columns:t(zt(e))})},[e,c]),h=(0,qt.useCallback)((e,t,a)=>{let n;p(l=>l.map((l,s)=>s!==e?l:l.map((e,l)=>l!==t?e:(n={...e,...a},n)))),n&&l?.id===n.id&&s(n)},[p,l?.id,s]),g=(0,qt.useCallback)((t,a)=>{const n=zt(e)[t]?.[a];p(e=>e.map((e,n)=>n===t?e.filter((e,t)=>t!==a):e)),n&&l?.id===n.id&&s(null)},[e,p,l?.id,s]),x=zt(e),b=e.layout||"2-50",f={...we(e.style,{includeText:!0}),display:"flex",flexDirection:"column",width:"100%"};return(0,Kt.jsxs)("div",{className:"form-field "+(a?"active":""),onClick:d,children:[u&&(0,Kt.jsxs)("section",{className:"meta-menu",children:[(0,Kt.jsx)("span",{className:"drag-handle admin-badge blue",children:(0,Kt.jsx)("i",{className:"adminfont-drag"})}),(0,Kt.jsx)("span",{className:"admin-badge red",onClick:e=>{e.stopPropagation(),m()},children:(0,Kt.jsx)("i",{className:"adminfont-delete"})})]}),(0,Kt.jsx)("section",{className:"form-field-container-wrapper",children:(0,Kt.jsx)("div",{className:`email-columns layout-${b}`,style:{display:"flex",width:"100%",justifyContent:e.style?.justifyContent||"flex-start",alignItems:e.style?.alignItems||"stretch",gap:e.style?.gap?`${e.style.gap}rem`:"1rem"},children:x.map((e,a)=>(0,Kt.jsx)("div",{className:"email-column-wrapper",style:f,children:(0,Kt.jsx)(Ut.ReactSortable,{list:e,setList:e=>i(t,a,e),group:{name:n,pull:!0,put:!0},className:"email-column",animation:150,handle:".drag-handle",emptyInsertThreshold:20,children:0===e.length?(0,Kt.jsx)("div",{className:"column-drop-zone",children:(0,Kt.jsx)("i",{className:"adminfont-plus"})}):e.map((e,n)=>(0,Kt.jsx)(Rt,{block:e,isColumnChild:!0,isActive:o?.parentIndex===t&&o?.columnIndex===a&&o?.childIndex===n,onSelect:l=>{l?.stopPropagation?.(),((e,a,n)=>{r({parentIndex:t,columnIndex:a,childIndex:n},e)})(e,a,n)},onChange:e=>h(a,n,e),onDelete:()=>g(a,n)},e.id))})},a))})})]})},Gt=a(1609),Vt=a(5139),Yt=a(1609),Zt=a(790),Jt=({title:e,desc:t,className:a,id:n,iconName:l,onIconClick:s,action:i,transparent:r=!1,contentWidth:o=!1,toggle:c=!1,defaultExpanded:d=!0,badges:m=[],children:u,isLoading:p})=>{const[h,g]=(0,Yt.useState)(d);return(0,Yt.useEffect)(()=>{g(d)},[d]),(0,Zt.jsx)("div",{...n?{id:n}:{},className:`card-content ${r?"transparent":""} ${o?"content-width":""} ${a||""}`,children:p?(0,Zt.jsxs)(Zt.Fragment,{children:[(0,Zt.jsxs)("div",{className:"card-header",children:[(0,Zt.jsxs)("div",{className:"left",children:[(0,Zt.jsx)(Ie,{width:6.25}),(0,Zt.jsx)(Ie,{width:10})]}),(0,Zt.jsx)("div",{className:"right",children:(0,Zt.jsx)(Ie,{variant:"circular",width:1.5,height:1.5})})]}),(0,Zt.jsxs)("div",{className:"card-body",children:[(0,Zt.jsx)(Ie,{width:"100%",height:8}),(0,Zt.jsx)(Ie,{width:"100%",height:8})]})]}):(0,Zt.jsxs)(Zt.Fragment,{children:[(e||l||i||c)&&(0,Zt.jsxs)("div",{className:"card-header",children:[(0,Zt.jsxs)("div",{className:"left",children:[e&&(0,Zt.jsxs)("div",{className:"title",children:[e,m.map((e,t)=>(0,Zt.jsx)("span",{className:`admin-badge ${e.color??""}`,children:e.text},t))]}),t&&(0,Zt.jsx)("div",{className:"des",children:t})]}),(0,Zt.jsxs)("div",{className:"right",children:[i,c&&(0,Zt.jsx)("i",{className:`adminfont-${l||(h?"pagination-right-arrow":"keyboard-arrow-down")}`,onClick:()=>{g(!h),s?.()}}),l&&!c&&!i&&(0,Zt.jsx)("i",{className:`adminfont-${l}`,onClick:()=>s?.(),style:{cursor:s?"pointer":"default"}})]})]}),h&&u&&(0,Zt.jsx)("div",{className:"card-body",children:u})]})})},Xt=a(790),Qt=({style:e={},onChange:t,includeTextStyles:a=!0})=>(0,Xt.jsxs)(Xt.Fragment,{children:[a&&(0,Xt.jsx)(Jt,{toggle:!0,defaultExpanded:!1,title:"Text",children:(0,Xt.jsxs)(st,{children:[(0,Xt.jsx)(nt,{label:"Text Align",children:(0,Xt.jsx)(ue,{options:[{key:"left",value:"left",icon:"left-align"},{key:"center",value:"center",icon:"center-align"},{key:"right",value:"right",icon:"right-align"},{key:"justify",value:"justify",icon:"justify-align"}],value:e.textAlign||"left",onChange:a=>t({...e,textAlign:a})})}),(0,Xt.jsx)(nt,{cols:6,label:"Font Size (rem)",children:(0,Xt.jsx)(V,{type:"number",minNumber:.5,maxNumber:5,value:e.fontSize??1,onChange:a=>{t({...e,fontSize:Number(a)})}})}),(0,Xt.jsx)(nt,{cols:6,label:"Line Height",children:(0,Xt.jsx)(V,{type:"number",minNumber:1,maxNumber:3,value:e.lineHeight??1.5,onChange:a=>{t({...e,lineHeight:Number(a)})}})}),(0,Xt.jsx)(nt,{cols:6,label:"Font Weight",children:(0,Xt.jsxs)("select",{value:e.fontWeight||"normal",className:"basic-input",onChange:a=>t({...e,fontWeight:a.target.value}),children:[(0,Xt.jsx)("option",{value:"300",children:"Light (300)"}),(0,Xt.jsx)("option",{value:"normal",children:"Normal (400)"}),(0,Xt.jsx)("option",{value:"500",children:"Medium (500)"}),(0,Xt.jsx)("option",{value:"600",children:"Semibold (600)"}),(0,Xt.jsx)("option",{value:"bold",children:"Bold (700)"})]})}),(0,Xt.jsx)(nt,{cols:6,label:"Text Decoration",children:(0,Xt.jsxs)("select",{value:e.textDecoration||"none",className:"basic-input",onChange:a=>t({...e,textDecoration:a.target.value}),children:[(0,Xt.jsx)("option",{value:"none",children:"None"}),(0,Xt.jsx)("option",{value:"underline",children:"Underline"}),(0,Xt.jsx)("option",{value:"overline",children:"Overline"}),(0,Xt.jsx)("option",{value:"line-through",children:"Line Through"})]})})]})}),(0,Xt.jsx)(Jt,{toggle:!0,defaultExpanded:!1,title:"Color",children:(0,Xt.jsxs)(st,{children:[(0,Xt.jsx)(nt,{cols:6,label:"Background",children:(0,Xt.jsx)(V,{type:"color",value:e.backgroundColor||"#ffffff",onChange:a=>{t({...e,backgroundColor:a})}})}),(0,Xt.jsx)(nt,{cols:6,label:"Text",children:(0,Xt.jsx)(V,{type:"color",value:e.color||"#000000",onChange:a=>{t({...e,color:a})}})})]})}),(0,Xt.jsx)(Jt,{toggle:!0,defaultExpanded:!1,title:"Spacing",children:(0,Xt.jsxs)(st,{children:[(0,Xt.jsx)(nt,{label:"Padding",children:(0,Xt.jsx)("div",{className:"spacing-controls",children:["Top","Right","Bottom","Left"].map(a=>(0,Xt.jsxs)("div",{className:"spacing-input",children:[(0,Xt.jsx)(V,{type:"number",minNumber:0,value:e[`padding${a}`]??0,onChange:n=>{t({...e,[`padding${a}`]:Number(n)})}}),(0,Xt.jsx)("label",{children:a})]},`padding-${a}`))})}),(0,Xt.jsx)(nt,{label:"Margin",children:(0,Xt.jsx)("div",{className:"spacing-controls",children:["Top","Right","Bottom","Left"].map(a=>(0,Xt.jsxs)("div",{className:"spacing-input",children:[(0,Xt.jsx)(V,{type:"number",minNumber:0,value:e[`margin${a}`]??0,onChange:n=>{t({...e,[`margin${a}`]:Number(n)})}}),(0,Xt.jsxs)("label",{children:[a,"(rem)"]})]},`margin-${a}`))})})]})}),(0,Xt.jsx)(Jt,{toggle:!0,defaultExpanded:!1,title:"Border",children:(0,Xt.jsxs)(st,{children:[(0,Xt.jsx)(nt,{label:"Width(rem)",cols:6,children:(0,Xt.jsx)(V,{type:"number",minNumber:0,value:e.borderWidth??0,onChange:a=>{t({...e,borderWidth:Number(a)})}})}),(0,Xt.jsx)(nt,{label:"Radius(rem)",cols:6,children:(0,Xt.jsx)(V,{type:"number",minNumber:0,value:e.borderRadius??0,onChange:a=>{t({...e,borderRadius:Number(a)})}})}),(0,Xt.jsx)(nt,{label:"Color",cols:6,children:(0,Xt.jsx)(V,{type:"color",value:e.borderColor||"#000000",onChange:a=>{t({...e,borderColor:a})}})}),(0,Xt.jsx)(nt,{label:"Style",cols:6,children:(0,Xt.jsxs)("select",{value:e.borderStyle||"solid",className:"basic-input",onChange:a=>t({...e,borderStyle:a.target.value}),children:[(0,Xt.jsx)("option",{value:"solid",children:"Solid"}),(0,Xt.jsx)("option",{value:"dashed",children:"Dashed"}),(0,Xt.jsx)("option",{value:"dotted",children:"Dotted"}),(0,Xt.jsx)("option",{value:"double",children:"Double"}),(0,Xt.jsx)("option",{value:"none",children:"None"})]})})]})})]}),ea=a(1609),ta=a(790);function aa(e,t,a){return e.proSetting&&!Un?.khali_dabba?(a?.("pro"),!0):!(!e.moduleEnabled||t.includes(e.moduleEnabled)||(a?.("module",e.moduleEnabled),0))}var na=({value:e,onChange:t,onSave:a})=>(0,ta.jsx)("div",{className:"edit-option-wrapper",children:(0,ta.jsxs)("div",{className:"edit-option",children:[(0,ta.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),a())},className:"basic-input",autoFocus:!0}),(0,ta.jsx)("div",{className:"edit-icon",children:(0,ta.jsx)("span",{className:"admin-badge green border adminfont-check",onClick:e=>{e.stopPropagation(),a()}})})]})}),la=e=>{const{options:t,value:a=[],modules:n,onBlocked:l,onChange:s,onOptionsChange:i,field:r,look:o}=e,[c,d]=(0,ea.useState)(!1),[m,u]=(0,ea.useState)(""),[p,h]=(0,ea.useState)(null),[g,x]=(0,ea.useState)(""),b=a.length===t.length,f=(e,t,a)=>{let n=[...e];return t.filter(e=>e.dependent===a).forEach(e=>{n=n.filter(t=>t!==e.value),n=f(n,t,e.value)}),n},j=(e,t,a)=>{let n=[...e];const l=t.find(e=>e.value===a);return l?.dependent&&(n.includes(l.dependent)||n.push(l.dependent),n=j(n,t,l.dependent)),n},y=()=>{const e=m.trim();if(!e)return;const a=e.toLowerCase().replace(/\s+/g,"_"),n={key:a,value:a,label:e,edit:!0};i?.([...t,n]),u(""),d(!1)},v="radio"===e.type?"radio":"checkbox";return(0,ta.jsxs)(ta.Fragment,{children:[t&&0!==t.length?(0,ta.jsxs)("div",{className:e.wrapperClass||("toggle"===o?"toggle-btn":e.selectDeselect?"checkbox-list-side-by-side":"simple-checkbox"),children:[e.selectDeselect&&(0,ta.jsx)("div",{className:"checkbox-list-header",children:(0,ta.jsxs)("div",{className:"checkbox",children:[(0,ta.jsx)("input",{type:"checkbox",checked:b,onChange:()=>{t.some(e=>aa(e,n,l))||e.onMultiSelectDeselectChange?.(b?[]:t.map(e=>e.value))},className:!b&&a.length>0?"minus-icon":""}),(0,ta.jsxs)("span",{children:[a.length," items"]})]})}),t.map((r,c)=>{const d=a.includes(r.value),m=r.key??c,u=`toggle-switch-${m}`,b=p===c;return(0,ta.jsxs)("div",{className:"toggle-checkbox-header",children:[e.rightContent&&(0,ta.jsx)("p",{className:"settings-metabox-description",dangerouslySetInnerHTML:{__html:r.label??""}}),(0,ta.jsx)("div",{className:e.inputInnerWrapperClass||("toggle"===o?"toggle-checkbox":"default-checkbox"),"data-tour":e.tour,children:b?(0,ta.jsx)(na,{value:g,onChange:x,onSave:()=>{aa(r,n,l)||(e=>{const a=g.trim();if(!a)return;const n=t.map((t,n)=>n===e?{...t,label:a}:t);i?.(n),h(null),x("")})(c)}}):(0,ta.jsxs)(ta.Fragment,{children:[(0,ta.jsx)("input",{className:e.inputClass,id:u,type:v,name:r.name??"basic-input",value:r.value,checked:d,onChange:()=>{aa(r,n,l)||(e=>{let n;a.includes(e)?(n=a.filter(t=>t!==e),n=f(n,t,e)):(n=[...a,e],n=j(n,t,e)),s(n)})(r.value)}}),(0,ta.jsxs)("label",{className:"checkbox-label",htmlFor:u,children:[r.label,r.proSetting&&!Un?.khali_dabba&&(0,ta.jsxs)("span",{className:"admin-pro-tag",children:[(0,ta.jsx)("i",{className:"adminfont-pro-tag"})," ","Pro"]}),!r.proSetting&&r.moduleEnabled&&!n.includes(r.moduleEnabled)&&(0,ta.jsxs)("span",{className:"admin-pro-tag module",children:[(0,ta.jsx)("i",{className:`adminfont-${r.moduleEnabled}`}),(y=r.moduleEnabled,y.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")),(0,ta.jsx)("i",{className:"adminfont-lock"})]}),(0,ta.jsx)("div",{className:"label-des",children:r.desc})]}),r.edit&&(0,ta.jsxs)("div",{className:"edit-icon",children:[(0,ta.jsx)("span",{className:"admin-badge blue border adminfont-edit",onClick:e=>{e.stopPropagation(),h(c),x(r.label??r.value)}}),(0,ta.jsx)("span",{className:"admin-badge red border adminfont-delete",onClick:e=>{e.stopPropagation(),(e=>{const r=t[e];if(aa(r,n,l))return;const o=t.filter((t,a)=>a!==e);i?.(o),s(a.filter(e=>e!==r.value))})(c)}})]})]})})]},m);var y})]}):(0,ta.jsx)("input",{type:"checkbox",checked:a.includes(r.rowKey),onChange:e=>{aa(r,n,l)||s(e.target.checked)}}),e.addNewBtn&&(c?(0,ta.jsxs)("div",{className:"add-new-option",children:[(0,ta.jsx)("input",{type:"text",value:m,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),y())},placeholder:"Enter new option",className:"basic-input",autoFocus:!0}),(0,ta.jsxs)("button",{className:"admin-btn btn-green",onClick:e=>{e.preventDefault(),y()},children:[(0,ta.jsx)("i",{className:"adminfont-active"})," Save"]})]}):(0,ta.jsx)("div",{className:"add-new-option",children:(0,ta.jsxs)("div",{className:"admin-btn btn-purple",onClick:()=>d(!0),children:[(0,ta.jsx)("i",{className:"adminfont-plus"})," ",e.addNewBtn]})}))]})},sa={render:({field:e,value:t,onChange:a,canAccess:n,modules:l,settings:s,onOptionsChange:i,onBlocked:r})=>{const o=Array.isArray(t)?t.filter(e=>e?.trim()):"string"==typeof t&&t.trim()?[t]:[],c=s?.[`${e.key}_options`]??e.options,d=Array.isArray(c)?c.map(t=>({...t,value:String(t.value),edit:t.edit??!!e.addNewBtnText})):[];return(0,ta.jsx)(la,{wrapperClass:"toggle"===e.look?"toggle-btn":!0===e.selectDeselect?"checkbox-list-side-by-side":"simple-checkbox",inputInnerWrapperClass:"toggle"===e.look?"toggle-checkbox":"default-checkbox",inputClass:e.class,tour:e.tour,selectDeselect:e.selectDeselect,selectDeselectValue:"Select / Deselect All",rightContent:e.rightContent,addNewBtn:e.addNewBtnText,options:d,value:o,modules:l,field:e,onChange:e=>{n&&a(e)},onOptionsChange:e=>{n&&i?.(e)},onBlocked:r,onMultiSelectDeselectChange:e=>{n&&a(e)}})},validate:(e,t)=>!e.required||t&&0!==t.length?null:`${e.label} is required`},ia=a(4956),ra=a(790),oa=({inputClass:e,id:t,name:a,value:n,rowNumber:l=6,colNumber:s=50,readOnly:i,placeholder:r,tinymceApiKey:o,usePlainText:c=!1,onChange:d,onClick:m,onMouseOver:u,onMouseOut:p,onFocus:h,onBlur:g})=>(0,ra.jsx)(ra.Fragment,{children:o&&!c?(0,ra.jsx)(ia.Editor,{apiKey:o,value:n,init:{height:50*l,menubar:!1,plugins:["advlist autolink lists link image charmap print preview anchor","searchreplace visualblocks code fullscreen","insertdatetime media table paste code help wordcount"],toolbar:"undo redo | formatselect | bold italic backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help"},onEditorChange:e=>{d?.(e)}}):(0,ra.jsx)("textarea",{className:`textarea-input ${e||""}`,id:t,name:a,placeholder:r,value:n,rows:l,cols:s,onChange:e=>{d?.(e.target.value)},onClick:m,onMouseOver:u,onMouseOut:p,onFocus:h,onBlur:g,readOnly:i})}),ca={render:({field:e,value:t,onChange:a,canAccess:n})=>(0,ra.jsx)(oa,{inputClass:e.class,id:e.id,name:e.name,placeholder:e.placeholder,rowNumber:e.rowNumber,colNumber:e.colNumber,readOnly:e.readOnly,value:t||"",usePlainText:e.usePlainText,tinymceApiKey:Un?.tinymceApiKey?Un.tinymceApiKey:"",onChange:e=>{n&&a(e)}},e.key),validate:()=>null},da=a(790),ma=/^6[0-9A-Za-z_-]{39}$/,ua=[{value:"1",label:"1 Column"},{value:"2-50",label:"50 / 50"},{value:"2-66",label:"66 / 34"},{value:"3",label:"3 Columns"},{value:"4",label:"4 Columns"}],pa=[{id:"h1",value:1,label:"H1"},{id:"h2",value:2,label:"H2"},{id:"h3",value:3,label:"H3"},{id:"h4",value:4,label:"H4"},{id:"h5",value:5,label:"H5"},{id:"h6",value:6,label:"H6"}],ha=new Set(["richtext","heading","image","button","divider","columns"]),ga=new Set(["richtext","heading","button"]),xa=({label:e,type:t,value:a,onChange:n,readonly:l=!1,placeholder:s})=>(0,da.jsx)(nt,{label:e,children:(0,da.jsx)(V,{type:t,value:a||"",onChange:e=>n(String(e)),readOnly:l,placeholder:s})}),ba=({title:e,children:t})=>(0,da.jsx)(Jt,{toggle:!0,defaultExpanded:!0,title:e,children:(0,da.jsx)(st,{children:t})}),fa=({disabled:e=!1,onChange:t})=>(0,da.jsx)(nt,{label:"Visibility",children:(0,da.jsx)(ue,{options:[{key:"visible",value:"true",label:"Visible"},{key:"hidden",value:"false",label:"Hidden"}],value:e?"false":"true",onChange:e=>t("false"===e)})}),ja=({options:e,onChange:t})=>{const a=(0,Gt.useCallback)(()=>{t([...e,{id:crypto.randomUUID(),label:"Option value",value:"value"}])},[e,t]),n=(0,Gt.useCallback)((a,n)=>{const l=[...e];l[a]={...l[a],...n},t(l)},[e,t]),l=(0,Gt.useCallback)(a=>{t(e.filter((e,t)=>t!==a))},[e,t]);return(0,da.jsxs)("div",{className:"multioption-wrapper",onClick:e=>e.stopPropagation(),children:[(0,da.jsx)("label",{children:"Set option"}),(0,da.jsx)(Vt.ReactSortable,{list:e,setList:t,handle:".drag-handle-option",children:e.map((e,t)=>(0,da.jsxs)("div",{className:"option-list-wrapper drag-handle-option",children:[(0,da.jsx)("div",{className:"option-icon admin-badge blue",children:(0,da.jsx)("i",{className:"adminfont-drag"})}),(0,da.jsx)("div",{className:"option-label",children:(0,da.jsx)(V,{value:e.label,onChange:e=>n(t,{label:e})})}),(0,da.jsx)("div",{className:"option-icon admin-badge red",children:(0,da.jsx)("div",{role:"button",className:"delete-btn adminfont-delete",tabIndex:0,onClick:()=>l(t)})})]},e.id||t))}),(0,da.jsx)(E,{buttons:[{text:"Add new",icon:"plus",color:"purple",onClick:a}]})]})},ya=({formField:e,onChange:t})=>(0,da.jsxs)(da.Fragment,{children:[(0,da.jsx)(xa,{label:"Placeholder",value:e.placeholder||"",onChange:e=>t("placeholder",e)}),(0,da.jsx)(xa,{label:"Character limit",type:"number",value:e.charlimit?.toString()||"",onChange:e=>t("charlimit",Number(e))})]}),va={text:ya,email:ya,textarea:({formField:e,onChange:t})=>(0,da.jsxs)(da.Fragment,{children:[(0,da.jsx)(xa,{label:"Placeholder",value:e.placeholder||"",onChange:e=>t("placeholder",e)}),(0,da.jsx)(xa,{label:"Character limit",type:"number",value:e.charlimit?.toString()||"",onChange:e=>t("charlimit",Number(e))}),(0,da.jsx)(xa,{label:"Row",type:"number",value:e.row?.toString()||"",onChange:e=>t("row",Number(e))}),(0,da.jsx)(xa,{label:"Column",type:"number",value:e.column?.toString()||"",onChange:e=>t("column",Number(e))})]}),richtext:({formField:e,onChange:t})=>(0,da.jsx)(ba,{title:"Content",children:(0,da.jsx)(nt,{label:"HTML Content",children:(0,da.jsx)(oa,{name:"html",value:e.html||"",onChange:e=>t("html",e),placeholder:"Enter HTML content"})})}),heading:({formField:e,onChange:t})=>(0,da.jsxs)(ba,{title:"Heading Content",children:[(0,da.jsx)(xa,{label:"Heading Text",value:e.text||"",onChange:e=>t("text",e),placeholder:"Enter heading text"}),(0,da.jsx)(nt,{label:"Heading Level",children:(0,da.jsx)(ue,{options:pa,value:e.level||2,onChange:e=>t("level",Number(e))})})]}),image:({formField:e,onChange:t})=>(0,da.jsx)(da.Fragment,{children:(0,da.jsxs)(ba,{title:"Image",children:[(0,da.jsx)(xa,{label:"Image URL",value:e.src||"",onChange:e=>t("src",e)}),(0,da.jsx)(xa,{label:"Alt Text",value:e.alt||"",onChange:e=>t("alt",e)})]})}),button:({formField:e,onChange:t})=>(0,da.jsx)(da.Fragment,{children:(0,da.jsxs)(ba,{title:"Button Content",children:[(0,da.jsx)(xa,{label:"Button Text",value:e.text||e.placeholder||"",onChange:e=>t("text",e)}),(0,da.jsx)(xa,{label:"Button URL",value:e.url||"",onChange:e=>t("url",e)})]})}),columns:({formField:e,onChange:t})=>(0,da.jsx)(da.Fragment,{children:(0,da.jsxs)(ba,{title:"Layout",children:[(0,da.jsx)(nt,{label:"Column Layout",children:(0,da.jsx)("select",{value:e.layout||"2-50",className:"basic-input",onChange:e=>t("layout",e.target.value),children:ua.map(({value:e,label:t})=>(0,da.jsx)("option",{value:e,children:t},e))})}),(0,da.jsx)(nt,{cols:6,label:"Gap (rem)",children:(0,da.jsx)(V,{type:"number",minNumber:0,maxNumber:5,step:.25,value:e.style?.gap??1,onChange:a=>{const n=e.style||{};t("style",{...n,gap:Number(a)})}})})]})}),"multi-select":({formField:e,onChange:t})=>(0,da.jsx)(ja,{options:e.options||[],onChange:e=>{t("options",e)}}),dropdown:({formField:e,onChange:t})=>(0,da.jsx)(ja,{options:e.options||[],onChange:e=>t("options",e)}),checkboxes:({formField:e,onChange:t})=>(0,da.jsx)(ja,{options:e.options||[],onChange:e=>t("options",e)}),radio:({formField:e,onChange:t})=>(0,da.jsx)(ja,{options:e.options||[],onChange:e=>t("options",e)}),recaptcha:({formField:e,onChange:t})=>{const[a,n]=(0,Gt.useState)(()=>ma.test(e.sitekey||"")),l=(0,Gt.useCallback)(e=>{t("sitekey",e),n(ma.test(e))},[t]);return(0,da.jsxs)(da.Fragment,{children:[(0,da.jsx)(xa,{label:"Site key",value:e.sitekey||"",onChange:l,className:a?"":"highlight"}),(0,da.jsxs)("div",{children:["Register your site with Google to obtain the"," ",(0,da.jsx)("a",{href:"https://www.google.com/recaptcha",target:"_blank",rel:"noopener noreferrer",className:"link-item",children:"reCAPTCHA script"}),"."]})]})},attachment:({formField:e,onChange:t})=>(0,da.jsx)(xa,{label:"Max File Size",type:"number",value:e.filesize?.toString()||"",onChange:e=>t("filesize",Number(e))}),default:()=>null},Na=({formField:e,inputTypeList:t=[],onChange:a,onTypeChange:n,opened:l,option:s,metaType:i="setting-meta"})=>{const[r,o]=(0,Gt.useState)(l.click),c=va[e?.type||"default"]||va.default;(0,Gt.useEffect)(()=>{o(l.click)},[l]);const d=(0,Gt.useMemo)(()=>ha.has(e?.type||""),[e?.type]),m=(0,Gt.useMemo)(()=>ga.has(e?.type||""),[e?.type]),u=(0,Gt.useCallback)(e=>{a("disabled",e)},[a]),p=(0,Gt.useCallback)(e=>{a("required",e.target.checked)},[a]),h=(0,Gt.useCallback)(e=>{a("value",e)},[a]),g=(0,Gt.useCallback)(e=>{a("style",e)},[a]);return r&&e?(0,da.jsxs)("div",{className:"setting-panel",onClick:e=>e.stopPropagation(),children:[(0,da.jsx)("div",{className:"settings-title",children:e.type?`${e.type.charAt(0).toUpperCase()+e.type.slice(1)} settings`:"Input settings"}),(0,da.jsxs)(st,{children:[(0,da.jsx)(xa,{label:"Field label",value:e.label||"",onChange:e=>{a("label",e)}}),e.readonly?(0,da.jsxs)(da.Fragment,{children:[(0,da.jsx)(xa,{label:"Placeholder",value:e.placeholder||"",onChange:e=>{a("placeholder",e)}}),(0,da.jsx)(fa,{disabled:e.disabled,onChange:u})]}):(0,da.jsxs)(da.Fragment,{children:["setting-meta"!==i&&(0,da.jsx)(xa,{label:"Value",value:s?.value||"",onChange:h}),(0,da.jsx)(xa,{label:"setting-meta"===i?"Name":"Label",value:"setting-meta"===i?e.name||"":s?.label||"",readonly:"setting-meta"===i&&e.readonly,onChange:e=>{a("setting-meta"===i?"name":"label",e)}}),"setting-meta"===i&&(0,da.jsxs)(da.Fragment,{children:[e.type&&(0,da.jsx)(c,{formField:e,onChange:a}),d&&(0,da.jsx)(Qt,{style:e.style||{},onChange:g,includeTextStyles:m}),(!d||"richtext"===e.type&&"form"===e.context)&&(0,da.jsxs)(da.Fragment,{children:[(0,da.jsx)(fa,{disabled:e.disabled,onChange:u}),(0,da.jsx)(nt,{label:"Required",children:(0,da.jsx)("div",{className:"input-wrapper",children:(0,da.jsx)(la,{options:[{key:"required",value:"required",label:"Required"}],value:e.required?["required"]:[],onChange:t=>{const a=t.includes("required");a!==e.required&&p({target:{checked:a}})}})})})]})]})]})]})]}):null},Ca=m(a(1609)),ka=a(790),wa=({tabs:e,defaultActiveIndex:t=0,className:a="",value:n,onChange:l,canAccess:s,headerExtra:i,modules:r,onBlocked:o})=>{const[c,d]=(0,Ca.useState)(t),m=e=>{const t=zn[e.type],a=t?.render;if(!t||!a)return null;const i=n?.[e.key]||"";return(0,ka.jsx)(a,{field:e,value:i,onChange:t=>{l&&l({...n,[e.key]:t})},canAccess:s,modules:r,onBlocked:o})};return(0,ka.jsxs)(ka.Fragment,{children:[e.length>1&&(0,ka.jsxs)("div",{className:`tabs-wrapper ${a}`,children:[(0,ka.jsx)("div",{className:"tabs-item",children:e.map((e,t)=>(0,ka.jsx)("div",{className:"tab "+(t===c?"active-tab":""),onClick:()=>d(t),children:(0,ka.jsxs)("span",{className:"tab-name",children:[e.icon&&(0,ka.jsx)("i",{className:`adminfont-${e.icon}`}),e.label]})},t))}),i&&(0,ka.jsx)("div",{className:"tabs-header-extra",children:i})]}),(()=>{const t=e[c];if(!t)return null;if(t.type){const e=zn[t.type],a=e?.render;if(e&&a){const e={...t,type:t.type,key:t.key||`tab-${c}`},i=n?.[t.key||`tab-${c}`]||t.value||"",r=e=>{l&&l({...n,[t.key||`tab-${c}`]:e})};return(0,ka.jsx)(a,{field:e,value:i,onChange:r,canAccess:s})}return null}return a=t.content,Array.isArray(a)?a.map((e,t)=>e&&"object"==typeof e&&!Ca.default.isValidElement(e)&&"string"==typeof e.type?m(e):e):a&&"object"==typeof a&&!Ca.default.isValidElement(a)&&"string"==typeof a.type?m(a):a;var a})(),e[c]?.footer&&(0,ka.jsx)("div",{className:"tabs-footer",children:(0,ka.jsxs)("a",{href:e[c].footer.url,className:"admin-btn btn-purple",children:[e[c].footer.icon&&(0,ka.jsx)("i",{className:e[c].footer.icon}),e[c].footer.text]})})]})},_a={render:({field:e,value:t,onChange:a,canAccess:n,modules:l,onBlocked:s})=>(0,ka.jsx)(wa,{tabs:e.tabs||[],value:t,onChange:a,canAccess:n,modules:l,onBlocked:s}),validate:()=>null},Sa=a(790),Aa=({blocks:e,onChange:t,blockGroups:a,visibleGroups:n=[],templates:l=[],activeTemplateId:s,onTemplateSelect:i,showTemplatesTab:r=!1,groupName:o,proSettingChange:c=()=>!1,context:d="default",inputTypeList:m,availablePlaceholder:u,enableDefaultBlocks:p=!0})=>{const[h,g]=(0,$t.useState)(e),[x,b]=(0,$t.useState)(null),[f,j]=(0,$t.useState)(()=>Object.fromEntries((n.length?a.filter(e=>n.includes(e.id)):a).map(e=>[e.id,!0]))),y=(0,$t.useRef)(!1),v=(0,$t.useRef)(!0),N=(0,$t.useRef)(!1),C=(0,$t.useRef)(h);C.current=h;const k="form"===d,w=$t.default.useMemo(()=>a.flatMap(e=>e.blocks).filter(e=>e.defaultField),[a]),_=k?h.find(e=>"title"===e.type):null,S=k?h.find(e=>"button"===e.type):null,A=k?h.find(e=>"richtext"===e.type&&"form"===e.context):null,T=k?h.filter(e=>"button"!==e.type&&"title"!==e.type&&"richtext"!==e.type):h;(0,$t.useEffect)(()=>{"form"===d&&p&&g(e=>e.some(e=>"button"===e.type)?e:[...e,Ft({value:"button",label:"Submit",placeholder:"Submit"})])},[]),(0,$t.useEffect)(()=>{"form"===d&&p&&g(e=>e.some(e=>"title"===e.type)?e:[Ft({value:"title",label:"Registration Form"}),...e])},[]),(0,$t.useEffect)(()=>{const e=w.some(e=>"name"===e.id);"form"===d&&e&&g(e=>e.some(e=>"name"===e.name)?e:[...e,Ft({value:"text",label:"Store Name",fixedName:"name",placeholder:"Enter your store name"})])},[]),(0,$t.useEffect)(()=>{if("form"!==d||!p)return;const t=e?.some(e=>"richtext"===e.type&&"form"===e.context);g(t?e:e=>e.some(e=>"richtext"===e.type&&"form"===e.context)?e:[...e,Ft({value:"richtext",label:"Terms & Conditions",fixedName:"terms_conditions",context:"form",html:'<a href="#">I agree to the Terms & Conditions</a>',required:!0})])},[d,e]),(0,$t.useEffect)(()=>{N.current||e!==C.current&&g(e.map(e=>e?.id&&e?.type?e:Ft(e,d)))},[e]),(0,$t.useEffect)(()=>{v.current?v.current=!1:y.current&&(t(h),y.current=!1,N.current=!1)},[h]);const E=(0,$t.useCallback)(()=>{y.current=!0},[]),M=(({blocks:e,onBlocksUpdate:t,openBlock:a,setOpenBlock:n})=>{const[l,s]=(0,qt.useState)(null),i=(0,qt.useCallback)((a,n)=>{const l=[...e];l[a]=n,t(l)},[e,t]),r=(0,qt.useCallback)((t,l,s,r)=>{const o=e[t];if("columns"!==o?.type)return;const c=zt(o).map((e,t)=>t!==l?e:e.map((e,t)=>t===s?{...e,...r}:e));i(t,{...o,columns:c});const d=c[l][s];a?.id===d?.id&&n(d)},[e,a?.id,i,n]),o=(0,qt.useCallback)((t,l)=>{const s=e[t];if("columns"!==s?.type)return;const r=Wt(s.layout||"2-50"),o=Wt(l);let c=zt(s);if(o>r)for(let e=r;e<o;e++)c.push([]);else if(o<r){const e=c.slice(o).flat();c=[...c.slice(0,o)],c[o-1]=[...c[o-1],...e]}const d={...s,layout:l,columns:c};i(t,d),a?.id===s.id&&n(d)},[e,a?.id,i,n]),c=(0,qt.useCallback)(()=>s(null),[]);return{selectedLocation:l,setSelectedLocation:s,handleChildUpdate:r,handleLayoutChange:o,clearSelection:c}})({blocks:h,onBlocksUpdate:e=>{N.current=!0,g(e),E()},openBlock:x,setOpenBlock:b}),$=(0,$t.useRef)(null),I=(0,$t.useRef)(!1),D=(0,$t.useCallback)(()=>{if(!$.current)return;const{canvas:e,columns:t}=$.current;$.current=null,I.current=!1;let a=(()=>{const t=C.current;if(!e)return t;if("form"!==d)return[...e];const a=t.find(e=>"title"===e.type),n=t.find(e=>"button"===e.type);let l=[...e];return a&&(l=[a,...l]),n&&(l=[...l,n]),l})();t.forEach((e,t)=>{const[n,l]=t.split("-").map(Number);a=a.map((t,a)=>{if(a!==n||"columns"!==t.type)return t;const s=zt(t);return s[l]=e,{...t,columns:s}})}),N.current=!0,g(a),E()},[E]),L=()=>{I.current||(I.current=!0,Promise.resolve().then(D))},P=(0,$t.useCallback)(e=>{c()||($.current||($.current={columns:new Map}),$.current.canvas=e.map(e=>Ft(e,d)),L())},[c,d]),F=(0,$t.useCallback)((e,t,a)=>{$.current||($.current={columns:new Map}),$.current.columns.set(`${e}-${t}`,a.map(e=>Ft(e))),L()},[]),O=(0,$t.useCallback)((e,t)=>{c()||(g(a=>{const n=a[e];if(!Object.keys(t).some(e=>{return a=n[e],l=t[e],!(Array.isArray(a)&&Array.isArray(l)?a.length===l.length&&a.every((e,t)=>e===l[t]):a===l);var a,l}))return a;N.current=!0;const l=[...a];return l[e]={...n,...t},x?.id===l[e].id&&b(l[e]),l}),E())},[c,x?.id,E]),B=(0,$t.useCallback)((e,t)=>{if(t?.stopPropagation(),c())return;const a=T[e];"name"!==a?.name&&(g(e=>e.filter(e=>e.id!==a.id)),E(),x?.id===a?.id&&(b(null),M.clearSelection()))},[c,h,x?.id,M,E]),R=(0,$t.useCallback)((e,t)=>{g(a=>(N.current=!0,a.map((a,n)=>n!==e||a===t?a:(N.current=!0,t)))),E()},[E]),q=(0,$t.useCallback)((e,t)=>{if(!c()){if(M.selectedLocation){const{parentIndex:a,columnIndex:n,childIndex:l}=M.selectedLocation;M.handleChildUpdate(a,n,l,{[e]:t})}else{const a=h.findIndex(e=>e.name===x?.name);if(a<0)return;"layout"===e&&"columns"===h[a].type?M.handleLayoutChange(a,t):O(a,{[e]:t})}E()}},[c,M,h,x?.id,O,E]),U=(0,$t.useCallback)(e=>j(t=>({...t,[e]:!t[e]})),[]),W=(0,$t.useCallback)(()=>m||(a[0]?.blocks??[]).map(e=>({value:e.value,label:e.label})),[m,a]),K=(0,$t.useCallback)(e=>{const t=e.trim();return t?t.startsWith("[")&&t.endsWith("]")?t:`[${t}]`:""},[]),z=(0,$t.useCallback)(e=>{switch(e.type){case"richtext":return"html";case"heading":case"button":case"title":return"text";default:return"placeholder"}},[]),H=(0,$t.useCallback)(e=>{if(c()||!x)return;const t=K(e);if(!t)return;const a=z(x),n=x[a],l=`${"string"==typeof n?n:""}${t}`;if(M.selectedLocation){const{parentIndex:e,columnIndex:t,childIndex:n}=M.selectedLocation;return M.handleChildUpdate(e,t,n,{[a]:l}),void E()}const s=h.findIndex(e=>e.id===x.id);s<0||O(s,{[a]:l})},[c,x,K,z,M,E,h,O]),G=n.length?a.filter(e=>n.includes(e.id)):a,V=(()=>{const e=G.some(e=>e.blocks.length>0),t=r&&l.length>0;return e||t})();return(0,Sa.jsxs)("div",{className:"registration-form-wrapper",children:[V&&(0,Sa.jsx)("div",{className:"elements-wrapper",children:(0,Sa.jsx)(wa,{tabs:[{label:"Blocks",content:(0,Sa.jsx)(Sa.Fragment,{children:G.map(({id:e,label:t,icon:a,blocks:n})=>(0,Sa.jsxs)("aside",{className:"elements-section",children:[(0,Sa.jsxs)("div",{className:"section-meta",onClick:()=>U(e),children:[(0,Sa.jsxs)("div",{className:"elements-title",children:[a&&(0,Sa.jsx)("i",{className:a}),t," ",(0,Sa.jsxs)("span",{children:["(",n.length,")"]})]}),(0,Sa.jsx)("i",{className:"adminfont-pagination-right-arrow "+(f[e]?"rotate":"")})]}),f[e]&&(0,Sa.jsx)(It.ReactSortable,{list:n,setList:()=>{},sort:!1,group:{name:o,pull:"clone",put:!1},className:"section-container open",children:n.map(e=>(0,Sa.jsxs)("div",{className:"elements-items",onClick:()=>{c()||(g(t=>(N.current=!0,"richtext"===e.value&&t.some(e=>"richtext"===e.type&&"form"===e.context)?t:[...t,Ft(e,d,t)])),E())},children:[(0,Sa.jsx)("i",{className:`adminfont-${e.icon}`}),(0,Sa.jsx)("div",{className:"elements-name",children:e.fixedName})]},e.id||e.value))})]},e))})},...r&&l.length?[{label:"Templates",content:(0,Sa.jsx)("aside",{className:"elements-section",children:(0,Sa.jsx)("main",{className:"template-list",children:l.map(({id:e,name:t})=>(0,Sa.jsxs)("div",{className:"template-item "+(e===s?"active":""),onClick:()=>i?.(e),children:[(0,Sa.jsx)("div",{className:"template-name",children:t}),(0,Sa.jsx)("div",{className:"template-image-wrapper",children:(0,Sa.jsxs)("div",{className:"template-image",children:[(0,Sa.jsx)("span",{}),(0,Sa.jsx)("span",{}),(0,Sa.jsx)("span",{}),(0,Sa.jsx)("span",{}),(0,Sa.jsx)("span",{})]})})]},e))})})}]:[]]})}),(0,Sa.jsxs)("div",{className:"canvas-editor-wrapper",children:[(0,Sa.jsxs)("div",{className:"canvas-editor",children:[k&&_&&(0,Sa.jsx)(Bt,{block:_,isActive:x?.name===_.name,onSelect:()=>b(_),onChange:e=>{const t=h.findIndex(e=>e.id===_.id);O(t,e)},showMeta:!1}),(0,Sa.jsx)(It.ReactSortable,{list:T,setList:P,group:{name:o,pull:!0,put:!0},handle:".drag-handle",animation:150,children:T.map((e,t)=>"columns"===e.type?(0,Sa.jsx)(Ht,{block:e,parentIndex:t,isActive:x?.name===e.name,groupName:o,openBlock:x,setOpenBlock:b,onColumnSetList:F,onChildMutate:e=>R(t,e),selectedLocation:M.selectedLocation,onChildSelect:(e,t)=>{b(t),M.setSelectedLocation(e)},onSelect:()=>{b(e),M.clearSelection()},onDelete:()=>B(t)},e.id):(0,Sa.jsx)(Bt,{block:e,isActive:x?.name===e.name,onSelect:()=>{b(e),M.clearSelection()},onChange:e=>O(t,e),onDelete:"name"===e.name?void 0:e=>B(t,e)},e.id))}),k&&A&&(0,Sa.jsx)(Bt,{block:A,isActive:x?.name===A.name,onSelect:()=>b(A),onChange:e=>{const t=h.findIndex(e=>e.id===A.id);O(t,e)},showMeta:!1}),k&&S&&(0,Sa.jsx)(Bt,{block:S,isActive:x?.name===S.name,onSelect:()=>b(S),onChange:e=>{const t=h.findIndex(e=>e.id===S.id);O(t,e)},showMeta:!1})]}),u&&(0,Sa.jsx)("div",{className:"available-placeholder",children:u?.map((e,t)=>(0,Sa.jsx)("span",{className:"admin-badge",role:"button",tabIndex:0,onClick:()=>H(e),onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),H(e))},children:e},t))})]}),(0,Sa.jsx)("div",{className:"settings-panel-wrapper",children:x&&(0,Sa.jsx)(Na,{formField:x,opened:{click:!0},onChange:q,inputTypeList:W()})})]})},Ta=a(790),Ea=[{id:"default",name:"Default Template",previewText:"Start with a blank email template",blocks:[]}],Ma=({value:e,onChange:t,field:a,setting:n={},proSettingChange:l=()=>!1,name:s=a?.key,canAccess:i,modules:r,onBlocked:o})=>{const c=a?.context||"form",d="email"===c,m=e||n[s]||{},[u,p]=Mt.default.useState(()=>d?a?.emailTemplates?.length?a.emailTemplates.map(e=>({...e,...m.emailTemplates?.find(t=>t.id===e.id)})):m.emailTemplates?.length?m.emailTemplates:Ea:[]),[h,g]=Mt.default.useState(m.activeEmailTemplateId||a?.defaultTemplateId||u[0]?.id||Ea[0].id),x=u.find(e=>e.id===h),b=Mt.default.useCallback(e=>{d?p(a=>{const n=a.map(t=>t.id===h?{...t,blocks:e}:t);return t({emailTemplates:n,activeEmailTemplateId:h}),n}):t({formfieldlist:e})},[d,h,t]),f=Mt.default.useCallback(e=>{if(d&&a?.emailTemplates){const n=a.emailTemplates.find(t=>t.id===e);n&&(p(t=>t.map(t=>t.id===e?{...t,blocks:n.blocks}:t)),t({emailTemplates:u.map(t=>t.id===e?{...t,blocks:n.blocks}:t),activeEmailTemplateId:e}))}g(e)},[d,a?.emailTemplates,u,t]),j=Mt.default.useMemo(()=>d?x?.blocks||[]:Array.isArray(e?.formfieldlist)?e.formfieldlist:Array.isArray(n[s]?.formfieldlist)?n[s].formfieldlist:[],[e,n,s,d,x]),y=a?.visibleGroups||["registration"];return(0,Ta.jsx)(Aa,{blocks:j,onChange:e=>{var t;i&&!((t=a).proSetting&&!Un.khali_dabba?(o?.("pro"),1):t.moduleEnabled&&!r.includes(t.moduleEnabled)?(o?.("module",t.moduleEnabled),1):t.requiredPlugin&&!(Un.active_plugins||[]).includes(t.requiredPlugin)&&(o?.("plugin",t),1))&&b(e)},blockGroups:a?.blockGroups||[],enableDefaultBlocks:a?.enableDefaultBlocks,visibleGroups:y,groupName:c,proSettingChange:l,context:c,...d&&{templates:u,activeTemplateId:h,onTemplateSelect:f,showTemplatesTab:!0},availablePlaceholder:a?.availablePlaceholder},h)},$a={render:Ma},Ia=a(1609),Da=a(790),La={async loadScript(e){if(window.google?.maps)return;if(document.getElementById("google-map-script"))return;const t=document.createElement("script");t.id="google-map-script",t.src=`https://maps.googleapis.com/maps/api/js?key=${e}&libraries=places,marker`,t.async=!0,t.defer=!0,document.head.appendChild(t),await new Promise(e=>t.onload=e)},createMap:(e,t,a,n,l)=>new window.google.maps.Map(e,{center:{lat:t,lng:a},zoom:n,mapId:l}),createMarker(e,t,a,n="default",l){const s={lat:t,lng:a};let i;if("store"===n){const e=document.createElement("div");e.style.display="flex",e.style.alignItems="center",e.style.gap="6px";const t=document.createElement("div");t.style.width="28px",t.style.height="28px",t.style.borderRadius="50%",t.style.background="#4B96F3",t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.boxShadow="0 2px 6px rgba(0,0,0,0.3)";const a=document.createElement("img");a.src="https://maps.gstatic.com/mapfiles/place_api/icons/v2/convenience_pinlet.png",a.style.width="16px",t.appendChild(a);const n=document.createElement("div");n.innerText=l||"",n.style.background="white",n.style.padding="2px 8px",n.style.borderRadius="6px",n.style.fontSize="12px",n.style.fontWeight="500",n.style.whiteSpace="nowrap",n.style.boxShadow="0 1px 4px rgba(0,0,0,0.3)",e.appendChild(t),e.appendChild(n),i=e}else{if("default"===n){const t=document.createElement("img");return t.src="https://maps.gstatic.com/mapfiles/api-3/images/spotlight-poi2.png",t.style.width="32px",t.style.height="32px",new google.maps.marker.AdvancedMarkerElement({map:e,position:s,content:t,gmpDraggable:!0})}{const e=document.createElement("div");e.style.width="16px",e.style.height="16px",e.style.borderRadius="50%",e.style.background="user"===n?"#2563eb":"#ef4444",e.style.border="2px solid white",e.style.boxShadow="0 0 4px rgba(0,0,0,0.4)",i=e}}return new google.maps.marker.AdvancedMarkerElement({map:e,position:s,content:i,gmpDraggable:"store"!==n})},onDragEnd(e,t){e.addListener("dragend",e=>{const a=e.latLng;t(a.lat(),a.lng())})},onMapClick(e,t){e.addListener("click",e=>t(e.latLng.lat(),e.latLng.lng()))},reverseGeocode:async(e,t)=>new Promise(a=>{(new window.google.maps.Geocoder).geocode({location:{lat:e,lng:t}},(e,t)=>a("OK"===t?e[0]:null))}),extractAddress(e){if(!e)return{};const t={};return e.address_components?.forEach(e=>{e.types.includes("locality")&&(t.city=e.long_name),e.types.includes("administrative_area_level_1")&&(t.state=e.long_name),e.types.includes("country")&&(t.country=e.short_name),e.types.includes("postal_code")&&(t.zip=e.long_name)}),{address:e.formatted_address,city:t.city,state:t.state,country:t.country,zip:t.zip,location_address:e.formatted_address}}},Pa={google_map:La,mapbox:{async loadScript(e){if(window.mapboxgl)return void(window.mapboxgl.accessToken=e);const t=document.createElement("script");t.src="https://api.mapbox.com/mapbox-gl-js/v3.18.1/mapbox-gl.js",document.head.appendChild(t),await new Promise(e=>t.onload=e),window.mapboxgl.accessToken=e;const a=document.createElement("link");a.rel="stylesheet",a.href="https://api.mapbox.com/mapbox-gl-js/v3.18.1/mapbox-gl.css",document.head.appendChild(a)},createMap:(e,t,a,n)=>new window.mapboxgl.Map({container:e,style:"mapbox://styles/mapbox/standard",center:[a,t],zoom:n}),createMarker(e,t,a,n="default"){const l="user"===n?"#2563eb":"store"===n?"#16a34a":"#ef4444";return new window.mapboxgl.Marker({draggable:!0,color:l}).setLngLat([a,t]).addTo(e)},onDragEnd(e,t){e.on("dragend",()=>{const{lat:a,lng:n}=e.getLngLat();t(a,n)})},onMapClick(e,t){e.on("click",e=>t(e.lngLat.lat,e.lngLat.lng))},async reverseGeocode(e,t){const a=await fetch(`https://api.mapbox.com/search/geocode/v6/reverse?longitude=${t}&latitude=${e}&access_token=${window.mapboxgl.accessToken}`),n=await a.json();return n.features?.[0]},extractAddress(e){if(!e)return{};const t=e.properties?.context||{},a=e.properties?.full_address||e.place_name||"";return{address:a,city:t.place?.name,state:t.region?.name,country:t.country?.country_code,zip:t.postcode?.name,location_address:a}}}},Fa=({apiKey:e,mapId:t,locationLat:a,locationLng:n,mapProvider:l,onLocationUpdate:s,placeholderSearch:i,stores:r})=>{const o=Pa[l]||La,c=(0,Ia.useRef)(null),d=(0,Ia.useRef)(null),m=(0,Ia.useRef)(null),u=(0,Ia.useRef)([]),p=(0,Ia.useRef)(null),h=(0,Ia.useRef)(null),[g,x]=(0,Ia.useState)(""),[b,f]=(0,Ia.useState)([]),[j,y]=(0,Ia.useState)(!1),v=a?parseFloat(a):40.7128,N=n?parseFloat(n):-74.006,C=async(e,t)=>{const a=await o.reverseGeocode(e,t),n=o.extractAddress(a);s({...n,location_lat:e.toString(),location_lng:t.toString()})};(0,Ia.useEffect)(()=>{c.current&&(async()=>{await o.loadScript(e),"google_map"===l&&y(!0);const a=o.createMap(c.current,v,N,12,t),n=o.createMarker(a,v,N,"default");d.current=a,m.current=n,o.onDragEnd(n,C),o.onMapClick(a,C)})()},[]),(0,Ia.useEffect)(()=>{d.current&&(u.current.forEach(e=>{"map"in e?e.map=null:"remove"in e&&e.remove()}),u.current=[],r?.data?.forEach(e=>{if(!e.location_lat||!e.location_lng)return;const t=o.createMarker(d.current,parseFloat(e.location_lat),parseFloat(e.location_lng),"store",e.store_name);u.current.push(t)}))},[r,o]),(0,Ia.useEffect)(()=>{if(!d.current||!m.current)return;const e=parseFloat(a),t=parseFloat(n);e&&t&&("google_map"===l?(d.current.setCenter({lat:e,lng:t}),m.current.position={lat:e,lng:t}):"mapbox"===l&&(d.current.setCenter([t,e]),m.current.setLngLat([t,e])))},[a,n]),(0,Ia.useEffect)(()=>{if("google_map"!==l)return;if(!j)return;if(!p.current)return;const e=new window.google.maps.places.Autocomplete(p.current,{types:["geocode"],fields:["formatted_address","geometry","address_components","name"]});e.addListener("place_changed",()=>{const t=e.getPlace();if(!t.geometry?.location)return;const a=t.geometry.location.lat(),n=t.geometry.location.lng();d.current&&m.current&&(d.current.setCenter({lat:a,lng:n}),m.current.position={lat:a,lng:n},d.current.setZoom(17));const l=La.extractAddress(t);s({...l,location_lat:a.toString(),location_lng:n.toString()})})},[l,j]);const k=(0,Ia.useRef)(Math.random().toString(36).substring(2)).current;return(0,Da.jsxs)("div",{className:"map-wrapper",style:{position:"relative"},children:[(0,Da.jsxs)("div",{className:"input-field",style:{position:"absolute",top:"3.83rem",left:"0.625rem",zIndex:9},children:[(0,Da.jsx)("input",{ref:p,defaultValue:g,placeholder:i,className:"basic-input",onChange:t=>{var a;x(t.target.value),"mapbox"===l&&(a=t.target.value,clearTimeout(h.current),h.current=setTimeout(async()=>{const t=await fetch(`https://api.mapbox.com/search/searchbox/v1/suggest?q=${encodeURIComponent(a)}&access_token=${e}&session_token=${k}`),n=await t.json();f(n.suggestions||[])},300))}}),b.length>0&&(0,Da.jsx)("ul",{children:b.map(t=>(0,Da.jsx)("li",{onClick:()=>(async t=>{const a=await fetch(`https://api.mapbox.com/search/searchbox/v1/retrieve/${t.mapbox_id}?access_token=${e}&session_token=${k}`),n=await a.json(),l=n.features?.[0];if(!l)return;const[s,i]=l.geometry.coordinates;d.current&&m.current&&(m.current.setLngLat([s,i]),d.current.setCenter([s,i]),d.current.setZoom(17)),C(i,s),f([]),x(l.properties?.full_address||t.name)})(t),children:t.name},t.mapbox_id))})]}),(0,Da.jsx)("div",{ref:c,className:"map",style:{width:"100%",height:"25rem"}})]})},Oa={render:({field:e,value:t,onChange:a})=>(0,Da.jsx)(Fa,{apiKey:e.apiKey,mapId:e.mapId,locationAddress:t?.location_address||"",locationLat:t?.location_lat||"",locationLng:t?.location_lng||"",isUserLocation:e.isUserLocation,onLocationUpdate:a,placeholderSearch:e.placeholderSearch||"Search location",stores:e.stores||null,mapProvider:e.type})},Ba=a(1609),Ra=m(a(3743)),qa=a(1609),Ua=a(790),Wa=({text:e,variant:t="code",copyButtonLabel:a="Copy",copiedLabel:n="Copied!",onCopy:l})=>{const[s,i]=(0,qa.useState)(!1),r=async()=>{try{let t=e;if(l){const e=l();"string"==typeof e&&(t=e)}if(!t)return;await navigator.clipboard.writeText(t),i(!0),setTimeout(()=>i(!1),2e3)}catch(e){console.error("Copy failed",e)}};return"button"===t?(0,Ua.jsx)("div",{className:"buttons-wrapper",children:(0,Ua.jsxs)("div",{className:"admin-btn btn-purple",onClick:r,children:[(0,Ua.jsx)("i",{className:"adminfont-vendor-form-copy"}),(0,Ua.jsx)("span",{className:"copy-success",children:s?n:a})]})}):"icon"===t?(0,Ua.jsx)(D,{className:s?"copied":"",text:s?n:a,children:(0,Ua.jsx)("i",{className:s?"adminfont-check":"adminfont-vendor-form-copy",onClick:r})}):(0,Ua.jsxs)("div",{className:"copy-to-clipboard",children:[(0,Ua.jsx)("code",{children:e}),(0,Ua.jsx)(D,{className:s?"copied":"",text:s?n:a,children:(0,Ua.jsx)("i",{className:s?"adminfont-check":"adminfont-vendor-form-copy",onClick:r})})]})},Ka={render:({field:e})=>(0,Ua.jsx)(Wa,{text:e.text,variant:e.variant||"code",copyButtonLabel:e.copyButtonLabel,copiedLabel:e.copiedLabel,onCopy:e.onCopy}),validate:()=>null},za=a(790),Ha=({apiLink:e,downloadFileName:t,downloadBtnText:a="Download",copyBtnText:n="Copy",deleteBtnText:l="Delete"})=>{const[s,i]=(0,Ba.useState)([]),[r,o]=(0,Ba.useState)(!1),c=/^([^:]+:[^:]+:[^:]+):(.*)$/;return(0,Ba.useEffect)(()=>{(0,Ra.default)({url:b(Un,e),method:"GET",headers:{"X-WP-Nonce":Un.nonce},params:{logcount:100}}).then(e=>{i(e.data)})},[e]),(0,za.jsxs)("div",{className:"section-log-container",children:[(0,za.jsxs)("div",{className:"buttons-wrapper",children:[(0,za.jsx)(E,{position:"left",buttons:[{icon:"import",text:a,color:"purple",onClick:a=>{(a=>{a.preventDefault();const n=t;(0,Ra.default)({url:b(Un,`${e}/download`),method:"GET",headers:{"X-WP-Nonce":Un.nonce},params:{file:n},responseType:"blob"}).then(e=>{const t=new Blob([e.data],{type:e.headers["content-type"]}),a=window.URL.createObjectURL(t),l=document.createElement("a");l.href=a,l.setAttribute("download",n),document.body.appendChild(l),l.click(),document.body.removeChild(l)}).catch(e=>console.error("Error downloading file:",e))})?.(a)}}]}),(0,za.jsx)(E,{position:"left",buttons:[{icon:"delete",text:l,color:"red",onClick:t=>{t.preventDefault(),(0,Ra.default)({url:b(Un,e),method:"DELETE",headers:{"X-WP-Nonce":Un.nonce},params:{logcount:100}}).then(()=>{i([])})}}]})]}),(0,za.jsxs)("div",{className:"log-container-wrapper",children:[(0,za.jsxs)("div",{className:"wrapper-header",children:[(0,za.jsxs)("div",{className:"log-viewer-text",children:[Un.tab_name," - log viewer"]}),(0,za.jsx)(Wa,{variant:"button",copyButtonLabel:n,copiedLabel:"Copied",onCopy:e=>{e.preventDefault();const t=s.map(e=>{const t=e.match(c);return t?`${t[1].trim()} : ${t[2].trim()}`:e}).join("\n");navigator.clipboard.writeText(t).then(()=>o(!0)).catch(e=>{o(!1),console.error("Error copying logs to clipboard:",e)}),setTimeout(()=>o(!1),1e4)}})]}),(0,za.jsx)("div",{className:"wrapper-body",children:s.map((e,t)=>{const a=e.match(c);return a?(0,za.jsxs)("div",{className:"log-row",children:[(0,za.jsxs)("span",{className:"log-creation-date",children:[a[1].trim()," :"]}),(0,za.jsx)("span",{className:"log-details",children:a[2].trim()})]},t):null})})]})]})},Ga={render:({field:e})=>(0,za.jsx)(Ha,{apiLink:String(e.apiLink),downloadFileName:String(e.fileName),downloadBtnText:e.downloadBtnText,copyBtnText:e.copyBtnText,deleteBtnText:e.deleteBtnText}),validate:()=>null},Va=m(a(1609)),Ya=a(790);function Za(e,t,a){return e.proSetting&&!Un?.khali_dabba?(a?.("pro"),!0):!(!e.moduleEnabled||t.includes(e.moduleEnabled)||(a?.("module",e.moduleEnabled),0))}var Ja=({type:e,field:t,fieldKey:a,rowKey:n,column:l,rowLabel:s,value:i,disabled:r,onChange:o,modules:c,onBlocked:d})=>{const m=zn[e];if(!m)return(0,Ya.jsx)("td",{children:"—"},a);const u=m.render,p={...l,...t,key:a,type:e,label:l.label??s,rowKey:n,rowLabel:s,disabled:r};return(0,Ya.jsx)(u,{field:p,value:i,modules:c,onBlocked:d,canAccess:!r,onChange:e=>{Za(p,c,d)||o(a,e)}})},Xa=({rows:e,columns:t,setting:a,visibilityContext:n,onChange:l,storeTabSetting:s,proSetting:i,modules:r,onBlocked:o,khali_dabba:c})=>{const[d,m]=(0,Va.useState)(()=>!Array.isArray(e)&&Object.keys(e).length>0?Object.keys(e)[0]:null),u=n??a,p=e=>{if(!e.visibleWhen)return!0;const{key:t,value:a}=e.visibleWhen;return Array.isArray(a)?a.includes(u?.[t]):u?.[t]===a},h=t.filter(p),g=(e,t,n,s,i)=>{const c=t.fields??e.fields??[{key:e.key,type:"checkbox"}];return(0,Ya.jsx)("td",{children:(0,Ya.jsx)("div",{className:"multi-field-cell",children:c.map(c=>{if("checkbox"==e.type){const t=e.key,s=a.role_access_table?.[t]??a[t]??[],d=s.includes(n),m=e=>{const a=e.target.checked?[...s,n]:s.filter(e=>e!==n);l(t,a)};return(0,Ya.jsx)("input",{type:"checkbox",checked:d,disabled:!i,onChange:t=>{Za(e,r,o)||m(t)}},`${e.key}_${c.key}_${n}`)}{const d=t.fields||e.fields?`${e.key}_${c.key}_${t.key}`:`${e.key}`;return(0,Ya.jsx)(Ja,{type:c.type,field:c,fieldKey:d,rowKey:n,column:e,rowLabel:s,value:a[d]??[],disabled:!i,onChange:l,modules:r,onBlocked:o},d)}})})},`${e.key}_${n}`)};return(0,Ya.jsxs)(Ya.Fragment,{children:[i&&!c&&(0,Ya.jsxs)("span",{className:"admin-pro-tag",children:[(0,Ya.jsx)("i",{className:"adminfont-pro-tag"})," Pro"]}),(0,Ya.jsxs)("table",{className:"multi-input-table",children:[(0,Ya.jsx)("thead",{children:(0,Ya.jsxs)("tr",{children:[(0,Ya.jsx)("th",{}),t.filter(p).map(e=>(0,Ya.jsxs)("th",{children:[e.label,e.proSetting&&!c&&(0,Ya.jsxs)("span",{className:"admin-pro-tag",children:[(0,Ya.jsx)("i",{className:"adminfont-pro-tag"})," Pro"]})]},e.key))]})}),(0,Ya.jsx)("tbody",{children:Array.isArray(e)?(b=e,b.map(e=>{const n=!e.enabledKey||(a[e.enabledKey]?.includes(e.key)??!1);return(0,Ya.jsxs)("tr",{className:e.enabledKey&&!n?"row-disabled":"",children:[(0,Ya.jsx)("td",{children:e.enabledKey?(0,Ya.jsxs)(Ya.Fragment,{children:[(0,Ya.jsx)("input",{type:"checkbox",id:`row-toggle_${e.key}`,checked:n,onChange:t=>(t=>{const n=a[e.enabledKey]??[];l(e.enabledKey,t?[...n,e.key]:n.filter(t=>t!==e.key))})(t.target.checked)}),(0,Ya.jsx)("span",{children:e.label})]}):e.label}),n?t.filter(p).map(t=>g(t,e,e.key,e.label,!0)):(0,Ya.jsx)("td",{colSpan:h.length,children:(0,Ya.jsx)("span",{className:"red-color",children:e.inactiveMessage??"Inactive"})})]},e.key)})):(x=e,Object.entries(x).map(([e,a])=>{const n=d===e;return(0,Ya.jsxs)(Va.default.Fragment,{children:[(0,Ya.jsx)("div",{className:"toggle-header",onClick:()=>m(n?null:e),children:(0,Ya.jsxs)("div",{className:"header-title",children:[a.label,(0,Ya.jsx)("i",{className:"adminfont-"+(n?"keyboard-arrow-down":"pagination-right-arrow")})]})}),n&&Object.entries(a.capability).map(([e,n])=>{const l=Object.values(s).some(t=>t?.includes(e));return(0,Ya.jsxs)("tr",{children:[(0,Ya.jsx)("td",{children:n}),t.filter(p).map(t=>g(t,a,e,n,l))]},e)})]},e)}))})]})]});var x,b},Qa={render:({field:e,value:t,onChange:a,canAccess:n,modules:l,settings:s,onBlocked:i,storeTabSetting:r})=>{const o=t&&"object"==typeof t&&!Array.isArray(t)?t:{},c=e.storeSetting?o:s;return(0,Ya.jsx)(Xa,{khali_dabba:Un?.khali_dabba??!1,rows:e.rows??[],columns:e.columns??[],setting:c,visibilityContext:s,storeTabSetting:r??{},proSetting:e.proSetting??!1,modules:l??[],onBlocked:i,onChange:(e,t)=>{if(!n)return;const l="object"==typeof e?e:{[e]:t};a({...o,...l})}})},validate:()=>null},en=a(1609),tn=a(790),an=({id:e,fields:t=[],value:a=[],onChange:n,addButtonLabel:l="Add",deleteButtonLabel:s="Delete",single:i=!1,wrapperClass:r="",canAccess:o,mapping:c=!1})=>{const[d,m]=(0,en.useState)([]);function u(e){m(e),n(e)}(0,en.useEffect)(()=>{m(i?a.length?[a[0]]:[{}]:a.length?a:[{}])},[a,i]);const p=(e,t,a)=>{if(0===a&&e.skipFirstRow)return!1;if(!e.dependent)return!0;const n=t?.[e.dependent.key],l=Array.isArray(n)?n.includes(e.dependent.value):n===e.dependent.value;return e.dependent.set?l:!l};function h(){if(!d.length)return!0;const e=d[d.length-1]??{};return t.every(t=>!(!t.skipFirstRow||1!==d.length)||(!t.key||(!p(t,e,d.length-1)||""!==e[t.key])))}function g(){if(!c)return!0;const e=t.find(e=>"select"===e.type);return!e?.options||d.length<e.options.length}function x(){i||h()&&g()&&u([...d,{}])}function b(e,t,a){c&&(e=function(e,t,a){if("select"!==e.type||!e.options)return e;const n=d.filter((e,t)=>t!==a).map(t=>t?.[e.key]);return{...e,options:e.options.filter(a=>!n.includes(a.value)||a.value===t?.[e.key])}}(e,t,a));const l=zn[e.type];if("checklist"===e.type)return(0,tn.jsx)(ct,{className:"checklist",items:e.options});if(!l)return null;const s=l.render,i=t?.[e.key];return(0,tn.jsxs)(tn.Fragment,{children:[!(0===a)&&e.label&&(0,tn.jsx)("label",{children:e.label}),(0,tn.jsx)(s,{field:e,value:i,onChange:t=>{!function(e,t,a){const l=d.map((n,l)=>l===e?{...n??{},[t]:a}:n);n(l)}(a,e.key,t)},canAccess:o})]})}return(0,tn.jsx)("div",{className:"nested-wrapper",id:e,children:d.map((e,a)=>(0,tn.jsxs)("div",{className:`nested-row ${i?"":"multiple"} ${r}`,children:[t.map(t=>0===a&&t.skipFirstRow?null:p(t,e,a)?(0,tn.jsxs)(tn.Fragment,{children:[t.beforeElement&&b(t.beforeElement,e,a),b(t,e,a),t.afterElement&&b(t.afterElement,e,a)]}):null),!i&&(0,tn.jsx)(E,{buttons:[...a===d.length-1&&g()?[{icon:"plus",color:"purple",text:l,onClick:x,disabled:!h()}]:[],...d.length>1&&a>0?[{icon:"delete",text:s,color:"red",onClick:()=>{return e=a,void(i||u(d.filter((t,a)=>a!==e)));var e}}]:[]]})]},`nested-row-${a}`))})},nn={render:({field:e,value:t,onChange:a,canAccess:n})=>(0,tn.jsx)(an,{id:e.key,label:e.label,mapping:e.mapping,fields:e.nestedFields??[],value:t,wrapperClass:e.rowClass,addButtonLabel:e.addButtonLabel,deleteButtonLabel:e.deleteButtonLabel,single:e.single,onChange:e=>{n&&a(e)},canAccess:n},e.key),validate:()=>null},ln=a(790),sn=({textType:e,preText:t,postText:a})=>(0,ln.jsxs)(ln.Fragment,{children:["pre"==e&&(0,ln.jsx)("span",{className:"before",children:t}),"post"==e&&(0,ln.jsx)("span",{className:"after",children:a})]}),rn={render:({field:e})=>(0,ln.jsx)(sn,{type:e.type,textType:e.textType,preText:e.preText,postText:e.postText}),validate:(e,t)=>e.required&&!t?.[e.key]?`${e.label} is required`:null},on=a(790),cn={render:({formField:e})=>e?.sitekey?(0,on.jsx)("div",{className:"main-input-wrapper recaptcha",children:"reCAPTCHA has been successfully added to the form."}):(0,on.jsx)("div",{className:"main-input-wrapper recaptcha",children:"Please enter the reCAPTCHA site key in the field settings to enable reCAPTCHA."}),validate:(e,t)=>e.required&&!t?.[e.key]?`${e.label} is required`:null},dn=a(790),mn=({wrapperClass:e="",title:t,desc:a,withoutBorder:n=!1})=>(0,dn.jsxs)("div",{className:`divider-section ${t?"":"border-only"} ${n?"without-border":""} ${e}`,children:[t&&(0,dn.jsx)("div",{className:"title",dangerouslySetInnerHTML:{__html:t}}),a&&(0,dn.jsx)("span",{className:"desc",children:a})]}),un={render:({field:e})=>(0,dn.jsx)(mn,{wrapperClass:e.wrapperClass,title:e.title,desc:e.desc,withoutBorder:e.withoutBorder}),validate:()=>null},pn=a(790),hn=e=>{const{options:t,optionLabel:a}=e,n=a;return(0,pn.jsx)(pn.Fragment,{children:t.map((e,t)=>(0,pn.jsxs)("div",{className:"shortcode-wrapper",children:[(0,pn.jsxs)("div",{className:"shortcode-details",children:[(0,pn.jsxs)("div",{className:"shortcode-title",children:[e.name," -"," ",(0,pn.jsx)(Wa,{text:e.label})]}),(0,pn.jsx)("div",{className:"des",children:e.desc})]}),e.arguments&&e.arguments.length>0?(0,pn.jsx)("div",{className:"shortcode-table",children:(0,pn.jsxs)("table",{children:[(0,pn.jsx)("thead",{children:(0,pn.jsx)("tr",{children:n.map((e,t)=>(0,pn.jsx)("th",{children:e},t))})}),(0,pn.jsx)("tbody",{children:e.arguments.map((e,t)=>(0,pn.jsxs)("tr",{children:[(0,pn.jsx)("td",{children:(0,pn.jsx)("b",{children:e.attribute})}),(0,pn.jsx)("td",{children:e.description}),(0,pn.jsx)("td",{children:e.accepted}),(0,pn.jsx)("td",{children:e.default})]},t))})]})}):(0,pn.jsx)("div",{className:"no-args-message",children:"No arguments required"})]},e.label||t))})},gn={render:({field:e})=>(0,pn.jsx)(hn,{icon:e.icon,options:Array.isArray(e.options)?e.options:[],optionLabel:e.optionLabel},e.key),validate:()=>null},xn=a(1609),bn=m(a(3743)),fn=a(790),jn=({apiLink:e,copyButtonLabel:t="Copy System Info",copiedLabel:a="Copied!"})=>{const[n,l]=(0,xn.useState)(null),[s,i]=(0,xn.useState)([]);return(0,xn.useEffect)(()=>{(0,bn.default)({url:b(Un,e),method:"GET",headers:{"X-WP-Nonce":Un.nonce}}).then(e=>{l(e.data)})},[e]),n?(0,fn.jsxs)("div",{className:"system-info",children:[(0,fn.jsx)(Wa,{variant:"button",copyButtonLabel:t,copiedLabel:a,onCopy:()=>n?(e=>{let t="";return Object.values(e).forEach(e=>{t+=`=== ${e.label} ===\n`,Object.values(e.fields).forEach(e=>{t+=`${e.label}: ${e.value}\n`}),t+="\n"}),t.trim()})(n):""}),Object.entries(n).map(([e,t])=>{const a=s.includes(e);return(0,fn.jsxs)("div",{className:"system-item",children:[(0,fn.jsxs)("div",{onClick:()=>(e=>{i(t=>t.includes(e)?[]:[e])})(e),className:"name",children:[(0,fn.jsx)("span",{children:t.label}),(0,fn.jsx)("i",{className:a?"adminfont-keyboard-arrow-down":"adminfont-pagination-right-arrow "})]}),a&&(0,fn.jsx)("div",{className:"content",children:(0,fn.jsx)("table",{children:(0,fn.jsx)("tbody",{children:Object.entries(t.fields).map(([e,t])=>(0,fn.jsxs)("tr",{children:[(0,fn.jsx)("td",{className:"field-label",children:t.label}),(0,fn.jsx)("td",{className:"field-value",children:t.value})]},e))})})})]},e)})]}):(0,fn.jsxs)("div",{className:"system-info",children:[(0,fn.jsx)("div",{className:"buttons-wrapper",children:(0,fn.jsx)("div",{className:"admin-btn btn-purple",children:(0,fn.jsx)(Ie,{width:6})})}),Array.from({length:10}).map((e,t)=>(0,fn.jsx)("div",{className:"system-item",children:(0,fn.jsxs)("div",{className:"name",children:[(0,fn.jsx)(Ie,{width:11.25}),(0,fn.jsx)("i",{className:"adminfont-pagination-right-arrow"})]})},t))]})},yn={render:({field:e,appLocalizer:t})=>(0,fn.jsx)(jn,{apiLink:e.apiLink,appLocalizer:t,copyButtonLabel:e.copyButtonLabel,copiedLabel:e.copiedLabel}),validate:()=>null},vn=a(790),Nn=({value:e="",length:t=8,onChange:a})=>e?(0,vn.jsxs)(vn.Fragment,{children:[(0,vn.jsx)(Wa,{text:e,variant:"icon",copyButtonLabel:"Copy",copiedLabel:"Copied!"}),(0,vn.jsx)("div",{className:"clear-btn",onClick:()=>{a("")},children:(0,vn.jsx)("i",{className:"adminfont-delete color-red"})})]}):(0,vn.jsx)(E,{buttons:[{icon:"star-icon",text:"Generate",onClick:()=>{const e=(n=t,Array.from({length:n},()=>"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(Math.floor(62*Math.random()))).join(""));var n;a(e)}}]}),Cn={render:({field:e,value:t,onChange:a})=>(0,vn.jsx)(Nn,{value:t,length:e.length,onChange:a})},kn=a(1609),wn=a(790),Sn=(0,kn.forwardRef)(({mode:e="multiple",max:t,value:a=[],primary:n="",enablePrimary:l=!0,placeholder:s="Enter email...",onChange:i},r)=>{const[o,c]=(0,kn.useState)(a),[d,m]=(0,kn.useState)(l?n:""),[u,p]=(0,kn.useState)(""),h=(0,kn.useRef)(null),g="multiple"===e,x=o.length>0;(0,kn.useEffect)(()=>{c(a)},[a]),(0,kn.useEffect)(()=>{m(l?n:"")},[n,l]),(0,kn.useImperativeHandle)(r,()=>h.current);const b=(0,kn.useCallback)(e=>/^\S+@\S+\.([a-zA-Z]{2,})$/.test(e),[]),f=(0,kn.useCallback)(e=>{if(!(e=e.trim())||!b(e)||o.includes(e)||t&&o.length>=t)return;const a=[...o,e];c(a);let n=d;l&&g&&1===a.length&&(m(e),n=e),p(""),i?.(a,n)},[o,t,b,l,g,d,i]),j=(0,kn.useCallback)(e=>{const t=o.filter(t=>t!==e);l&&d===e&&m(t[0]||""),c(t),i?.(t,l&&t[0]||"")},[o,d,l,i]),y=(0,kn.useCallback)(e=>{l&&g&&(m(e),i?.(o,e))},[l,g,o,i]),v=!g&&x,N=u.trim(),C=!v&&N&&b(N)&&(!g||!o.includes(N));return(0,wn.jsxs)("div",{className:"emails-section",onClick:()=>!v&&h.current?.focus(),children:[o.map(e=>(0,wn.jsxs)("div",{className:"email "+(l&&d===e?"primary":""),children:[l&&g&&(0,wn.jsx)("i",{className:"stat-icon adminfont-star"+(d===e?" primary":"-o"),onClick:t=>{t.stopPropagation(),y(e)}}),(0,wn.jsx)("span",{children:e}),(0,wn.jsx)("i",{className:"adminfont-close close",onClick:t=>{t.stopPropagation(),j(e)}})]},e)),(0,wn.jsxs)("div",{className:"input-wrapper",children:[(0,wn.jsx)(V,{ref:h,type:"email",inputClass:"email-input",value:u,placeholder:s,onChange:e=>p(String(e)),onKeyDown:e=>{["Enter",","," "].includes(e.key)&&(e.preventDefault(),f(u))},readOnly:v}),C&&(0,wn.jsxs)("div",{className:"inline-suggestion",onClick:()=>f(N),children:[(0,wn.jsx)("i",{className:"adminfont-mail orange"})," ",N]})]})]})}),An={render:({field:e,value:t,onChange:a})=>(0,wn.jsx)(Sn,{mode:e.mode,max:e.max,value:t?.list||[],primary:t?.primary||"",enablePrimary:e.enablePrimary,placeholder:e.placeholder,onChange:(e,t)=>a?.({list:e,primary:t})}),validate:()=>null},Tn=a(1609),En=m(a(3743)),Mn=a(790),$n=({buttonText:e,buttonIcon:t,apilink:a,variant:n,action:l,parameter:s,interval:i,successMessage:r,failureMessage:o,tasks:c,onComplete:d,onError:m,onTaskComplete:u,onChange:p,value:h})=>{const[g,x]=(0,Tn.useState)(!1),[f,j]=(0,Tn.useState)(""),[y,v]=(0,Tn.useState)(!1),[N,C]=(0,Tn.useState)([]),k=(0,Tn.useRef)(0),w=(0,Tn.useRef)(null),_=(0,Tn.useRef)({}),[S,A]=(0,Tn.useState)(0),[T,M]=(0,Tn.useState)("");(0,Tn.useEffect)(()=>{if(S<N.length){const e=setTimeout(()=>{A(e=>e+1)},i);return()=>clearTimeout(e)}},[S,N]);const $=async()=>{if(x(!0),k.current>=c.length)return x(!1),j("completed"),void d?.();const e=c[k.current];try{const t={};l&&(t.action=e.action),s&&(t.parameter=s),e.previousResponseData?.length&&e.previousResponseData.forEach(e=>{t[e]=_.current[e]});const n=await En.default.post(b(Un,a),t,{headers:{"X-WP-Nonce":Un.nonce}});if(n.data?.error)return j("failed"),x(!1),M(`${e.failureMessage||o}`),void m?.({task:e,error:n.data.error});_.current[e.action]=n.data,C(t=>[...t,{action:e.message,status:"success"}]),u?.(e,n),k.current++,await $()}catch(t){console.error("Task execution failed:",t),j("failed"),x(!1),M(`${e.failureMessage||o}\n${t.message}`),m?.({task:e,error:t})}},I=()=>{En.default.get(b(Un,a),{headers:{"X-WP-Nonce":Un.nonce},params:{parameter:s}}).then(({data:e})=>{v(e.running),C(e.status||[])})};return(0,Tn.useEffect)(()=>{n||I()},[]),(0,Tn.useEffect)(()=>(y?w.current=setInterval(I,i):w.current&&(clearInterval(w.current),w.current=null),()=>{w.current&&clearInterval(w.current)}),[y,I,i]),(0,Mn.jsxs)(Mn.Fragment,{children:[(0,Mn.jsxs)("div",{className:"loader-wrapper",children:[(0,Mn.jsx)(E,{buttons:[{text:e,color:"purple-bg",onClick:e=>{e.preventDefault(),c?.length?$():(n||v(!0),x(!0),En.default.post(b(Un,a),{parameter:s},{headers:{"X-WP-Nonce":Un.nonce}}).then(e=>{j(!0===e.data?"success":"failed"),n&&p?.({options:e.data||[],selected:""}),x(!1)}).catch(e=>{console.error("Task execution failed:",e),j("failed"),x(!1)}))},disabled:g,icon:t||"import"}],position:"left"}),g&&(0,Mn.jsx)("div",{className:"multivendorx-loader"})]}),(0,Mn.jsx)("div",{className:"sequential-task-executor",children:N&&N.length>0&&N.map((e,t)=>(0,Mn.jsxs)("div",{className:`sequential-task ${f}`,style:{"--progress-time":i/1e3+"s"},children:[e.action,(0,Mn.jsxs)("div",{className:"status-wrapper",children:[(0,Mn.jsxs)("span",{className:"status-icons",children:["failed"===f&&(0,Mn.jsx)("i",{className:"failed-icon adminfont-error"}),"completed"===f&&(0,Mn.jsx)("i",{className:"completed-icon adminfont-check"})]}),e.total&&(0,Mn.jsxs)("span",{children:[e.current," / ",e.total]})]})]},t))}),f&&(0,Mn.jsx)(Qe,{type:"failed"===f?"error":"success",displayPosition:"inline-notice",message:"failed"===f?T||o:r}),n&&h?.options?.length>0&&(0,Mn.jsx)(K,{options:h.options,value:h.selected||"",onChange:e=>{p?.({...h,selected:e})}})]})},In={render:({field:e,value:t,onChange:a,canAccess:n})=>(0,Mn.jsx)($n,{buttonText:e.buttonText,buttonIcon:e.buttonIcon,apilink:e.apilink,variant:e.variant,parameter:e.parameter,action:e.action,interval:e.interval,successMessage:e.successMessage,failureMessage:e.failureMessage,tasks:e.tasks,onComplete:e.onComplete,onError:e.onError,onTaskComplete:e.onTaskComplete,value:t||"",onChange:e=>{n&&a(e)}})},Dn=a(1609),Ln=a(790),Pn=[{id:"1",type:"text",label:"Name",name:"name",placeholder:"Enter your name here"},{id:"2",type:"email",label:"Email",name:"email",placeholder:"Enter your email here"},{id:"3",type:"text",label:"Phone",name:"phone",placeholder:"Enter your phone number here"},{id:"4",type:"text",label:"Address",name:"address",placeholder:"Enter your address here"},{id:"5",type:"text",label:"Subject",name:"subject",placeholder:"Enter the subject of your enquiry here"},{id:"6",type:"text",label:"Comment",name:"comment",placeholder:"Enter the details of your enquiry here"},{id:"7",type:"fileupload",label:"Filesize Limit",name:"File upload size limit"},{id:"8",type:"attachment",label:"Fileupload",name:"File upload",placeholder:""},{id:"9",type:"custom-recaptcha",label:"Captcha",name:"Captcha",placeholder:""},{id:"10",type:"button",label:"Submit"}],Fn=e=>Array.isArray(e)?e:[],On=e=>"submit"===e?.name?.trim().toLowerCase(),Bn=e=>e.some(e=>On(e))?e.map(e=>On(e)?{...e,disabled:!1}:e):[...e,{id:"10",type:"button",label:"Submit",placeholder:"",disabled:!1,name:"Submit"}],Rn=({field:e,value:t,canAccess:a,onChange:n,modules:l,onBlocked:s})=>{const[i,r]=(0,Dn.useState)(()=>Bn(Fn(t))),[o,c]=(0,Dn.useState)(null),d=(0,Dn.useRef)(!1),m=(0,Dn.useRef)({}),u=()=>e.proSetting&&!Un?.khali_dabba?(s?.("pro"),!0):e.moduleEnabled&&!l?.includes(e.moduleEnabled)?(s?.("module",e.moduleEnabled),!0):!(!e.requiredPlugin||(Un?.active_plugins||[]).includes(e.requiredPlugin)||(s?.("plugin",e),0));(0,Dn.useEffect)(()=>{const e=Fn(t),a=Bn(e);JSON.stringify(i)!==JSON.stringify(a)&&(r(a),d.current=!1)},[t]),(0,Dn.useEffect)(()=>{if(d.current){const e=Bn(i);n(e),d.current=!1}},[i,n]),(0,Dn.useEffect)(()=>{const e=e=>{if(o){const t=m.current[o];t&&!t.contains(e.target)&&c(null)}};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[o]);const p=e=>i.find(t=>String(t.id)===String(e)),h=e=>{const t=p(e);if(t)return t;const a=Pn.find(t=>t.id===e),n=On(a);return{id:a?.id||e,type:a?.type||"text",label:a?.label||e,placeholder:a?.placeholder||"",disabled:!n,name:a?.name||""}},g=e=>{a&&!u()&&(c(e),setTimeout(()=>{m.current[e]&&m.current[e]?.focus()},0))};return(0,Ln.jsxs)("div",{className:"free-form-customizer",children:[(0,Ln.jsxs)("div",{className:"free-form-header",children:[(0,Ln.jsx)("div",{className:"title",children:"Field Label"}),(0,Ln.jsx)("div",{className:"title",children:"Placeholder Text"})]}),Pn.map(e=>{const t=p(e.id),n=t?.label??e.label??"",l=t?.placeholder??e.placeholder??"",s=On(t)||On(e),c=!!s||!(t?.disabled??1),x=o===e.id;return(0,Ln.jsxs)("div",{className:`free-form-row ${c?"":"enable-visibility"} ${s?"submit-btn":""}`,children:[(0,Ln.jsx)("div",{className:"free-form-input",children:x?(0,Ln.jsx)(V,{type:"text",value:n,onChange:t=>{return n=e.id,l=t,void(a&&(d.current=!0,r(e=>{if(e.find(e=>String(e.id)===String(n)))return e.map(e=>String(e.id)===String(n)?{...e,label:l}:e);const t=h(n);return[...e,{...t,label:l}]})));var n,l},readOnly:!a,ref:t=>m.current[e.id]=t}):s?(0,Ln.jsxs)("div",{className:"buttons-wrapper",onClick:()=>g(e.id),children:[(0,Ln.jsx)("div",{className:"admin-btn btn-purple",children:n}),a&&(0,Ln.jsx)("i",{className:"edit-icon adminfont-edit"})]}):(0,Ln.jsxs)("label",{onClick:()=>g(e.id),children:[n,(0,Ln.jsx)("i",{className:"edit-icon adminfont-edit"})]})}),!s&&(0,Ln.jsxs)(Ln.Fragment,{children:[(0,Ln.jsx)("div",{className:"free-form-input",children:(0,Ln.jsx)(V,{type:"text",value:l,onChange:t=>{return n=e.id,l=t,void(a&&!u()&&(d.current=!0,r(e=>{if(e.find(e=>String(e.id)===String(n)))return e.map(e=>String(e.id)===String(n)?{...e,placeholder:l}:e);const t=h(n);return[...e,{...t,placeholder:l}]})));var n,l},readOnly:!a})}),(0,Ln.jsx)("i",{onClick:()=>(e=>{const t=i.find(t=>t.id===e)||Pn.find(t=>t.id===e);if(On(t)||u())return;const n=p(e)?.disabled??!0;((e,t)=>{const n=i.find(t=>t.id===e)||Pn.find(t=>t.id===e);!On(n)&&a&&(d.current=!0,r(a=>{if(a.find(t=>String(t.id)===String(e)))return a.map(a=>String(a.id)===String(e)?{...a,disabled:t}:a);const n=h(e);return[...a,{...n,disabled:t}]}))})(e,!n)})(e.id),className:"visibility-icon adminfont-"+(c?"eye":"eye-blocked")})]})]},e.id)})]})},qn={render:({field:e,value:t,onChange:a,canAccess:n,modules:l,onBlocked:s})=>(0,Ln.jsx)(Rn,{field:e,value:t,canAccess:n,onChange:a,modules:l,onBlocked:s}),validate:()=>null},Un=(()=>{const e=window.appLocalizer||{};return{nonce:e.nonce,apiUrl:e.apiUrl,restUrl:e.restUrl,khali_dabba:e.khali_dabba,active_plugins:e.active_plugins,shop_url:e.shop_url,tab_name:e.tab_name,site_url:e.site_url,tinymceApiKey:e.tinymceApiKey}})(),Wn=Object.entries({AF:{name:"Afghanistan",dial_code:"+93"},AL:{name:"Albania",dial_code:"+355"},DZ:{name:"Algeria",dial_code:"+213"},AS:{name:"AmericanSamoa",dial_code:"+1684"},AD:{name:"Andorra",dial_code:"+376"},AO:{name:"Angola",dial_code:"+244"},AI:{name:"Anguilla",dial_code:"+1264"},AQ:{name:"Antarctica",dial_code:"+672"},AG:{name:"Antigua and Barbuda",dial_code:"+1268"},AR:{name:"Argentina",dial_code:"+54"},AM:{name:"Armenia",dial_code:"+374"},AW:{name:"Aruba",dial_code:"+297"},AU:{name:"Australia",dial_code:"+61"},AT:{name:"Austria",dial_code:"+43"},AZ:{name:"Azerbaijan",dial_code:"+994"},BS:{name:"Bahamas",dial_code:"+1242"},BH:{name:"Bahrain",dial_code:"+973"},BD:{name:"Bangladesh",dial_code:"+880"},BB:{name:"Barbados",dial_code:"+1246"},BY:{name:"Belarus",dial_code:"+375"},BE:{name:"Belgium",dial_code:"+32"},BZ:{name:"Belize",dial_code:"+501"},BJ:{name:"Benin",dial_code:"+229"},BM:{name:"Bermuda",dial_code:"+1441"},BT:{name:"Bhutan",dial_code:"+975"},BO:{name:"Bolivia, Plurinational State of",dial_code:"+591"},BA:{name:"Bosnia and Herzegovina",dial_code:"+387"},BW:{name:"Botswana",dial_code:"+267"},BR:{name:"Brazil",dial_code:"+55"},IO:{name:"British Indian Ocean Territory",dial_code:"+246"},BN:{name:"Brunei Darussalam",dial_code:"+673"},BG:{name:"Bulgaria",dial_code:"+359"},BF:{name:"Burkina Faso",dial_code:"+226"},BI:{name:"Burundi",dial_code:"+257"},KH:{name:"Cambodia",dial_code:"+855"},CM:{name:"Cameroon",dial_code:"+237"},CA:{name:"Canada",dial_code:"+1"},CV:{name:"Cape Verde",dial_code:"+238"},KY:{name:"Cayman Islands",dial_code:"+345"},CF:{name:"Central African Republic",dial_code:"+236"},TD:{name:"Chad",dial_code:"+235"},CL:{name:"Chile",dial_code:"+56"},CN:{name:"China",dial_code:"+86"},CX:{name:"Christmas Island",dial_code:"+61"},CC:{name:"Cocos (Keeling) Islands",dial_code:"+61"},CO:{name:"Colombia",dial_code:"+57"},KM:{name:"Comoros",dial_code:"+269"},CG:{name:"Congo",dial_code:"+242"},CD:{name:"Congo, The Democratic Republic of the Congo",dial_code:"+243"},CK:{name:"Cook Islands",dial_code:"+682"},CR:{name:"Costa Rica",dial_code:"+506"},CI:{name:"Cote d'Ivoire",dial_code:"+225"},HR:{name:"Croatia",dial_code:"+385"},CU:{name:"Cuba",dial_code:"+53"},CY:{name:"Cyprus",dial_code:"+357"},CZ:{name:"Czech Republic",dial_code:"+420"},DK:{name:"Denmark",dial_code:"+45"},DJ:{name:"Djibouti",dial_code:"+253"},DM:{name:"Dominica",dial_code:"+1767"},DO:{name:"Dominican Republic",dial_code:"+1849"},EC:{name:"Ecuador",dial_code:"+593"},EG:{name:"Egypt",dial_code:"+20"},SV:{name:"El Salvador",dial_code:"+503"},GQ:{name:"Equatorial Guinea",dial_code:"+240"},ER:{name:"Eritrea",dial_code:"+291"},EE:{name:"Estonia",dial_code:"+372"},ET:{name:"Ethiopia",dial_code:"+251"},FK:{name:"Falkland Islands (Malvinas)",dial_code:"+500"},FO:{name:"Faroe Islands",dial_code:"+298"},FJ:{name:"Fiji",dial_code:"+679"},FI:{name:"Finland",dial_code:"+358"},FR:{name:"France",dial_code:"+33"},GF:{name:"French Guiana",dial_code:"+594"},PF:{name:"French Polynesia",dial_code:"+689"},GA:{name:"Gabon",dial_code:"+241"},GM:{name:"Gambia",dial_code:"+220"},GE:{name:"Georgia",dial_code:"+995"},DE:{name:"Germany",dial_code:"+49"},GH:{name:"Ghana",dial_code:"+233"},GI:{name:"Gibraltar",dial_code:"+350"},GR:{name:"Greece",dial_code:"+30"},GL:{name:"Greenland",dial_code:"+299"},GD:{name:"Grenada",dial_code:"+1473"},GP:{name:"Guadeloupe",dial_code:"+590"},GU:{name:"Guam",dial_code:"+1671"},GT:{name:"Guatemala",dial_code:"+502"},GG:{name:"Guernsey",dial_code:"+44"},GN:{name:"Guinea",dial_code:"+224"},GW:{name:"Guinea-Bissau",dial_code:"+245"},GY:{name:"Guyana",dial_code:"+595"},HT:{name:"Haiti",dial_code:"+509"},VA:{name:"Holy See (Vatican City State)",dial_code:"+379"},HN:{name:"Honduras",dial_code:"+504"},HK:{name:"Hong Kong",dial_code:"+852"},HU:{name:"Hungary",dial_code:"+36"},IS:{name:"Iceland",dial_code:"+354"},IN:{name:"India",dial_code:"+91"},ID:{name:"Indonesia",dial_code:"+62"},IR:{name:"Iran, Islamic Republic of Persian Gulf",dial_code:"+98"},IQ:{name:"Iraq",dial_code:"+964"},IE:{name:"Ireland",dial_code:"+353"},IM:{name:"Isle of Man",dial_code:"+44"},IL:{name:"Israel",dial_code:"+972"},IT:{name:"Italy",dial_code:"+39"},JM:{name:"Jamaica",dial_code:"+1876"},JP:{name:"Japan",dial_code:"+81"},JE:{name:"Jersey",dial_code:"+44"},JO:{name:"Jordan",dial_code:"+962"},KZ:{name:"Kazakhstan",dial_code:"+77"},KE:{name:"Kenya",dial_code:"+254"},KI:{name:"Kiribati",dial_code:"+686"},KP:{name:"Korea, Democratic People's Republic of Korea",dial_code:"+850"},KR:{name:"Korea, Republic of South Korea",dial_code:"+82"},KW:{name:"Kuwait",dial_code:"+965"},KG:{name:"Kyrgyzstan",dial_code:"+996"},LA:{name:"Laos",dial_code:"+856"},LV:{name:"Latvia",dial_code:"+371"},LB:{name:"Lebanon",dial_code:"+961"},LS:{name:"Lesotho",dial_code:"+266"},LR:{name:"Liberia",dial_code:"+231"},LY:{name:"Libyan Arab Jamahiriya",dial_code:"+218"},LI:{name:"Liechtenstein",dial_code:"+423"},LT:{name:"Lithuania",dial_code:"+370"},LU:{name:"Luxembourg",dial_code:"+352"},MO:{name:"Macao",dial_code:"+853"},MK:{name:"Macedonia",dial_code:"+389"},MG:{name:"Madagascar",dial_code:"+261"},MW:{name:"Malawi",dial_code:"+265"},MY:{name:"Malaysia",dial_code:"+60"},MV:{name:"Maldives",dial_code:"+960"},ML:{name:"Mali",dial_code:"+223"},MT:{name:"Malta",dial_code:"+356"},MH:{name:"Marshall Islands",dial_code:"+692"},MQ:{name:"Martinique",dial_code:"+596"},MR:{name:"Mauritania",dial_code:"+222"},MU:{name:"Mauritius",dial_code:"+230"},YT:{name:"Mayotte",dial_code:"+262"},MX:{name:"Mexico",dial_code:"+52"},FM:{name:"Micronesia, Federated States of Micronesia",dial_code:"+691"},MD:{name:"Moldova",dial_code:"+373"},MC:{name:"Monaco",dial_code:"+377"},MN:{name:"Mongolia",dial_code:"+976"},ME:{name:"Montenegro",dial_code:"+382"},MS:{name:"Montserrat",dial_code:"+1664"},MA:{name:"Morocco",dial_code:"+212"},MZ:{name:"Mozambique",dial_code:"+258"},MM:{name:"Myanmar",dial_code:"+95"},NA:{name:"Namibia",dial_code:"+264"},NR:{name:"Nauru",dial_code:"+674"},NP:{name:"Nepal",dial_code:"+977"},NL:{name:"Netherlands",dial_code:"+31"},AN:{name:"Netherlands Antilles",dial_code:"+599"},NC:{name:"New Caledonia",dial_code:"+687"},NZ:{name:"New Zealand",dial_code:"+64"},NI:{name:"Nicaragua",dial_code:"+505"},NE:{name:"Niger",dial_code:"+227"},NG:{name:"Nigeria",dial_code:"+234"},NU:{name:"Niue",dial_code:"+683"},NF:{name:"Norfolk Island",dial_code:"+672"},MP:{name:"Northern Mariana Islands",dial_code:"+1670"},NO:{name:"Norway",dial_code:"+47"},OM:{name:"Oman",dial_code:"+968"},PK:{name:"Pakistan",dial_code:"+92"},PW:{name:"Palau",dial_code:"+680"},PS:{name:"Palestinian Territory, Occupied",dial_code:"+970"},PA:{name:"Panama",dial_code:"+507"},PG:{name:"Papua New Guinea",dial_code:"+675"},PY:{name:"Paraguay",dial_code:"+595"},PE:{name:"Peru",dial_code:"+51"},PH:{name:"Philippines",dial_code:"+63"},PN:{name:"Pitcairn",dial_code:"+872"},PL:{name:"Poland",dial_code:"+48"},PT:{name:"Portugal",dial_code:"+351"},PR:{name:"Puerto Rico",dial_code:"+1939"},QA:{name:"Qatar",dial_code:"+974"},RO:{name:"Romania",dial_code:"+40"},RU:{name:"Russia",dial_code:"+7"},RW:{name:"Rwanda",dial_code:"+250"},RE:{name:"Reunion",dial_code:"+262"},BL:{name:"Saint Barthelemy",dial_code:"+590"},SH:{name:"Saint Helena, Ascension and Tristan Da Cunha",dial_code:"+290"},KN:{name:"Saint Kitts and Nevis",dial_code:"+1869"},LC:{name:"Saint Lucia",dial_code:"+1758"},MF:{name:"Saint Martin",dial_code:"+590"},PM:{name:"Saint Pierre and Miquelon",dial_code:"+508"},VC:{name:"Saint Vincent and the Grenadines",dial_code:"+1784"},WS:{name:"Samoa",dial_code:"+685"},SM:{name:"San Marino",dial_code:"+378"},ST:{name:"Sao Tome and Principe",dial_code:"+239"},SA:{name:"Saudi Arabia",dial_code:"+966"},SN:{name:"Senegal",dial_code:"+221"},RS:{name:"Serbia",dial_code:"+381"},SC:{name:"Seychelles",dial_code:"+248"},SL:{name:"Sierra Leone",dial_code:"+232"},SG:{name:"Singapore",dial_code:"+65"},SK:{name:"Slovakia",dial_code:"+421"},SI:{name:"Slovenia",dial_code:"+386"},SB:{name:"Solomon Islands",dial_code:"+677"},SO:{name:"Somalia",dial_code:"+252"},ZA:{name:"South Africa",dial_code:"+27"},SS:{name:"South Sudan",dial_code:"+211"},GS:{name:"South Georgia and the South Sandwich Islands",dial_code:"+500"},ES:{name:"Spain",dial_code:"+34"},LK:{name:"Sri Lanka",dial_code:"+94"},SD:{name:"Sudan",dial_code:"+249"},SR:{name:"Suriname",dial_code:"+597"},SJ:{name:"Svalbard and Jan Mayen",dial_code:"+47"},SZ:{name:"Swaziland",dial_code:"+268"},SE:{name:"Sweden",dial_code:"+46"},CH:{name:"Switzerland",dial_code:"+41"},SY:{name:"Syrian Arab Republic",dial_code:"+963"},TW:{name:"Taiwan",dial_code:"+886"},TJ:{name:"Tajikistan",dial_code:"+992"},TZ:{name:"Tanzania, United Republic of Tanzania",dial_code:"+255"},TH:{name:"Thailand",dial_code:"+66"},TL:{name:"Timor-Leste",dial_code:"+670"},TG:{name:"Togo",dial_code:"+228"},TK:{name:"Tokelau",dial_code:"+690"},TO:{name:"Tonga",dial_code:"+676"},TT:{name:"Trinidad and Tobago",dial_code:"+1868"},TN:{name:"Tunisia",dial_code:"+216"},TR:{name:"Turkey",dial_code:"+90"},TM:{name:"Turkmenistan",dial_code:"+993"},TC:{name:"Turks and Caicos Islands",dial_code:"+1649"},TV:{name:"Tuvalu",dial_code:"+688"},UG:{name:"Uganda",dial_code:"+256"},UA:{name:"Ukraine",dial_code:"+380"},AE:{name:"United Arab Emirates",dial_code:"+971"},GB:{name:"United Kingdom",dial_code:"+44"},US:{name:"United States",dial_code:"+1"},UY:{name:"Uruguay",dial_code:"+598"},UZ:{name:"Uzbekistan",dial_code:"+998"},VU:{name:"Vanuatu",dial_code:"+678"},VE:{name:"Venezuela, Bolivarian Republic of Venezuela",dial_code:"+58"},VN:{name:"Vietnam",dial_code:"+84"},VG:{name:"Virgin Islands, British",dial_code:"+1284"},VI:{name:"Virgin Islands, U.S.",dial_code:"+1340"},WF:{name:"Wallis and Futuna",dial_code:"+681"},YE:{name:"Yemen",dial_code:"+967"},ZM:{name:"Zambia",dial_code:"+260"},ZW:{name:"Zimbabwe",dial_code:"+263"}}).map(([e,{name:t,dial_code:a}])=>{return{label:`${n=e,n.toUpperCase().replace(/./g,e=>String.fromCodePoint(127397+e.charCodeAt(0)))} ${t} ${a}`,value:a};var n}),Kn=(e,t)=>{(0,y.useEffect)(()=>{const a=a=>{e.current&&!e.current.contains(a.target)&&t()};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[e,t])},zn={text:Y,number:Y,email:Y,time:Y,date:Y,password:Y,"email-input":An,select:z,dropdown:z,"multi-select":z,creatable:z,"creatable-multi":z,title:Ae,heading:Ae,richtext:Ae,checkbox:sa,checkboxes:sa,attachment:Et,image:Et,textarea:ca,preposttext:rn,button:M,nested:nn,section:un,"multi-checkbox-table":Qa,"expandable-panel":kt,"choice-toggle":pe,"block-builder":$a,"system-info":yn,tab:_a,log:Ga,"calendar-input":oe,"event-calendar":Ue,recaptcha:cn,address:Q,divider:un,"color-setting":be,"sequential-task-executor":In,"endpoint-editor":Pe,"shortcode-table":gn,itemlist:ct,notice:tt,google_map:Oa,mapbox:Oa,"random-input-key-generator":Cn,"copy-to-clipboard":Ka,"free-form":qn},Hn=(0,f.create)(e=>({modules:[],insertModule:t=>e(e=>({modules:[...e.modules,t]})),removeModule:t=>e(e=>({modules:e.modules.filter(e=>e!==t)}))}));async function Gn(e,t,a){if("true"===localStorage.getItem(`force_${e}_context_reload`)){try{const e=await j.default.get(b(Un,a),{headers:{"X-WP-Nonce":Un.nonce}});Array.isArray(e.data)&&Hn.setState({modules:e.data})}catch(e){console.error("Failed to fetch active modules:",e)}"pro"===t&&localStorage.setItem(`force_${e}_context_reload`,"false")}}var Vn=a(790),Yn=({setting:e,updateSetting:t,settings:a,Popup:n,storeTabSetting:l})=>{const{modal:s,submitUrl:i,id:r}=a,o=(0,p.useRef)(!1),c=(0,p.useRef)(0),d=(0,p.useRef)(null),[m,u]=(0,p.useState)(!1),[h,g]=(0,p.useState)({moduleName:"",settings:"",plugin:""}),{modules:f}=Hn(),[j,y]=(0,p.useState)({});(0,p.useEffect)(()=>{if(o.current){o.current=!1,c.current=10,d.current&&clearInterval(d.current);const t=setInterval(()=>{c.current-=1,c.current<0&&(x(Un,b(Un,i),{setting:e,settingName:r}).then(e=>{const t=e;t.message&&Je.add({title:"Great!",message:t.message,type:t.type||"success",position:"float"}),t.redirect_link&&window.open(t.redirect_link,"_self")}),clearInterval(t),d.current=null)},50);d.current=t}},[e,i,r]),(0,p.useEffect)(()=>{if(!1===m){const e=setTimeout(()=>{g({moduleName:"",settings:"",plugin:""})},100);return()=>clearTimeout(e)}},[m]);const v=e=>e?.find(({plugin:e})=>!Un?.active_plugins?.includes(e)),N=(t,a=null)=>{const n=e[t];return Array.isArray(a)?a.includes(n):Array.isArray(n)?null===a&&n.length>0||n.includes(a):!(null!==a||!Boolean(n))||n===a},C=e=>!(!0===e.set&&!N(e.key)||!1===e.set&&N(e.key)||void 0!==e.value&&!N(e.key,e.value)),k=(a,n)=>{o.current=!0;const l=s.find(e=>e.key===a);if(!l)return;if("nested"===l.type)return void t(a,n);if(Array.isArray(n)&&n.length>0&&"object"==typeof n[0]){if(Array.isArray(e[a])&&e[a].length>0)return void t(a,[]);const l=n.filter(e=>!(e.proSetting&&!Un?.khali_dabba)).map(e=>e.value);return void t(a,l)}const i=A(l,n);y(e=>({...e,[a]:i})),i||t(a,n)},w=["select","text"],_=e=>w.includes(e.beforeElement?.type)||w.includes(e.afterElement?.type),S=(a,n,s,i,r)=>{if(a.component)return a.component;const c=zn[a.type];if(!c)return null;const d=c.render,m=_(n)?s?.[a.key]??"":s??"";return(0,Vn.jsx)(d,{field:a,value:m,onChange:e=>{_(n)?i(n.key,{...s??{},[a.key]:e}):i(a.key,e)},canAccess:r,modules:f,settings:e,onOptionsChange:e=>{o.current=!0,t(`${a.key}_options`,e)},onBlocked:(e,t)=>{"pro"===e&&(g({moduleName:"",settings:"",plugin:""}),u(!0)),"module"===e&&t&&(g({moduleName:t,settings:"",plugin:""}),u(!0)),"plugin"===e&&t&&(g({moduleName:"",settings:"",plugin:t}),u(!0))},storeTabSetting:l})},A=(e,t)=>{const a=zn[e.type];return a?.validate?_(e)?a.validate(e,t??{}):a.validate(e,t):null};return(0,Vn.jsxs)(Vn.Fragment,{children:[m&&(0,Vn.jsx)(P,{position:"lightbox",open:m,onClose:()=>{u(!1)},width:31.25,height:"auto",children:(0,Vn.jsx)(n,{moduleName:String(h.moduleName),settings:h.settings,plugin:h.plugin})}),(0,Vn.jsx)(st,{children:s.map(t=>{const a=_(t)?e[t.key]??{}:e[t.key]??"";if(Array.isArray(t.dependent)){for(const e of t.dependent)if(!C(e))return null}else if(t.dependent&&!C(t.dependent))return null;const n=(l=t.proSetting??!1,s=String(t.moduleEnabled??""),i=String(t.dependentSetting??""),r=t.dependentPlugin,!(l&&!Un?.khali_dabba||s&&!f.includes(s)||i&&Array.isArray(e[i])&&0===e[i].length||v(r)));var l,s,i,r;const o=(0,Vn.jsxs)(Vn.Fragment,{children:[t.beforeElement&&S(t.beforeElement,t,a,k,n),S(t,t,a,k,n),t.afterElement&&S(t.afterElement,t,a,k,n)]}),c=t.proSetting&&!Un?.khali_dabba||t.moduleEnabled&&!f.includes(t.moduleEnabled)||t.dependentSetting&&(()=>{const a=e[t.dependentSetting];return Array.isArray(a)&&0===a.length})()||!!v(t.dependentPlugin);return"section"===t.type?(0,Vn.jsx)(Vn.Fragment,{children:o}):(0,Vn.jsxs)("div",{className:`form-group ${!1===t.row?"":"row"} ${t.classes?t.classes:""} ${t.proSetting?"pro-setting":""} ${t.moduleEnabled&&!f.includes(t.moduleEnabled)?"module-enabled":""}`,"data-col":t.cols,onClick:a=>((t,a)=>{if(a.proSetting&&!Un?.khali_dabba)return u(!0),void t.stopPropagation();if(a.moduleEnabled&&!f.includes(a.moduleEnabled))return g({moduleName:a.moduleEnabled,settings:"",plugin:""}),u(!0),void t.stopPropagation();if(a.dependentSetting&&Array.isArray(e[a.dependentSetting])&&0===e[a.dependentSetting].length)return g({moduleName:"",settings:a.dependentSetting,plugin:""}),u(!0),void t.stopPropagation();const n=v(a.dependentPlugin);return n?(g({moduleName:"",settings:"",plugin:n}),u(!0),void t.stopPropagation()):void 0})(a,t),children:[t.label&&(0,Vn.jsxs)("label",{className:"settings-form-label",htmlFor:t.key,children:[(0,Vn.jsxs)("div",{className:"title",children:[t.icon&&(0,Vn.jsx)("i",{className:`adminfont-${t.icon} ${t.icon}`}),t.label]}),t.settingDescription&&(0,Vn.jsx)("div",{className:"settings-metabox-description",children:t.settingDescription})]},t.key),(0,Vn.jsxs)("div",{className:"settings-input-content",children:[c&&p.default.isValidElement(o)?p.default.cloneElement(o,{onClick:e=>{e.stopPropagation()}}):o,j[t.key]&&(0,Vn.jsx)(Qe,{uniqueKey:`error-${t.key}`,type:"error",displayPosition:"inline",message:j[t.key]}),t.desc&&(0,Vn.jsx)("p",{className:"settings-metabox-description",dangerouslySetInnerHTML:{__html:t.desc}})]}),(t.proSetting&&Un?.khali_dabba||!t.proSetting)&&t.moduleEnabled&&!f.includes(t.moduleEnabled)&&(0,Vn.jsxs)("span",{className:"admin-pro-tag module",children:[(0,Vn.jsx)("i",{className:`adminfont-${t.moduleEnabled}`}),String(t.moduleEnabled).split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),(0,Vn.jsx)("i",{className:"adminfont-lock"})]}),t.proSetting&&!Un.khali_dabba&&(0,Vn.jsxs)("span",{className:"admin-pro-tag",children:[(0,Vn.jsx)("i",{className:"adminfont-pro-tag"}),"Pro"]})]},t.key)})})]})},Zn=a(1609),Jn=m(a(8145)),Xn=a(1609),Qn=a(790),el=e=>{const{captchaValid:t,submitted:a,field:n}=e,[l,s]=(0,Xn.useState)(""),[i,r]=(0,Xn.useState)(""),[o,c]=(0,Xn.useState)(!0);return(0,Xn.useEffect)(()=>{s((()=>{const e=9e5,t=Math.floor(4294967296/e)*e;let a=0;do{a=window.crypto.getRandomValues(new Uint32Array(1))[0]}while(a>=t);return(1e5+a%e).toString()})())},[]),(0,Qn.jsxs)(Qn.Fragment,{children:[(0,Qn.jsx)("input",{type:"text",id:"securityCode",className:"basic-input",name:"securityCode",onChange:e=>{e.preventDefault();const a=e.target.value;r(a);const n=a===l;c(n),t(n)},value:i,placeholder:n.placeholder}),(0,Qn.jsxs)("p",{children:["Your security code is:"," ",l]}),!o&&(0,Qn.jsx)("p",{style:{color:"red"},children:"Invalid security code, please try again."}),a&&!i&&(0,Qn.jsx)("p",{style:{color:"red"},children:"Recaptcha is required."})]})},tl=a(790),al={name:"",email:""},nl={name:"",email:""},ll={name:"",email:""},sl=({label:e,fieldName:t,error:a,children:n})=>(0,tl.jsxs)("p",{className:"woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide",children:[e&&(0,tl.jsx)("label",{htmlFor:t,children:e}),n,a&&(0,tl.jsx)("span",{className:"error-text",children:a})]}),il=({options:e,onChange:t,fieldName:a="checkbox"})=>{const[n,l]=(0,Zn.useState)(e.filter(({isDefault:e})=>e));return(0,Zn.useEffect)(()=>{t(n.map(e=>e.value))},[n,t]),(0,tl.jsx)(tl.Fragment,{children:e.map(e=>{const t=`${a}_${e.value}`;return(0,tl.jsxs)("label",{htmlFor:t,className:"woocommerce-form__label woocommerce-form__label-for-checkbox",children:[(0,tl.jsx)("input",{type:"checkbox",className:"woocommerce-form__input woocommerce-form__input-checkbox",id:t,checked:!!n.find(t=>t.value===e.value),onChange:t=>((e,t)=>{const a=n.filter(t=>t.value!==e.value);t&&a.push(e),l(a)})(e,t.target.checked)}),(0,tl.jsx)("span",{children:e.label})]},t)})})},rl=({options:e,onChange:t,fieldName:a="radio"})=>{const[n,l]=(0,Zn.useState)(e.find(({isDefault:e})=>e)?.value);return(0,Zn.useEffect)(()=>{t(n)},[n,t]),(0,tl.jsx)("div",{className:"multiselect-container items-wrapper",children:e.map((e,t)=>{const s=`${a}_${e.value}`;return(0,tl.jsxs)("label",{className:"woocommerce-form__label woocommerce-form__label-for-radio","data-index":t,htmlFor:s,children:[(0,tl.jsx)("input",{type:"radio",className:"woocommerce-form__input woocommerce-form__input-radio",id:s,value:e.value,checked:n===e.value,onChange:e=>l(e.target.value)}),(0,tl.jsx)("span",{children:e.label})]},s)})})},ol=({options:e=[],onChange:t,isMulti:a=!1})=>{const[n,l]=(0,Zn.useState)(a?e.filter(({isDefault:e})=>e):e.find(({isDefault:e})=>e)||null);return(0,tl.jsx)(Jn.default,{isMulti:a,value:n,onChange:e=>{l(e),t(a?Array.isArray(e)?e.map(e=>e.value):[]:e?e.value:null)},options:e})},cl=({formFields:e,onClose:t,response:a,onSubmit:n,countryList:l,stateList:s,formMessages:i={}})=>{const[r,o]=(0,Zn.useState)({}),[c,d]=(0,Zn.useState)({}),[m,u]=(0,Zn.useState)(""),[p,h]=(0,Zn.useState)(null),[g,x]=(0,Zn.useState)(!1),[b,f]=(0,Zn.useState)(!1),[j,y]=(0,Zn.useState)(!1),v=e.formfieldlist||[],N=v.find(e=>"button"===e.type),C=v.filter(e=>"button"!==e.type).sort((e,t)=>"richtext"===e.type?1:"richtext"===t.type?-1:0),k=v.find(e=>"recaptcha"===e.type),w=k?.sitekey||null,_=(new Date).getFullYear()+"-01-01";(0,Zn.useEffect)(()=>{a&&o(a)},[a]),(0,Zn.useEffect)(()=>{if(!w)return;const e=()=>{window.grecaptcha?.ready(()=>{window.grecaptcha?.execute(w,{action:"form_submission"}).then(h).catch(()=>x(!0))})};if(window.grecaptcha)e();else{const t=document.createElement("script");t.src=`https://www.google.com/recaptcha/api.js?render=${w}`,t.async=!0,t.onload=e,t.onerror=()=>x(!0),document.body.appendChild(t)}},[w]);const S=(e,t)=>{o(a=>({...a,[e]:t})),c[e]&&d(t=>{const a={...t};return delete a[e],a})},A=e=>{f(e)},T=(e,t)=>{if(e.disabled)return null;const a=e.name??"",m=c[a],h=`${e.id}-${t}`;switch(e.type){case"title":return(0,tl.jsx)("h2",{children:e.text},h);case"section":return(0,tl.jsx)("p",{className:"woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide",children:e.label},h);case"divider":return(0,tl.jsx)("p",{className:"section-divider-container"},h);case"text":if("store-phone"===e.name||"Store Phone"===e.label||"Phone"===e.label){const t=r[a]||{};return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsxs)("div",{style:{display:"flex",gap:"10px"},children:[(0,tl.jsx)("div",{style:{minWidth:"140px"},children:(0,tl.jsxs)("select",{value:t.country_code||"",onChange:e=>S(a,{...t,country_code:e.target.value}),children:[(0,tl.jsx)("option",{value:"",children:"Select country code"}),Wn.map(e=>(0,tl.jsx)("option",{value:e.value,children:e.label},e.value))]})}),(0,tl.jsx)("input",{type:"text",className:"input-text",value:t.phone||"",placeholder:e.placeholder,onChange:e=>S(a,{...t,phone:e.target.value})})]})},h)}return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("input",{type:"text",name:e.id,className:"input-text",value:r[a]||"",placeholder:e.placeholder,onChange:e=>S(a,e.target.value),required:e.required,maxLength:e.charlimit})},h);case"email":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("input",{type:"email",name:a,className:"input-text",value:r[a]||(x="email",al?.[x]??nl?.[x]??ll?.[x])||"",placeholder:e.placeholder,onChange:e=>S(a,e.target.value),required:e.required,maxLength:e.charlimit})},h);case"textarea":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("textarea",{name:e.id,className:"input-text",value:r[a]||"",placeholder:e.placeholder,onChange:e=>S(a,e.target.value),required:e.required,maxLength:e.charlimit,rows:e.row,cols:e.col})},h);case"checkboxes":const f=`checkbox_${e.id}_${e.name||t}`;return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)(il,{options:e.options||[],onChange:e=>S(a,e),fieldName:f})},h);case"multi-select":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("div",{className:"woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide",children:(0,tl.jsx)(ol,{options:e.options??[],onChange:e=>S(a,e),isMulti:!0})})},h);case"dropdown":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("div",{className:"woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide",children:(0,tl.jsx)(ol,{options:e.options??[],onChange:e=>S(a,e)})})},h);case"radio":const N=`radio_${e.id}_${e.name||t}`;return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)(rl,{options:e.options??[],onChange:e=>S(a,e),fieldName:N})},h);case"recaptcha":return(0,tl.jsx)("p",{className:"woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide",children:(0,tl.jsx)("div",{className:"recaptcha-wrapper",children:(0,tl.jsx)("input",{type:"hidden",name:"g-recaptcha-response",value:p,className:"input-text"})})},h);case"attachment":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("input",{readOnly:!0,id:"dropzone-file",type:"file",className:"hidden",onChange:e=>((e,t)=>{const a=t.target.files?.[0];a&&(u(a.name),o(t=>({...t,[e]:a})),c[e]&&d(t=>{const a={...t};return delete a[e],a}))})(a,e)})},h);case"datepicker":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("div",{className:"date-picker-wrapper",children:(0,tl.jsx)("input",{type:"date",className:"input-text",value:r[a]||_,onChange:e=>S(a,e.target.value)})})},h);case"timepicker":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)("input",{type:"time",className:"input-text",value:r[a]||"",onChange:e=>S(a,e.target.value)})},h);case"address":{const t=e.fields?.length?e.fields:[{key:"address",label:"Address Line 1",type:"text",required:!0},{key:"address_2",label:"Address Line 2",type:"text"},{key:"city",label:"City",type:"text",required:!0},{key:"country",label:"Country",type:"select"},{key:"state",label:"State",type:"select"},{key:"zip",label:"Postal Code",type:"text",required:!0}];return(0,tl.jsxs)("fieldset",{children:[(0,tl.jsx)("legend",{children:e.label}),t.map((e,t)=>{const a=e.key,n=r[a]??"",i=`${h}-${e.key}-${t}`;if("text"===e.type)return(0,tl.jsxs)("p",{className:"woocommerce-form-row form-row",children:[(0,tl.jsx)("label",{children:e.label}),(0,tl.jsx)("input",{type:"text",className:"input-text",value:n,placeholder:e.placeholder,required:e.required,onChange:e=>S(a,e.target.value)})]},i);if("select"===e.type){let t=[];if("country"===e.key)t=l||[];else if("state"===e.key){const e=r.country,a=s?.[e];Array.isArray(a)?t=a:a&&"object"==typeof a&&(t=Object.entries(a).map(([e,t])=>({value:e,label:String(t)})))}return(0,tl.jsxs)("p",{className:"woocommerce-form-row form-row",children:[(0,tl.jsx)("label",{children:e.label}),(0,tl.jsx)(ol,{options:t,onChange:e=>S(a,e)})]},i)}return null})]},h)}case"button":return(0,tl.jsx)("p",{className:"woocommerce-form-row form-row",children:(0,tl.jsx)("button",{className:"woocommerce-button button wp-element-button",style:e.style||{},onClick:e=>{const t=v.find(e=>"recaptcha"===e.type);(!1!==t?.disabled||!g&&p)&&(e=>{e.preventDefault();const t={},a=v.find(e=>"custom-recaptcha"===e.type);if(y(!0),a&&!b)return void d(e=>({...e,[a.label||a.id]:"Invalid security code."}));if(v.forEach(e=>{if(e.disabled||!e.name)return;const a=r[e.name];if("name"!==e.name)if("email"!==e.type){if(e.required)switch(e.type){case"text":case"email":case"textarea":case"datepicker":case"timepicker":a&&("string"!=typeof a||a.trim())||(t[e.name]=i.fieldRequired?.replace("%s",e.label||""));break;case"checkboxes":case"multi-select":Array.isArray(a)&&0!==a.length||(t[e.name]=i.fieldRequired?.replace("%s",e.label||""));break;case"dropdown":case"radio":case"attachment":a||(t[e.name]=i.fieldRequired?.replace("%s",e.label||""));break;case"richtext":a||(t[e.name]=i.termsRequired)}}else/^\S+@\S+\.([a-zA-Z]{2,})$/.test(a)||(t[e.name]=i.invalidEmail);else a&&("string"!=typeof a||a.trim())||(t[e.name]=i.fieldRequired?.replace("%s",e.label||"Store Name"))}),Object.keys(t).length)return void d(t);d({});const l={};for(const e in r){const t=r[e];null!=t&&(l[e]=t)}n(l)})(e)},children:e.label||e.placeholder||"Submit"})},h);case"richtext":return(0,tl.jsxs)("label",{className:"woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide terms-checkbox",children:[(0,tl.jsx)("input",{type:"checkbox",checked:Boolean(r[a]),className:"woocommerce-form__input woocommerce-form__input-checkbox",onChange:e=>S(a,e.target.checked)}),(0,tl.jsx)("span",{className:"richtext-content",dangerouslySetInnerHTML:{__html:e.html||""}}),m&&(0,tl.jsx)("span",{className:"error-text",children:m})]},h);case"custom-recaptcha":return(0,tl.jsx)(sl,{label:e.label,fieldName:a,error:m,children:(0,tl.jsx)(el,{captchaValid:A,submitted:j,field:e})},h);default:return null}var x};return(0,tl.jsxs)("form",{className:"woocommerce-form woocommerce-form-login login",children:[t&&(0,tl.jsx)("svg",{className:"close-icon",onClick:t,width:"1rem",height:"1rem",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,tl.jsx)("path",{d:"M20.7457 3.32851C20.3552 2.93798 19.722 2.93798 19.3315 3.32851L12.0371 10.6229L4.74275 3.32851C4.35223 2.93798 3.71906 2.93798 3.32854 3.32851C2.93801 3.71903 2.93801 4.3522 3.32854 4.74272L10.6229 12.0371L3.32856 19.3314C2.93803 19.722 2.93803 20.3551 3.32856 20.7457C3.71908 21.1362 4.35225 21.1362 4.74277 20.7457L12.0371 13.4513L19.3315 20.7457C19.722 21.1362 20.3552 21.1362 20.7457 20.7457C21.1362 20.3551 21.1362 19.722 20.7457 19.3315L13.4513 12.0371L20.7457 4.74272C21.1362 4.3522 21.1362 3.71903 20.7457 3.32851Z",fill:"#e71313"})}),C.map((e,t)=>T(e,t)),N&&T(N,C.length)]})},dl=a(1609),ml=a(1609),ul=a(790),pl=({search:e,results:t,onQueryUpdate:a,onResultClick:n,width:l,variant:s="default"})=>{if(!e)return null;const{placeholder:i="",options:r=[]}=e,o=r.length>0,[c,d]=(0,ml.useState)(""),[m,u]=(0,ml.useState)(o&&r.length>0?r[0].value:""),[p,h]=(0,ml.useState)(!1),[g,x]=(0,ml.useState)(!1),b=(0,ml.useRef)(null);(0,ml.useEffect)(()=>{c||h(!1)},[c]),Kn(b,()=>{"mini-search"===s&&g&&!c&&x(!1),h(!1)});const f=(e,t=m)=>{a({searchValue:e,...o&&{searchAction:t}})},j=p&&t&&t.length>0;return(0,ul.jsxs)("div",{className:"search-field",ref:b,children:[o&&(0,ul.jsx)("div",{className:"search-action",children:(0,ul.jsx)(K,{options:r,value:m,size:`${l}rem`,onChange:e=>{u(e),f(c,e)},background:"var(--theme-background-color)",color:"var(--theme-color)"})}),(0,ul.jsxs)("div",{className:"search-section",children:[(0,ul.jsx)(V,{type:"text",placeholder:i,value:c,onChange:e=>{d(e),h(!0),f(e)}}),(0,ul.jsx)("i",{className:"adminfont-search",onClick:()=>{"mini-search"===s&&(x(!g),g||setTimeout(()=>{const e=b.current?.querySelector("input");e?.focus()},100))}})]}),j&&(0,ul.jsx)(ot,{className:"search-results",items:t.map(e=>({title:e.name,desc:e.desc,icon:e.icon,action:()=>{n(e),h(!1),d(""),u(o&&r.length>0?r[0].value:""),x(!1),f("",o&&r.length>0?r[0].value:"")}}))})]})},hl=a(790),gl=e=>!("type"in e),xl=({modulesArray:e={category:!1,modules:[]},apiLink:t,proPopupContent:a,pluginName:n,variant:l="default",filter:s=!0})=>{const[i,r]=(0,dl.useState)(!1),[o,c]=(0,dl.useState)("All"),[d,m]=(0,dl.useState)("All"),[u,p]=(0,dl.useState)(""),[h,g]=(0,dl.useState)(null),{modules:f,insertModule:j,removeModule:y}=Hn(),v=(0,dl.useMemo)(()=>e.modules.filter(gl),[e.modules]),N=v.length,C=v.filter(e=>f.includes(e.id)).length,k=N-C,w=e=>e?Array.isArray(e)?e:[e]:[],_=[{id:"All",label:"All"},...e.modules.filter(e=>!gl(e)).map(e=>({id:e.id,label:e.label}))],S=e=>{e.reqPluging?.length&&g({moduleName:e.name,plugins:e.reqPluging})},A=(0,dl.useMemo)(()=>e.modules.filter(e=>{if(!gl(e))return!1;if("mini-module"===l&&!e.miniModule)return!1;const t=w(e.category),a=f.includes(e.id),n="All"===o||t.includes(o),s="All"===d||"Active"===d&&a||"Inactive"===d&&!a,i=!u||e.name.toLowerCase().includes(u.toLowerCase());return n&&s&&i}),[v,o,d,u,f]);(0,dl.useEffect)(()=>{let e=null,t=!1;const a=t=>{e&&!e.contains(t.target)&&(e.classList.remove("highlight"),e=null)};return(()=>{if(t)return;const a=window.location.hash,n=new URLSearchParams(a.replace("#&","")).get("module");n&&setTimeout(()=>{const a=document.getElementById(n);a&&(a.scrollIntoView({behavior:"smooth",block:"start"}),a.classList.add("highlight"),e=a,t=!0)},500)})(),document.addEventListener("pointerdown",a),()=>document.removeEventListener("pointerdown",a)},[]);const T=[{label:`All (${N})`,value:"All"},{label:`Active (${C})`,value:"Active"},{label:`Inactive (${k})`,value:"Inactive"}];return(0,hl.jsxs)(hl.Fragment,{children:[h&&(0,hl.jsx)(P,{position:"lightbox",open:!0,onClose:()=>g(null),width:28,header:{icon:"verification11",title:"Required plugins missing",description:"This module needs the following plugins to work."},children:(0,hl.jsxs)("div",{className:"required-popup",children:[(0,hl.jsx)("div",{className:"title",children:"Plugins required"}),h.plugins.map((e,t)=>(0,hl.jsxs)("div",{className:"item",children:[(0,hl.jsx)("span",{className:"plugin-name",children:e.name}),(0,hl.jsxs)("a",{href:e.link,target:"_blank",rel:"noopener noreferrer",className:"admin-btn btn-purple",children:[(0,hl.jsx)("i",{className:"adminfont-import"})," Install"]})]},t))]})}),i&&(0,hl.jsx)(P,{position:"lightbox",open:i,onClose:()=>r(!1),width:31.25,height:"auto",children:a&&(0,hl.jsx)(a,{})}),(0,hl.jsxs)("div",{className:"module-container","data-variant":l,children:["default"===l&&!0===s&&(0,hl.jsxs)("div",{className:"filter-wrapper",children:[(0,hl.jsx)("div",{className:"category-filter",children:e.category&&_.length>1&&_.map(e=>(0,hl.jsx)("span",{className:"category-item "+(o===e.id?"active":""),onClick:()=>c(e.id),children:e.label},e.id))}),(0,hl.jsxs)("div",{className:"module-search",children:[(0,hl.jsx)(pl,{search:{placeholder:"Search ....."},onQueryUpdate:e=>{p(e.searchValue),"searchAction"in e&&m(e.searchAction)}}),(0,hl.jsx)(K,{type:"single-select",options:T,value:d,size:8,onChange:e=>m(e)})]})]}),(0,hl.jsx)("div",{className:"module-option-row",children:A.map((e,a)=>{if(!gl(e))return null;const s=e,i=f.includes(s.id),o=s.reqPluging||[],c=w(s.category),d=(0,hl.jsx)(la,{look:"toggle",type:"checkbox",value:i?[s.id]:[],onChange:e=>((e,a)=>{if(document.querySelector(".module-list-item.highlight")?.classList.remove("highlight"),!(e=>!e.proModule||(Un.khali_dabba??!1))(a))return void r(!0);if(a.reqPluging?.some(e=>!(Array.isArray(Un.active_plugins)&&Un.active_plugins.includes(e.slug))))return void S(a);const l=e.length>0?"activate":"deactivate";"activate"===l?j?.(a.id):y?.(a.id),localStorage.setItem(`force_${n}_context_reload`,"true"),x(Un,b(Un,t),{id:a.id,action:l}).then(()=>{Je.add({title:"Success!",message:`Module ${l}d`,type:"success",position:"float"}),a.reloadOnChange&&window.location.reload()}).catch(()=>{Je.add({title:"Error",message:`Failed to ${l} module`,type:"error",position:"float"})})})(e,s),options:[{key:s.id,value:s.id}]});return(0,hl.jsxs)("div",{id:s.id,"data-index":a,className:"module-list-item",children:[(0,hl.jsxs)("div",{className:"module-body",children:[(0,hl.jsxs)("div",{className:"module-header",children:[(0,hl.jsx)("div",{className:"icon",children:(0,hl.jsx)("i",{className:`font adminfont-${s.id}`})}),s.proModule&&!Un.khali_dabba&&(0,hl.jsx)("div",{className:"pro-tag",children:(0,hl.jsx)("i",{className:"adminfont-pro-tag"})}),"mini-module"===l&&(Un.khali_dabba||!s.proModule)&&d]}),(0,hl.jsxs)("div",{className:"module-details",children:[(0,hl.jsx)("div",{className:"meta-name",children:s.name}),"default"===l&&(0,hl.jsxs)(hl.Fragment,{children:[c.length>0&&(0,hl.jsx)("div",{className:"tag-wrapper",children:c.map((e,t)=>{return(0,hl.jsx)("span",{className:"admin-badge blue",children:(a=e,a.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "))},t);var a})}),(0,hl.jsx)("div",{className:"meta-description",dangerouslySetInnerHTML:{__html:s.desc||""}})]})]})]}),"default"===l&&(0,hl.jsxs)("div",{className:"footer-wrapper",children:[o.length>0&&(0,hl.jsxs)("div",{className:"requires",children:[(0,hl.jsx)("div",{className:"requires-title",children:"Requires:"}),(0,hl.jsx)("span",{className:"link-item",onClick:()=>S(s),children:o.map(e=>e.name).join(", ")})]}),(0,hl.jsxs)("div",{className:"module-footer",children:[(0,hl.jsxs)("div",{className:"buttons",children:[s.docLink&&(0,hl.jsx)("a",{href:s.docLink,target:"_blank",rel:"noreferrer",children:(0,hl.jsx)("i",{className:"adminfont-document"})}),s.videoLink&&(0,hl.jsx)("a",{href:s.videoLink,target:"_blank",rel:"noreferrer",children:(0,hl.jsx)("i",{className:"adminfont-button-appearance"})}),s.settingsLink&&(0,hl.jsx)("a",{href:s.settingsLink,children:(0,hl.jsx)("i",{className:"adminfont-setting"})})]}),(0,hl.jsx)("div",{"data-tour":`${s.id}-showcase-tour`,children:d})]})]})]},s.id)})})]})]})},bl=a(1609),fl=a(790),jl=({column:e=!1,general:t=!1,children:a,className:n})=>(0,fl.jsx)("div",{className:`container-wrapper ${e?"column":""} ${t?"general-wrapper":""} ${n||""}`,children:a}),yl=a(790),vl=({headerIcon:e,headerTitle:t,headerDescription:a,showPremiumLink:n,buttons:l=[],headerCustomContent:s})=>t||a?(0,yl.jsxs)("div",{className:"title-section",children:[(0,yl.jsxs)("div",{className:"title-wrapper",children:[(0,yl.jsxs)("div",{className:"title",children:[e&&(0,yl.jsx)("i",{className:`title-icon adminfont-${e}`}),t]}),a&&(0,yl.jsx)("div",{className:"description",children:a})]}),n&&(0,yl.jsxs)("a",{href:n,className:"tab pro-btn",children:[(0,yl.jsx)("i",{className:"adminfont-pro-tag"}),"Upgrade",(0,yl.jsx)("i",{className:"adminfont-arrow-right"})]}),l.length>0&&(0,yl.jsx)(E,{buttons:l.map(e=>({text:e.label,icon:e.icon,color:e.color,onClick:e.onClick}))}),s&&(0,yl.jsxs)("div",{className:"title-custom-section",children:[" ",s," "]})]}):null,Nl=({renderBreadcrumb:e,renderMenuItems:t,settingContent:a=[],customContent:n,action:l})=>(0,yl.jsxs)(yl.Fragment,{children:[e&&(0,yl.jsx)("div",{className:"breadcrumbs",children:e()}),t&&a.length>0&&(0,yl.jsxs)("div",{className:"tabs-wrapper",children:[(0,yl.jsx)("div",{className:"tabs-item",children:t(a)}),n&&(0,yl.jsx)("div",{className:"custom-content",children:n}),l&&(0,yl.jsx)("div",{className:"action-wrapper",children:l})]})]}),Cl=e=>"file"===e.type,kl=e=>"folder"===e.type,wl=({settingContent:e,className:t="",currentSetting:a,getForm:n,prepareUrl:l,HeaderSection:s,Link:i,settingName:r="",onNavigate:o,settingTitleSection:c,variant:d="default",menuIcon:m,action:u,headerTitle:p,headerDescription:h,headerIcon:g,showPremiumLink:x=!1,customContent:b})=>{const[f,j]=(0,bl.useState)(a),{flatContentMap:y,siblingLevelMap:v,hierarchyPathMap:N,folderToFirstFileMap:C}=(0,bl.useMemo)(()=>{const t={},a={},n={},l={},s=(e,i=[])=>{let r=null;return e.forEach(o=>{if(Cl(o)){const l=o.content.id;t[l]=o.content,a[l]=e,n[l]=[...i,o],r||(r=l)}else if(kl(o)){const e=s(o.content,[...i,o]);e&&(l[o.name||""]=e,r||(r=e))}}),r};return s(e),{flatContentMap:t,siblingLevelMap:a,hierarchyPathMap:n,folderToFirstFileMap:l}},[e]),k=N[f]||[],w=y[f],_=v[f]||e,S=k.length>1,A=e=>{if(!e||e===f)return;j(e);const t=l(e);o?o(t):window.history.pushState(null,"",t)},T=(e,t)=>{if((e=>"heading"===e.type)(e))return(0,yl.jsx)("div",{className:"tab-heading",children:e.content.headerTitle},t);if(Cl(e)){const t=e.content;return(0,yl.jsxs)(i,{to:l(t.id),className:"tab "+(f===t.id?"active-tab":""),onClick:e=>{0!==e.button||e.metaKey||e.ctrlKey||(e.preventDefault(),A(t.id))},children:[(0,yl.jsxs)("div",{className:"tab-name",children:[m&&t.headerIcon&&(0,yl.jsx)("i",{className:`adminfont-${t.headerIcon}`}),(0,yl.jsx)("span",{children:t.count}),t.headerTitle]}),"default"!==d&&"settings"!==d&&t.headerDescription&&(0,yl.jsx)("div",{className:"des",children:t.headerDescription})]},t.id)}if(kl(e)){const a=C[e.name||""],n=k.some(t=>t===e);return(0,yl.jsx)(i,{to:a?l(a):"#",className:"tab "+(n?"active-tab":""),onClick:e=>{!a||0!==e.button||e.metaKey||e.ctrlKey||(e.preventDefault(),A(a))},children:(0,yl.jsx)("div",{className:"tab-name",children:e.name})},t)}return null},E=e=>e.map(T);return(0,bl.useEffect)(()=>{if(a)j(a);else{const e=Object.keys(y);if(e.length>0){const t=e[0];j(t);const a=l(t);window.history.replaceState(null,"",a)}}},[a,y,l]),(0,yl.jsx)(yl.Fragment,{children:(0,yl.jsxs)("div",{className:`settings-wrapper ${t}`,"data-template":d,children:[c&&(0,yl.jsx)(yl.Fragment,{children:c}),(0,yl.jsx)(vl,{headerIcon:"default"===d?w?.headerIcon:g,headerTitle:"default"===d?w?.headerTitle:p,headerDescription:h,showPremiumLink:!Un.khali_dabba&&x?Un.shop_url:void 0}),(0,yl.jsx)(Nl,{renderBreadcrumb:"default"===d?()=>{const e=[{name:r,id:"root",type:"root"}];return k.forEach(t=>{e.push({name:Cl(t)?t.content.headerTitle:t.name||"",id:Cl(t)?t.content.id:t.name||"",type:t.type})}),e.map((e,t)=>(0,yl.jsxs)("span",{children:[t>0&&" / ",(0,yl.jsx)(i,{to:"file"===e.type?l(e.id):"#",onClick:e=>((e,t)=>{if(t.preventDefault(),0===e){const e=C.root||Object.keys(y)[0];return void A(e)}const a=k[e-1];a&&(Cl(a)?A(a.content.id):kl(a)&&A(C[a.name||""]))})(t,e),children:e.name})]},`${e.id}-${t}`))}:void 0,renderMenuItems:()=>E(e),settingContent:e,action:u,customContent:b}),(0,yl.jsxs)(jl,{general:!0,children:[s&&(0,yl.jsx)(s,{}),S&&(0,yl.jsx)("div",{id:"tabs-wrapper",className:"tabs-wrapper",children:(0,yl.jsx)("div",{className:"tabs-item",children:E(_)})}),(0,yl.jsxs)("div",{className:"tab-content",children:[!w||"support"===w.id||w.hideSettingHeader?null:(0,yl.jsx)(mn,{title:w.settingTitle??w.headerTitle,desc:w.settingSubTitle??w.headerDescription}),n(f)]})]})]})})},_l=m(a(1609)),Sl=a(790),Al=({brandImg:e,results:t=[],search:a,onQueryUpdate:n,onResultClick:l,free:s,pro:i,utilityList:r=[],utilityListWithTab:o=[]})=>{const c=(0,_l.useRef)(null),[d,m]=_l.default.useState([]);return(0,_l.useEffect)(()=>{(()=>{const e=document.querySelectorAll("#screen-meta + .wrap .notice, #wpbody-content .notice");if(e.length>0){const t=[];e.forEach(e=>{t.push(e.outerHTML),e.remove()}),m(t)}})()},[]),(0,Sl.jsxs)(Sl.Fragment,{children:[(0,Sl.jsx)(et,{position:"banner"}),(0,Sl.jsxs)("div",{className:"admin-header",ref:c,children:[(0,Sl.jsxs)("div",{className:"left-section",children:[(0,Sl.jsx)("img",{className:"brand-logo",src:e,alt:"Logo"}),(0,Sl.jsxs)("div",{className:"version-tag",children:[(0,Sl.jsxs)("span",{className:"admin-badge purple",children:[(0,Sl.jsx)("i",{className:"adminfont-info"})," ",(0,Sl.jsx)("b",{children:"Free:"}),s]}),(0,Sl.jsxs)("span",{className:"admin-badge red",children:[(0,Sl.jsx)("i",{className:"adminfont-pro-tag"})," Pro:",i||"Not Installed"]})]})]}),(0,Sl.jsxs)("div",{className:"right-section",children:[(0,Sl.jsx)(pl,{search:a,results:t,width:11,onQueryUpdate:n,onResultClick:l}),o.map((e,t)=>(0,Sl.jsx)(P,{position:"menu-dropdown",toggleIcon:e?.toggleIcon,tooltipName:e?.tooltipName,tooltipPosition:e?.tooltipPosition,width:24,children:e?.tabs&&(0,Sl.jsx)(wa,{tabs:e.tabs})},t)),r.map((e,t)=>(0,Sl.jsx)(P,{position:"menu-dropdown",toggleIcon:e.toggleIcon,tooltipName:e?.tooltipName,tooltipPosition:e?.tooltipPosition,children:(0,Sl.jsx)(ot,{items:e.items})},t))]})]}),(0,Sl.jsx)("div",{className:"notice-wrapper wrap",children:d.length>0&&d.map((e,t)=>(0,Sl.jsxs)(Sl.Fragment,{children:[(0,Sl.jsx)("div",{dangerouslySetInnerHTML:{__html:e}},t),(0,Sl.jsx)(et,{position:"notice"})]}))}),(0,Sl.jsx)(et,{position:"float"})]})},Tl=a(1609),El=m(a(3743)),Ml=a(4449),$l=a(790),Il={headers:{"X-WP-Nonce":Un.nonce}},Dl=async(e,t)=>{try{await El.default.post(b(Un,"tour"),{completed:e,store_id:t},Il)}catch(e){console.error("Error updating tour status:",e)}},Ll="guided_tour_step",Pl=({steps:e,storeId:t})=>{const{setIsOpen:a,setSteps:n,setCurrentStep:l}=(0,Ml.useTour)(),s=(0,Tl.useCallback)(async()=>{a(!1),sessionStorage.removeItem(Ll),await Dl(!0,t)},[a]),i=(0,Tl.useCallback)((e,t)=>{window.location.href===e?l(t):(sessionStorage.setItem(Ll,String(t)),window.location.href=e)},[l]);return(0,Tl.useEffect)(()=>{(async()=>{try{if(!(await(async e=>(await El.default.get(b(Un,"tour"),{...Il,params:{store_id:e}})).data)(t)).completed){const t=sessionStorage.getItem(Ll),r=t?parseInt(t):0,o=e.map((t,a)=>{const n=a===e.length-1;return{...t,content:()=>{const e=[];return n||e.push({text:"End Tour",color:"red",onClick:s}),!n&&t.next&&e.push({text:"Next",color:"purple",onClick:()=>i(t.next.link,t.next.step)}),(n||t.finish)&&e.push({text:"Finish Tour",color:"purple",onClick:s}),(0,$l.jsxs)("div",{className:"tour-box",children:[(0,$l.jsx)("div",{className:"title",children:t.title}),(0,$l.jsx)("div",{className:"desc",children:t.description}),(0,$l.jsx)(E,{buttons:e})]})}}});n(o),l(r),a(!0)}}catch(e){console.error("Error loading tour:",e)}})()},[e,n,a,l,i,s]),null},Fl=({steps:e,storeId:t,...a})=>(0,$l.jsx)(Ml.TourProvider,{steps:[],showNavigation:!1,showPrevNextButtons:!1,showDots:!1,showBadge:!1,className:"tour-content",styles:{popover:e=>({...e,padding:"1.125rem",borderRadius:"0.313rem"})},onClickClose:({setIsOpen:e})=>{e(!1),Dl(!0,t),sessionStorage.removeItem(Ll)},onClickMask:({setIsOpen:e})=>{e(!1),Dl(!0,t),sessionStorage.removeItem(Ll)},...a,children:(0,$l.jsx)(Pl,{steps:e,storeId:t})}),Ol=a(790),Bl=({wrapperClass:e="",template:t,value:a,onChange:n,addLabel:l="Add New",emptyText:s="No items added yet",childrenRenderer:i=()=>!1,canAccess:r=!0})=>(0,Ol.jsx)(Ol.Fragment,{children:(0,Ol.jsxs)("div",{className:`repeater-field-wrapper ${e}`,children:[0===a.length?(0,Ol.jsx)(Qe,{type:"info",displayPosition:"inline-notice",message:s}):a.map((e,l)=>{const s=i?.(e,l);return(0,Ol.jsxs)("div",{className:"repeater-field",children:[(0,Ol.jsxs)("div",{className:"field",children:[t.fields.map(t=>function(e,t,l){const s=zn[e.type];if(!s)return null;const i=s.render,o=t?.[e.key],c=e=>{const t=[...a];t[l]={...t[l],...e},n(t)};return(0,Ol.jsxs)(Ol.Fragment,{children:[e.label&&(0,Ol.jsx)("label",{children:e.label}),(0,Ol.jsx)(i,{field:{...e,onClick:e.onClick?()=>e.onClick({row:t,rowIndex:l,updateRow:c}):e.onClick},value:o,onChange:t=>{((e,t,l)=>{const s=[...a];s[e]={...s[e],[t]:l},n(s)})(l,e.key,t)},canAccess:r})]})}(t,e,l)),(0,Ol.jsx)(E,{position:"left",buttons:[{icon:"delete",text:"Delete",color:"red",onClick:()=>(e=>{n(a.filter((t,a)=>a!==e))})(l)}]})]}),s&&(0,Ol.jsx)("div",{className:"repeater-field-nested",children:s})]},l)}),(0,Ol.jsx)(E,{position:"left",buttons:[{icon:"plus",text:l,color:"purple",onClick:()=>{const e={};t.fields.forEach(t=>{e[t.key]="file"===t.type?null:""}),n([...a,e])}}]})]})}),Rl=a(790),ql=({grid:e=12,className:t="",children:a,fullHeight:n=!1,row:l=!1})=>(0,Rl.jsx)("div",{className:`card-wrapper ${l?"row":""} ${t} ${n?"full-height":""}`,"data-cols":e,children:a}),Ul=a(790),Wl=({title:e,titleLink:t,avatar:a,onClick:n,descriptions:l=[],badges:s=[],amount:i,amountClassName:r="",className:o="",isLoading:c=!1,rightContent:d})=>{const m=t?(0,Ul.jsx)("a",{href:t,rel:"noopener noreferrer",children:e}):n?(0,Ul.jsx)("span",{onClick:n,children:e}):e;return(0,Ul.jsx)("div",{className:"info-item-wrapper",children:(0,Ul.jsx)("div",{className:`info-item ${o}`,children:c?(0,Ul.jsxs)(Ul.Fragment,{children:[(0,Ul.jsxs)("div",{className:"details-wrapper",children:[a&&(0,Ul.jsx)("div",{className:"avatar",children:(0,Ul.jsx)(Ie,{variant:"circular",width:1.875,height:1.875})}),(0,Ul.jsxs)("div",{className:"details",children:[(0,Ul.jsxs)("div",{className:"name",children:[(0,Ul.jsx)(Ie,{width:11.25,height:1.5}),s.length>0&&(0,Ul.jsx)(Ie,{variant:"rectangular",width:3.75,height:1.25})]}),l&&(0,Ul.jsx)("div",{className:"des",children:(0,Ul.jsx)(Ie,{width:"90%"})}),(0,Ul.jsx)("div",{className:"des",children:(0,Ul.jsx)(Ie,{width:"75%"})})]})]}),void 0!==i&&(0,Ul.jsx)("div",{className:"right-details",children:(0,Ul.jsx)("div",{className:"price",children:(0,Ul.jsx)(Ie,{width:4.375})})})]}):(0,Ul.jsxs)(Ul.Fragment,{children:[(0,Ul.jsxs)("div",{className:"details-wrapper",children:[(()=>{if(!a)return null;const t=a.image?(0,Ul.jsx)("img",{src:a.image,alt:e}):a.iconClass?(0,Ul.jsx)("i",{className:`adminfont-${a.iconClass}`}):(0,Ul.jsx)("span",{className:`adminfont-${a.iconClass}`,children:a.text});return(0,Ul.jsx)("div",{className:"avatar",children:a.link?(0,Ul.jsx)("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",children:t}):t})})(),(0,Ul.jsxs)("div",{className:"details",children:[(0,Ul.jsxs)("div",{className:"name",children:[m,s.map((e,t)=>(0,Ul.jsx)("span",{className:`admin-badge ${e.className}`,onClick:e.onClick,children:e.text},t))]}),l.map((e,t)=>(0,Ul.jsxs)("div",{className:"des",children:[e.label&&e.value&&(0,Ul.jsxs)(Ul.Fragment,{children:[e.boldLabel?(0,Ul.jsx)("b",{children:e.label}):e.label,": "]}),e.value]},t))]})]}),void 0!==i&&(0,Ul.jsx)("div",{className:"right-details",children:(0,Ul.jsx)("div",{className:`price ${r}`,children:i})}),d&&(0,Ul.jsx)("div",{className:"right-content",children:d})]})})})},Kl=a(790),zl=({data:e,variant:t="default",cols:a,isLoading:n=!1})=>(0,Kl.jsx)("div",{className:"analytics-container "+(a?"flex-wrap":""),"data-template":t,children:e.map((e,l)=>(0,Kl.jsxs)("div",{className:`analytics-item ${a?`col-${a}`:""} ${e.colorClass||""}`,children:[(0,Kl.jsx)("div",{className:"analytics-icon",children:n?(0,Kl.jsx)(Ie,{width:3.75,height:3.75}):e.icon&&(0,Kl.jsx)("i",{className:`adminfont-${e.icon} ${e.iconClass||""}`})}),(0,Kl.jsxs)("div",{className:"details",children:[(0,Kl.jsx)("div",{className:"number",children:n?(0,Kl.jsx)(Ie,{width:5}):e.number}),(0,Kl.jsx)("div",{className:"text",children:n?(0,Kl.jsx)(Ie,{width:6.25}):e.text}),"dashboard"===t&&(0,Kl.jsx)("div",{className:"report",children:n?(0,Kl.jsx)(Ie,{width:3.75}):e.extra})]})]},l))}),Hl=a(790),Gl=({icon:e="info",iconColor:t="red",title:a,desc:n,buttonText:l,buttonLink:s,buttonTarget:i="_self",onButtonClick:r,className:o=""})=>(0,Hl.jsxs)("div",{className:`permission-wrapper ${o}`,children:[(0,Hl.jsx)("i",{className:`adminfont-${e} ${t}`}),(0,Hl.jsx)("div",{className:"title",children:a}),n&&(0,Hl.jsx)("div",{className:"desc",children:n}),l&&(s?(0,Hl.jsx)("a",{href:s,target:i,rel:"_blank"===i?"noopener noreferrer":"",className:"admin-btn btn-purple",children:l}):(0,Hl.jsx)("div",{className:"admin-btn btn-purple",role:"button",onClick:()=>{r&&r()},children:l}))]}),Vl=a(1609),Yl=a(790),Zl={settingName:"",setting:{}},Jl=(0,Vl.createContext)(void 0),Xl=(e,t)=>{switch(t.type){case"SET_SETTINGS":return{...t.payload};case"UPDATE_SETTINGS":{const{key:a,value:n}=t.payload,l={...e.setting,[a]:n};return{...e,setting:l}}case"CLEAR_SETTINGS":return{settingName:"",setting:{}};default:return e}},Ql=({children:e})=>{const[t,a]=(0,Vl.useReducer)(Xl,Zl);return(0,Yl.jsx)(Jl.Provider,{value:{...t,setSetting:(e,t)=>{a({type:"SET_SETTINGS",payload:{settingName:e,setting:t}})},updateSetting:(e,t)=>{a({type:"UPDATE_SETTINGS",payload:{key:e,value:t}})},clearSetting:()=>{a({type:"CLEAR_SETTINGS"})}},children:e})},es=()=>{const e=(0,Vl.useContext)(Jl);if(!e)throw new Error("useSetting must be used within a SettingProvider");return e},ts=(e={})=>Object.entries(e).map(([e,t])=>{if(null==t)return"";const a=e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase());return"number"==typeof t?`${a}:${t}rem`:`${a}:${t}`}).filter(Boolean).join(";"),as=e=>e.map(ns).join(""),ns=e=>{const t=ts(e.style);switch(e.type){case"heading":return`<h${e.level||1} style="${t}">\n ${e.text||""}\n </h${e.level||1}>`;case"richtext":return`<div style="${t}">\n ${e.html||""}\n </div>`;case"image":return`<img src="${e.src||""}" alt="${e.alt||""}" style="${t}" />`;case"button":return`<a href="${e.url||"#"}" style="${t};display:inline-block;text-decoration:none;">\n ${e.text||"Click"}\n </a>`;case"divider":return`<hr style="${t}" />`;case"columns":return ls(e);case"section":return`<div style="${t}">\n ${(e.columns||[]).flat().map(ns).join("")}\n </div>`;default:return""}},ls=e=>{const t=e.columns||[];return`\n <table width="100%" cellpadding="0" cellspacing="0" style="${ts(e.style)}">\n <tr>\n ${t.map(e=>`\n <td valign="top" style="padding:10px;">\n ${e.map(ns).join("")}\n </td>\n `).join("")}\n </tr>\n </table>\n `},ss=Date.now(),is=()=>ss++,rs=e=>{const t=(new DOMParser).parseFromString(e,"text/html"),a=[];return Array.from(t.body.children).forEach(e=>{const t=os(e);t&&a.push(t)}),a},os=e=>{if(3===e.nodeType){const t=e.textContent.trim();return t?{id:is(),type:"richtext",html:t}:null}if(1!==e.nodeType)return null;const t=e.tagName.toLowerCase();switch(t){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":return{id:is(),type:"heading",level:parseInt(t[1]),text:e.textContent,style:ds(e)};case"div":case"p":return{id:is(),type:"richtext",html:e.innerHTML.trim(),style:ds(e)};case"img":return{id:is(),type:"image",src:e.getAttribute("src"),alt:e.getAttribute("alt"),style:ds(e)};case"a":return{id:is(),type:"button",text:e.textContent,url:e.getAttribute("href"),style:ds(e)};case"hr":return{id:is(),type:"divider",style:ds(e)};case"table":return cs(e);default:return null}},cs=e=>{const t=Array.from(e.querySelectorAll("tr"));if(!t.length)return null;const a=[],n=t[0];return Array.from(n.children).forEach((e,t)=>{const n=[];e.childNodes.forEach(e=>{const t=os(e);t&&n.push(t)}),a.push(n)}),{id:is(),type:"columns",layout:String(a.length),columns:a,style:ds(e)}},ds=e=>{const t={},a=e.getAttribute("style");return a?(a.split(";").forEach(e=>{const[a,n]=e.split(":");if(!a||!n)return;const l=a.trim().replace(/-([a-z])/g,(e,t)=>t.toUpperCase());t[l]=n.trim().replace("rem","")}),t):t},ms=m(a(1609)),us=a(1609),ps=a(1609),hs=a(790),gs=({row:e,rowActions:t})=>{const[a,n]=(0,ps.useState)(!1),l=t.length<=2,s=(0,ps.useRef)(null);Kn(s,()=>{a&&n(!1)});const i=t=>"function"==typeof t.label?t.label(e):t.label,r=t=>"function"==typeof t.icon?t.icon(e):t.icon;return(0,hs.jsx)("div",{className:"table-action",ref:s,children:l?(0,hs.jsx)("div",{className:"inline-actions",children:t.map((t,a)=>(0,hs.jsx)(D,{text:i(t),children:(0,hs.jsx)("i",{onClick:()=>t.onClick(e),className:`adminfont-${r(t)}`})},a))}):(0,hs.jsxs)("div",{className:"action-icons",children:[(0,hs.jsx)("i",{className:"adminfont-more-vertical",onClick:()=>n(e=>!e)}),(0,hs.jsx)("div",{className:"action-dropdown "+(a?"show":"hover"),children:(0,hs.jsx)("ul",{children:t.map((t,a)=>(0,hs.jsxs)("li",{onClick:()=>{t.onClick(e),n(!1)},children:[(0,hs.jsx)("i",{className:`adminfont-${r(t)}`}),(0,hs.jsx)("span",{className:"tooltip-name",children:i(t)})]},a))})})]})})},xs=a(790),bs=(e={},t={},a="",n={})=>{let l=e[t.key];if(!t?.type)return l??null;switch(t.type){case"status":{const a=String(l).toLowerCase().split(/[-_]/).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" "),n="function"==typeof t.statusClass?t.statusClass(e):t.statusClass;return(0,xs.jsx)("span",{className:`admin-badge badge-${String(n).toLowerCase()}`,children:a})}case"date":{if(!l)return null;const e=new Date(l);if(isNaN(e.getTime()))return(0,xs.jsx)("span",{children:l});const t={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MMMM:e.toLocaleString(void 0,{month:"long"}),MMM:e.toLocaleString(void 0,{month:"short"}),MM:String(e.getMonth()+1).padStart(2,"0"),DD:String(e.getDate()).padStart(2,"0"),D:String(e.getDate()),HH:String(e.getHours()).padStart(2,"0"),mm:String(e.getMinutes()).padStart(2,"0"),ss:String(e.getSeconds()).padStart(2,"0")},n=(a||"YYYY-MM-DD").replace(/YYYY|YY|MMMM|MMM|MM|DD|D|HH|mm|ss/g,e=>t[e]??e);return(0,xs.jsx)("span",{children:n})}case"currency":{null!=l&&""!==l||(l=0);const e="number"==typeof l?l:parseFloat(l.toString().replace(/[^0-9.-]+/g,""));if(isNaN(e))return(0,xs.jsx)("span",{children:l});const{currencySymbol:t,priceDecimals:a,decimalSeparator:s,thousandSeparator:i,currencyPosition:r}=n,o=Number(a??2),c=e.toFixed(o).split(".");c[0]=c[0].replace(/\B(?=(\d{3})+(?!\d))/g,i??",");const d=o>0?c.join(s??"."):c[0];let m;return m="left"===r?`${t}${d}`:"left_space"===r?`${t} ${d}`:"right"===r?`${d}${t}`:"right_space"===r?`${d} ${t}`:`${t}${d}`,m}case"content":{const e=String(l??"").replace(/<[^>]*>/g," ").replace(/ /gi," ").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&").replace(/\s+/g," ").trim();return e.length>30?`${e.slice(0,30)}…`:e}default:return l??null}},fs=a(790),js=({header:e,cell:t,isEditing:a,onSave:n})=>{const l=t.value;if(!a)return(0,fs.jsx)(fs.Fragment,{children:t.display??l});switch(e.editType){case"toggle":return(0,fs.jsx)("input",{type:"checkbox",defaultChecked:Boolean(l),onChange:e=>n(e.target.checked),autoFocus:!0});case"select":return(0,fs.jsx)("select",{defaultValue:String(l),onBlur:e=>n(e.target.value),autoFocus:!0,children:e.options?.map(e=>(0,fs.jsx)("option",{value:e.value,children:e.label},e.value))});default:return(0,fs.jsx)("input",{type:"text",defaultValue:String(l??""),onBlur:e=>n(e.target.value),autoFocus:!0})}},ys=m(a(318)),vs=a(790),Ns="asc",Cs="desc",ks=({headers:e={},rows:t=[],className:a="",onSort:n=()=>{},emptyMessage:l,query:s={},ids:i=[],selectedIds:r=[],onSelectRow:o,onSelectAll:c,classNames:d="",onCellEdit:m,isLoading:u,enableBulkSelect:p=!1,format:h,currency:g,onRowReorder:x,expandable:b=!1})=>{const f=(0,us.useRef)(null),[j,y]=(0,us.useState)(!1),[v,N]=(0,us.useState)(!1),[C,k]=(0,us.useState)([]),w=(0,us.useMemo)(()=>{if(s.orderby)return s.orderby;const t=Object.entries(e).find(([,e])=>e.defaultSort);return t?.[0]},[s.orderby,e]),_=(0,us.useMemo)(()=>{if(s.order)return s.order;const t=Object.entries(e).find(([e])=>e===w);return t?.[1]?.defaultOrder??Cs},[s.order,e,w]),S=t.length>0,A=(0,us.useMemo)(()=>i.length>0&&i.every(e=>r.includes(e)),[i,r]),T=v||j?0:null,E=(0,us.useCallback)(()=>{const e=f.current;if(!e)return;const{scrollLeft:t,scrollWidth:a,clientWidth:n}=e;if(!(a>n))return N(!1),void y(!1);N(t>0),y(t+n<a)},[]);(0,us.useEffect)(()=>{E();const e=()=>requestAnimationFrame(E);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[e,t,E]);const M=(0,us.useCallback)(e=>{let t=Cs;w===e&&(t=_===Ns?Cs:Ns),n(e,t)},[w,_,n]),$=(0,us.useCallback)(()=>{c?.(!A)},[A,c]),I=(0,us.useCallback)(e=>{const t=i[e],a=r.includes(t);o?.(t,!a)},[i,r,o]),D=e=>e?(0,vs.jsx)("i",{className:`adminfont-${_===Ns?"arrow-up":"arrow-down"} sort-icon`}):(0,vs.jsx)("i",{className:"adminfont-arrow-down-up sort-icon"}),L={nodeSelector:x?"tbody tr":"",onDragEnd:(e,t)=>{e===t||t<0||x?.(e,t)}};return(0,vs.jsx)("div",{ref:f,className:`table-wrapper ${d}`,tabIndex:T,role:"group",onScroll:E,children:(0,vs.jsx)(ys.default,{...L,enableScroll:!!x,children:(0,vs.jsxs)("table",{className:"admin-table",children:[(0,vs.jsx)("thead",{className:"admin-table-header",children:(0,vs.jsxs)("tr",{className:"header-row",children:[b&&(0,vs.jsx)("th",{className:"header-col expand"}),p&&(0,vs.jsx)("th",{className:"header-col select",children:(0,vs.jsx)("input",{type:"checkbox",checked:A,onChange:$})}),x&&(0,vs.jsx)("td",{className:"admin-column drag"}),Object.entries(e).map(([e,t],a)=>{const{label:n,isSortable:l,isNumeric:s,screenReaderLabel:i}=t,r=w===e,o=["header-col",l&&"sortable",r&&"sorted",s&&"numeric",t.type].filter(Boolean).join(" ");return(0,vs.jsx)("th",{className:o,"aria-sort":l&&r?_===Ns?"ascending":"descending":null,style:t.width?{minWidth:"number"==typeof t.width?`${t.width}rem`:t.width}:{},children:l?(0,vs.jsxs)("div",{onClick:S?()=>M(t.key):null,className:"sort-button",children:[n,D(r)]}):(0,vs.jsxs)(us.Fragment,{children:[n,i&&(0,vs.jsx)("span",{className:"screen-reader-only",children:i})]})},e||a)})]})}),(0,vs.jsx)("tbody",{className:"admin-table-body",children:u?Array.from({length:Number(s.per_page)||5}).map((t,a)=>(0,vs.jsxs)("tr",{className:"admin-row",children:[p&&(0,vs.jsx)("td",{className:"admin-column select",children:(0,vs.jsx)(Ie,{width:1.25,height:1.25})}),x&&(0,vs.jsx)("td",{className:"admin-column drag",children:(0,vs.jsx)(Ie,{width:1,height:1})}),Object.entries(e).map(([e],t)=>(0,vs.jsx)("td",{className:"admin-column",children:(0,vs.jsx)(Ie,{width:"100%"})},e||t))]},a??t.id)):S?t.map((t,n)=>(0,vs.jsxs)(us.Fragment,{children:[(0,vs.jsxs)("tr",{className:"admin-row",children:[b&&(0,vs.jsx)("td",{className:"admin-column expand",children:t.variation?.length>0&&(0,vs.jsx)("i",{className:"adminfont-"+(C.includes(t.id)?"arrow-down":"arrow-right"),onClick:()=>k(e=>e.includes(t.id)?e.filter(e=>e!==t.id):[...e,t.id])})}),p&&(0,vs.jsx)("td",{className:"admin-column select",children:(0,vs.jsx)("input",{type:"checkbox",checked:r.includes(t.id),onChange:()=>I(n)})}),x&&(0,vs.jsx)("td",{className:"admin-column drag",children:(0,vs.jsx)("i",{className:"adminfont-move"})}),Object.entries(e).map(([e,n],l)=>{const s=t.id,i=t[n.key]||t[e];if("function"==typeof n.render)return(0,vs.jsx)("td",{className:`admin-column ${a} ${n?.type||""}`,style:n.width?{minWidth:"number"==typeof n.width?`${n.width}rem`:n.width}:{},children:n.render(t)},`${s}-${l}`);if("action"===n.type)return(0,vs.jsx)("td",{className:"admin-column action",children:(0,vs.jsx)(gs,{row:t,rowActions:n.actions})},`action-${s}`);let r=bs(t,n,h,g);return(0,vs.jsx)("td",{className:`admin-column ${a} ${n?.type||""}`,children:n.isEditable?js({header:n,cell:i,isEditing:!1,onSave:m}):r},`${s}-${l}`)})]},t.id??n),b&&C.includes(t.id)&&t.variation?.map(t=>(0,vs.jsxs)("tr",{className:"admin-row variation-row",children:[(0,vs.jsx)("td",{className:"admin-column expand"}),Object.entries(e).map(([e,n],l)=>(0,vs.jsx)("td",{className:`admin-column ${a} ${n?.type||""}`,children:"function"==typeof n.render?n.render(t):bs(t,n,h,g)},`${t.id}-${l}`))]},t.id))]},t.id??n)):(0,vs.jsx)("tr",{className:"admin-row",children:(0,vs.jsx)(Gl,{title:l||"No data to display"})})})]})})})},ws=a(1609),_s=a(790),Ss=[10,25,50,75,100],As=({page:e,perPage:t,total:a,onPageChange:n=()=>{},onPerPageChange:l=()=>{},showPagePicker:s=!0,showPerPagePicker:i=!0,showPageArrowsLabel:r=!0,perPageOptions:o=Ss})=>{const[c,d]=(0,ws.useState)(e),m=Math.ceil(a/t);(0,ws.useEffect)(()=>{d(e)},[e]);const u=0===a?0:(e-1)*t+1,p=Math.min(e*t,a),h=(e,t)=>{e<1&&(e=1),e>m&&(e=m),n(e,t)},g=r&&a>0&&(0,_s.jsxs)("span",{className:"show-section",role:"status","aria-live":"polite",children:["Showing ",u," to ",p," of ",a," entries."]}),x=(0,_s.jsxs)("div",{className:"showing-number",children:["Show",(0,_s.jsx)(K,{value:t,options:o.map(e=>({value:e,label:e})),onChange:t=>{(t=>{l(t);const s=Math.ceil(a/t);e>s&&n(s,"goto")})(t)}}),"entries"]});if(m<=1)return(0,_s.jsxs)("div",{className:"pagination-number-wrapper",children:[g,a>o[0]&&x]});const b=(()=>{const t=[];if(m<=6){for(let e=1;e<=m;e++)t.push(e);return t}t.push(1,2);let a=e-1,n=e+1;a=Math.max(a,3),n=Math.min(n,m-2),a>3&&t.push("...");for(let e=a;e<=n;e++)t.push(e);return n<m-2&&t.push("..."),t.push(m-1,m),t})();return(0,_s.jsxs)(_s.Fragment,{children:[(0,_s.jsxs)("div",{className:"pagination-number-wrapper",children:[g,i&&x]}),s&&(0,_s.jsxs)("div",{className:"pagination-number-wrapper",children:["Go to page",(0,_s.jsx)(V,{type:"number",minNumber:1,maxNumber:m,value:c,inputClass:"pagination-page-picker-input",onChange:e=>d(e),onBlur:t=>{const a=Number(t.target.value);Number.isFinite(a)&&a>=1&&a<=m?h(a,"goto"):d(e)},onClick:e=>e.currentTarget.select()}),(0,_s.jsxs)("div",{className:"pagination-arrow",children:[(0,_s.jsx)("span",{className:e<=1?"pagination-button-disabled":"",onClick:()=>h(1,"first"),"aria-label":"First Page",children:(0,_s.jsx)("i",{className:"admin-font adminfont-pagination-prev-arrow"})}),(0,_s.jsx)("span",{className:e<=1?"pagination-button-disabled":"",onClick:()=>h(e-1,"previous"),"aria-label":"Previous Page",children:(0,_s.jsx)("i",{className:"admin-font adminfont-pagination-left-arrow"})}),(0,_s.jsx)("div",{className:"pagination",children:b.map((t,a)=>"number"==typeof t?(0,_s.jsx)(E,{buttons:{text:String(t),color:e===t?"purple-bg":"white",onClick:()=>h(t)}},a):(0,_s.jsx)("span",{className:"pagination-ellipsis",children:t},a))}),(0,_s.jsx)("span",{className:e>=m?"pagination-button-disabled":"",onClick:()=>h(e+1,"next"),"aria-label":"Next Page",children:(0,_s.jsx)("i",{className:"admin-font adminfont-pagination-right-arrow"})}),(0,_s.jsx)("span",{className:e>=m?"pagination-button-disabled":"",onClick:()=>h(m,"last"),"aria-label":"Last Page",children:(0,_s.jsx)("i",{className:"admin-font adminfont-pagination-next-arrow"})})]})]})]})},Ts=a(790),Es=({actions:e=[],selectedIds:t,onApply:a,onClearSelection:n,onSelectCsvDownloadApply:l,onToggleSelectAll:s,totalIds:i,showDropdown:r=!0})=>{const o=i.length>0&&t.length===i.length;return(0,Ts.jsx)("div",{className:"table-filter-wrapper",children:(0,Ts.jsxs)("div",{className:"table-filter bulk",children:[(0,Ts.jsxs)("span",{className:"action-item count",children:[t.length," Rows selected",(0,Ts.jsx)("i",{onClick:n,className:"adminfont-close"})]}),(0,Ts.jsx)("div",{className:"action-item",children:(0,Ts.jsxs)("div",{className:"admin-btn",onClick:()=>s(!o),children:[" ",o?"Deselect All":"Select All"]})}),r&&e.length>0&&a&&(0,Ts.jsx)("div",{className:"group-field",children:(0,Ts.jsx)(K,{options:e,value:"",placeholder:"Bulk Actions",disabled:0===t.length,onChange:e=>{e&&a(String(e))}})}),l&&(0,Ts.jsx)(E,{buttons:{text:"CSV",icon:"download",disabled:0===t.length,onClick:()=>l(t)}})]})})},Ms=a(790),$s=({filters:e,query:t,onFilterChange:a,rows:n,onResetFilters:l,format:s})=>{if(!n||0===n.length&&0===Object.keys(t).length)return null;const i=Object.values(t||{}).some(e=>Array.isArray(e)?e.length:e);return(0,Ms.jsxs)("div",{className:"table-filter-wrapper",children:[(0,Ms.jsxs)("div",{className:"table-filter",children:[(0,Ms.jsxs)("span",{className:"title",children:[(0,Ms.jsx)("i",{className:"adminfont-filter"}),"Filter"]}),e.map(e=>{const n=t[e.key];if("date"===e.type){const t=n||(()=>{const e=new Date;return e.setMonth(e.getMonth()-1),{startDate:e,endDate:new Date}})();return(0,Ms.jsx)("div",{className:"group-field",children:(0,Ms.jsx)(re,{value:t,onChange:t=>{t&&a(e.key,t)},format:s})},e.key)}const l=e.options?.map(e=>({label:e.label,value:String(e.value)}))||[];return(0,Ms.jsx)("div",{className:"group-field",children:(0,Ms.jsx)(K,{type:e.multiple?"multi-select":"single-select",options:l,value:n,size:`${e.size}rem`,placeholder:`Select ${e.label}`,onChange:t=>{a(e.key,t)}})},e.key)})]}),i&&(0,Ms.jsx)(E,{buttons:{text:"Reset",icon:"refresh",color:"red",onClick:l}})]})},Is=a(790),Ds=({actions:e=[],query:t})=>{if(!e.length)return null;const a=e.map(e=>({text:e.label,icon:e.icon,color:e.color||"",onClick:()=>{e.onClickWithQuery&&t?e.onClickWithQuery(t):e.onClick?.()}}));return(0,Is.jsx)(E,{buttons:a,position:"left"})},Ls=a(790),Ps=({className:e="",search:t,headers:a={},ids:n=[],isLoading:l=!1,onColumnsChange:s,onSort:i,bulkActions:r=[],onBulkActionApply:o,rows:c=[],showMenu:d=!0,emptyMessage:m,summary:u,title:p,totalRows:h=0,categoryCounts:g=[],activeCategory:x="all",languageFilterCounts:b=[],activeLanguageFilter:f="all",filters:j=[],showColumnToggleIcon:y=!0,onSelectCsvDownloadApply:v,onCellEdit:N,buttonActions:C,format:k,onRowReorder:w,currency:_,expandable:S,...A})=>{const[T,E]=(0,ms.useState)([]),[M,$]=(0,ms.useState)(h),[I,D]=(0,ms.useState)({orderby:"",order:"desc",paged:1,per_page:10,filter:{},categoryFilter:x,languageFilter:f}),L=e=>(t,a)=>{D(n=>({...n,[e]:"paged"===e||"per_page"===e?Number(t):t,order:"sort"===e?a:n.order,orderby:"sort"===e?t:n.orderby}))},F=ms.default.useMemo(()=>g&&Array.isArray(g)?g.filter(e=>e&&e.count>0):[],[g]),O=ms.default.useMemo(()=>b&&Array.isArray(b)?b.filter(e=>e&&e.count>0):[],[b]);(0,ms.useEffect)(()=>{A.onQueryUpdate?.(I)},[I]),(0,ms.useEffect)(()=>{$(h)},[h]);const[B,R]=(0,ms.useState)(((e={})=>Object.entries(e).filter(([e,t])=>!1!==t.visible).map(([e])=>e))(a)),q=e=>{let t;if(B.includes(e)){if(B.length<=1)return;if(I.orderby===e){const e=Object.entries(a).find(([e,t])=>t.defaultSort);e&&L("sort")(e[0],"desc")}t=B.filter(t=>t!==e)}else t=[...B,e];R(t),s?.(t,e)},U=Object.entries(a).filter(([e,t])=>B.includes(e)&&!1!==t.tableDisplay).map(([e,{...t}])=>({key:e,...t}));return(0,Ls.jsxs)("div",{className:`admin-table-wrapper ${e}`,children:[p&&(0,Ls.jsx)("div",{className:"table-card-header",children:(0,Ls.jsx)("div",{className:"title",children:p})}),(F.length>0||C||t||d&&y)&&(0,Ls.jsxs)("div",{className:"admin-top-filter",children:[(F.length>0||O.length>0)&&(0,Ls.jsx)(Ls.Fragment,{children:(0,Ls.jsxs)("div",{className:"top-filter-wrapper",children:[F.length>0&&(0,Ls.jsx)("div",{className:"filters category",children:F.map(({label:e,value:t,count:a})=>(0,Ls.jsxs)("div",{className:"filter-item "+((I.categoryFilter||x)===t?"active":""),onClick:()=>(e=>{if(g&&Array.isArray(g)){const t=g.find(t=>t&&t.value===e);$(t?.count??0)}D(t=>({...t,paged:1,categoryFilter:e}))})(t),children:[e," (",a,")"]},t))}),O.length>0&&(0,Ls.jsx)("div",{className:"filter language",children:O.map(({label:e,value:t,count:a})=>(0,Ls.jsxs)("div",{className:"filter-item "+((I.languageFilter||f)===t?"active":""),onClick:()=>(e=>{D(t=>({...t,paged:1,languageFilter:e}))})(t),children:[e," (",a,")"]},t))})]})}),(0,Ls.jsxs)("div",{className:"table-action-wrapper",children:[C&&(0,Ls.jsx)(Ds,{actions:C,query:I}),t&&(0,Ls.jsx)(pl,{search:{placeholder:t.placeholder,options:t.options},width:t.size,onQueryUpdate:e=>{L("searchValue")(e.searchValue),"searchAction"in e&&L("searchAction")(String(e.searchAction))}}),d&&y&&(0,Ls.jsx)(P,{position:"menu-dropdown",toggleIcon:"more-vertical",tooltipName:"Manage display",tooltipPosition:"end",children:(0,Ls.jsx)(ot,{className:"default table-menu",items:Object.entries(a).filter(([e,t])=>!t.required).map(([e,t])=>({id:e,title:t.label,action:()=>q(e),tags:(0,Ls.jsx)("input",{type:"checkbox",checked:B.includes(e),onChange:t=>{t.stopPropagation(),q(e)}})}))})})]})]}),(0,Ls.jsx)(ks,{rows:c,headers:U,query:I,onSort:i||L("sort"),ids:n,onRowReorder:w,selectedIds:T,onSelectRow:(e,t)=>{E(a=>t?[...a,e]:a.filter(t=>t!==e))},onSelectAll:e=>{E(e?[...n]:[])},onCellEdit:N,enableBulkSelect:r.length>0||!!v,emptyMessage:m,isLoading:l,format:k,currency:_,expandable:S}),M>0&&(0,Ls.jsx)("div",{className:"admin-pagination",children:l?(0,Ls.jsx)(Ie,{width:"100%"}):(0,Ls.jsxs)(ms.Fragment,{children:[(0,Ls.jsx)(As,{page:Number(I.paged),perPage:Number(I.per_page),total:M,onPageChange:(e,t)=>{A.onPageChange?.(e,t),L("paged")(String(e),t)},onPerPageChange:e=>L("per_page")(String(e))}),u&&(0,Ls.jsx)("ul",{className:"table-summary",role:"complementary",children:u.map(({label:e,value:t},a)=>(0,Ls.jsxs)("li",{className:"table-summary-item",children:[(0,Ls.jsx)("span",{className:"table-summary-value",children:t}),(0,Ls.jsx)("span",{className:"table-summary-label",children:e})]},a))})]})}),(0,Ls.jsxs)("div",{className:"filter-wrapper",children:[T.length<=1&&j.length>0&&(0,Ls.jsx)($s,{filters:j,query:I.filter||{},onFilterChange:(e,t)=>{D(a=>({...a,paged:1,filter:{...a.filter,[e]:t}}))},rows:c,onResetFilters:()=>D(e=>({...e,filter:{},paged:1})),format:k}),T.length>1&&(r.length>0||v)&&(0,Ls.jsx)(Es,{actions:r,selectedIds:T,onApply:e=>{o?.(e,T),E([])},onClearSelection:()=>E([]),onSelectCsvDownloadApply:v,totalIds:n,onToggleSelectAll:e=>E(e?[...n]:[]),showDropdown:r.length>0})]})]})},Fs=e=>Array.isArray(e)?e:[],Os=(e,t)=>{const a=[];if(Array.isArray(e)&&Array.isArray(t))for(const n of e){if("folder"===n.type){const e=Os(n.content,t);e.length&&a.push({...n,content:e});continue}t.includes(n.content.id)&&a.push(n)}return a},Bs=e=>{const t=[];return Array.isArray(e)&&e.forEach(e=>{if("folder"===e.type)return e.content=Bs(e.content),void(e.content.length&&t.push(e));const a=e.content;a.pro_dependent||a.module_dependent||t.push(e)}),t},Rs=(e,t=[])=>Fs([...Bs(e),...Os(e,t)]),qs=(e,t)=>{if(Array.isArray(e))for(const a of e){if("folder"===a.type){const e=qs(a.content,t);if(e)return e;continue}const e=a.content;if(e.id===t)return e}return null},Us=(e,t,a)=>{if(!e.module_dependent)return!0;if(a.includes(e.id)){if(!e.pro_dependent)return!0;if(t)return!0}return!1}},3731(e,t,a){"use strict";const n=window.wp.element;var l=a(4934),s=a(1609),i=a(3390),r=a(8164);const o=window.wp.i18n;var c=a(790);const d=()=>{const[e,t]=(0,s.useState)(!1),[a,n]=(0,s.useState)(""),l=enquiryFormData,d=l.khali_dabba,m=`${enquiryFormData.apiUrl}/catalogx/v1/enquiries`,u=e=>{const a=new FormData;Object.keys(e).forEach(t=>{let n=e[t];"phone"===t&&"object"==typeof n&&(n=`${n.country_code}${n.phone}`),a.append(t,n)});const l=document.querySelector("#product-id-for-enquiry")?.value??"",s=document.querySelector(".quantity .qty")?.value??"1";a.append("productId",l),a.append("quantity",s),r.A.post(m,a,{headers:{"Content-Type":"multipart/form-data","X-WP-Nonce":enquiryFormData.nonce}}).then(e=>{n(e.data.msg),t(!0),""!==e.data.redirect_link&&(window.location.href=e.data.redirect_link),setTimeout(()=>{t(!1),window.location.reload()},3e3)})},p=()=>{const e=document.getElementById("catalogx-modal");e&&(e.style.display="none")};return(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)("div",{className:"form-wrapper",children:[(0,c.jsx)("div",{children:enquiryFormData.content_before_form}),d?(0,c.jsx)(i.FormViewer,{formFields:{formfieldlist:l.settings_pro},onSubmit:u,onClose:p,formMessages:{ /* translators: %s: Field label. */ fieldRequired:(0,o.__)("%s is required.","catalogx"),invalidEmail:(0,o.__)("Please enter a valid email address.","catalogx"),termsRequired:(0,o.__)("Please accept the Terms & Conditions.","catalogx")}}):(0,c.jsx)(i.FormViewer,{formFields:{formfieldlist:l.settings_free},onSubmit:u,onClose:p,formMessages:{ /* translators: %s: Field label. */ fieldRequired:(0,o.__)("%s is required.","catalogx"),invalidEmail:(0,o.__)("Please enter a valid email address.","catalogx"),termsRequired:(0,o.__)("Please accept the Terms & Conditions.","catalogx")}}),(0,c.jsx)("div",{children:enquiryFormData.content_after_form}),e&&(0,c.jsx)("div",{className:"woocommerce-notices-wrapper",children:(0,c.jsx)("ul",{className:"woocommerce-message",role:"alert",children:(0,c.jsx)("li",{children:a})})})]})})};document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("catalogx-modal");e&&(0,n.render)((0,c.jsx)(l.Kd,{children:(0,c.jsx)(d,{})}),e)})},1609(e){"use strict";e.exports=window.React},5795(e){"use strict";e.exports=window.ReactDOM},790(e){"use strict";e.exports=window.ReactJSXRuntime},1714(){},3799(){}};const t={};function a(n){const l=t[n];if(void 0!==l)return l.exports;const s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,a),s.exports}a.m=e,a.amdO={},(()=>{const e=[];a.O=(t,n,l,s)=>{if(n){s=s||0;for(var i=e.length;i>0&&e[i-1][2]>s;i--)e[i]=e[i-1];return void(e[i]=[n,l,s])}let r=1/0;for(i=0;i<e.length;i++){let[n,l,s]=e[i],c=!0;for(var o=0;o<n.length;o++)(!1&s||r>=s)&&Object.keys(a.O).every(e=>a.O[e](n[o]))?n.splice(o--,1):(c=!1,s<r&&(r=s));if(c){e.splice(i--,1);const a=l();void 0!==a&&(t=a)}}return t}})(),a.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},(()=>{const e=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;let t;a.t=function(n,l){if(1&l&&(n=this(n)),8&l)return n;if("object"==typeof n&&n){if(4&l&&n.__esModule)return n;if(16&l&&"function"==typeof n.then)return n}const s=Object.create(null);a.r(s);const i={};t=t||[null,e({}),e([]),e(e)];for(var r=2&l&&n;("object"==typeof r||"function"==typeof r)&&!~t.indexOf(r);r=e(r))Object.getOwnPropertyNames(r).forEach(e=>i[e]=()=>n[e]);return i.default=()=>n,a.d(s,i),s}})(),a.d=(e,t)=>{if(Array.isArray(t))for(var n=0;n<t.length;){var l=t[n++],s=t[n++];a.o(e,l)?0===s&&n++:0===s?Object.defineProperty(e,l,{enumerable:!0,value:t[n++]}):Object.defineProperty(e,l,{enumerable:!0,get:s})}else for(var l in t)a.o(t,l)&&!a.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},a.o=(e,t)=>Object.hasOwn(e,t),a.r=e=>{Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.j=350,a.dn=e=>{(Object.getOwnPropertyDescriptor(e,"name")||{}).writable||Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={350:0};a.O.j=t=>0===e[t];const t=(t,n)=>{let[l,s,i]=n;var r,o,c=0;if(l.some(t=>0!==e[t])){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(i)var d=i(a)}for(t&&t(n);c<l.length;c++)o=l[c],a.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return a.O(d)},n=globalThis.webpackChunkcatalogx||=[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),a.nc=void 0;let n=a.O(void 0,[96],()=>a(3731));n=a.O(n)})();
保存
返回