import{j as e,r as k,_ as s,b as ce,s as X}from"./wp-i18n-shim-DUX0OV_V.js";import{u as Ss,A as Ps}from"./ActionButton-Cr4Z2a1F.js";import{C as Ls}from"./CrudLayout-DRSWmVk9.js";import{F as B,T as q,a as Oe,b as D,E as Pe,c as Ne,S as bs,N as Fe,H as de,U as Ke,d as z,e as Ts}from"./Field-BWyeMycL.js";import{C as Ms}from"./Calender-GA8AQSPY.js";import{C as We}from"./CreditCard-m5nqt_RK.js";import{C as Ee}from"./Cogs-Cnkf43Xi.js";import{w as gs,C as Is}from"./withIconDefaults-BJCqj2oX.js";import{B as As,k as Es,A as _s,h as Fs,L as Ds,C as Rs,j as Ze,f as $s,u as Bs,R as Os,e as zs}from"./index-D01LF5Le.js";import{C as Hs,a as Vs,b as Gs,d as Ks,e as Ws,f as Zs}from"./command-Cf7PHIDr.js";import{P as qs,a as Ys,b as Us}from"./popover-D8UtFi-E.js";import{B as oe}from"./Button-BveKhP38.js";import{B as ps}from"./badge-DBj5X-b5.js";import{c as ae,a as De,X as ge}from"./utils-Bl0WAcve.js";import{C as xs}from"./Combination-BuKwnoTc.js";import{S as Qs}from"./switch-I41RT0Bn.js";import{L as hs}from"./label-CwRAQd0m.js";import{I as Xs}from"./input-Dw-69aYW.js";import{T as Ce}from"./time-picker-BSbsRgdR.js";import{D as fs}from"./date-picker-q5NTWWN-.js";import{f as ys,a as Js}from"./dateTimeFormat-yH4yHSCh.js";import{C as be}from"./calendar-Cz3-D5io.js";import{C as et,b as ks,V as js,S as st}from"./CalenderCheck-2TB2QVYq.js";import{P as te}from"./plus-WPVVS3Qe.js";import{P as tt}from"./ProUpgradeBanner-B_761Fa7.js";import{D as Re}from"./dollar-sign-Bnksw8VW.js";import{L as Le}from"./lock-ws9wrevH.js";import{C as vs}from"./crown-CcV7MJml.js";import{E as Te}from"./eye-BNq7Nif8.js";import{P as se}from"./ProBadge-CmJaWZjE.js";import{S as at,a as it,b as ot,c as nt,f as rt,C as lt}from"./select-BFNitOb0.js";import{E as ws}from"./external-link--Gk3o8ZG.js";import{a as K}from"./index-CLZ4-rw6.js";import{T as $e}from"./trash-2-CS5zm_gd.js";import{S as Ns}from"./save-BecwuxKD.js";import{G as dt}from"./grip-vertical-KUq1h8IO.js";import{C as qe}from"./checkbox-CQ-dG0Dh.js";import{S as ct}from"./separator-BQS_7xs6.js";import{S as _e}from"./skeleton-DfFmlQ5i.js";import{T as ut,a as mt,b as Ye,c as Ue}from"./tabs-7R76dlGV.js";import{P as Qe}from"./progress-CI0J5mUA.js";import"./apiConfig-BA13wrqF.js";import{D as Xe}from"./download-CulMzxYx.js";import{L as ne}from"./loader-circle-CcSu72zH.js";import{C as ze}from"./circle-alert-COuSc4NK.js";import{F as bt}from"./file-text-D1bHRDDM.js";import{C as Cs}from"./circle-check-Af-sR4AZ.js";import{u as re,s as U,a as Me}from"./store-rDqSxbzb.js";import{s as Be,e as Z}from"./toast-1-c8k_LJ.js";import{C as He}from"./ConfirmDialog-Bbm_78dn.js";import{S as gt}from"./shield-DVSNyXBB.js";import{I as pt}from"./ImageUpload-CcSoaEux.js";import{u as xt}from"./useMediaUploader-DCuR6epV.js";import{P as ht}from"./phone-input-BRAt4Ybc.js";import{v as Ve}from"./phoneValidation-RUqJw3r3.js";import"./vendor-DDjlQeP6.js";import"./ArrowLeftIcon-C8q2jgKs.js";import"./preload-helper-Dp1pzeXC.js";import"./tag-8m_NofXN.js";import"./proxy-CtW-P0pQ.js";import"./circle-check-big-Bxgqw2u9.js";import"./dialog-EtKUcLIM.js";import"./index-f2RCAr_u.js";import"./search-P9p39fmP.js";import"./index-Bl84CzKv.js";import"./scroll-area-JhQW4-1L.js";import"./format-KhiMdRwp.js";import"./index-CcfXrftP.js";import"./index-BrYiunaL.js";import"./lodash-Bd-B7UeG.js";import"./defineProperty-DbXIQDXj.js";import"./typeof-QjJsDpFa.js";/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ft=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],yt=ae("code-xml",ft);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kt=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],jt=ae("file-up",kt);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vt=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],wt=ae("key",vt);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nt=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Ct=ae("pencil",Nt);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const St=[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]],Pt=ae("percent",St);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lt=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Tt=ae("power",Lt);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mt=[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]],It=ae("refresh-ccw",Mt);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const At=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],Et=ae("shield-alert",At);function _t(){return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M16.667 0C18.5048 0.000176299 20 1.49512 20 3.33301V16.666C20 18.5039 18.5048 19.9998 16.667 20H3.33301C1.49516 19.9998 0 18.5039 0 16.666V3.33301C0 1.49512 1.49516 0.000176622 3.33301 0H16.667ZM1.33301 16.666C1.33301 17.7686 2.23049 18.6658 3.33301 18.666H9.33301V10.666H1.33301V16.666ZM10.667 18.666H16.667C17.7695 18.6658 18.667 17.7686 18.667 16.666V10.666H10.667V18.666ZM6.27637 12.7812C6.53703 12.5206 6.95808 12.5206 7.21875 12.7812C7.47917 13.0419 7.47934 13.463 7.21875 13.7236L6.27637 14.666L7.21875 15.6094C7.47933 15.87 7.47916 16.2911 7.21875 16.5518C7.08875 16.6818 6.91774 16.7471 6.74707 16.7471C6.57649 16.747 6.4063 16.6817 6.27637 16.5518L5.33301 15.6094L4.39062 16.5518C4.26063 16.6818 4.08961 16.7471 3.91895 16.7471C3.74841 16.747 3.57814 16.6817 3.44824 16.5518C3.18767 16.2911 3.18761 15.87 3.44824 15.6094L4.39062 14.666L3.44824 13.7236C3.1876 13.463 3.18766 13.0419 3.44824 12.7812C3.70891 12.5206 4.12996 12.5206 4.39062 12.7812L5.33301 13.7236L6.27637 12.7812ZM16.667 15.333C17.0355 15.3332 17.333 15.6321 17.333 16C17.3327 16.3677 17.0353 16.6658 16.667 16.666H12.667C12.2985 16.666 12.0003 16.3678 12 16C12 15.632 12.2983 15.333 12.667 15.333H16.667ZM16.667 12.666C17.0355 12.6662 17.333 12.9651 17.333 13.333C17.3329 13.7008 17.0355 13.9998 16.667 14H12.667C12.2984 14 12.0001 13.7009 12 13.333C12 12.965 12.2983 12.666 12.667 12.666H16.667ZM3.33301 1.33301C2.23049 1.33318 1.33301 2.23045 1.33301 3.33301V9.33301H9.33301V1.33301H3.33301ZM10.667 9.33301H18.667V3.33301C18.667 2.23045 17.7695 1.33318 16.667 1.33301H10.667V9.33301ZM5.33301 2.66602C5.70167 2.66602 6 2.96501 6 3.33301V4.66602H7.33301C7.70167 4.66602 8 4.96501 8 5.33301C7.99991 5.70093 7.70162 6 7.33301 6H6V7.33301C5.99991 7.70093 5.70162 8 5.33301 8C4.96455 7.99982 4.66708 7.70082 4.66699 7.33301V6H3.33301C2.96455 5.99982 2.66708 5.70082 2.66699 5.33301C2.66699 4.96512 2.96449 4.66619 3.33301 4.66602H4.66699V3.33301C4.66699 2.96512 4.96449 2.66619 5.33301 2.66602ZM16.667 4.66602C17.0355 4.66619 17.333 4.96512 17.333 5.33301C17.3329 5.70083 17.0355 5.99982 16.667 6H12.667C12.2984 6 12.0001 5.70093 12 5.33301C12 4.96501 12.2983 4.66602 12.667 4.66602H16.667Z",fill:"currentColor"})})}const Ft=gs(_t);function Dt(){return e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.84668 6.28027C1.55478 7.10616 1.40723 7.97453 1.40723 8.85938C1.40749 13.1239 4.87699 16.5938 9.1416 16.5938C10.7437 16.5937 12.2948 16.0934 13.5859 15.1875H11.915V13.7812H16.1338V18H14.7275V16.0928C13.139 17.3182 11.1752 17.9999 9.1416 18C4.08932 18 0.000263408 13.9109 0 8.85938C0 7.81465 0.175342 6.78918 0.520508 5.8125L1.84668 6.28027ZM9.7041 5.55469C10.1522 5.64605 10.5697 5.82289 10.9385 6.06738L11.9834 5.02246L12.9775 6.0166L11.9326 7.06152C12.1772 7.43042 12.354 7.84863 12.4453 8.29688H13.9229V9.70312H12.4453C12.3539 10.1512 12.1771 10.5687 11.9326 10.9375L12.9775 11.9824L11.9834 12.9766L10.9385 11.9316C10.5697 12.1761 10.1521 12.353 9.7041 12.4443V13.9219H8.29785V12.4443C7.84961 12.353 7.43139 12.1762 7.0625 11.9316L6.01758 12.9766L5.02344 11.9824L6.06836 10.9375C5.82387 10.5687 5.64703 10.1512 5.55566 9.70312H4.0791V8.29688H5.55566C5.647 7.84863 5.82378 7.43042 6.06836 7.06152L5.02344 6.0166L6.01758 5.02246L7.0625 6.06738C7.43139 5.8228 7.84964 5.64602 8.29785 5.55469V4.07812H9.7041V5.55469ZM3.27441 1.90527C4.86285 0.68029 6.82708 0 8.86035 0C13.9126 0.000263448 18.001 4.08905 18.001 9.14062C18.0009 10.1852 17.8255 11.21 17.4805 12.1865L16.1543 11.7188C16.4461 10.893 16.5947 10.0253 16.5947 9.14062C16.5947 4.87602 13.1249 1.40651 8.86035 1.40625C7.25807 1.40625 5.70636 1.90649 4.41504 2.8125H6.08691V4.21875H1.86816V0H3.27441V1.90527ZM9.00098 6.89062C7.83787 6.89062 6.8916 7.83689 6.8916 9C6.89187 10.1629 7.83803 11.1094 9.00098 11.1094C10.1637 11.1091 11.1101 10.1627 11.1104 9C11.1104 7.83705 10.1639 6.89089 9.00098 6.89062ZM9.00098 8.29688C9.38908 8.29714 9.7041 8.61184 9.7041 9C9.70384 9.38794 9.38891 9.70286 9.00098 9.70312C8.61281 9.70312 8.29812 9.3881 8.29785 9C8.29785 8.61167 8.61265 8.29688 9.00098 8.29688Z",fill:"currentColor"})})}const Rt=gs(Dt);function $t({tabs:a=[],activeTab:t,onTabChange:c}){const d=k.useMemo(()=>a.map(i=>i.id),[a]),o=k.useMemo(()=>d.includes(t)?[t]:[],[d,t]),r=k.useMemo(()=>a.filter(i=>o.includes(i.id)),[a,o]);return e.jsx("div",{className:"border border-border bg-white rounded-t-xl",children:r.map(i=>e.jsxs("div",{className:"relative flex items-center gap-3 px-6 py-4",children:[e.jsx("div",{className:"absolute left-0 top-1/2 -translate-y-1/2 w-[3px] h-8 bg-primary rounded-r-full"}),i.icon&&e.jsx("div",{className:"flex items-center justify-center w-9 h-9 rounded-lg bg-primary/8 text-primary",children:i.icon}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h2",{className:" text-[20px] font-semibold text-title leading-tight",children:i.title}),i.description&&e.jsx("p",{className:"text-xs text-title2 mt-0.5 leading-snug",children:i.description})]})]},i.id))})}function Bt(a){const t=document.createElement("textarea");return t.innerHTML=a,t.value}var ns,rs,ls,ds,cs,us,ms;const Je={tabs:[{id:"modules",title:s("Modules","radius-booking"),icon:e.jsx(As,{size:18})},{id:"general",title:s("General Settings","radius-booking"),icon:e.jsx(Ee,{})},{id:"schedule",title:s("Schedule Settings","radius-booking"),icon:e.jsx(Ms,{})},{id:"tax",title:s("Tax","radius-booking"),icon:e.jsx(Ee,{})},{id:"appointment-settings",title:s("Appointment Settings","radius-booking"),icon:e.jsx(Ft,{})},{id:"integrations",title:s("Integrations Settings","radius-booking"),icon:e.jsx(Rt,{})},{id:"payment",title:s("Payment Settings","radius-booking"),icon:e.jsx(We,{})},{id:"chatbot",title:s("AI Chatbot","radius-booking"),icon:e.jsx(Es,{size:18})},{id:"export-import",title:s("Export / Import","radius-booking"),icon:e.jsx(_s,{size:18})},...(ns=window.radius_booking_param)!=null&&ns.is_cl_active?[{id:"payout",title:s("Payout","radius-booking"),icon:e.jsx(We,{})}]:[],...(rs=window.radius_booking_param)!=null&&rs.is_pro?[{id:"license",title:s("License","radius-booking"),icon:e.jsx(Ee,{})}]:[]],sections:[{id:"currency",tab:"general",title:s("Currency & Price","radius-booking"),description:s("Symbol placement and number formatting","radius-booking"),cols:3,fields:[{key:"currency.symbol",type:"select2",label:s("Currency symbol","radius-booking"),options:Object.entries(window.radius_booking_param.currency_symbol).map(([a,t])=>({value:a,label:`${a} (${Bt(t)})`})),gridColumn:1},{key:"currency.symbolPosition",label:s("Symbol position","radius-booking"),type:"select",options:[{value:"before",label:s("Before price","radius-booking")},{value:"after",label:s("After price","radius-booking")},{value:"before_with_space",label:s("Before with space","radius-booking")},{value:"after_with_space",label:s("After with space","radius-booking")}],gridColumn:1},{key:"currency.decimals",label:s("Number of decimals","radius-booking"),type:"number",min:0,max:4,gridColumn:1},{key:"currency.thousand",label:s("Thousand separator","radius-booking"),type:"select",options:[{value:",",label:s("Comma (1,000)","radius-booking")},{value:".",label:s("Dot (1.000)","radius-booking")},{value:" ",label:s("Space (1 000)","radius-booking")}],gridColumn:2},{key:"currency.decimal",label:s("Decimal separator","radius-booking"),type:"select",options:[{value:".",label:s("Dot (0.99)","radius-booking")},{value:",",label:s("Comma (0,99)","radius-booking")}],gridColumn:2}]},{id:"phone",tab:"general",title:s("Phone Settings","radius-booking"),description:s("Country detection and validation","radius-booking"),fields:[{key:"phone.showAllCountries",label:s("Countries shown in phone field","radius-booking"),type:"select",options:[{value:!0,label:s("Show all countries","radius-booking")},{value:!1,label:s("Show only selected countries","radius-booking")}],gridColumn:1},{key:"phone.showOnlyCountries",label:s("Select countries available for phone number field","radius-booking"),type:"select2",options:(ls=window.radius_booking_param)==null?void 0:ls.country,multiple:!0,gridColumn:1,condition:{key:"phone.showAllCountries",value:!1}},{key:"phone.defaultCountry",label:s("Default Country","radius-booking"),type:"select2",options:(ds=window.radius_booking_param)==null?void 0:ds.country,dependency:"showOnlyCountries",gridColumn:1},{key:"phone.formatOnInput",label:s("Format phone number on input","radius-booking"),type:"toggle"},{key:"phone.showDialCode",label:s("Show country dial code next to flag","radius-booking"),type:"toggle"}]},{id:"auth",tab:"general",title:s("Authentication","radius-booking"),description:s("Customer accounts and login options","radius-booking"),fields:[{key:"auth.useWordPressUsers",label:s("Auto-create users on appointment confirmation","radius-booking"),type:"toggle"},{key:"auth.allowCustomerRegistration",label:s("Customer can register for an account","radius-booking"),type:"toggle"}]},{id:"pages",tab:"general",title:s("Setup Pages","radius-booking"),description:s("Select the pages that contain booking shortcodes","radius-booking"),fields:[{key:"pages.bookingFormPage",label:s("Booking Form Page","radius-booking"),type:"select2",options:((cs=window.radius_booking_param)==null?void 0:cs.wp_pages)||[],hint:s("Page containing [radius_booking_form] shortcode","radius-booking"),gridColumn:1},{key:"pages.myBookingPage",label:s("My Booking Page","radius-booking"),type:"select2",options:((us=window.radius_booking_param)==null?void 0:us.wp_pages)||[],hint:s("Page containing [rtrb_my_booking] shortcode","radius-booking"),gridColumn:1}]},{id:"business",tab:"general",title:s("Business Information","radius-booking"),description:s("Used across your communications and calendar","radius-booking"),fields:[{key:"business.companyName",label:s("Company Name","radius-booking"),type:"text",placeholder:s("Company Name","radius-booking"),gridColumn:1},{key:"business.phone",label:s("Business Phone","radius-booking"),type:"phone",placeholder:"(555) 555-5555",gridColumn:1},{key:"business.address",label:s("Business Address","radius-booking"),type:"text",placeholder:s("Street, City, State, ZIP","radius-booking"),gridColumn:1},{key:"business.logoUrl",label:s("Company Logo URL","radius-booking"),type:"image",placeholder:"https://..."}]},{id:"email",tab:"general",title:s("Email Settings","radius-booking"),description:s("Configure the sender details for all outgoing emails","radius-booking"),fields:[{key:"email.senderName",type:"text",label:s("Sender Name","radius-booking"),placeholder:s("e.g. My Booking System","radius-booking"),hint:s("Leave empty to use Company Name or site name","radius-booking"),gridColumn:1},{key:"email.senderEmail",type:"text",label:s("Sender Email","radius-booking"),placeholder:s("e.g. noreply@example.com","radius-booking"),hint:s("Leave empty to use WordPress admin email","radius-booking"),gridColumn:1},{key:"email.replyToEmail",type:"text",label:s("Reply-to Email","radius-booking"),placeholder:s("e.g. support@example.com","radius-booking"),hint:s("Leave empty to use Sender Email","radius-booking"),gridColumn:1}]},{id:"datetime",tab:"schedule",title:s("Date & Time","radius-booking"),description:s("Set formats and intervals for scheduling","radius-booking"),fields:[{key:"dateTime.timeSystem",label:s("Time system","radius-booking"),type:"select",options:[{value:"12h",label:s("12-hour clock","radius-booking")},{value:"24h",label:s("24-hour clock","radius-booking")}],gridColumn:1},{key:"dateTime.dateFormat",label:s("Date format","radius-booking"),type:"select",options:[{value:"Y-m-d",label:`${new Date().getFullYear()}-${String(new Date().getMonth()+1).padStart(2,"0")}-${String(new Date().getDate()).padStart(2,"0")} (yyyy-mm-dd)`},{value:"F j, Y",label:`${new Date().toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})} (F j, Y)`},{value:"m/d/Y",label:`${String(new Date().getMonth()+1).padStart(2,"0")}/${String(new Date().getDate()).padStart(2,"0")}/${new Date().getFullYear()} (mm/dd/yyyy)`},{value:"Y/m/d",label:`${new Date().getFullYear()}/${String(new Date().getMonth()+1).padStart(2,"0")}/${String(new Date().getDate()).padStart(2,"0")} (yyyy/mm/dd)`},{value:"Y.m.d",label:`${new Date().getFullYear()}.${String(new Date().getMonth()+1).padStart(2,"0")}.${String(new Date().getDate()).padStart(2,"0")} (yyyy.mm.dd)`}],gridColumn:1},{key:"dateTime.selectableInterval",label:s("Default Time Duration Step (minutes)","radius-booking"),type:"number",min:5,step:5,gridColumn:1}]},{id:"restrictions",tab:"schedule",title:s("Booking Restrictions","radius-booking"),description:s("Limit how far in advance customers can book","radius-booking"),cols:2,fields:[{key:"restrictions.earliest",label:s("Minimum time before booking","radius-booking"),type:"text",placeholder:s("e.g. +1 hour, +30 minutes","radius-booking"),hint:s('Use "+1 month", "+2 weeks", "+5 days", "+3 hours", "+30 minutes" or a fixed date YYYY-MM-DD.',"radius-booking"),gridColumn:1},{key:"restrictions.latest",label:s("Period available for booking in advance","radius-booking"),type:"text",placeholder:s("e.g. +6 months or 2025-12-31","radius-booking"),gridColumn:1},{key:"restrictions.minCancelTime",label:s("Minimum time required before canceling","radius-booking"),type:"text",placeholder:s("e.g. +24 hours","radius-booking"),hint:s('Use "+24 hours", "+2 days", etc.',"radius-booking"),gridColumn:1},{key:"restrictions.minRescheduleTime",label:s("Minimum time required before rescheduling","radius-booking"),type:"text",placeholder:s("e.g. +12 hours","radius-booking"),hint:s('Use "+12 hours", "+1 day", etc.',"radius-booking"),gridColumn:1}]},{id:"weekly-schedule",tab:"schedule",title:s("General Weekly Schedule","radius-booking"),description:s("Set default working hours for each day","radius-booking"),component:"custom",render:()=>null},{id:"custom-schedules",tab:"schedule",title:s("Days With Custom Schedules","radius-booking"),description:s("Override weekly schedule for specific dates","radius-booking"),component:"custom",render:()=>null},{id:"holidays",tab:"schedule",title:s("Holidays & Days Off","radius-booking"),description:s("Mark dates as unavailable for booking","radius-booking"),component:"custom",render:()=>null},{id:"configure-tax",tab:"tax",title:s("Configure Tax","radius-booking"),description:s("Configure tax calculation for bookings","radius-booking"),isPro:!0,fields:[{key:"tax.enabled",label:s("Enable Tax","radius-booking"),type:"toggle",position:"top"},{key:"tax.label",label:s("Tax Label","radius-booking"),type:"text",placeholder:s("e.g., VAT, GST, Sales Tax","radius-booking"),condition:{key:"tax.enabled",value:!0}},{key:"tax.rate",label:s("Tax Rate (%)","radius-booking"),type:"number",min:0,step:.1,condition:{key:"tax.enabled",value:!0}},{key:"tax.inclusive",label:s("Prices include tax","radius-booking"),type:"toggle",description:s("Enable if your service prices already include tax","radius-booking"),condition:{key:"tax.enabled",value:!0}}]},{id:"offline-payment",tab:"payment",title:s("Offline Payment","radius-booking"),description:s("Accept cash, check, or other offline payment methods","radius-booking"),component:"custom"},{id:"paypal",tab:"payment",title:s("PayPal","radius-booking"),description:s("Accept payments via PayPal","radius-booking"),component:"custom"},{id:"stripe",tab:"payment",title:s("Stripe","radius-booking"),description:s("Accept credit card payments via Stripe","radius-booking"),component:"custom"},{id:"service-list",tab:"appointment-settings",title:s("Service List Shortcode","radius-booking"),description:s("Configure the [rtrb_service_list] shortcode display","radius-booking"),cols:2,fields:[{key:"serviceList.layout",label:s("Default Layout","radius-booking"),type:"select",options:[{value:"grid",label:s("Grid","radius-booking")},{value:"list",label:s("List","radius-booking")}],gridColumn:1},{key:"serviceList.columns",label:s("Grid Columns","radius-booking"),type:"select",options:[{value:2,label:s("2 Columns","radius-booking")},{value:3,label:s("3 Columns","radius-booking")},{value:4,label:s("4 Columns","radius-booking")}],gridColumn:1},{key:"serviceList.perPage",label:s("Services Per Page","radius-booking"),type:"number",min:3,max:50,gridColumn:1},{key:"serviceList.buttonText",label:s("Book Button Text","radius-booking"),type:"text",placeholder:s("Book Now","radius-booking"),gridColumn:1},{key:"serviceList.primaryColor",label:s("Primary Color","radius-booking"),type:"color",gridColumn:2},{key:"serviceList.cardRadius",label:s("Card Border Radius","radius-booking"),type:"unit",units:["px","rem","em"],placeholder:"12",gridColumn:2},{key:"serviceList.showImage",label:s("Show service image","radius-booking"),type:"toggle"},{key:"serviceList.showPrice",label:s("Show service price","radius-booking"),type:"toggle"},{key:"serviceList.showDuration",label:s("Show service duration","radius-booking"),type:"toggle"},{key:"serviceList.showCategory",label:s("Show category badge","radius-booking"),type:"toggle"},{key:"serviceList.showDescription",label:s("Show service description","radius-booking"),type:"toggle"},{key:"serviceList.showCategoryFilter",label:s("Show category filter","radius-booking"),type:"toggle"},{key:"serviceList.showStaff",label:s("Show assigned staff","radius-booking"),type:"toggle"}]},{id:"statuses",tab:"appointment-settings",title:s("Statuses","radius-booking"),description:s("Configure default and auxiliary statuses for appointments","radius-booking"),fields:[{key:"statuses.default",label:s("Default appointment status","radius-booking"),type:"select",options:[{value:"confirmed",label:s("Confirmed","radius-booking")},{value:"pending",label:s("Pending","radius-booking")},{value:"canceled",label:s("Canceled","radius-booking")},{value:"completed",label:s("Completed","radius-booking")}],gridColumn:1}]},{id:"customer",tab:"appointment-settings",title:s("Customer Settings","radius-booking"),description:s("Rescheduling and cancellations","radius-booking"),isPro:!0,fields:[{key:"customer.allowReschedule",label:s("Allow customers to reschedule","radius-booking"),type:"toggle"},{key:"customer.allowCancel",label:s("Allow customers to cancel their bookings","radius-booking"),type:"toggle"}]},{id:"google-calendar-integration",tab:"integrations",title:s("Google Calendar","radius-booking"),description:s("Sync appointments with Google Calendar","radius-booking"),component:"custom"},{id:"zoom-integration",tab:"integrations",title:s("Zoom","radius-booking"),description:s("Create and manage Zoom meetings for appointments","radius-booking"),component:"custom"},{id:"apple-calendar-integration",tab:"integrations",title:s("Apple Calendar","radius-booking"),description:s("Generate iCal files for Apple Calendar sync","radius-booking"),component:"custom"},{id:"classified-listing-integration",tab:"integrations",title:s("Classified Listing","radius-booking"),description:s("Turn classified listings into bookable services","radius-booking"),component:"custom"},{id:"chatbot-general",tab:"chatbot",title:s("General Settings","radius-booking"),description:s("Configure your AI booking assistant","radius-booking"),isPro:!0,fields:[{key:"chatbot.enabled",label:s("Enable AI Chatbot","radius-booking"),type:"toggle",position:"top"},{key:"chatbot.showFormToggle",label:s("Enable AI/Classic Toggle in Appointment","radius-booking"),type:"toggle",hint:s("Show a toggle in the appointment form to switch between AI Booking and Classic Form.","radius-booking"),condition:{key:"chatbot.enabled",value:!0}},{key:"chatbot.provider",label:s("AI Provider","radius-booking"),type:"select",options:[{value:"openai",label:s("OpenAI (GPT)","radius-booking")},{value:"gemini",label:s("Google Gemini","radius-booking")}],gridColumn:1},{key:"chatbot.apiKey",label:s("OpenAI API Key","radius-booking"),type:"password",placeholder:"sk-...",hint:s("Your OpenAI API key. Never shared with the browser.","radius-booking"),gridColumn:1,condition:{key:"chatbot.provider",value:"openai"}},{key:"chatbot.model",label:s("OpenAI Model","radius-booking"),type:"select",options:[{value:"gpt-4o-mini",label:s("GPT-4o Mini (Fast & Affordable)","radius-booking")},{value:"gpt-4o",label:s("GPT-4o (Most Capable)","radius-booking")},{value:"gpt-3.5-turbo",label:s("GPT-3.5 Turbo (Legacy)","radius-booking")}],gridColumn:1,condition:{key:"chatbot.provider",value:"openai"}},{key:"chatbot.geminiApiKey",label:s("Gemini API Key","radius-booking"),type:"password",placeholder:"AIza...",hint:s("Your Google Gemini API key. Get one at aistudio.google.com","radius-booking"),gridColumn:1,condition:{key:"chatbot.provider",value:"gemini"}},{key:"chatbot.geminiModel",label:s("Gemini Model","radius-booking"),type:"select",options:[{value:"gemini-2.5-pro",label:s("Gemini 2.5 Pro (Most Capable - Stable)","radius-booking")},{value:"gemini-2.5-flash",label:s("Gemini 2.5 Flash (Balanced - Stable)","radius-booking")},{value:"gemini-2.5-flash-lite",label:s("Gemini 2.5 Flash Lite (Fast & Cost-Efficient)","radius-booking")},{value:"gemini-3.1-pro-preview",label:s("Gemini 3.1 Pro (Next-Gen Preview)","radius-booking")},{value:"gemini-3-flash-preview",label:s("Gemini 3 Flash (Fastest Reasoning Preview)","radius-booking")}],gridColumn:1,condition:{key:"chatbot.provider",value:"gemini"}},{key:"chatbot.responseStyle",label:s("Response Style","radius-booking"),type:"select",options:[{value:"modern",label:s("Modern (Rich Cards & UI)","radius-booking")},{value:"text",label:s("Text Only (Plain Messages)","radius-booking")}],gridColumn:1},{key:"chatbot.botName",label:s("Bot Name","radius-booking"),type:"text",placeholder:s("Booking Assistant","radius-booking"),gridColumn:1},{key:"chatbot.welcomeMessage",label:s("Welcome Message","radius-booking"),type:"textarea",placeholder:s("Hi! How can I help you today?","radius-booking"),rows:3,gridColumn:1}]},{id:"chatbot-display",tab:"chatbot",title:s("Display Settings","radius-booking"),description:s("Control where the chatbot appears","radius-booking"),isPro:!0,fields:[{key:"chatbot.displayMode",label:s("Display Mode","radius-booking"),type:"select",options:[{value:"all_pages",label:s("All Pages","radius-booking")},{value:"booking_pages",label:s("Booking Pages Only","radius-booking")},{value:"specific_pages",label:s("Specific Pages","radius-booking")}],gridColumn:1},{key:"chatbot.specificPages",label:s("Select Pages","radius-booking"),type:"select2",options:((ms=window.radius_booking_param)==null?void 0:ms.wp_pages)||[],multiple:!0,gridColumn:1,condition:{key:"chatbot.displayMode",value:"specific_pages"}}]},{id:"chatbot-appearance",tab:"chatbot",title:s("Appearance & Live Preview","radius-booking"),description:s("Customize the chatbot look and see changes in real time","radius-booking"),component:"custom",isPro:!0,fields:[{key:"chatbot.bubbleIcon",label:s("Bubble Icon","radius-booking"),type:"select",options:[{value:"chat",label:s("Chat Bubble","radius-booking")},{value:"headset",label:s("Headset / Support","radius-booking")},{value:"bot",label:s("Robot / AI","radius-booking")},{value:"help",label:s("Help Circle","radius-booking")},{value:"custom",label:s("Custom Image","radius-booking"),isPro:!0}]},{key:"chatbot.bubbleImage",label:s("Custom Icon Image","radius-booking"),type:"image",isPro:!0,condition:{key:"chatbot.bubbleIcon",value:"custom"}},{key:"chatbot.primaryColor",label:s("Primary Color","radius-booking"),type:"color"},{key:"chatbot.position",label:s("Widget Position","radius-booking"),type:"select",options:[{value:"bottom-right",label:s("Bottom Right","radius-booking")},{value:"bottom-left",label:s("Bottom Left","radius-booking")}]},{key:"chatbot.poweredBy",label:s("Powered By Text","radius-booking"),type:"text",isPro:!0,placeholder:s("Powered by Radius Booking","radius-booking"),hint:s("Leave empty to hide. Shown at the bottom of the chat window.","radius-booking"),proText:s("To update the text, Please upgrade to the Pro version.","radius-booking")}]},{id:"chatbot-knowledge",tab:"chatbot",title:s("Knowledge Base","radius-booking"),description:s("Manage FAQs and policies the chatbot can reference","radius-booking"),component:"custom",isPro:!0},{id:"chatbot-advanced",tab:"chatbot",title:s("Advanced Settings","radius-booking"),description:s("Fine-tune the AI model behavior","radius-booking"),isPro:!0,fields:[{key:"chatbot.maxTokens",label:s("Max Tokens","radius-booking"),type:"number",min:256,max:4096,step:128,hint:s("Maximum length of the AI response.","radius-booking"),gridColumn:1},{key:"chatbot.temperature",label:s("Temperature","radius-booking"),type:"number",min:0,max:2,step:.1,hint:s("Higher values make output more creative, lower values more focused.","radius-booking"),gridColumn:1}]},{id:"payout-settings",tab:"payout",title:s("Payout Configuration","radius-booking"),description:s("Configure commission rates, minimum payout amounts, and available payout methods for employees","radius-booking"),component:"custom",isPro:!0},{id:"languages",tab:"localization",title:s("Manage Languages","radius-booking"),description:s("Available languages for your booking system","radius-booking"),component:"custom",render:()=>null}]};function Ot({options:a,value:t,onChange:c,multiple:d=!1,className:o=""}){const[r,i]=k.useState(!1),u=l=>d?Array.isArray(t)&&t.includes(l):t===l,m=l=>{if(d){const p=Array.isArray(t)?t:[],v=p.includes(l)?p.filter(h=>h!==l):[...p,l];c(v)}else c(l),i(!1)},g=(l,p)=>{l.stopPropagation(),d&&Array.isArray(t)&&c(t.filter(v=>v!==p))},b=()=>{if(d){const p=Array.isArray(t)?t:[];return p.length===0?e.jsx("span",{className:"text-muted-foreground",children:s("Select countries","radius-booking")}):e.jsx("div",{className:"flex flex-wrap gap-1",children:p.map(v=>{const h=a.find(P=>P.value===v);return e.jsxs(ps,{variant:"secondary",className:"mr-1 mb-1",children:[(h==null?void 0:h.label)||v,e.jsx("span",{role:"button",tabIndex:0,className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer hover:bg-muted",onMouseDown:P=>P.preventDefault(),onClick:P=>g(P,v),onKeyDown:P=>{(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),g(P,v))},children:e.jsx(ge,{className:"h-3 w-3"})})]},v)})})}const l=a.find(p=>p.value===t);return(l==null?void 0:l.label)||e.jsx("span",{className:"text-muted-foreground",children:s("Select country","radius-booking")})};return e.jsxs(qs,{open:r,onOpenChange:i,children:[e.jsx(Ys,{asChild:!0,children:e.jsxs(oe,{variant:"outline",role:"combobox","aria-expanded":r,className:De("w-[250px] justify-between h-[45px] shadow-none w-full",o,d&&"h-auto min-h-[40px]"),children:[e.jsx("div",{className:"flex-1 text-left",children:b()}),e.jsx(Hs,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(Us,{className:"w-[250px] p-0 max-h-60 overflow-y-auto",children:e.jsxs(Vs,{children:[e.jsx(Gs,{className:"!border-none !focus:outline-none !focus:border-none !shadow-none",placeholder:s("Search ...","radius-booking")}),e.jsx(Ks,{children:s("No country found.","radius-booking")}),e.jsx(Ws,{children:a.map(l=>e.jsxs(Zs,{onSelect:()=>m(l.value),children:[e.jsx(xs,{className:De("mr-2 h-4 w-4",u(l.value)?"opacity-100":"opacity-0")}),l.label]},l.value))})]})})]})}function zt({settings:a,onUpdate:t}){const c=[{key:"monday",label:s("Monday","radius-booking"),short:s("Mon","radius-booking")},{key:"tuesday",label:s("Tuesday","radius-booking"),short:s("Tue","radius-booking")},{key:"wednesday",label:s("Wednesday","radius-booking"),short:s("Wed","radius-booking")},{key:"thursday",label:s("Thursday","radius-booking"),short:s("Thu","radius-booking")},{key:"friday",label:s("Friday","radius-booking"),short:s("Fri","radius-booking")},{key:"saturday",label:s("Saturday","radius-booking"),short:s("Sat","radius-booking")},{key:"sunday",label:s("Sunday","radius-booking"),short:s("Sun","radius-booking")}],d=(r,i)=>{t(`weeklySchedule.${r}.enabled`,i)},o=(r,i,u)=>{t(`weeklySchedule.${r}.${i}`,u)};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-[1fr_60px_1fr_1fr] gap-3 items-center px-4 py-2.5 bg-slate-50 rounded-lg text-xs font-semibold text-slate-500 uppercase tracking-wider",children:[e.jsx("span",{children:s("Day","radius-booking")}),e.jsx("span",{className:"text-center",children:s("Open","radius-booking")}),e.jsx("span",{children:s("Opens at","radius-booking")}),e.jsx("span",{children:s("Closes at","radius-booking")})]}),c.map(r=>{var m;const i=((m=a.weeklySchedule)==null?void 0:m[r.key])||{enabled:!0,start:"08:00",end:"17:00"},u=r.key==="saturday"||r.key==="sunday";return e.jsxs("div",{className:`grid grid-cols-[1fr_60px_1fr_1fr] gap-3 items-center px-4 py-3 rounded-lg border transition-all duration-200 ${i.enabled?"border-slate-200 bg-white shadow-sm":"border-transparent bg-slate-50/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-8 h-8 rounded-lg flex items-center justify-center text-xs font-bold ${i.enabled?u?"bg-orange-50 text-orange-600":"bg-blue-50 text-[#1d4ed8]":"bg-slate-100 text-slate-400"}`,children:r.short}),e.jsx(hs,{className:`text-sm font-medium ${i.enabled?"text-slate-900":"text-slate-400"}`,children:r.label})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(Qs,{checked:i.enabled,onCheckedChange:g=>d(r.key,g)})}),e.jsx(Ce,{value:i.start||"08:00",onChange:g=>o(r.key,"start",g),maxTime:i.end,disabled:!i.enabled,className:"w-full"}),e.jsx(Ce,{value:i.end||"17:00",onChange:g=>o(r.key,"end",g),minTime:i.start,disabled:!i.enabled,className:"w-full"})]},r.key)})]})}function Ht({settings:a,onUpdate:t}){const[c,d]=k.useState(!1),[o,r]=k.useState({date:"",start:"08:00",end:"17:00",label:""}),i=a.customSchedules||[],u=()=>{if(!o.date){alert(s("Please select a date","radius-booking"));return}const l=[...i,{...o,id:Date.now()}];t("customSchedules",l),r({date:"",start:"08:00",end:"17:00",label:""}),d(!1)},m=l=>{const p=i.filter(v=>v.id!==l);t("customSchedules",p)},g=l=>ys(l),b=l=>Js(l);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[i.length===0&&!c&&e.jsxs("div",{className:"rounded-lg border border-dashed border-slate-300 bg-slate-50 p-8 text-center",children:[e.jsx(be,{className:"mx-auto h-8 w-8 text-slate-400 mb-2"}),e.jsx("p",{className:"text-sm text-small-font",children:s("No custom schedules yet","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:s("Override your weekly schedule for specific dates","radius-booking")})]}),i.map(l=>e.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-border bg-white p-4 transition-all hover:border-slate-300",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(be,{className:"h-4 w-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-title",children:g(l.date)})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-600",children:[e.jsx(et,{className:"h-3.5 w-3.5 text-slate-400"}),e.jsxs("span",{children:[b(l.start)," - ",b(l.end)]}),l.label&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-300",children:"•"}),e.jsx("span",{className:"text-small-font",children:l.label})]})]})]}),e.jsx("button",{onClick:()=>m(l.id),className:"rounded-md p-2 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-600",title:s("Remove schedule","radius-booking"),children:e.jsx(ge,{className:"h-4 w-4"})})]},l.id))]}),c?e.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Date","radius-booking")}),e.jsx(fs,{date:o.date,setDate:l=>r({...o,date:l||""}),placeholder:s("Select date","radius-booking")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Label (optional)","radius-booking")}),e.jsx("input",{type:"text",value:o.label,onChange:l=>r({...o,label:l.target.value}),placeholder:s("e.g., Holiday hours","radius-booking"),className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Start Time","radius-booking")}),e.jsx(Ce,{value:o.start,onChange:l=>r({...o,start:l}),maxTime:o.end,className:"w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("End Time","radius-booking")}),e.jsx(Ce,{value:o.end,onChange:l=>r({...o,end:l}),minTime:o.start,className:"w-full"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:()=>{d(!1),r({date:"",start:"08:00",end:"17:00",label:""})},className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:s("Cancel","radius-booking")}),e.jsx("button",{onClick:u,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-semibold text-white shadow hover:bg-blue-700",children:s("Add Schedule","radius-booking")})]})]}):e.jsxs("button",{onClick:()=>d(!0),className:"flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-slate-300 bg-white px-4 py-3 text-sm font-medium text-slate-600 transition-colors hover:border-blue-300 hover:bg-blue-50 hover:text-blue-600",children:[e.jsx(te,{className:"h-4 w-4"}),s("Add Custom Schedule","radius-booking")]})]})}function Vt({settings:a,onUpdate:t}){const[c,d]=k.useState(!1),[o,r]=k.useState({date:"",label:""}),i=a.holidays||[],u=()=>{if(!o.date){alert(s("Please select a date","radius-booking"));return}const b=[...i,{...o,id:Date.now()}];t("holidays",b),r({date:"",label:""}),d(!1)},m=b=>{const l=i.filter(p=>p.id!==b);t("holidays",l)},g=b=>ys(b);return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[i.length===0&&!c&&e.jsxs("div",{className:"rounded-lg border border-dashed border-slate-300 bg-slate-50 p-8 text-center",children:[e.jsx(be,{className:"mx-auto h-8 w-8 text-slate-400 mb-2"}),e.jsx("p",{className:"text-sm text-small-font",children:s("No holidays or days off yet","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-400 mt-1",children:s("Mark dates as unavailable for booking","radius-booking")})]}),i.map(b=>e.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-red-200 bg-red-50 p-4 transition-all hover:border-red-300",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(be,{className:"h-4 w-4 text-red-600"}),e.jsx("span",{className:"text-sm font-medium text-title",children:g(b.date)})]}),b.label&&e.jsx("p",{className:"text-sm text-slate-600 ml-6",children:b.label})]}),e.jsx("button",{onClick:()=>m(b.id),className:"rounded-md p-2 text-red-400 transition-colors hover:bg-red-100 hover:text-red-600",title:s("Remove holiday","radius-booking"),children:e.jsx(ge,{className:"h-4 w-4"})})]},b.id))]}),c?e.jsxs("div",{className:"rounded-lg border border-red-200 bg-red-50 p-4 space-y-3",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Date","radius-booking")}),e.jsx(fs,{date:o.date,setDate:b=>r({...o,date:b||""}),placeholder:s("Select date","radius-booking")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Label (optional)","radius-booking")}),e.jsx("input",{type:"text",value:o.label,onChange:b=>r({...o,label:b.target.value}),placeholder:s("e.g., Christmas Day","radius-booking"),className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-red-200"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx("button",{onClick:()=>{d(!1),r({date:"",label:""})},className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:s("Cancel","radius-booking")}),e.jsx("button",{onClick:u,className:"rounded-md bg-red-600 px-3 py-1.5 text-sm font-semibold text-white shadow hover:bg-red-700",children:s("Add Holiday","radius-booking")})]})]}):e.jsxs("button",{onClick:()=>d(!0),className:"flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-slate-300 bg-white px-4 py-3 text-sm font-medium text-slate-600 transition-colors hover:border-red-300 hover:bg-red-50 hover:text-red-600",children:[e.jsx(te,{className:"h-4 w-4"}),s("Add Holiday / Day Off","radius-booking")]})]})}function Gt({settings:a,onUpdate:t}){const[c,d]=k.useState(!1),[o,r]=k.useState(""),i=a.languages||[],u=()=>{if(!o.trim()){alert(s("Please enter a language name","radius-booking"));return}if(i.includes(o.trim())){alert(s("This language is already added","radius-booking"));return}const g=[...i,o.trim()];t("languages",g),r(""),d(!1)},m=g=>{const b=i.filter(l=>l!==g);t("languages",b)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[i.length===0&&!c&&e.jsx("div",{className:"rounded-lg border border-dashed border-slate-300 bg-slate-50 p-8 text-center",children:e.jsx("p",{className:"text-sm text-small-font",children:s("No languages configured","radius-booking")})}),i.map((g,b)=>e.jsxs("div",{className:"flex items-center gap-4 rounded-lg border border-border bg-white p-4 transition-all hover:border-slate-300",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-100",children:e.jsx("span",{className:"text-sm font-medium text-blue-700",children:g.charAt(0).toUpperCase()})}),e.jsx("span",{className:"text-sm font-medium text-title",children:g})]}),e.jsx("button",{onClick:()=>m(g),className:"rounded-md p-2 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-600",title:s("Remove language","radius-booking"),children:e.jsx(ge,{className:"h-4 w-4"})})]},b))]}),c?e.jsxs("div",{className:"rounded-lg border border-blue-200 bg-blue-50 p-4 space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Language Name","radius-booking")}),e.jsx("input",{type:"text",value:o,onChange:g=>r(g.target.value),placeholder:s("e.g., Spanish, French, Bengali","radius-booking"),className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200",onKeyDown:g=>g.key==="Enter"&&u()})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:()=>{d(!1),r("")},className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:s("Cancel","radius-booking")}),e.jsx("button",{onClick:u,className:"rounded-md bg-primary px-3 py-1.5 text-sm font-semibold text-white shadow hover:bg-blue-700",children:s("Add Language","radius-booking")})]})]}):e.jsxs("button",{onClick:()=>d(!0),className:"flex w-full items-center justify-center gap-2 rounded-md border border-dashed border-slate-300 bg-white px-4 py-3 text-sm font-medium text-slate-600 transition-colors hover:border-blue-300 hover:bg-blue-50 hover:text-blue-600",children:[e.jsx(te,{className:"h-4 w-4"}),s("Add Language","radius-booking")]})]})}function Ge(a){var v,h,P;const{title:t,description:c,icon:d,enabled:o,testMode:r,onToggleEnabled:i,onToggleTestMode:u,children:m,isPro:g=!1,disabled:b=!1}=a,l={bg:"bg-[#F5FAFF]",border:"border-blue-200",badge:"bg-primary"},p=b||g&&!((v=window.radius_booking_param)!=null&&v.is_pro);return e.jsxs("div",{className:`rounded-lg border ${o&&!p?l.border:"border-border"} ${o&&!p?l.bg:"bg-lighter-2"} p-6 transition-all ${p?"opacity-60":""}`,children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${o&&!p?l.badge:"bg-[#DFEEFB]"}`,children:e.jsx(d,{className:`h-5 w-5 ${o&&!p?"text-white":"text-primary"}`})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold text-title",children:t}),g&&!((h=window.radius_booking_param)!=null&&h.is_pro)&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gradient-to-r from-amber-400 to-orange-500 px-2 py-0.5 text-xs font-semibold text-white shadow-sm",children:[e.jsx(vs,{className:"h-3 w-3"}),"PRO"]})]}),e.jsx("p",{className:"text-sm text-slate-600",children:c}),p&&g&&e.jsx("p",{className:"text-xs text-amber-600 mt-1 font-medium",children:s("Upgrade to PRO to use this payment gateway","radius-booking")})]})]}),(t==="PayPal"||t==="Offline Payment")&&e.jsx(D,{checked:o,onChange:i,label:"",disabled:p,boxStyle:!1}),t==="Stripe"&&((P=window.radius_booking_param)==null?void 0:P.is_pro)&&e.jsx(D,{checked:o,onChange:i,label:"",boxStyle:!1,disabled:p})]}),o&&!p&&e.jsxs(e.Fragment,{children:[r!==void 0&&e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-md border border-border bg-white p-3",children:[e.jsx(D,{checked:r,onChange:u,label:"",boxStyle:!1,variant:"square",checkedBg:"bg-amber-500",unCheckedBg:"bg-primary"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-title2",children:r?s("Test Mode","radius-booking"):s("Live Mode","radius-booking")}),e.jsx(ps,{variant:`${r?"borer":"default"}`,className:"rounded-full px-2 py-0.5 text-xs font-medium",children:r?s("Sandbox","radius-booking"):s("Production","radius-booking")})]}),e.jsx("p",{className:"text-xs text-small-font mt-0.5",children:r?s("No real transactions will be processed","radius-booking"):s("Real transactions will be processed","radius-booking")})]})]}),e.jsx("div",{className:"space-y-4",children:m})]}),!o&&!p&&e.jsx("p",{className:"text-sm text-small-font italic",children:s("Enable this payment method to configure settings","radius-booking")}),p&&g&&e.jsx(tt,{title:t,type:"Payment"})]})}function Se({value:a,onChange:t,placeholder:c,label:d,isVisible:o,onToggleVisible:r,disabled:i=!1}){return e.jsxs("div",{children:[d&&e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:d}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:o?"text":"password",value:a||"",onChange:u=>t(u.target.value),placeholder:c,disabled:i,className:"w-full rounded-md border border-border bg-white px-3 py-2 pr-10 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"}),e.jsx("button",{type:"button",onClick:r,disabled:i,className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 hover:text-slate-600 disabled:opacity-50 disabled:cursor-not-allowed",children:o?e.jsx(Pe,{className:"h-4 w-4"}):e.jsx(Te,{className:"h-4 w-4"})})]})]})}function Kt({settings:a,onUpdate:t}){var d;const c=((d=a.payment)==null?void 0:d.offline)||{};return e.jsxs(Ge,{title:s("Offline Payment","radius-booking"),description:s("Accept cash, check, or other offline methods","radius-booking"),icon:Re,enabled:c.enabled,onToggleEnabled:o=>t("payment.offline.enabled",o),isPro:!1,children:[e.jsx(B,{label:s("Payment method label","radius-booking"),children:e.jsx(q,{value:c.label||"",onChange:o=>t("payment.offline.label",o.target.value),placeholder:s("e.g., Pay at venue, Cash on delivery","radius-booking")})}),e.jsx(B,{label:s("Payment instructions","radius-booking"),children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(Oe,{value:c.instructions||"",onChange:o=>t("payment.offline.instructions",o.target.value),placeholder:s("Instructions shown to customers after booking...","radius-booking"),rows:4}),e.jsx("p",{className:"mt-1 text-xs text-small-font",children:s("These instructions will be displayed on the confirmation page","radius-booking")})]})})]})}function Wt({settings:a,onUpdate:t}){var i,u;const[c,d]=ce.useState({liveClient:!1,liveSecret:!1,testClient:!1,testSecret:!1}),o=((i=a.payment)==null?void 0:i.paypal)||{},r=o.testMode;return(u=window.radius_booking_param)!=null&&u.is_pro,e.jsx(Ge,{title:s("PayPal","radius-booking"),description:s("Accept payments via PayPal","radius-booking"),icon:ks,enabled:o.enabled,testMode:o.testMode,onToggleEnabled:m=>t("payment.paypal.enabled",m),onToggleTestMode:m=>t("payment.paypal.testMode",m),children:e.jsxs("div",{className:`space-y-4 rounded-md border p-4 ${r?"border-amber-200 bg-amber-50":"border-green-200 bg-green-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Le,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:r?s("Test Credentials (Sandbox)","radius-booking"):s("Live Credentials","radius-booking")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(Se,{label:r?s("Test Client ID","radius-booking"):s("Live Client ID","radius-booking"),value:r?o.testClientId:o.liveClientId,onChange:m=>t(r?"payment.paypal.testClientId":"payment.paypal.liveClientId",m),placeholder:r?s("Enter your PayPal sandbox client ID","radius-booking"):s("Enter your PayPal live client ID","radius-booking"),isVisible:r?c.testClient:c.liveClient,onToggleVisible:()=>d(m=>({...m,[r?"testClient":"liveClient"]:!m[r?"testClient":"liveClient"]}))}),e.jsx(Se,{label:r?s("Test Secret Key","radius-booking"):s("Live Secret Key","radius-booking"),value:r?o.testSecretKey:o.liveSecretKey,onChange:m=>t(r?"payment.paypal.testSecretKey":"payment.paypal.liveSecretKey",m),placeholder:r?s("Enter your PayPal sandbox secret key","radius-booking"):s("Enter your PayPal live secret key","radius-booking"),isVisible:r?c.testSecret:c.liveSecret,onToggleVisible:()=>d(m=>({...m,[r?"testSecret":"liveSecret"]:!m[r?"testSecret":"liveSecret"]}))})]})]})})}function Zt({settings:a,onUpdate:t}){var u,m;const[c,d]=ce.useState({livePublishable:!1,liveSecret:!1,testPublishable:!1,testSecret:!1}),o=((u=a.payment)==null?void 0:u.stripe)||{},r=o.testMode,i=((m=window.radius_booking_param)==null?void 0:m.is_pro)||!1;return e.jsxs(Ge,{title:s("Stripe","radius-booking"),description:s("Accept credit card payments","radius-booking"),icon:ks,enabled:o.enabled,testMode:o.testMode,onToggleEnabled:g=>t("payment.stripe.enabled",g),onToggleTestMode:g=>t("payment.stripe.testMode",g),isPro:!0,children:[e.jsxs("div",{className:`space-y-4 rounded-md border p-4 ${r?"border-amber-200 bg-amber-50":"border-green-200 bg-green-50"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Le,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:r?s("Test Credentials","radius-booking"):s("Live Credentials","radius-booking")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[e.jsx(Se,{label:r?s("Test Publishable Key","radius-booking"):s("Live Publishable Key","radius-booking"),value:r?o.testPublishableKey:o.livePublishableKey,onChange:g=>t(r?"payment.stripe.testPublishableKey":"payment.stripe.livePublishableKey",g),placeholder:`pk_${r?"test":"live"}_...`,isVisible:r?c.testPublishable:c.livePublishable,onToggleVisible:()=>d(g=>({...g,[r?"testPublishable":"livePublishable"]:!g[r?"testPublishable":"livePublishable"]})),disabled:!i}),e.jsx(Se,{label:r?s("Test Secret Key","radius-booking"):s("Live Secret Key","radius-booking"),value:r?o.testSecretKey:o.liveSecretKey,onChange:g=>t(r?"payment.stripe.testSecretKey":"payment.stripe.liveSecretKey",g),placeholder:`sk_${r?"test":"live"}_...`,isVisible:r?c.testSecret:c.liveSecret,onToggleVisible:()=>d(g=>({...g,[r?"testSecret":"liveSecret"]:!g[r?"testSecret":"liveSecret"]})),disabled:!i})]})]}),i&&e.jsx("button",{onClick:()=>t("payment.stripe.testMode",!o.testMode),className:"text-sm text-blue-600 hover:text-blue-700 underline",children:r?s("Switch to Live credentials","radius-booking"):s("Switch to Test credentials","radius-booking")})]})}function Ie(a){var p,v,h;const{title:t,description:c,icon:d,enabled:o,onToggleEnabled:r,children:i,docsLink:u,isPro:m=!1,disabled:g=!1}=a,b={bg:"bg-[#F5FAFF]",border:"border-blue-200",badge:"bg-primary"},l=g||m&&!((p=window.radius_booking_param)!=null&&p.is_pro);return e.jsxs("div",{className:`rounded-lg border ${o&&!l?b.border:"border-border"} ${o&&!l?b.bg:"bg-lighter-2"} p-6 transition-all ${l?"opacity-60":""}`,children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${o&&!l?b.badge:"bg-[#DFEEFB]"}`,children:e.jsx(d,{className:`h-5 w-5 ${o&&!l?"text-white":"text-primary"}`})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h3",{className:"text-base font-semibold text-title",children:t}),m&&!((v=window.radius_booking_param)!=null&&v.is_pro)&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-gradient-to-r from-amber-400 to-orange-500 px-2 py-0.5 text-xs font-semibold text-white shadow-sm",children:[e.jsx(vs,{className:"h-3 w-3"}),"PRO"]})]}),e.jsx("p",{className:"text-sm text-slate-600",children:c}),l&&m&&e.jsx("p",{className:"text-xs text-amber-600 mt-1 font-medium",children:s("Upgrade to PRO to use this integration","radius-booking")}),l&&!m&&g&&e.jsx("p",{className:"text-xs text-amber-600 mt-1 font-medium",children:s("Please install and activate the Classified Listing plugin to use this integration","radius-booking")})]})]}),t==="Google Calendar"&&e.jsx(D,{checked:o,onChange:r,label:"",disabled:l,boxStyle:!1}),(t==="Apple Calendar"||t==="Zoom")&&((h=window.radius_booking_param)==null?void 0:h.is_pro)&&e.jsx(D,{checked:o,onChange:r,label:"",boxStyle:!1}),t==="Classified Listing"&&e.jsx(D,{checked:!l&&o,onChange:l?()=>{}:r,label:"",boxStyle:!1})]}),u&&o&&!l&&e.jsxs("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"mb-4 inline-flex items-center gap-1 text-xs text-blue-600 hover:text-blue-700",children:[e.jsx(ws,{className:"h-3 w-3"}),s("View setup documentation","radius-booking")]}),o&&!l&&e.jsx("div",{className:"space-y-4",children:i}),!o&&!l&&e.jsx("p",{className:"text-sm text-small-font italic",children:s("Enable this integration to configure settings","radius-booking")})]})}function ye({value:a,onChange:t,placeholder:c,label:d,isVisible:o,onToggleVisible:r,disabled:i=!1}){return e.jsxs("div",{children:[d&&e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:d}),e.jsxs("div",{className:"relative max-w-[600px]",children:[e.jsx("input",{type:o?"text":"password",value:a||"",onChange:u=>t(u.target.value),placeholder:c,disabled:i,className:"w-full rounded-md border border-border bg-white px-3 py-2 pr-10 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"}),e.jsx("button",{type:"button",onClick:r,disabled:i,className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 hover:text-slate-600 disabled:opacity-50 disabled:cursor-not-allowed",children:o?e.jsx(Pe,{className:"h-4 w-4"}):e.jsx(Te,{className:"h-4 w-4"})})]})]})}function qt({settings:a,onUpdate:t}){var i,u;const[c,d]=ce.useState({apiKey:!1,apiSecret:!1,sdkKey:!1,sdkSecret:!1}),o=((i=a.integrations)==null?void 0:i.zoom)||{},r=((u=window.radius_booking_param)==null?void 0:u.is_pro)||!1;return e.jsxs(Ie,{title:s("Zoom","radius-booking"),description:s("Create and manage Zoom meetings for appointments","radius-booking"),icon:js,enabled:o.enabled,onToggleEnabled:m=>t("integrations.zoom.enabled",m),docsLink:"https://marketplace.zoom.us/docs/guides",isPro:!0,children:[e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Le,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:s("API Credentials","radius-booking")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(ye,{label:s("Account ID","radius-booking"),value:o.accountId,onChange:m=>t("integrations.zoom.accountId",m),placeholder:s("Enter your Zoom Account ID","radius-booking"),isVisible:c.accountId,onToggleVisible:()=>d(m=>({...m,accountId:!m.accountId})),disabled:!r}),e.jsx(ye,{label:s("Client ID","radius-booking"),value:o.clientId,onChange:m=>t("integrations.zoom.clientId",m),placeholder:s("Enter your Zoom Client ID","radius-booking"),isVisible:c.clientId,onToggleVisible:()=>d(m=>({...m,clientId:!m.clientId})),disabled:!r}),e.jsx(ye,{label:s("Client Secret","radius-booking"),value:o.clientSecret,onChange:m=>t("integrations.zoom.clientSecret",m),placeholder:s("Enter your Zoom Client Secret","radius-booking"),isVisible:c.clientSecret,onToggleVisible:()=>d(m=>({...m,clientSecret:!m.clientSecret})),disabled:!r})]})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-3",children:[e.jsx(D,{checked:o.requirePassword,onChange:m=>t("integrations.zoom.requirePassword",m),label:s("Require password for Zoom meetings","radius-booking"),disabled:!r}),e.jsx(D,{checked:o.enableWaitingRoom,onChange:m=>t("integrations.zoom.enableWaitingRoom",m),label:s("Enable waiting room for meetings","radius-booking"),disabled:!r}),e.jsx(D,{checked:o.sendInviteEmail,onChange:m=>t("integrations.zoom.sendInviteEmail",m),label:s("Send Zoom meeting invite to customers","radius-booking"),disabled:!r})]}),e.jsx(B,{label:s("Default meeting duration (minutes)","radius-booking"),children:e.jsx("input",{type:"number",value:o.defaultDuration||60,onChange:m=>t("integrations.zoom.defaultDuration",Number(m.target.value)),min:"15",step:"15",disabled:!r,className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"})})]})}function Yt({settings:a,onUpdate:t,onSave:c}){var b;const[d,o]=ce.useState({clientId:!1,clientSecret:!1}),[r,i]=ce.useState(!1),u=((b=a.integrations)==null?void 0:b.googleCalendar)||{},m=ce.useMemo(()=>!u.clientId||!u.redirectUri?"":"https://accounts.google.com/o/oauth2/v2/auth?"+new URLSearchParams({client_id:u.clientId,redirect_uri:u.redirectUri,response_type:"code",scope:"https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/calendar.events",access_type:"offline",prompt:"consent",state:u.oauth_nonce||""}).toString(),[u.clientId,u.redirectUri,u.oauth_nonce]),g=async l=>{if(l.preventDefault(),!(!m||r))try{i(!0),await c(),window.location.href=m}catch{i(!1)}};return e.jsx(Ie,{title:s("Google Calendar","radius-booking"),description:s("Sync appointments with Google Calendar","radius-booking"),icon:be,enabled:u.enabled,onToggleEnabled:l=>t("integrations.googleCalendar.enabled",l),docsLink:"https://developers.google.com/calendar/api/guides/overview",isPro:!1,children:e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(Le,{className:"h-4 w-4 text-slate-600"}),e.jsx("span",{className:"text-sm font-medium text-title2",children:s("OAuth 2.0 Credentials","radius-booking")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(ye,{label:s("Client ID","radius-booking"),value:u.clientId,onChange:l=>t("integrations.googleCalendar.clientId",l),placeholder:s("Enter your Google OAuth Client ID","radius-booking"),isVisible:d.clientId,onToggleVisible:()=>o(l=>({...l,clientId:!l.clientId}))}),e.jsx(ye,{label:s("Client Secret","radius-booking"),value:u.clientSecret,onChange:l=>t("integrations.googleCalendar.clientSecret",l),placeholder:s("Enter your Google OAuth Client Secret","radius-booking"),isVisible:d.clientSecret,onToggleVisible:()=>o(l=>({...l,clientSecret:!l.clientSecret}))}),e.jsx(B,{label:s("Redirect URI","radius-booking"),className:"max-w-[600px]",children:e.jsx(q,{value:u.redirectUri||"",onChange:l=>t("integrations.googleCalendar.redirectUri",l.target.value),placeholder:"https://yourdomain.com/oauth/callback",disabled:!0})}),u.clientId&&u.redirectUri&&u.clientSecret&&m&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-indigo-200",children:[e.jsxs("button",{type:"button",onClick:g,disabled:r,className:"inline-flex items-center gap-2 px-4 py-2 bg-indigo-600 text-white text-sm font-medium rounded-md hover:bg-indigo-700 transition-colors disabled:opacity-60 cursor-pointer disabled:cursor-wait",children:[e.jsx(ws,{className:"h-4 w-4"}),r?s("Saving & Redirecting...","radius-booking"):s("Configure Google Calendar Access","radius-booking")]}),e.jsx("p",{className:"mt-2 text-xs text-slate-600",children:s("Settings will be saved automatically before redirecting to Google","radius-booking")})]})]})]})})}function Ut({settings:a,onUpdate:t}){var o,r;const c=((o=a.integrations)==null?void 0:o.appleCalendar)||{},d=((r=window.radius_booking_param)==null?void 0:r.is_pro)||!1;return e.jsx(Ie,{title:s("Apple Calendar","radius-booking"),description:s("Generate iCal files for Apple Calendar sync","radius-booking"),icon:be,enabled:c.enabled,onToggleEnabled:i=>t("integrations.appleCalendar.enabled",i),isPro:!0,children:e.jsxs("div",{className:"rounded-md border border-border bg-white p-4 space-y-4",children:[e.jsx("p",{className:"text-sm text-slate-600",children:s("Apple Calendar integration works via iCal (.ics) files. Enable this to allow customers to download calendar files or subscribe to calendar feeds.","radius-booking")}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:[e.jsx(D,{checked:c.showDownloadLink,onChange:i=>t("integrations.appleCalendar.showDownloadLink",i),label:s('Show "Add to Apple Calendar" download link',"radius-booking"),disabled:!d}),e.jsx(D,{checked:c.includeLocation,onChange:i=>t("integrations.appleCalendar.includeLocation",i),label:s("Include location details in calendar events","radius-booking"),disabled:!d}),e.jsx(D,{checked:c.includeDescription,onChange:i=>t("integrations.appleCalendar.includeDescription",i),label:s("Include appointment details in calendar events","radius-booking"),disabled:!d}),e.jsx(D,{checked:c.addReminders,onChange:i=>t("integrations.appleCalendar.addReminders",i),label:s("Add reminders to calendar events","radius-booking"),disabled:!d})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-x-3",children:[c.addReminders&&d&&e.jsx(B,{label:s("Reminder time before appointment (minutes)","radius-booking"),children:e.jsx("input",{type:"number",value:c.reminderMinutes||60,onChange:i=>t("integrations.appleCalendar.reminderMinutes",Number(i.target.value)),min:"0",step:"15",className:"w-full rounded-md border border-border bg-white px-3 py-2 text-sm text-title focus:outline-none focus:ring-2 focus:ring-blue-200"})}),e.jsx(B,{label:s("Calendar Name","radius-booking"),children:e.jsx("div",{className:"flex flex-col w-full",children:e.jsx(q,{value:c.calendarName||"",onChange:i=>t("integrations.appleCalendar.calendarName",i.target.value),placeholder:s("My Business Appointments","radius-booking"),disabled:!d})})}),e.jsx(B,{label:s("Organizer Email","radius-booking"),children:e.jsx("div",{className:"flex flex-col w-full",children:e.jsx(q,{value:c.organizerEmail||"",onChange:i=>t("integrations.appleCalendar.organizerEmail",i.target.value),placeholder:"bookings@yourbusiness.com",disabled:!d,type:"email"})})})]})]})})}function Qt({settings:a,onUpdate:t}){var b,l,p,v;const c=((b=a.integrations)==null?void 0:b.classifiedListing)||{},d=a.staffPermissions||{},o=!!((l=window.radius_booking_param)!=null&&l.is_pro),i=(c.listingMappingMode||"service")==="staff",u=!!((p=window.radius_booking_param)!=null&&p.is_cl_active),m=((v=a==null?void 0:a.dateTime)==null?void 0:v.selectableInterval)||30,g=k.useMemo(()=>{const h=Math.max(5,Number(m)||30),P=480,f=[];for(let n=h;n<=P;n+=h){const j=Math.floor(n/60),S=n%60;let L;j===0?L=`${S} ${s("minutes","radius-booking")}`:S===0?L=j===1?s("1 hour","radius-booking"):`${j} ${s("hours","radius-booking")}`:L=`${j} ${j>1?s("hours","radius-booking"):s("hour","radius-booking")} ${S} ${s("minutes","radius-booking")}`,f.push({value:String(n),label:L})}return f},[m]);return e.jsxs(Ie,{title:s("Classified Listing","radius-booking"),description:s("Turn classified listings into bookable services or staff members","radius-booking"),icon:Fs,enabled:c.enabled,onToggleEnabled:h=>t("integrations.classifiedListing.enabled",h),disabled:!u,children:[e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"text-sm font-medium text-title2",children:s("Listing Mapping Mode","radius-booking")})}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:[e.jsxs("label",{className:`flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-all ${i?"border-border bg-white hover:border-slate-300":"border-primary bg-[#F5FAFF]"}`,children:[e.jsx("input",{type:"radio",name:"listingMappingMode",value:"service",checked:!i,onChange:()=>t("integrations.classifiedListing.listingMappingMode","service"),className:"mt-0.5 accent-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-title",children:s("Listing as Service","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:s("Each listing becomes a bookable service. The listing owner becomes the staff member.","radius-booking")})]})]}),e.jsxs("label",{className:`flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-all ${i?"border-primary bg-[#F5FAFF]":"border-border bg-white hover:border-slate-300"}`,children:[e.jsx("input",{type:"radio",name:"listingMappingMode",value:"staff",checked:i,onChange:()=>t("integrations.classifiedListing.listingMappingMode","staff"),className:"mt-0.5 accent-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-title",children:s("Listing as Staff","radius-booking")}),e.jsx("p",{className:"text-xs text-slate-500 mt-0.5",children:s("Each listing becomes a staff member. A shared default service is used for all bookings.","radius-booking")})]})]})]})]}),e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsx("div",{className:"flex items-center gap-2 mb-2",children:e.jsx("span",{className:"text-sm font-medium text-title2",children:s("Integration Settings","radius-booking")})}),!i&&e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:[e.jsx(D,{checked:c.syncPrice,onChange:h=>t("integrations.classifiedListing.syncPrice",h),label:s("Sync price from listing","radius-booking")}),e.jsx(D,{checked:c.syncDescription,onChange:h=>t("integrations.classifiedListing.syncDescription",h),label:s("Sync description from listing","radius-booking")})]}),i&&e.jsx("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:e.jsx(D,{checked:c.syncPrice,onChange:h=>t("integrations.classifiedListing.syncPrice",h),label:s("Use listing price as staff rate","radius-booking")})}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-4",children:[i&&e.jsx(B,{label:s("Default Service Name","radius-booking"),children:e.jsx(q,{value:c.defaultServiceName||s("Consultation","radius-booking"),onChange:h=>t("integrations.classifiedListing.defaultServiceName",h.target.value),placeholder:s("Consultation","radius-booking")})}),e.jsx(B,{label:s("Default Duration","radius-booking"),children:e.jsxs(at,{value:String(c.defaultDuration||60),onValueChange:h=>t("integrations.classifiedListing.defaultDuration",Number(h)),children:[e.jsx(it,{className:"w-full bg-white",children:e.jsx(ot,{placeholder:s("Select duration","radius-booking")})}),e.jsx(nt,{children:g.map(h=>e.jsx(rt,{value:h.value,children:h.label},h.value))})]})}),e.jsx(B,{label:s("Book Now Button Text","radius-booking"),children:e.jsx(q,{value:c.bookNowButtonText||s("Book Now","radius-booking"),onChange:h=>t("integrations.classifiedListing.bookNowButtonText",h.target.value),placeholder:s("Book Now","radius-booking")})})]})]}),e.jsx("div",{className:"mt-3 p-3 rounded-md bg-blue-50 border border-blue-100",children:e.jsx("p",{className:"text-xs text-blue-700",children:i?s('In "Listing as Staff" mode, each listing with booking enabled will create a staff member using the listing title and image. All staff share a single default service for bookings.',"radius-booking"):s('When enabled, a "Radius Booking" meta box will appear on each listing edit screen. Listing owners can check "Enable Booking" to make their listing bookable. The listing will be synced as a service in Radius Booking automatically.',"radius-booking")})}),e.jsxs("div",{className:"rounded-md border border-blue-200 bg-white p-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-title2",children:s("Seller Permissions","radius-booking")}),e.jsx("span",{className:"text-xs text-slate-500",children:s("— Control what sellers can do from their dashboard","radius-booking")})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-2 gap-3",children:[e.jsx(D,{checked:!!d.canEditService,onChange:h=>t("staffPermissions.canEditService",h),label:s("Seller can edit their services","radius-booking")}),e.jsx("div",{className:o?"":"pointer-events-none select-none opacity-60",children:e.jsx(D,{checked:!!d.canDeleteService,onChange:h=>t("staffPermissions.canDeleteService",h),label:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{children:s("Seller can delete their services","radius-booking")}),!o&&e.jsx(se,{})]})})}),e.jsx("div",{className:o?"":"pointer-events-none select-none opacity-60",children:e.jsx(D,{checked:!!d.canManageStaff,onChange:h=>t("staffPermissions.canManageStaff",h),label:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{children:s("Seller can manage staff members","radius-booking")}),!o&&e.jsx(se,{})]})})}),e.jsx("div",{className:o?"":"pointer-events-none select-none opacity-60",children:e.jsx(D,{checked:!!d.canEditWorkSchedule,onChange:h=>t("staffPermissions.canEditWorkSchedule",h),label:e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{children:s("Seller can update their work schedule","radius-booking")}),!o&&e.jsx(se,{})]})})})]})]})]})}const je="/radius-booking/v1/chatbot/knowledge";function Xt(){const[a,t]=k.useState([]),[c,d]=k.useState(!0),[o,r]=k.useState(null),[i,u]=k.useState({question:"",answer:"",category:"general"}),[m,g]=k.useState(!1),b=k.useCallback(async()=>{try{d(!0);const f=await K({path:je});t(f.data||[])}catch{}finally{d(!1)}},[]);k.useEffect(()=>{b()},[b]);const l=()=>{u({question:"",answer:"",category:"general"}),r(null),g(!1)},p=f=>{u({question:f.question,answer:f.answer,category:f.category||"general"}),r(f.id),g(!0)},v=async()=>{if(!(!i.question.trim()||!i.answer.trim()))try{o?await K({path:`${je}/${o}`,method:"PUT",data:i}):await K({path:je,method:"POST",data:i}),l(),b()}catch{}},h=async f=>{if(window.confirm(s("Are you sure you want to delete this entry?","radius-booking")))try{await K({path:`${je}/${f}`,method:"DELETE"}),b()}catch{}},P={policy:"bg-blue-100 text-blue-700",payment:"bg-green-100 text-green-700",general:"bg-gray-100 text-gray-700",hours:"bg-yellow-100 text-yellow-700"};return c?e.jsx("div",{className:"py-6 text-center text-sm text-gray-400",children:s("Loading knowledge base...","radius-booking")}):e.jsxs("div",{className:"space-y-4",children:[a.length>0&&e.jsx("div",{className:"border border-border rounded-lg divide-y divide-border",children:a.map(f=>{var n;return e.jsxs("div",{className:"flex items-start justify-between gap-4 p-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium text-sm text-title2 truncate",children:f.question}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded text-xs font-medium ${P[f.category]||P.general}`,children:f.category})]}),e.jsx("p",{className:"text-sm text-gray-500 line-clamp-2",children:f.answer})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>p(f),className:"p-1.5 rounded hover:bg-slate-100 text-gray-400 hover:text-gray-600",title:s("Edit","radius-booking"),children:e.jsx(Ct,{size:14})}),!((n=f.id)!=null&&n.startsWith("default-"))&&e.jsx("button",{onClick:()=>h(f.id),className:"p-1.5 rounded hover:bg-red-50 text-gray-400 hover:text-red-500",title:s("Delete","radius-booking"),children:e.jsx($e,{size:14})})]})]},f.id)})}),a.length===0&&!m&&e.jsx("div",{className:"py-8 text-center text-sm text-gray-400",children:s("No knowledge base entries yet. Add your first FAQ.","radius-booking")}),m&&e.jsxs("div",{className:"border border-border rounded-lg p-4 space-y-3 bg-slate-50",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h4",{className:"text-sm font-medium text-title2",children:o?s("Edit Entry","radius-booking"):s("Add New Entry","radius-booking")}),e.jsx("button",{onClick:l,className:"p-1 rounded hover:bg-slate-200 text-gray-400",children:e.jsx(ge,{size:16})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:s("Question","radius-booking")}),e.jsx("input",{type:"text",value:i.question,onChange:f=>u({...i,question:f.target.value}),className:"w-full rounded-md border border-border px-3 py-2 text-sm",placeholder:s("e.g. What are your business hours?","radius-booking")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:s("Answer","radius-booking")}),e.jsx("textarea",{value:i.answer,onChange:f=>u({...i,answer:f.target.value}),rows:3,className:"w-full rounded-md border border-border px-3 py-2 text-sm",placeholder:s("Provide the answer the chatbot should give...","radius-booking")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-gray-600 mb-1",children:s("Category","radius-booking")}),e.jsxs("select",{value:i.category,onChange:f=>u({...i,category:f.target.value}),className:"rounded-md border border-border px-3 py-2 text-sm",children:[e.jsx("option",{value:"general",children:s("General","radius-booking")}),e.jsx("option",{value:"policy",children:s("Policy","radius-booking")}),e.jsx("option",{value:"payment",children:s("Payment","radius-booking")}),e.jsx("option",{value:"hours",children:s("Hours","radius-booking")})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx("button",{onClick:l,className:"rounded-md border border-border bg-white px-3 py-1.5 text-sm text-gray-600 hover:bg-slate-50",children:s("Cancel","radius-booking")}),e.jsxs("button",{onClick:v,disabled:!i.question.trim()||!i.answer.trim(),className:"rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-white hover:bg-blue-700 disabled:opacity-50 flex items-center gap-1.5",children:[e.jsx(Ns,{size:14}),o?s("Update","radius-booking"):s("Save","radius-booking")]})]})]}),!m&&e.jsxs("button",{onClick:()=>g(!0),className:"flex items-center gap-1.5 rounded-md border border-dashed border-border px-3 py-2 text-sm text-gray-500 hover:text-primary hover:border-primary transition-colors",children:[e.jsx(te,{size:16}),s("Add Knowledge Entry","radius-booking")]})]})}function Jt({settings:a,onChange:t}){const c=!!(a!=null&&a.enabled),d=(a==null?void 0:a.commissionType)||"percentage",o=(a==null?void 0:a.commissionRate)??0,r=(a==null?void 0:a.minimumPayoutAmount)??50,i=(a==null?void 0:a.payoutMethods)||{},[u,m]=k.useState(null),[g,b]=k.useState(""),[l,p]=k.useState(""),[v,h]=k.useState(!1),P=(y,N,M)=>{const A={...i,[y]:{...i[y],[N]:M}};t("payoutMethods",A)},f=(y,N)=>{P(y,"fields",N)},n=y=>{var M;const N=((M=i[y])==null?void 0:M.fields)||[];f(y,[...N,{key:"",label:"",type:"text"}])},j=(y,N,M,A)=>{var I;const x=[...((I=i[y])==null?void 0:I.fields)||[]];x[N]={...x[N],[M]:A},x[N].key=A.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,""),f(y,x)},S=(y,N)=>{var A;const M=[...((A=i[y])==null?void 0:A.fields)||[]];M.splice(N,1),f(y,M)},L=y=>{var N;P(y,"enabled",!((N=i[y])!=null&&N.enabled))},R=()=>{if(!g.trim()||!l.trim())return;const y=g.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"");if(i[y])return;const N={...i,[y]:{enabled:!0,label:l.trim(),description:"",fields:[]}};t("payoutMethods",N),b(""),p(""),h(!1),m(y)},C=y=>{const N={...i};delete N[y],t("payoutMethods",N),u===y&&m(null)},$=y=>{m(u===y?null:y)},H=Object.entries(i);return e.jsxs("div",{className:"space-y-8",children:[e.jsx("div",{className:`rounded-lg border p-5 transition-all ${c?"border-green-200 bg-green-50/30":"border-border bg-lighter-2"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg transition-colors ${c?"bg-green-500":"bg-slate-200"}`,children:e.jsx(Tt,{className:`h-5 w-5 ${c?"text-white":"text-slate-400"}`})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:s("Enable Payouts","radius-booking")}),e.jsx("p",{className:"text-xs text-small-font",children:c?s("Employees can view their balance and request payouts.","radius-booking"):s("Payout feature is disabled. Employees will not see payout options.","radius-booking")})]})]}),e.jsx(D,{checked:c,onChange:y=>t("enabled",y),label:"",boxStyle:!1})]})}),e.jsxs("div",{className:`space-y-8 ${c?"":"pointer-events-none select-none opacity-40"}`,children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(Pt,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:s("Commission","radius-booking")}),e.jsx("p",{className:"text-xs text-small-font",children:s("Deduct a fee from each employee payout","radius-booking")})]})]}),e.jsxs(Ne,{cols:3,children:[e.jsx(B,{label:s("Commission Type","radius-booking"),children:e.jsx(bs,{value:d,onChange:y=>t("commissionType",y.target.value),options:[{value:"percentage",label:s("Percentage (%)","radius-booking")},{value:"fixed",label:s("Fixed Amount","radius-booking")}]})}),e.jsx(B,{label:d==="percentage"?s("Rate (%)","radius-booking"):s("Amount","radius-booking"),children:e.jsx(Fe,{value:o,onChange:y=>t("commissionRate",parseFloat(y.target.value)||0),min:0,step:d==="percentage"?.1:1,placeholder:"0"})}),e.jsx(B,{label:s("Minimum Payout Amount","radius-booking"),children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(Fe,{value:r,onChange:y=>t("minimumPayoutAmount",parseFloat(y.target.value)||0),min:0,placeholder:"50"}),e.jsx(de,{children:s("Employees must request at least this amount.","radius-booking")})]})})]})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-primary/10",children:e.jsx(Re,{className:"h-4 w-4 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:s("Payout Methods","radius-booking")}),e.jsx("p",{className:"text-xs text-small-font",children:s("Methods employees can use to receive payouts","radius-booking")})]})]}),!v&&e.jsxs("button",{type:"button",onClick:()=>h(!0),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-primary bg-primary/5 hover:bg-primary/10 border border-primary/20 rounded-lg transition-colors",children:[e.jsx(te,{className:"w-3.5 h-3.5"}),s("Add Method","radius-booking")]})]}),e.jsxs("div",{className:"space-y-3",children:[H.map(([y,N])=>{const M=u===y,A=!!N.enabled;return e.jsxs("div",{className:`rounded-lg border transition-all ${A?"border-border bg-white":"border-border/60 bg-slate-50/50"}`,children:[e.jsxs("div",{className:"flex items-center gap-3 p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(dt,{className:"w-4 h-4 text-slate-300 shrink-0"}),e.jsx(D,{checked:A,onChange:()=>L(y),label:"",boxStyle:!1}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`text-sm font-medium truncate ${A?"text-title":"text-slate-400"}`,children:N.label||y}),e.jsx("span",{className:"text-[10px] font-mono text-slate-300 bg-slate-100 px-1.5 py-0.5 rounded shrink-0",children:y})]}),!M&&N.description&&e.jsx("p",{className:"text-xs text-slate-400 truncate mt-0.5",children:N.description})]})]}),e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>$(y),className:"p-1.5 text-slate-400 hover:text-slate-600 hover:bg-slate-100 rounded-md transition-colors",title:M?s("Collapse","radius-booking"):s("Edit","radius-booking"),children:M?e.jsx(lt,{className:"w-4 h-4"}):e.jsx(Is,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>C(y),className:"p-1.5 text-slate-300 hover:text-red-500 hover:bg-red-50 rounded-md transition-colors",title:s("Remove method","radius-booking"),children:e.jsx($e,{className:"w-4 h-4"})})]})]}),M&&e.jsx("div",{className:"px-4 pb-4 pt-0 border-t border-border/50 mt-0",children:e.jsxs("div",{className:"space-y-4 pt-4",children:[e.jsx(B,{label:s("Label","radius-booking"),children:e.jsx(q,{value:N.label||"",onChange:x=>P(y,"label",x.target.value),placeholder:s("e.g. Bank Transfer","radius-booking")})}),e.jsx(B,{label:s("Description","radius-booking"),children:e.jsx(Oe,{value:N.description||"",onChange:x=>P(y,"description",x.target.value),placeholder:s("Describe this payout method for employees...","radius-booking"),rows:2})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("label",{className:"text-xs font-medium text-title2",children:s("Required Fields","radius-booking")}),e.jsxs("button",{type:"button",onClick:()=>n(y),className:"inline-flex items-center gap-1 px-2 py-1 text-[11px] font-medium text-primary bg-primary/5 hover:bg-primary/10 border border-primary/20 rounded-md transition-colors",children:[e.jsx(te,{className:"w-3 h-3"}),s("Add Field","radius-booking")]})]}),e.jsx("p",{className:"text-[11px] text-slate-400 mb-2",children:s("Define what information staff need to provide for this method.","radius-booking")}),(N.fields||[]).length>0?e.jsx("div",{className:"space-y-2",children:(N.fields||[]).map((x,I)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1",children:e.jsx(q,{value:x.label||"",onChange:T=>j(y,I,"label",T.target.value),placeholder:s("Field label (e.g. Account Number)","radius-booking")})}),e.jsx("span",{className:"text-[10px] font-mono text-slate-300 bg-slate-100 px-1.5 py-1 rounded shrink-0 min-w-[60px] text-center",children:x.key||s("auto","radius-booking")}),e.jsx("button",{type:"button",onClick:()=>S(y,I),className:"p-1.5 text-slate-300 hover:text-red-500 hover:bg-red-50 rounded-md transition-colors shrink-0",title:s("Remove field","radius-booking"),children:e.jsx($e,{className:"w-3.5 h-3.5"})})]},I))}):e.jsx("p",{className:"text-[11px] text-slate-400 italic",children:s("No fields configured. Staff won't need to provide details for this method.","radius-booking")})]})]})})]},y)}),H.length===0&&!v&&e.jsxs("div",{className:"rounded-lg border border-dashed border-slate-200 p-8 text-center",children:[e.jsx(Re,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),e.jsx("p",{className:"text-sm text-slate-500 mb-3",children:s("No payout methods configured","radius-booking")}),e.jsxs("button",{type:"button",onClick:()=>h(!0),className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-primary bg-primary/5 hover:bg-primary/10 border border-primary/20 rounded-lg transition-colors",children:[e.jsx(te,{className:"w-4 h-4"}),s("Add Your First Method","radius-booking")]})]}),v&&e.jsxs("div",{className:"rounded-lg border-2 border-dashed border-primary/30 bg-primary/[0.02] p-4",children:[e.jsx("h5",{className:"text-sm font-medium text-title mb-3",children:s("Add New Payout Method","radius-booking")}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 mb-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Method Key","radius-booking")}),e.jsx(q,{value:g,onChange:y=>b(y.target.value),placeholder:s("e.g. paypal, wise, crypto","radius-booking")}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:s("Unique identifier (lowercase, no spaces). Auto-formatted.","radius-booking")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-title2",children:s("Display Label","radius-booking")}),e.jsx(q,{value:l,onChange:y=>p(y.target.value),placeholder:s("e.g. PayPal, Wise, Cryptocurrency","radius-booking")}),e.jsx("p",{className:"text-[11px] text-slate-400 mt-1",children:s("Shown to employees when requesting a payout.","radius-booking")})]})]}),g.trim()&&i[g.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"")]&&e.jsx("p",{className:"text-xs text-red-500 mb-2",children:s("A method with this key already exists.","radius-booking")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:R,disabled:!g.trim()||!l.trim()||!!i[g.trim().toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_]/g,"")],className:"inline-flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-white bg-primary hover:bg-primary/90 rounded-lg transition-colors disabled:opacity-40 disabled:cursor-not-allowed",children:[e.jsx(te,{className:"w-4 h-4"}),s("Add","radius-booking")]}),e.jsx("button",{type:"button",onClick:()=>{h(!1),b(""),p("")},className:"px-4 py-2 text-sm font-medium text-slate-600 hover:text-slate-800 hover:bg-slate-100 rounded-lg transition-colors",children:s("Cancel","radius-booking")})]})]})]})]})]})]})}const ve={chat:e.jsx("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),headset:e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M3 18v-6a9 9 0 0 1 18 0v6"}),e.jsx("path",{d:"M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z"})]}),bot:e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"10",rx:"2"}),e.jsx("circle",{cx:"12",cy:"5",r:"2"}),e.jsx("path",{d:"M12 7v4"}),e.jsx("line",{x1:"8",y1:"16",x2:"8",y2:"16"}),e.jsx("line",{x1:"16",y1:"16",x2:"16",y2:"16"})]}),help:e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),e.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]})},ea=e.jsxs("svg",{viewBox:"0 0 24 24",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});function sa({settings:a}){const[t,c]=k.useState(!0),d=(a==null?void 0:a.chatbot)||{},o=d.primaryColor||"#0040ff",r=d.botName||s("Booking Assistant","radius-booking"),i=d.welcomeMessage||s("Hi! I'm your booking assistant. How can I help you today?","radius-booking"),u=d.position||"bottom-right",m=d.bubbleIcon||"chat",g=d.bubbleImage||"",b=d.poweredBy??s("Powered by Radius Booking","radius-booking"),l=u==="bottom-right";return e.jsxs("div",{className:"relative rounded-xl border border-gray-200 overflow-hidden",style:{background:"repeating-conic-gradient(#f8f8f8 0% 25%, #fff 0% 50%) 50% / 20px 20px",minHeight:480},children:[e.jsx("div",{className:"absolute top-3 left-3 bg-white/90 backdrop-blur text-xs text-gray-500 px-2 py-1 rounded-md border border-gray-100 z-10",children:s("Preview","radius-booking")}),t&&e.jsx("div",{className:"absolute z-10",style:{width:340,bottom:80,...l?{right:20}:{left:20}},children:e.jsxs("div",{style:{borderRadius:16,background:"#fff",boxShadow:"0 8px 30px rgba(0,0,0,0.12)",display:"flex",flexDirection:"column",overflow:"hidden",height:370},children:[e.jsxs("div",{style:{backgroundColor:o,padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",flexShrink:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx("div",{style:{width:32,height:32,borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center",color:"#fff"},children:m==="custom"&&g?e.jsx("img",{src:g,alt:"",style:{width:"100%",height:"100%",borderRadius:"50%",objectFit:"cover"}}):ve[m]||ve.chat}),e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:15,fontWeight:600,color:"#fff"},children:r}),e.jsx("div",{style:{fontSize:11,color:"rgba(255,255,255,0.8)"},children:s("Online","radius-booking")})]})]}),e.jsx("button",{onClick:()=>c(!1),style:{background:"rgba(255,255,255,0.15)",border:"none",borderRadius:"50%",width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:"#fff"},children:ea})]}),e.jsxs("div",{style:{flex:1,padding:"16px",overflowY:"auto"},children:[e.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"12px 12px 12px 4px",background:"#f0f2f5",fontSize:13,lineHeight:1.5,color:"#1a1a1a"},children:i}),e.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"12px 12px 4px 12px",backgroundColor:o,fontSize:13,lineHeight:1.5,color:"#fff",marginTop:12,marginLeft:"auto"},children:s("What services do you offer?","radius-booking")}),e.jsx("div",{style:{maxWidth:"85%",padding:"10px 14px",borderRadius:"12px 12px 12px 4px",background:"#f0f2f5",fontSize:13,lineHeight:1.5,color:"#1a1a1a",marginTop:12},children:s("We offer a variety of services! Let me check for you...","radius-booking")})]}),e.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid #eee",display:"flex",alignItems:"center",gap:8,background:"#fff"},children:[e.jsx("input",{type:"text",placeholder:s("Type a message...","radius-booking"),disabled:!0,style:{flex:1,border:"1px solid #e0e0e0",borderRadius:24,padding:"8px 16px",fontSize:13,outline:"none",background:"#fafafa",fontFamily:"inherit"}}),e.jsx("button",{disabled:!0,style:{width:36,height:36,borderRadius:"50%",border:"none",backgroundColor:o,display:"flex",alignItems:"center",justifyContent:"center",opacity:.5,flexShrink:0},children:e.jsxs("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"#fff",strokeWidth:"2",children:[e.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),e.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),b&&e.jsx("div",{style:{textAlign:"center",padding:6,fontSize:10,color:"#bbb",background:"#fafafa"},children:b})]})}),e.jsx("button",{onClick:()=>c(p=>!p),className:"absolute z-10",style:{bottom:20,...l?{right:20}:{left:20},width:56,height:56,borderRadius:"50%",border:"none",backgroundColor:o,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 12px rgba(0,0,0,0.15)",color:"#fff",transition:"transform 0.2s ease"},children:t?e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):m==="custom"&&g?e.jsx("img",{src:g,alt:"",style:{width:28,height:28,borderRadius:"50%",objectFit:"cover"}}):ve[m]||ve.chat})]})}const pe="/radius-booking/v1/export-import";async function ta(){return K({path:`${pe}/modules`,method:"GET"})}async function aa(a){return K({path:`${pe}/export/init`,method:"POST",data:{modules:a}})}async function es(a,t=0,c=500){return K({path:`${pe}/export/batch?module=${a}&offset=${t}&limit=${c}`,method:"GET"})}async function ia(a){return K({path:`${pe}/import/init`,method:"POST",data:a})}async function ss(a,t,c){return K({path:`${pe}/import/batch`,method:"POST",data:{session_key:a,module:t,records:c}})}async function ts(a){return K({path:`${pe}/import/cleanup`,method:"POST",data:{session_key:a}})}const we=500;function oa(){const[a,t]=k.useState([]),[c,d]=k.useState(!1),[o,r]=k.useState(!1),[i,u]=k.useState({label:"",current:0,total:0}),[m,g]=k.useState(!1),[b,l]=k.useState(!1),[p,v]=k.useState({label:"",current:0,total:0}),[h,P]=k.useState(null),[f,n]=k.useState(null),j=k.useRef(!1),S=k.useCallback(async()=>{var y;d(!0);try{const N=await ta();t(((y=N.data)==null?void 0:y.modules)||[])}catch(N){console.error("Failed to load modules:",N)}finally{d(!1)}},[]),L=k.useCallback(async y=>{var N,M,A;if(y.length){r(!0),j.current=!1;try{const x=await aa(y),{metadata:I,modules:T,counts:E}=x.data,O=Object.values(E).reduce((w,_)=>w+_,0);let V=0;const W={metadata:I,data:{}};for(const w of T){if(j.current)break;const _=E[w]||0;if(W.data[w]=[],w==="settings"){u({label:X(s("Exporting %s...","radius-booking"),w),current:V,total:O});const G=await es(w,0,1);W.data[w]=((N=G.data)==null?void 0:N.records)||{},V+=1}else{let G=0,he=!0;for(;he&&!j.current;){u({label:X(s("Exporting %s...","radius-booking"),w),current:V,total:O});const Q=await es(w,G,we),ie=((M=Q.data)==null?void 0:M.records)||[];W.data[w].push(...ie),V+=ie.length,he=((A=Q.data)==null?void 0:A.has_more)||!1,G+=we}}}u({label:s("Export complete!","radius-booking"),current:O,total:O});const Y=JSON.stringify(W,null,2),Ae=new Blob([Y],{type:"application/json"}),xe=URL.createObjectURL(Ae),J=document.createElement("a"),ke=new Date().toISOString().split("T")[0];J.href=xe,J.download=`radius-booking-export-${ke}.json`,document.body.appendChild(J),J.click(),document.body.removeChild(J),URL.revokeObjectURL(xe)}catch(x){console.error("Export failed:",x),u({label:s("Export failed. Please try again.","radius-booking"),current:0,total:0})}finally{r(!1)}}},[]),R=k.useCallback(async y=>new Promise((N,M)=>{const A=new FileReader;A.onload=async x=>{var I,T;try{const E=JSON.parse(x.target.result);n(E);const O=await ia(E);P({sessionKey:(I=O.data)==null?void 0:I.session_key,plan:((T=O.data)==null?void 0:T.plan)||[],metadata:E.metadata}),N(O.data)}catch(E){console.error("Failed to parse import file:",E),P(null),n(null),M(E)}},A.onerror=M,A.readAsText(y)}),[]),C=k.useCallback(async()=>{var x;if(!h||!f)return;g(!0),j.current=!1;const{sessionKey:y,plan:N}=h,M=N.reduce((I,T)=>I+T.count,0);let A=0;try{for(const I of N){if(j.current)break;const{module:T,count:E}=I,O=((x=f.data)==null?void 0:x[T])||[];if(T==="settings")v({label:X(s("Importing %s...","radius-booking"),T),current:A,total:M}),await ss(y,T,O),A+=1;else for(let V=0;V<O.length&&!j.current;V+=we){const W=O.slice(V,V+we);v({label:X(s("Importing %s...","radius-booking"),T),current:A,total:M}),await ss(y,T,W),A+=W.length}}await ts(y),v({label:s("Import complete!","radius-booking"),current:M,total:M}),l(!0)}catch(I){console.error("Import failed:",I),v({label:s("Import failed. Please try again.","radius-booking"),current:0,total:0});try{await ts(y)}catch{}}finally{g(!1)}},[h,f]),$=k.useCallback(()=>{j.current=!0},[]),H=k.useCallback(()=>{P(null),n(null),v({label:"",current:0,total:0}),l(!1)},[]);return{modules:a,modulesLoading:c,loadModules:S,exporting:o,exportProgress:i,runExport:L,importing:m,importComplete:b,importProgress:p,importPlan:h,parseImportFile:R,runImport:C,resetImport:H,abort:$}}function na(){var xe,J,ke;const[a,t]=k.useState("export"),[c,d]=k.useState([]),o=k.useRef(null),[r,i]=k.useState(!1),[u,m]=k.useState(null),[g,b]=k.useState(null),[l,p]=k.useState(!1),{modules:v,modulesLoading:h,loadModules:P,exporting:f,exportProgress:n,runExport:j,importing:S,importComplete:L,importProgress:R,importPlan:C,parseImportFile:$,runImport:H,resetImport:y}=oa(),N=S||f;k.useEffect(()=>{P()},[P]),k.useEffect(()=>{v.length>0&&c.length===0&&d(v.map(w=>w.name))},[v]),k.useEffect(()=>{if(!N)return;const w=Q=>{Q.preventDefault(),Q.returnValue=""};window.addEventListener("beforeunload",w);const _=Q=>{const ie=Q.target.closest("a[href]");ie&&(ie.href&&ie.href.startsWith("blob:")||ie.hasAttribute("download")||(Q.preventDefault(),Q.stopPropagation()))};document.addEventListener("click",_,!0);const G=window.location.hash,he=()=>{window.location.hash=G};return window.addEventListener("hashchange",he),()=>{window.removeEventListener("beforeunload",w),document.removeEventListener("click",_,!0),window.removeEventListener("hashchange",he)}},[N]);const M=v.length>0&&c.length===v.length,A=()=>d(M?[]:v.map(w=>w.name)),x=w=>d(_=>_.includes(w)?_.filter(G=>G!==w):[..._,w]),I=v.filter(w=>c.includes(w.name)).reduce((w,_)=>w+_.count,0),T=n.total>0?Math.round(n.current/n.total*100):0,E=k.useCallback(async w=>{if(b(null),m(w.name),!w.name.endsWith(".json")){b(s("Please select a valid .json file.","radius-booking"));return}p(!0);try{await $(w)}catch(_){b((_==null?void 0:_.message)||s("Failed to parse the file.","radius-booking"))}finally{p(!1)}},[$]),O=w=>{var G;const _=(G=w.target.files)==null?void 0:G[0];_&&E(_)},V=w=>{var G;w.preventDefault(),i(!1);const _=(G=w.dataTransfer.files)==null?void 0:G[0];_&&E(_)},W=()=>{m(null),b(null),o.current&&(o.current.value=""),y()},Y=R.total>0?Math.round(R.current/R.total*100):0,Ae=((xe=C==null?void 0:C.plan)==null?void 0:xe.reduce((w,_)=>w+_.count,0))||0;return e.jsxs("div",{className:"space-y-5",children:[N&&e.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[e.jsx(Et,{className:"w-4 h-4 text-amber-600 shrink-0"}),e.jsx("p",{className:"text-[13px] text-amber-800 font-medium",children:S?s("Import is in progress. Please do not close, reload, or navigate away from this page.","radius-booking"):s("Export is in progress. Please do not close, reload, or navigate away from this page.","radius-booking")})]}),e.jsxs(ut,{value:a,onValueChange:w=>{S||t(w)},children:[e.jsxs(mt,{className:"h-10 p-0.5 bg-slate-100/80 rounded-lg w-auto inline-flex",children:[e.jsxs(Ye,{value:"export",disabled:S,className:"gap-1.5 px-5 text-[13px] rounded-md data-[state=active]:bg-white data-[state=active]:shadow-sm",children:[e.jsx(Xe,{className:"w-3.5 h-3.5"})," ",s("Export","radius-booking")]}),e.jsxs(Ye,{value:"import",className:"gap-1.5 px-5 text-[13px] rounded-md data-[state=active]:bg-white data-[state=active]:shadow-sm",children:[e.jsx(Ke,{className:"w-3.5 h-3.5"})," ",s("Import","radius-booking")]})]}),e.jsx(Ue,{value:"export",className:"mt-4",children:h?e.jsx("div",{className:"space-y-2.5",children:[1,2,3,4,5].map(w=>e.jsxs("div",{className:"flex items-center gap-3 py-2 px-1",children:[e.jsx(_e,{className:"h-4 w-4 rounded-sm"}),e.jsx(_e,{className:"h-4 flex-1 rounded"}),e.jsx(_e,{className:"h-5 w-10 rounded-full"})]},w))}):e.jsxs("div",{className:"space-y-3",children:[e.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group py-1",children:[e.jsx(qe,{checked:M,onCheckedChange:A,disabled:f}),e.jsx("span",{className:"text-[13px] font-semibold text-title group-hover:text-primary transition-colors flex-1",children:s("Select All","radius-booking")}),e.jsxs("span",{className:"text-xs text-small-font tabular-nums",children:[c.length,"/",v.length]})]}),e.jsx(ct,{}),e.jsx("div",{className:"space-y-px max-h-[340px] overflow-y-auto -mx-1 px-1",children:v.map(w=>{const _=c.includes(w.name);return e.jsxs("label",{className:`flex items-center gap-3 py-2 px-3 rounded-md cursor-pointer transition-colors ${_?"bg-[#F5FAFF]":"hover:bg-slate-50"}`,children:[e.jsx(qe,{checked:_,onCheckedChange:()=>x(w.name),disabled:f}),e.jsx("span",{className:"text-[13px] text-title flex-1",children:w.label}),e.jsx("span",{className:"text-[11px] text-small-font tabular-nums bg-slate-100 rounded-full px-2 py-0.5",children:w.count.toLocaleString()})]},w.name)})}),(f||n.total>0)&&e.jsxs("div",{className:"bg-[#F5FAFF] rounded-md p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[13px]",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-title font-medium",children:[f&&e.jsx(ne,{className:"w-3.5 h-3.5 text-primary animate-spin"}),n.label]}),e.jsxs("span",{className:"font-semibold text-primary tabular-nums",children:[T,"%"]})]}),e.jsx(Qe,{value:T,className:"h-1.5"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsx("span",{className:"text-xs text-small-font",children:c.length>0?X(s("%s records","radius-booking"),I.toLocaleString()):s("No modules selected","radius-booking")}),e.jsxs(oe,{onClick:()=>j(c),disabled:f||!c.length,size:"sm",children:[e.jsx(Xe,{className:"w-3.5 h-3.5"}),f?s("Exporting...","radius-booking"):s("Export","radius-booking")]})]})]})}),e.jsx(Ue,{value:"import",className:"mt-4",children:e.jsxs("div",{className:"space-y-4",children:[!C&&!L&&(l?e.jsx("div",{className:"border-2 border-primary/30 bg-[#F5FAFF] rounded-lg py-12 px-6 text-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-2.5",children:[e.jsx(ne,{className:"w-8 h-8 text-primary animate-spin"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-medium text-title",children:s("Reading file...","radius-booking")}),e.jsx("p",{className:"text-xs text-small-font mt-0.5",children:u})]})]})}):e.jsxs("div",{onClick:()=>{var w;return(w=o.current)==null?void 0:w.click()},onDragOver:w=>{w.preventDefault(),i(!0)},onDragLeave:()=>i(!1),onDrop:V,className:`border-2 border-dashed rounded-lg py-12 px-6 text-center cursor-pointer transition-all ${r?"border-primary bg-[#F5FAFF]":"border-slate-200 hover:border-slate-300 hover:bg-slate-50/60"}`,children:[e.jsxs("div",{className:"flex flex-col items-center gap-2.5",children:[e.jsx("div",{className:`h-11 w-11 rounded-full flex items-center justify-center transition-colors ${r?"bg-primary/10":"bg-slate-100"}`,children:e.jsx(jt,{className:`w-5 h-5 ${r?"text-primary":"text-slate-400"}`})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-medium text-title",children:s("Click to select or drag & drop","radius-booking")}),e.jsx("p",{className:"text-xs text-small-font mt-0.5",children:s(".json export file from Radius Booking","radius-booking")})]})]}),e.jsx("input",{ref:o,type:"file",accept:".json",onChange:O,className:"hidden"})]})),g&&e.jsxs("div",{className:"flex items-center gap-2.5 text-sm p-3 bg-red-50 border border-red-200 rounded-md",children:[e.jsx(ze,{className:"w-4 h-4 text-red-500 shrink-0"}),e.jsx("span",{className:"text-red-700 text-[13px]",children:g})]}),C&&!L&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 bg-slate-50 p-3 rounded-md",children:[e.jsx(bt,{className:"w-4 h-4 text-primary shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[13px] font-medium text-title truncate",children:u}),e.jsxs("p",{className:"text-xs text-small-font",children:[((J=C.metadata)==null?void 0:J.version)&&`v${C.metadata.version}`,((ke=C.metadata)==null?void 0:ke.exported_at)&&` · ${new Date(C.metadata.exported_at).toLocaleDateString()}`,` · ${Ae.toLocaleString()} records`]})]}),!S&&e.jsx("button",{onClick:W,className:"p-1 rounded hover:bg-slate-200 transition-colors",children:e.jsx(ge,{className:"w-3.5 h-3.5 text-small-font"})})]}),e.jsx("div",{className:"border border-border rounded-md divide-y divide-border",children:C.plan.map(w=>e.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[e.jsx("span",{className:"text-[13px] text-title capitalize",children:w.module.replace(/_/g," ")}),e.jsx("span",{className:"text-[11px] text-small-font tabular-nums bg-slate-100 rounded-full px-2 py-0.5",children:w.count.toLocaleString()})]},w.module))}),(S||R.total>0)&&e.jsxs("div",{className:"bg-[#F5FAFF] rounded-md p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between text-[13px]",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-title font-medium",children:[S&&e.jsx(ne,{className:"w-3.5 h-3.5 text-primary animate-spin"}),R.label]}),e.jsxs("span",{className:"font-semibold text-primary tabular-nums",children:[Y,"%"]})]}),e.jsx(Qe,{value:Y,className:"h-1.5"})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[!S&&e.jsx(oe,{variant:"outline",size:"sm",onClick:W,children:s("Cancel","radius-booking")}),e.jsx(oe,{size:"sm",onClick:H,disabled:S,className:"bg-green-600 hover:bg-green-700",children:S?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-3.5 h-3.5 animate-spin"})," ",s("Importing...","radius-booking")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ke,{className:"w-3.5 h-3.5"})," ",s("Start Import","radius-booking")]})})]})]}),L&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 bg-green-50 border border-green-200 rounded-md",children:[e.jsx(Cs,{className:"w-5 h-5 text-green-600 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[13px] font-semibold text-green-800",children:s("Import completed successfully","radius-booking")}),e.jsx("p",{className:"text-xs text-green-600 mt-0.5",children:s("All data has been imported into this site.","radius-booking")})]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(oe,{variant:"outline",size:"sm",onClick:W,children:s("Import Another File","radius-booking")})})]})]})})]}),e.jsxs("details",{className:"group border border-border rounded-md",children:[e.jsxs("summary",{className:"flex items-center gap-2 px-3 py-2 cursor-pointer text-xs font-semibold text-small-font uppercase tracking-wider select-none hover:bg-slate-50 transition-colors",children:[e.jsx(yt,{className:"w-3.5 h-3.5"}),s("Developer API","radius-booking")]}),e.jsx("pre",{className:"text-xs p-3 border-t border-border overflow-x-auto leading-relaxed text-title bg-slate-50",children:`use RadiusTheme\\RadiusBooking\\Facades\\Export;
use RadiusTheme\\RadiusBooking\\Facades\\Import;

// Export
$data = Export::module('appointment')->export();
$data = Export::modules(['category', 'service', 'staff'])->export();

// Import
Import::module('appointment')->import($records);
Import::fromFile('/path/to/export.json')->import();`})]})]})}const as=[{key:"service",name:s("Service Booking","radius-booking"),description:s("Traditional appointment booking with services, staff, and time slots. This is the core booking module.","radius-booking"),icon:Ds,color:"bg-blue-500",alwaysOn:!0},{key:"meeting",name:s("Meeting Booking","radius-booking"),description:s("Calendly-style meeting scheduling. Create shareable booking links for 1-on-1 meetings with independent availability.","radius-booking"),icon:js,color:"bg-purple-500",alwaysOn:!1},{key:"event",name:s("Event Booking","radius-booking"),description:s("Event management with ticket types, capacity limits, waitlists, and attendee registration.","radius-booking"),icon:Rs,color:"bg-orange-500",alwaysOn:!1}];function ra({dirty:a=!1}){const t=re(b=>b(U).getSettings(),[]),{setSettingsFields:c}=Me(U),[d,o]=k.useState({service:!0,meeting:!1,event:!1}),[r,i]=k.useState(!1),[u,m]=k.useState(!1);k.useEffect(()=>{t!=null&&t.modules&&o({service:!0,meeting:!!t.modules.meeting,event:!!t.modules.event})},[t==null?void 0:t.modules]);const g=async b=>{var p;if(b==="service")return;const l={...d,[b]:!d[b]};o(l),i(!0);try{await K({path:"/radius-booking/v1/settings/modules",method:"PUT",data:l}),c("modules",l);const v=(p=as.find(h=>h.key===b))==null?void 0:p.name;if(Be(l[b]?X(s("%s enabled","radius-booking"),v):X(s("%s disabled","radius-booking"),v)),a){m(!0);return}setTimeout(()=>window.location.reload(),700)}catch{Z(s("Failed to save module settings","radius-booking")),o(v=>({...v,[b]:!l[b]}))}finally{i(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-title mb-1",children:s("Booking Modules","radius-booking")}),e.jsx("p",{className:"text-sm text-small-font",children:s("Enable or disable booking modules. Disabled modules are hidden from the sidebar and their features become inactive.","radius-booking")})]}),e.jsx("div",{className:"grid gap-4",children:as.map(b=>{const l=b.icon,p=d[b.key];return e.jsxs("div",{className:`relative flex items-start gap-4 p-5 rounded-xl border-2 transition-all ${p?"border-primary/30 bg-primary/[0.02]":"border-border bg-white"}`,children:[e.jsx("div",{className:`flex items-center justify-center w-11 h-11 rounded-lg ${b.color} text-white shrink-0`,children:e.jsx(l,{className:"w-5 h-5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:b.name}),b.alwaysOn&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-[10px] font-medium bg-green-100 text-green-700",children:s("Always Active","radius-booking")})]}),e.jsx("p",{className:"text-sm text-small-font leading-relaxed",children:b.description})]}),e.jsx("div",{className:"shrink-0 pt-1",children:b.alwaysOn?e.jsx("div",{className:"flex items-center justify-center w-10 h-6 rounded-full bg-green-500",children:e.jsx(xs,{className:"w-3.5 h-3.5 text-white"})}):e.jsx("button",{type:"button",role:"switch","aria-checked":p,disabled:r,onClick:()=>g(b.key),className:`relative inline-flex h-6 w-10 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${p?"bg-primary":"bg-gray-200"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ${p?"translate-x-4":"translate-x-0"}`})})})]},b.key)})}),e.jsx(He,{open:u,onClose:()=>m(!1),onConfirm:()=>window.location.reload(),title:s("Reload to update sidebar?","radius-booking"),description:s("Your module change is saved. Reloading will update the sidebar navigation, but any unsaved changes on other settings tabs will be lost.","radius-booking"),confirmText:s("Reload","radius-booking"),cancelText:s("Stay","radius-booking"),confirmVariant:"default"})]})}function la(){const[a,t]=k.useState(""),[c,d]=k.useState(null),[o,r]=k.useState(""),[i,u]=k.useState(!0),[m,g]=k.useState(!1),[b,l]=k.useState(!1),[p,v]=k.useState(!1);k.useEffect(()=>{K({path:"/radius-booking/v1/license/status",method:"GET"}).then(j=>{j!=null&&j.data&&(t(j.data.license_key||""),d(j.data.status||null),r(j.data.message||""))}).catch(()=>{}).finally(()=>u(!1))},[]);const h=async()=>{var j,S,L,R;if(!a.trim()){Z(s("Please enter a license key.","radius-booking"));return}g(!0);try{const C=await K({path:"/radius-booking/v1/license/activate",method:"POST",data:{license_key:a.trim()}});(j=C==null?void 0:C.data)!=null&&j.success?(d("valid"),r(C.data.message||s("License activated successfully.","radius-booking")),Be(C.data.message||s("License activated!","radius-booking"))):(d(((S=C==null?void 0:C.data)==null?void 0:S.status)||"invalid"),r(((L=C==null?void 0:C.data)==null?void 0:L.message)||s("Activation failed.","radius-booking")),Z(((R=C==null?void 0:C.data)==null?void 0:R.message)||s("Activation failed.","radius-booking")))}catch(C){Z((C==null?void 0:C.message)||s("Failed to activate license.","radius-booking"))}finally{g(!1)}},P=async()=>{var j,S;l(!0);try{const L=await K({path:"/radius-booking/v1/license/deactivate",method:"POST"});(j=L==null?void 0:L.data)!=null&&j.success?(d(null),t(""),r(""),Be(L.data.message||s("License deactivated.","radius-booking"))):Z(((S=L==null?void 0:L.data)==null?void 0:S.message)||s("Deactivation failed.","radius-booking"))}catch(L){Z((L==null?void 0:L.message)||s("Failed to deactivate license.","radius-booking"))}finally{l(!1)}},f={valid:{label:s("Active","radius-booking"),icon:Cs,color:"text-green-600",bg:"bg-green-50 border-green-200"},invalid:{label:s("Invalid","radius-booking"),icon:Ze,color:"text-red-600",bg:"bg-red-50 border-red-200"},expired:{label:s("Expired","radius-booking"),icon:ze,color:"text-amber-600",bg:"bg-amber-50 border-amber-200"}},n=c?f[c]||f.invalid:null;return i?e.jsx("div",{className:"flex items-center justify-center py-16",children:e.jsx(ne,{className:"w-6 h-6 animate-spin text-primary"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-title mb-1",children:s("License Management","radius-booking")}),e.jsx("p",{className:"text-sm text-small-font",children:s("Activate your Radius Booking Pro license to receive updates and premium support.","radius-booking")})]}),n&&e.jsxs("div",{className:`flex items-center gap-3 p-4 rounded-xl border ${n.bg}`,children:[e.jsx(n.icon,{className:`w-5 h-5 ${n.color}`}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:`text-sm font-semibold ${n.color}`,children:X(s("License %s","radius-booking"),n.label)}),o&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:o})]})]}),e.jsxs("div",{className:"bg-white border border-border rounded-xl p-6 space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3 pb-4 border-b border-border",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(wt,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"text-sm font-semibold text-title",children:s("License Key","radius-booking")}),e.jsx("p",{className:"text-xs text-small-font",children:s("Enter your purchase license key","radius-booking")})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(hs,{htmlFor:"license_key",children:s("License Key","radius-booking")}),e.jsxs("div",{className:"relative",children:[e.jsx(Xs,{id:"license_key",type:p?"text":"password",placeholder:s("Enter your license key...","radius-booking"),value:a,onChange:j=>t(j.target.value),disabled:c==="valid",className:"h-11 font-mono text-sm pr-10"}),e.jsx("button",{type:"button",onClick:()=>v(!p),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-title transition-colors",children:p?e.jsx(Pe,{className:"w-4 h-4"}):e.jsx(Te,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex items-center gap-3",children:c==="valid"?e.jsx(oe,{variant:"destructive",onClick:P,disabled:b,className:"h-10",children:b?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-2 animate-spin"})," ",s("Deactivating...","radius-booking")]}):e.jsxs(e.Fragment,{children:[e.jsx(Ze,{className:"w-4 h-4 mr-2"})," ",s("Deactivate License","radius-booking")]})}):e.jsx(oe,{onClick:h,disabled:m||!a.trim(),className:"h-10",children:m?e.jsxs(e.Fragment,{children:[e.jsx(ne,{className:"w-4 h-4 mr-2 animate-spin"})," ",s("Activating...","radius-booking")]}):e.jsxs(e.Fragment,{children:[e.jsx(gt,{className:"w-4 h-4 mr-2"})," ",s("Activate License","radius-booking")]})})})]})]})}const F=({className:a,...t})=>e.jsx("div",{className:De("animate-pulse rounded-md bg-slate-200",a),...t}),ue=({type:a="text"})=>{switch(a){case"toggle":return e.jsxs("div",{className:"flex items-center justify-between py-3",children:[e.jsxs("div",{className:"space-y-1 flex-1",children:[e.jsx(F,{className:"h-4 w-40"}),e.jsx(F,{className:"h-3 w-64"})]}),e.jsx(F,{className:"h-6 w-11 rounded-full"})]});case"select":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{className:"h-4 w-32"}),e.jsx(F,{className:"h-10 w-full rounded-md"})]});case"textarea":return e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{className:"h-4 w-32"}),e.jsx(F,{className:"h-24 w-full rounded-md"})]});default:return e.jsxs("div",{className:"space-y-2",children:[e.jsx(F,{className:"h-4 w-32"}),e.jsx(F,{className:"h-10 w-full rounded-md"}),e.jsx(F,{className:"h-3 w-48"})]})}},is=({fieldCount:a=3,hasToggle:t=!1})=>e.jsxs("div",{className:"rounded-lg border border-border bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"mb-6 space-y-2 border-b border-slate-100 pb-4",children:[e.jsx(F,{className:"h-6 w-48"}),e.jsx(F,{className:"h-4 w-96"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-4",children:Array.from({length:a}).map((c,d)=>e.jsx(ue,{type:"text"},d))}),t&&e.jsxs("div",{className:"border-t border-slate-100 pt-6 space-y-1",children:[e.jsx(ue,{type:"toggle"}),e.jsx(ue,{type:"toggle"})]})]})]}),da=()=>e.jsxs("div",{className:"rounded-lg border border-border bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"mb-6 space-y-2 border-b border-slate-100 pb-4",children:[e.jsx(F,{className:"h-6 w-48"}),e.jsx(F,{className:"h-4 w-96"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-3",children:[e.jsx(ue,{type:"text"}),e.jsx(ue,{type:"text"}),e.jsx(ue,{type:"select"})]})]}),ca=()=>e.jsxs("div",{className:"rounded-lg border border-border bg-white p-6 shadow-sm",children:[e.jsxs("div",{className:"mb-6 space-y-2 border-b border-slate-100 pb-4",children:[e.jsx(F,{className:"h-6 w-48"}),e.jsx(F,{className:"h-4 w-96"})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(F,{className:"h-5 w-32"}),e.jsx(F,{className:"h-9 w-24 rounded-md"})]}),Array.from({length:3}).map((a,t)=>e.jsx("div",{className:"rounded-md border border-border p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"space-y-2 flex-1",children:[e.jsx(F,{className:"h-4 w-40"}),e.jsx(F,{className:"h-3 w-64"})]}),e.jsx(F,{className:"h-8 w-8 rounded"})]})},t))]})]});function ua(){return e.jsx("div",{className:"min-h-screen",children:e.jsx("main",{className:"bg-white border-l border-b border-r border-border px-[50px] py-[20px] rounded-bl-[12px] rounded-br-[12px]",children:e.jsx("div",{className:"w-full",children:e.jsxs("section",{className:"space-y-8",children:[e.jsx(da,{}),e.jsx(is,{fieldCount:4,hasToggle:!0}),e.jsx(ca,{}),e.jsx(is,{fieldCount:2,hasToggle:!1}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx(F,{className:"h-10 w-20 rounded-md"}),e.jsx(F,{className:"h-10 w-32 rounded-md"})]})]})})})})}const me=a=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a);function le(a,t){return t.split(".").reduce((c,d)=>c==null?void 0:c[d],a)}function fe(a,t){if(!a)return!0;const{key:c,value:d}=a,o=le(t,c);return o===d?!0:typeof d=="boolean"&&typeof o=="string"?o===String(d):typeof o=="boolean"&&typeof d=="string"?String(o)===d:!1}function os(a){return a==="true"?!0:a==="false"?!1:a}function ma({value:a,onChange:t,placeholder:c,disabled:d,hint:o}){const[r,i]=k.useState(!1);return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:r?"text":"password",value:a||"",onChange:u=>t(u.target.value),placeholder:c,disabled:d,className:"w-full rounded-md border border-border bg-white px-3 py-2 pr-10 text-sm text-title placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-blue-200 disabled:bg-slate-50 disabled:text-small-font disabled:cursor-not-allowed"}),e.jsx("button",{type:"button",onClick:()=>i(!r),disabled:d,className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-1 text-slate-400 hover:text-slate-600 disabled:opacity-50 disabled:cursor-not-allowed",children:r?e.jsx(Pe,{className:"h-4 w-4"}):e.jsx(Te,{className:"h-4 w-4"})})]}),o&&e.jsx(de,{children:o})]})}function ba({value:a,onChange:t,units:c=["px","rem","em","%"],placeholder:d="0"}){const o=k.useMemo(()=>{const l=String(a||"").match(/^([\d.]*)\s*(px|rem|em|%|)$/i);return{num:l?l[1]:"",unit:l&&l[2]?l[2].toLowerCase():c[0]}},[a,c]),r=o.unit==="px"?1:.125,i=o.unit==="px"?0:3,u=(b,l)=>{t(b===""?"":`${b}${l}`)},m=()=>{const b=parseFloat(o.num)||0,l=parseFloat((b+r).toFixed(i));u(String(l),o.unit)},g=()=>{const b=parseFloat(o.num)||0,l=Math.max(0,parseFloat((b-r).toFixed(i)));u(String(l),o.unit)};return e.jsxs("div",{className:"flex items-center w-full rounded-md border border-border overflow-hidden focus-within:ring-2 focus-within:ring-blue-200",children:[e.jsx("button",{type:"button",onClick:g,className:"flex items-center justify-center w-9 h-9 shrink-0 bg-slate-50 text-slate-500 hover:bg-slate-100 hover:text-title border-r border-border transition-colors",children:e.jsx("svg",{width:"12",height:"2",viewBox:"0 0 12 2",fill:"none",children:e.jsx("path",{d:"M0.5 1H11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("input",{type:"text",inputMode:"decimal",value:o.num,onChange:b=>{const l=b.target.value;(l===""||/^\d*\.?\d*$/.test(l))&&u(l,o.unit)},placeholder:d,className:"flex-1 min-w-0 bg-white px-3 py-2 text-sm text-title text-center placeholder:text-slate-400 focus:outline-none border-0"}),e.jsx("button",{type:"button",onClick:m,className:"flex items-center justify-center w-9 h-9 shrink-0 bg-slate-50 text-slate-500 hover:bg-slate-100 hover:text-title border-l border-r border-border transition-colors",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M6 0.5V11.5M0.5 6H11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("select",{value:o.unit,onChange:b=>u(o.num,b.target.value),className:"h-9 bg-slate-50 px-2 text-sm font-medium text-title focus:outline-none cursor-pointer border-0 w-[30%]",children:c.map(b=>e.jsx("option",{value:b,children:b},b))})]})}function ee({field:a,value:t,onChange:c}){var l,p,v,h,P;const d=re(f=>f(U).settingsError(),[]),{setSettingsError:o}=Me(U),r=(l=a.transform)!=null&&l.toDisplay?a.transform.toDisplay(t):t,i=f=>{var j;const n=(j=a.transform)!=null&&j.toStore?a.transform.toStore(f):f;c(n)},u=!!((p=window.radius_booking_param)!=null&&p.is_pro),m=xt(),g=k.useCallback(()=>{m({title:s("Select Location Photo","radius-booking"),onSelect:({id:f,url:n,sizes:j})=>{i(n)}})},[m]),b=k.useCallback(()=>{i("")},[]);switch(a.type){case"text":return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(q,{value:r||"",onChange:f=>i(f.target.value),placeholder:a.placeholder,disabled:a.disabled}),u&&a.hint&&e.jsx(de,{children:a.hint}),a.proText&&!u&&e.jsx(de,{children:a.proText})]});case"password":return e.jsx(ma,{value:r,onChange:i,placeholder:a.placeholder,disabled:a.disabled,hint:a.hint});case"image":return e.jsx(e.Fragment,{children:e.jsx(pt,{imagePath:r,onUpload:g,onRemove:b})});case"textarea":return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(Oe,{value:r||"",onChange:f=>i(f.target.value),placeholder:a.placeholder,rows:a.rows}),a.hint&&e.jsx(de,{children:a.hint})]});case"number":return e.jsx(Fe,{value:t||"",onChange:f=>i(Math.max(0,Number(f.target.value))),min:a.min,max:a.max,step:a.step,placeholder:0});case"phone":return e.jsxs("div",{className:a.className||"flex flex-col w-full",children:[e.jsx(ht,{value:t||0,onChange:f=>{i(f);const n=Ve(f);o(n!==!0?{business:{phone:n}}:{business:{phone:""}})},error:(v=d==null?void 0:d.business)==null?void 0:v.phone}),((h=d==null?void 0:d.business)==null?void 0:h.phone)&&e.jsx("div",{children:e.jsxs("p",{className:"text-xs text-red-600 flex items-center gap-1",children:[e.jsx(ze,{className:"h-3 w-3"}),(P=d==null?void 0:d.business)==null?void 0:P.phone]})})]});case"select":return e.jsx(bs,{value:t,onChange:f=>{const n=a.options.find(S=>S.value==f.target.value),j=n?n.value:f.target.value;i(os(j))},options:a.options});case"select2":return e.jsx(Ot,{options:a.options,value:t,onChange:f=>{if(a.multiple)i(f);else{const n=a.options.find(S=>S.value==f),j=n?n.value:f;i(os(j))}},multiple:a.multiple,className:""});case"color":return e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("input",{type:"color",value:r||"#0040ff",onChange:f=>i(f.target.value),className:"w-10 h-10 rounded border border-gray-300 cursor-pointer p-0.5"}),e.jsx(q,{value:r||"",onChange:f=>i(f.target.value),placeholder:"#0040ff",className:"flex-1"})]});case"toggle":return e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsx(D,{checked:t||!1,onChange:i,label:a.label}),a.hint&&e.jsx(de,{children:a.hint})]});case"unit":return e.jsx(ba,{value:r,onChange:i,units:a.units,placeholder:a.placeholder});default:return e.jsxs("div",{children:[s("Unknown field type:","radius-booking")," ",a.type]})}}function ga(){const a=Me(U),t=re(n=>n(U).getSettings(),[]);re(n=>n(U).settingsLoading(),[]);const[c,d]=k.useState(!1),[o,r]=$s(),i=o.get("tab")||"general",[u,m]=k.useState(!1),[g,b]=k.useState(!1);k.useEffect(()=>{b(!0)},[t]),k.useEffect(()=>{let n=!0;return(async()=>{n&&a.getSettings({})})(),()=>{n=!1}},[a]);const l=k.useMemo(()=>{var j;const n=!!((j=window.radius_booking_param)!=null&&j.is_cl_active);return Je.sections.filter(S=>!(S.tab!==i||S.tab==="payout"&&!n))},[i]);function p(n,j){var S,L;if(n==="phone.showOnlyCountries"&&a.setSettingsFields("phone.defaultCountry",""),n==="phone.defaultCountry"&&((L=(S=t==null?void 0:t.phone)==null?void 0:S.showOnlyCountries)==null?void 0:L.length)>0){const C=t.phone.showOnlyCountries.find($=>$===j);C?j=C:j=""}a.setSettingsFields(n,j)}async function v(){var n,j,S,L,R,C,$,H,y,N,M;try{if(((n=t==null?void 0:t.email)==null?void 0:n.senderEmail)!==""&&!me((j=t==null?void 0:t.email)==null?void 0:j.senderEmail)){Z(s("Invalid Email Sender Email","radius-booking"));return}if(((S=t==null?void 0:t.email)==null?void 0:S.replyToEmail)!==""&&!me((L=t==null?void 0:t.email)==null?void 0:L.replyToEmail)){Z(s("Invalid Email Sender Reply-To Email","radius-booking"));return}if(((C=(R=t==null?void 0:t.integrations)==null?void 0:R.appleCalendar)==null?void 0:C.enabled)===!0&&((H=($=t==null?void 0:t.integrations)==null?void 0:$.appleCalendar)==null?void 0:H.organizerEmail)!==""&&!me((N=(y=t==null?void 0:t.integrations)==null?void 0:y.appleCalendar)==null?void 0:N.organizerEmail)){Z(s("Invalid Apple Calendar Organizer Email","radius-booking"));return}const A=Ve((M=t==null?void 0:t.business)==null?void 0:M.phone);if(A!==!0){a.setSettingsError({business:{phone:A}});return}await a.saveSettings(t),m(!0),b(!1),setTimeout(()=>m(!1),1500)}catch{}}const h=()=>{d(!0)},P=async()=>{await a.restoreSettings()&&d(!1)};function f(n){var y,N,M,A;if(n.component==="custom"){if(n.id==="weekly-schedule")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(zt,{settings:t,onUpdate:p})},n.id);if(n.id==="custom-schedules")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Ht,{settings:t,onUpdate:p})},n.id);if(n.id==="holidays")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Vt,{settings:t,onUpdate:p})},n.id);if(n.id==="languages")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Gt,{settings:t,onUpdate:p})},n.id);if(n.id==="offline-payment")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Kt,{settings:t,onUpdate:p})},n.id);if(n.id==="paypal")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Wt,{settings:t,onUpdate:p})},n.id);if(n.id==="stripe")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Zt,{settings:t,onUpdate:p})},n.id);if(n.render)return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:n.render()},n.id);if(n.id==="google-calendar-integration")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Yt,{settings:t,onUpdate:p,onSave:v})},n.id);if(n.id==="zoom-integration")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(qt,{settings:t,onUpdate:p})},n.id);if(n.id==="apple-calendar-integration")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Ut,{settings:t,onUpdate:p})},n.id);if(n.id==="classified-listing-integration")return e.jsx(z,{id:n.id,title:n.title,description:n.description,children:e.jsx(Qt,{settings:t,onUpdate:p})},n.id);if(n.id==="chatbot-appearance"){const x=n.fields||[],I=!!((y=window.radius_booking_param)!=null&&y.is_pro),T=n.isPro&&!I;return e.jsx(z,{id:n.id,title:n.title,description:n.description,badge:T?e.jsx(se,{}):null,children:e.jsx("div",{className:T?"pointer-events-none select-none opacity-50":"",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[e.jsx("div",{className:"space-y-5",children:x.map(E=>{if(!fe(E.condition,t))return null;const O=le(t,E.key),V=E.isPro&&!I,W=E.type==="select"&&!I?{...E,options:E.options.map(Y=>Y.isPro?{...Y,label:X(s("%s (Pro)","radius-booking"),Y.label),disabled:!0}:Y)}:E;return e.jsx("div",{className:V?"relative":"",children:e.jsx(B,{label:E.label,badge:V?e.jsx(se,{}):null,children:e.jsx("div",{className:V?"pointer-events-none select-none opacity-50":"",children:e.jsx(ee,{field:W,value:O,onChange:Y=>p(E.key,Y)})})})},E.key)})}),e.jsx("div",{children:e.jsx(sa,{settings:t})})]})})},n.id)}if(n.id==="payout-settings"){const x=n.isPro&&!((N=window.radius_booking_param)!=null&&N.is_pro);return e.jsx(z,{id:n.id,title:n.title,description:n.description,badge:x?e.jsx(se,{}):null,children:e.jsx("div",{className:x?"pointer-events-none select-none opacity-50":"",children:e.jsx(Jt,{settings:(t==null?void 0:t.payout)||{},onChange:(I,T)=>p(`payout.${I}`,T)})})},n.id)}if(n.id==="chatbot-knowledge"){const x=n.isPro&&!((M=window.radius_booking_param)!=null&&M.is_pro);return e.jsx(z,{id:n.id,title:n.title,description:n.description,badge:x?e.jsx(se,{}):null,children:e.jsx("div",{className:x?"pointer-events-none select-none opacity-50":"",children:e.jsx(Xt,{})})},n.id)}}const j=n.fields||[],S=j.filter(x=>x.position==="top"),L=j.filter(x=>x.position!=="top"),R=L.some(x=>x.gridColumn),C=L.filter(x=>x.type==="toggle"&&!x.gridColumn),$=L.filter(x=>x.type!=="toggle"||x.gridColumn),H=n.isPro&&!((A=window.radius_booking_param)!=null&&A.is_pro);return e.jsx(z,{id:n.id,title:n.title,description:n.description,badge:H?e.jsx(se,{}):null,children:e.jsxs("div",{className:H?"pointer-events-none select-none opacity-50":"",children:[S.length>0&&S.map(x=>{if(!fe(x.condition,t))return null;const I=le(t,x.key);return e.jsx(Ne,{cols:"3",children:e.jsx("div",{className:"mb-5",children:e.jsx(ee,{field:x,value:I,onChange:T=>p(x.key,T)})},x.key)})}),R&&$.length>0&&e.jsx(Ne,{cols:n.cols,children:$.map((x,I)=>{if(!fe(x.condition,t))return null;const T=le(t,x.key);return x.type==="toggle"?e.jsx("div",{className:"flex items-end",children:e.jsx(ee,{field:x,value:T,onChange:E=>p(x.key,E)})},x.key):x.fullWidth?e.jsx(B,{label:x.label,className:"sm:col-span-3",children:e.jsx(ee,{field:x,value:T,onChange:E=>p(x.key,E)})},x.key):e.jsx(B,{label:x.label,children:e.jsx(ee,{field:x,value:T,onChange:E=>p(x.key,E)})},x.key)})}),!R&&$.length>0&&e.jsx(Ts,{children:$.map(x=>{if(!fe(x.condition,t))return null;const I=le(t,x.key);return x.label?e.jsx(B,{label:x.label,children:e.jsx(ee,{field:x,value:I,onChange:T=>p(x.key,T)})},x.key):e.jsx(ee,{field:x,value:I,onChange:T=>p(x.key,T)},x.key)})}),C.length>0&&e.jsx(Ne,{children:C.map(x=>{if(!fe(x.condition,t))return null;const I=le(t,x.key);return e.jsx(ee,{field:x,value:I,onChange:T=>p(x.key,T)},x.key)})})]})},n.id)}return t.length===0?e.jsx(ua,{}):e.jsxs("div",{className:"min-h-screen",children:[e.jsx("div",{className:"",children:e.jsx($t,{tabs:Je.tabs,activeTab:i,onTabChange:n=>r({tab:n})})}),e.jsx("main",{className:"bg-white border-l border-b border-r border-border px-[50px] py-[20px] rounded-bl-[12px] rounded-br-[12px]",children:e.jsx("div",{className:"w-full",children:i==="modules"?e.jsx(ra,{dirty:g}):i==="export-import"?e.jsx(na,{}):i==="license"?e.jsx(la,{}):e.jsxs("section",{className:"space-y-8",children:[l.map(n=>f(n)),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:h,className:"rounded-md border border-border bg-white px-4 py-2 text-sm font-medium text-title2 shadow-sm hover:bg-slate-50",children:s("Reset","radius-booking")}),e.jsx("button",{onClick:v,className:"rounded-md bg-primary px-4 py-2 text-sm font-semibold text-white shadow hover:bg-blue-700",children:u?s("Saved","radius-booking"):s("Save Changes","radius-booking")})]})]})})}),e.jsx(He,{open:c,onClose:()=>d(!1),onConfirm:()=>P(),title:s("Are you sure?","radius-booking"),description:s("This action will reset you settings.","radius-booking"),confirmText:s("Reset","radius-booking")})]})}function pa(){const a=Ss("/settings"),t=re(h=>h(U).isSettingsSaving(),[]),{mode:c}=a;Bs();const[d,o]=k.useState(!1),r=Me(U),i=()=>{switch(c){case"list":return e.jsx(ga,{});default:return null}},u=re(h=>h(U).getSettings(),[]),m=re(h=>h(U).settingsError(),[]),g=async()=>{var P,f,n,j,S,L,R,C,$,H,y,N;if(((P=u==null?void 0:u.email)==null?void 0:P.senderEmail)!==""&&!me((f=u==null?void 0:u.email)==null?void 0:f.senderEmail)){Z(s("Invalid Email Sender Email","radius-booking"));return}if(((n=u==null?void 0:u.email)==null?void 0:n.replyToEmail)!==""&&!me((j=u==null?void 0:u.email)==null?void 0:j.replyToEmail)){Z(s("Invalid Email Sender Reply-To Email","radius-booking"));return}if(((L=(S=u==null?void 0:u.integrations)==null?void 0:S.appleCalendar)==null?void 0:L.enabled)===!0&&((C=(R=u==null?void 0:u.integrations)==null?void 0:R.appleCalendar)==null?void 0:C.organizerEmail)!==""&&!me((H=($=u==null?void 0:u.integrations)==null?void 0:$.appleCalendar)==null?void 0:H.organizerEmail)){Z(s("Invalid Apple Calendar Organizer Email","radius-booking"));return}const h=Ve((y=u==null?void 0:u.business)==null?void 0:y.phone);if(h!==!0){r.setSettingsError({business:{phone:h}}),Z(((N=m==null?void 0:m.business)==null?void 0:N.phone)||s("Server error","radius-booking"));return}await r.saveSettings(u)},b=()=>{o(!0)},l=async()=>{await r.restoreSettings()&&o(!1)},v=({list:[{key:"reset-settings",label:s("Reset","radius-booking"),icon:It,onClick:b,variant:"cancel"},{key:"save-settings",label:s("Save Settings","radius-booking"),icon:Ns,onClick:g,loading:t,variant:"primary"}]}[c]||[]).map(h=>e.jsx(Ps,{label:h.label,icon:h.icon,onClick:h.onClick,loading:h.loading||!1,variant:h.variant||"primary"},h.key));return e.jsxs("div",{children:[e.jsx(Ls,{title:s("Settings","radius-booking"),description:s("Configure scheduling, payments, customers, and more","radius-booking"),showBack:c!=="list",onBack:a.navigateTo.list,actions:v,icon:e.jsx(st,{className:"w-5 h-5 text-primary-colordefault"}),children:i()}),e.jsx(He,{open:d,onClose:()=>o(!1),onConfirm:()=>l(),title:s("Are you sure?","radius-booking"),description:s("This action will reset you settings.","radius-booking"),confirmText:s("Reset","radius-booking")})]})}function _i(){return e.jsx(Os,{children:e.jsx(zs,{path:"/",element:e.jsx(pa,{})})})}export{_i as default};
//# sourceMappingURL=index-CLfDOQdS.js.map
