@resulticks/trustsignal-wa-hsm 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/resulticks-trustsignal-wa-hsm.cjs.js +24 -24
- package/dist/resulticks-trustsignal-wa-hsm.es.js +1981 -1966
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),k=require("react"),Re=async(a,r={})=>{try{return await Qe(a.apiKey,r)}catch(s){return console.error("API Error:",s),{status:"error",message:s instanceof Error?s.message:"Failed to fetch templates"}}},Qe=async(a,r={})=>{const s=r.limit||100,t=r.offset?Math.floor(r.offset/s)+1:1,n=await fetch(`https://wpapi.trustsignal.io/api/v1/template?page=${t}&limit=${s}`,{method:"GET",headers:{Authorization:`Bearer ${a}`,"Content-Type":"application/json"}});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const l=await n.json();if(!l.success)throw new Error(l.message||"Failed to fetch templates");return{status:"success",data:l.templates.map(u=>({id:u.id,name:u.name,category:u.category,language:u.lang,type:u.temptype||"TEXT",body:u.temp_var_data||"",status:u.status,creation_time:new Date(u.created_at).getTime(),updation_time:new Date(u.modified_at).getTime(),medialist:u.medialist,shortlink:u.shortlink,temp_error:u.temp_error||void 0})),meta:{total:l.totalrecords,page:l.page,limit:l.limit}}};/**
|
|
2
2
|
* @license lucide-react v0.344.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/var
|
|
6
|
+
*/var Ze={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
7
7
|
* @license lucide-react v0.344.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const ea=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ee=(a,r)=>{const s=k.forwardRef(({color:t="currentColor",size:n=24,strokeWidth:l=2,absoluteStrokeWidth:x,className:u="",children:g,...b},h)=>k.createElement("svg",{ref:h,...Ze,width:n,height:n,stroke:t,strokeWidth:x?Number(l)*24/Number(n):l,className:["lucide",`lucide-${ea(a)}`,u].join(" "),...b},[...r.map(([M,c])=>k.createElement(M,c)),...Array.isArray(g)?g:[g]]));return s.displayName=`${a}`,s};/**
|
|
12
12
|
* @license lucide-react v0.344.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const ge=ee("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
17
17
|
* @license lucide-react v0.344.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const aa=ee("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
22
22
|
* @license lucide-react v0.344.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const je=ee("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
27
27
|
* @license lucide-react v0.344.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const sa=ee("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
32
32
|
* @license lucide-react v0.344.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const
|
|
36
|
+
*/const ra=ee("FileText",[["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:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
37
37
|
* @license lucide-react v0.344.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const
|
|
41
|
+
*/const na=ee("FileVideo",[["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:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/**
|
|
42
42
|
* @license lucide-react v0.344.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const ta=ee("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
|
|
47
47
|
* @license lucide-react v0.344.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const
|
|
51
|
+
*/const be=ee("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
52
52
|
* @license lucide-react v0.344.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const ke=ee("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
57
57
|
* @license lucide-react v0.344.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const ia=ee("Pencil",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
62
62
|
* @license lucide-react v0.344.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const Oe=ee("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
|
|
67
67
|
* @license lucide-react v0.344.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const Se=ee("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
72
72
|
* @license lucide-react v0.344.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const
|
|
76
|
+
*/const la=ee("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
|
|
77
77
|
* @license lucide-react v0.344.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const
|
|
81
|
+
*/const Le=ee("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
|
|
82
82
|
* @license lucide-react v0.344.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const ca=ee("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
87
87
|
* @license lucide-react v0.344.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const xa=ee("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
92
92
|
* @license lucide-react v0.344.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const oa=ee("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
|
|
97
97
|
* @license lucide-react v0.344.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const ne=J("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function me({isOpen:a,onClose:s,title:r,children:t}){const n=j.useRef(null);return j.useEffect(()=>{const l=i=>{n.current&&!n.current.contains(i.target)&&s()};return a&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[a,s]),a?e.jsx("div",{className:"rsp-fixed rsp-inset-0 rsp-bg-black rsp-bg-opacity-50 rsp-flex rsp-items-center rsp-justify-center rsp-p-4 rsp-z-50",children:e.jsxs("div",{ref:n,className:"rsp-bg-white rsp-rounded-lg rsp-shadow-xl rsp-w-full rsp-max-w-[600px] rsp-animate-modal-appear",style:{backgroundColor:"#f5f7fc"},children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-px-6 rsp-py-4 rsp-border-b",children:[e.jsx("h2",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900 rsp-text-center rsp-w-full rsp-break-words rsp-break-all rsp-whitespace-pre-wrap",children:r}),e.jsx("button",{onClick:s,className:"rsp-p-1 hover:rsp-bg-gray-100 rsp-rounded-full",children:e.jsx(ne,{className:"rsp-w-5 rsp-h-5 rsp-text-gray-500"})})]}),e.jsx("div",{className:"rsp-px-6 rsp-py-4 rsp-overflow-y-auto rsp-max-h-[70vh] rsp-break-words rsp-whitespace-pre-wrap",children:t})]})}):null}const Re=j.createContext({});function sa({apiKey:a,pConfig:s,children:r}){const t=j.useMemo(()=>({apiKey:a,resulMeta:s}),[a,s]),n=j.useRef(null);return j.useEffect(()=>{if(typeof window>"u"||a===void 0&&!s)return;let l={};try{const f=localStorage.getItem("account");f&&(l=JSON.parse(f))}catch(f){console.error("TrustSignalProvider: Failed to read account from storage",f)}const i={...l,...a!==void 0?{apiKey:a}:{},...s?{resulMeta:s}:{}},p=JSON.stringify(i);if(p!==n.current)try{localStorage.setItem("account",p),n.current=p}catch(f){console.error("TrustSignalProvider: Failed to persist account to storage",f)}},[a,s]),e.jsx(Re.Provider,{value:t,children:r})}function ra(){return j.useContext(Re)}const oe=a=>a?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(a):!1;function na({onCreateTemplate:a,onEditTemplate:s}){const[r,t]=j.useState([]),[n,l]=j.useTransition(),[i,p]=j.useState([]),[f,m]=j.useState(!1),[w,U]=j.useState(()=>{const d=localStorage.getItem("account");return d?JSON.parse(d):{apiKey:""}}),{resulMeta:o}=ra(),[k,E]=j.useState(!1);j.useEffect(()=>{if(!o)return;(async()=>{m(!0);try{const I={"Content-Type":"application/json",reqs:`${o.token}`},W={clientId:o.clientId,departmentId:o.departmentId,userId:o.userId,senderId:0},Z=await(await fetch("https://wiz.resul.io/Communication/GetServiceProviderWA",{method:"POST",headers:I,body:JSON.stringify(W)})).json();console.log("WA Sender Details:",Z);const ee=((Z==null?void 0:Z.data)||[]).filter(ce=>String((ce==null?void 0:ce.ServiceProviderName)||"").toLowerCase().includes("trustsignal"));l(()=>{p(Array.isArray(ee)?ee:[])}),console.log("filterData",ee)}catch(I){console.error("Error fetching WA sender details:",I),l(()=>{p([])})}finally{m(!1)}})()},[o,l]);const[y,g]=j.useState(()=>{const d=localStorage.getItem("account"),I=d?JSON.parse(d).apiKey:"";return oe(I)}),[x,h]=j.useState(!1),[u,v]=j.useState(null),[L,V]=j.useState(null),[b,N]=j.useState({isOpen:!1}),M=j.useRef(null),[B,P]=j.useState(""),[G,c]=j.useState("all"),[C,S]=j.useState("all"),[A,R]=j.useState("all"),[D,_]=j.useState(1),$=20;j.useEffect(()=>{_(1)},[B,G,C,A]);const[X,se]=j.useState({isOpen:!1});j.useEffect(()=>{(async()=>{var W;const I=w.apiKey;if(!oe(I)){M.current&&I!==M.current&&(l(()=>{t([])}),M.current=null),g(!1),h(!1);return}h(!0),v(null);try{const F=await Me(w,{limit:1});if((F==null?void 0:F.status)==="error")throw new Error(F.message||"Template list error");const Z=(W=F==null?void 0:F.meta)==null?void 0:W.total;if(!Z||Z===0){l(()=>{t([])}),M.current=I,g(!1),h(!1);return}const ee=await Me(w,{limit:Z});if((ee==null?void 0:ee.status)==="error")throw new Error(ee.message||"Template list error");l(()=>{t(Array.isArray(ee.data)?ee.data:[])}),M.current=I,g(!1)}catch(F){v(F instanceof Error?F.message:"Failed to fetch templates"),M.current||l(()=>{t([])}),M.current=null,g(!1)}finally{h(!1)}})()},[w,l]);const T=d=>{const I=d.target.value,W={...w,apiKey:I};l(()=>{U(W)}),localStorage.setItem("account",JSON.stringify(W))},ae=(d,I)=>{se({isOpen:!0,url:d,templateName:I}),E(!0)},O=()=>{se({isOpen:!1}),E(!1)},xe=async d=>{try{const I=localStorage.getItem("account"),W=I?JSON.parse(I):{apiKey:""};if(!W.apiKey){v("Please enter your TrustSignal API key");return}V(String(d));const{deleteTemplateById:F}=await Promise.resolve().then(()=>require("./delete-CZKt5rSC.cjs")),Z=await F(W.apiKey,d);if(!Z.success)throw new Error(Z.message||"Delete failed");t(ee=>ee.filter(ce=>String(ce.id)!==String(d))),N({isOpen:!1})}catch(I){v(I instanceof Error?I.message:"Failed to delete template")}finally{V(null)}},H=r.filter(d=>{const I=B.trim(),W=I.toLowerCase(),F=d.id!=null?String(d.id):"",Z=d.name?String(d.name).toLowerCase():"",ee=I===""||F.includes(I)||Z.includes(W),ce=G==="all"||String(d.status||"").toLowerCase()===G.toLowerCase(),_e=C==="all"||String(d.category||"").toLowerCase()===C.toLowerCase(),Fe=A==="all"||String(d.language||"").toLowerCase()===A.toLowerCase();return ee&&ce&&_e&&Fe}),ie=Array.from(new Set(r.map(d=>d.language).filter(Boolean))).sort(),re=Array.from(new Set(r.map(d=>d.category).filter(Boolean))).sort(),Y=Array.from(new Set(r.map(d=>d.status).filter(Boolean))).sort(),z=Math.max(1,Math.ceil(H.length/$)),Q=(D-1)*$,K=Q+$,q=H.slice(Q,K);return e.jsxs("div",{className:"rsp-container rsp-mx-auto rsp-px-4 rsp-py-1 rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm",children:[e.jsx("div",{className:"rsp-flex rsp-justify-end rsp-items-center"}),e.jsx("div",{className:" rsp-p-4 rsp-pl-0 rsp-rounded-lg rsp-shadow-sm rsp-mb-6",children:e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-1",children:"TrustSignal Account"}),e.jsxs("div",{className:"rsp-flex rsp-items-end rsp-gap-2",children:[e.jsx("div",{className:"rsp-relative rsp-flex-1",children:e.jsxs("div",{className:"rsp-relative",children:[(x||f)&&e.jsx("div",{className:"rsp-absolute rsp-right-2 rsp-top-1/2 -rsp-translate-y-1/2 rsp-z-10",children:e.jsx(fe,{className:"rsp-w-4 rsp-h-4 rsp-text-blue-600 rsp-animate-spin"})}),e.jsxs("select",{name:"trustsignalAccount",value:w.apiKey,onChange:T,disabled:x||f,className:"rsp-w-full rsp-h-[50px] rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent disabled:rsp-opacity-70 disabled:rsp-cursor-wait rsp-transition-all",children:[e.jsx("option",{value:"",children:f?"Loading senders...":"Select TrustSignal sender"}),i.map(d=>{const I=d.SenderID??d.UserName??"trustsignal-sender",W=d.SenderName??d.ServiceProviderName??"TrustSignal Sender",F=d.UserName??"";return oe(F)?e.jsx("option",{value:F,children:W},I):null})]})]})}),e.jsx("div",{className:"rsp-p-2",children:e.jsx("button",{onClick:()=>a==null?void 0:a(),className:"rsp-bg-blue-600 rsp-text-white rsp-p-1 rsp-rounded-full hover:rsp-bg-blue-700 rsp-flex rsp-items-center rsp-gap-2",children:e.jsx(je,{className:"rsp-w-6 rsp-h-6"})})})]})]})}),u&&e.jsx("div",{className:"rsp-bg-red-50 rsp-border-l-4 rsp-border-red-500 rsp-p-4 rsp-mb-6",children:e.jsxs("div",{className:"rsp-flex",children:[e.jsx("div",{className:"rsp-flex-shrink-0",children:e.jsx(ve,{className:"rsp-h-5 rsp-w-5 rsp-text-red-400"})}),e.jsx("div",{className:"rsp-ml-3",children:e.jsx("p",{className:"rsp-text-sm rsp-text-red-700",children:u})})]})}),e.jsx("div",{className:"rsp-mb-6",children:e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{type:"text",placeholder:"Search by name or ID...",value:B,onChange:d=>P(d.target.value),className:"rsp-w-full rsp-px-0 rsp-py-3 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent"})})}),e.jsxs("div",{className:"rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200 rsp-overflow-hidden rsp-relative",children:[(x||n)&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-white/60 rsp-backdrop-blur-sm rsp-z-10 rsp-flex rsp-items-center rsp-justify-center rsp-transition-opacity",children:e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2",children:[e.jsx(fe,{className:"rsp-w-6 rsp-h-6 rsp-text-blue-600 rsp-animate-spin"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:"Loading templates..."})]})}),e.jsx("div",{className:"rsp-overflow-x-auto",children:e.jsxs("table",{className:`rsp-min-w-full rsp-transition-opacity ${n?"rsp-opacity-70":"rsp-opacity-100"}`,children:[e.jsx("thead",{children:e.jsxs("tr",{className:"rsp-bg-blue-600 rsp-text-white",children:[e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"ID"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Name"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-gap-2",children:[e.jsx("span",{children:"Category"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center rsp-min-w-[120px]",children:[e.jsxs("select",{value:C,onChange:d=>S(d.target.value),className:"rsp-pr-7 rsp-pl-2 rsp-py-1 rsp-border rsp-border-white rsp-border-opacity-30 rsp-rounded-md rsp-text-sm rsp-bg-blue-400 rsp-bg-opacity-30 rsp-appearance-none rsp-h-auto rsp-leading-normal focus:rsp-outline-none focus:rsp-border-opacity-60 focus:rsp-bg-opacity-50 rsp-cursor-pointer rsp-text-white hover:rsp-bg-opacity-40 hover:rsp-border-opacity-50 rsp-transition-all",onClick:d=>d.stopPropagation(),children:[e.jsx("option",{value:"all",className:"rsp-text-gray-900 rsp-bg-white",children:"All"}),re.map(d=>e.jsx("option",{value:d.toLowerCase(),className:"rsp-text-gray-900 rsp-bg-white",children:d.charAt(0).toUpperCase()+d.slice(1)},d))]}),e.jsx(pe,{className:"rsp-absolute rsp-right-1.5 rsp-w-4 rsp-h-4 rsp-text-white rsp-pointer-events-none"})]})]})}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-gap-2",children:[e.jsx("span",{children:"Language"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center rsp-min-w-[120px]",children:[e.jsxs("select",{value:A,onChange:d=>R(d.target.value),className:"rsp-pr-7 rsp-pl-2 rsp-py-1 rsp-border rsp-border-white rsp-border-opacity-30 rsp-rounded-md rsp-text-sm rsp-bg-blue-400 rsp-bg-opacity-30 rsp-appearance-none rsp-h-auto rsp-leading-normal focus:rsp-outline-none focus:rsp-border-opacity-60 focus:rsp-bg-opacity-50 rsp-cursor-pointer rsp-text-white hover:rsp-bg-opacity-40 hover:rsp-border-opacity-50 rsp-transition-all",onClick:d=>d.stopPropagation(),children:[e.jsx("option",{value:"all",className:"rsp-text-gray-900 rsp-bg-white",children:"All"}),ie.map(d=>e.jsx("option",{value:d,className:"rsp-text-gray-900 rsp-bg-white",children:String(d).toUpperCase()},d))]}),e.jsx(pe,{className:"rsp-absolute rsp-right-1.5 rsp-w-4 rsp-h-4 rsp-text-white rsp-pointer-events-none"})]})]})}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Type"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-gap-2",children:[e.jsx("span",{children:"Status"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center rsp-min-w-[120px]",children:[e.jsxs("select",{value:G,onChange:d=>c(d.target.value),className:"rsp-pr-7 rsp-pl-2 rsp-py-1 rsp-border rsp-border-white rsp-border-opacity-30 rsp-rounded-md rsp-text-sm rsp-bg-blue-400 rsp-bg-opacity-30 rsp-appearance-none rsp-h-auto rsp-leading-normal focus:rsp-outline-none focus:rsp-border-opacity-60 focus:rsp-bg-opacity-50 rsp-cursor-pointer rsp-text-white hover:rsp-bg-opacity-40 hover:rsp-border-opacity-50 rsp-transition-all",onClick:d=>d.stopPropagation(),children:[e.jsx("option",{value:"all",className:"rsp-text-gray-900 rsp-bg-white",children:"All"}),Y.map(d=>e.jsx("option",{value:d.toLowerCase(),className:"rsp-text-gray-900 rsp-bg-white",children:d.charAt(0).toUpperCase()+d.slice(1)},d))]}),e.jsx(pe,{className:"rsp-absolute rsp-right-1.5 rsp-w-4 rsp-h-4 rsp-text-white rsp-pointer-events-none"})]})]})}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Created"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Updated"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Media"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Actions"})]})}),e.jsx("tbody",{children:y&&q.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"rsp-px-6 rsp-py-12 rsp-text-center",children:e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-3",children:[e.jsx(fe,{className:"rsp-w-8 rsp-h-8 rsp-text-blue-600 rsp-animate-spin"}),e.jsx("span",{className:"rsp-text-gray-600",children:"Loading templates..."})]})})}):q.length>0?q.map((d,I)=>{const W=String(d.status||"").toLowerCase();return e.jsxs("tr",{className:`rsp-border-b rsp-border-gray-200 ${I%2===0?"rsp-bg-white":"rsp-bg-blue-50"} hover:rsp-bg-blue-100 rsp-transition-colors`,children:[e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900",children:d.id??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900 rsp-font-medium",children:d.name??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700 rsp-capitalize",children:d.category??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:d.language??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:d.type??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4",children:e.jsx("span",{className:`rsp-inline-flex rsp-px-3 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium
|
|
102
|
-
${W==="approved"?"rsp-bg-green-100 rsp-text-green-800":W==="rejected"?"rsp-bg-red-100 rsp-text-red-800":"rsp-bg-yellow-100 rsp-text-yellow-800"}`,children:d.status??"Unknown"})}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:d.creation_time?new Date(d.creation_time).toLocaleDateString():"N/A"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:d.updation_time?new Date(d.updation_time).toLocaleDateString():"N/A"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:d.medialist&&typeof d.medialist=="object"&&"header"in d.medialist&&d.medialist.header?e.jsxs("button",{onClick:()=>ae(String(d.medialist.header||""),d.name||""),className:"rsp-inline-flex rsp-items-center rsp-px-3 rsp-py-1 rsp-rounded rsp-text-xs rsp-font-medium rsp-bg-blue-100 rsp-text-blue-800 hover:rsp-bg-blue-200 rsp-transition-colors",children:[e.jsxs("svg",{className:"rsp-w-3 rsp-h-3 rsp-mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),e.jsx("span",{children:"View Media"})]}):e.jsx("span",{className:"rsp-inline-flex rsp-px-2 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium rsp-bg-gray-100 rsp-text-gray-800",children:"No Media"})}),e.jsx("td",{className:"rsp-px-6 rsp-py-4",children:e.jsxs("div",{className:"rsp-flex rsp-gap-2",children:[e.jsx("button",{onClick:()=>s==null?void 0:s(String(d.id)),className:"rsp-inline-flex rsp-items-center rsp-justify-center rsp-w-8 rsp-h-8 rsp-rounded rsp-bg-blue-600 rsp-text-white hover:rsp-bg-blue-700 rsp-transition-colors",title:"Update",children:e.jsx(Ye,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>N({isOpen:!0,templateId:String(d.id),templateName:d.name}),disabled:L===String(d.id),className:`rsp-inline-flex rsp-items-center rsp-justify-center rsp-w-8 rsp-h-8 rsp-rounded rsp-text-white rsp-transition-colors ${L===String(d.id)?"rsp-bg-red-400":"rsp-bg-red-600 hover:rsp-bg-red-700"}`,title:L===String(d.id)?"Deleting...":"Delete",children:e.jsx(Ze,{className:"rsp-w-4 rsp-h-4"})})]})})]},String(d.id)||I)}):y?null:e.jsx("tr",{children:e.jsx("td",{colSpan:9,className:"rsp-px-6 rsp-py-8 rsp-text-center rsp-text-gray-500",children:oe(w.apiKey)?"No templates found":"Please select a TrustSignal account"})})})]})})]}),q.length>0&&e.jsxs("div",{className:"rsp-flex rsp-justify-between rsp-items-center rsp-mt-6 rsp-px-6 rsp-py-4 rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200",children:[e.jsxs("div",{className:"rsp-text-sm rsp-text-gray-700",children:["Showing ",e.jsx("span",{className:"rsp-font-medium",children:Q+1})," to ",e.jsx("span",{className:"rsp-font-medium",children:Math.min(K,H.length)})," of ",e.jsx("span",{className:"rsp-font-medium",children:H.length})," results"]}),e.jsxs("div",{className:"rsp-flex rsp-gap-2",children:[e.jsx("button",{onClick:()=>_(d=>Math.max(d-1,1)),disabled:D===1,className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",children:"Previous"}),e.jsxs("span",{className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700",children:["Page ",D," of ",z]}),e.jsx("button",{onClick:()=>_(d=>Math.min(d+1,z)),disabled:D===z,className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",children:"Next"})]})]}),e.jsx(me,{isOpen:X.isOpen,onClose:O,title:`Media - ${X.templateName||"Template"}`,children:e.jsxs("div",{className:"rsp-space-y-4",children:[X.url&&e.jsxs("div",{className:"rsp-text-center",children:[e.jsxs("div",{className:"rsp-relative rsp-bg-gray-50 rsp-rounded-lg rsp-p-4 rsp-min-h-[200px] rsp-flex rsp-items-center rsp-justify-center",children:[e.jsx("img",{src:X.url,alt:"Template media",className:"rsp-max-w-full rsp-max-h-[400px] rsp-mx-auto rsp-rounded-lg rsp-shadow-md rsp-object-contain",onLoad:()=>{E(!1)},onError:()=>{E(!1)}}),k&&e.jsx("div",{className:"loading-placeholder rsp-absolute rsp-inset-0 rsp-flex rsp-items-center rsp-justify-center",children:e.jsx("div",{className:"rsp-text-gray-500 rsp-text-sm",children:"Loading media..."})}),!k&&e.jsxs("div",{className:"error-placeholder rsp-absolute rsp-inset-0 rsp-flex rsp-flex-col rsp-items-center rsp-justify-center",style:{display:"none"},children:[e.jsx("svg",{className:"rsp-w-[100%] rsp-h-12 rsp-text-gray-400 rsp-m-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e.jsx("p",{className:"rsp-text-gray-500 rsp-text-sm rsp-mb-2",children:"Load media on new tab"})]})]}),e.jsxs("div",{className:"rsp-mt-4 rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg",children:[e.jsx("p",{className:"rsp-text-xs rsp-text-gray-600 rsp-mb-1",children:"Media URL:"}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-800 rsp-break-all rsp-font-mono",children:X.url})]})]}),e.jsx("div",{className:"rsp-flex rsp-justify-end rsp-pt-4",children:e.jsxs("a",{href:X.url,target:"_blank",rel:"noopener noreferrer",className:"rsp-inline-flex rsp-items-center rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-text-sm rsp-font-medium rsp-rounded-md hover:rsp-bg-blue-700 rsp-transition-colors",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),"Open in New Tab"]})})]})}),e.jsx(me,{isOpen:b.isOpen,onClose:()=>N({isOpen:!1}),title:"Delete Template",children:e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsxs("p",{className:"rsp-text-sm rsp-text-gray-700",children:["Are you sure you want to delete the template ",e.jsx("span",{className:"rsp-font-medium",children:b.templateName}),"?"]}),e.jsxs("div",{className:"rsp-flex rsp-justify-end rsp-gap-3",children:[e.jsx("button",{onClick:()=>N({isOpen:!1}),className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50",children:"Cancel"}),e.jsx("button",{onClick:()=>b.templateId&&xe(b.templateId),className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-white rsp-bg-red-600 rsp-rounded-md hover:rsp-bg-red-700",children:"Delete"})]})]})})]})}const ta=async(a,s)=>{var r,t,n,l,i,p,f;try{console.log("Creating template with data:",s);const m=s.language,w=s.headerType==="MEDIA"&&s.mediaType==="DOCUMENT",U=s.type==="CAROUSEL";let o="";w?o=Be(s,m):U?o=Oe(s,m):o=Pe(s,m),console.log("Raw JSON string being sent:",o);const k={method:"POST",headers:{"Content-Type":"application/json"},body:o,redirect:"follow"};console.log("Making request to:",`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`),console.log("Request options:",k);const E=await fetch(`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`,k);console.log("Response status:",E.status),console.log("Response headers:",Object.fromEntries(E.headers.entries()));const y=await E.text();console.log("Raw response:",y);let g;try{g=JSON.parse(y)}catch(x){throw new Error(`Invalid JSON response from TrustSignal API: ${x instanceof Error?x.message:"Unknown error"}`)}if(console.log("Parsed response:",g),!g.success)throw new Error(g.message||"Template creation failed");return{status:"success",message:"Template created successfully",data:{template:g.template,details:[{template_name:((r=g.template)==null?void 0:r.name)||s.name,template_id:((t=g.template)==null?void 0:t.id)||"unknown",meta_tid:(n=g.template)==null?void 0:n.meta_tid,status:(l=g.template)==null?void 0:l.status,quality:(i=g.template)==null?void 0:i.quality,temp_route:(p=g.template)==null?void 0:p.temp_route,temptype:(f=g.template)==null?void 0:f.temptype}]}}}catch(m){return console.error("TrustSignal API Error:",m),{status:"error",message:m instanceof Error?m.message:"Failed to create template"}}};function ia(a){const s=a.language,r=a.headerType==="MEDIA"&&a.mediaType==="DOCUMENT",t=a.type==="CAROUSEL";return r?Be(a,s):t?Oe(a,s):Pe(a,s)}const Be=(a,s)=>{var l,i;const r={name:a.name,lang:s,category:a.category,components:[]};a.headerType==="MEDIA"&&a.mediaUrl&&(r.media={header:a.mediaUrl},r.components.push({type:"HEADER",format:"DOCUMENT"}));const t=le(a.body),n={type:"BODY",text:a.body};if(t.length>0&&((l=a.sampleContent)!=null&&l.bodyVariables)){const p=Ce(a,t);n.example={body_text:[p]}}if(r.components.push(n),(i=a.footer)!=null&&i.trim()&&r.components.push({type:"FOOTER",text:a.footer}),a.buttons&&a.buttons.length>0){const p=a.buttons.map(f=>{var w;const m={type:f.type==="CALL"?"PHONE_NUMBER":f.type,text:f.text};if(f.type==="URL"&&f.value&&(m.url=f.value,f.urlType==="dynamic"&&f.value.includes("{{"))){const U=le(f.value);if(U.length>0&&((w=a.sampleContent)!=null&&w.buttonVariables)){const o=U.map(({number:k})=>{var E,y;return((y=(E=a.sampleContent)==null?void 0:E.buttonVariables)==null?void 0:y[k])||`sample${k}`});m.example=o}}return(f.type==="CALL"||f.type==="PHONE_NUMBER")&&f.value&&(m.phone_number=Ne(f.value)),m});r.components.push({type:"BUTTONS",buttons:p})}return JSON.stringify(r)},Oe=(a,s)=>{var i,p,f;const r={name:a.name,lang:s,category:a.category,shortlink:a.enableClickTracking?"1":"0",components:[]};(i=a.carousel)!=null&&i.cards.length&&(r.media={},a.carousel.cards.forEach((m,w)=>{m.mediaUrl&&(r.media[`card${w}header`]=m.mediaUrl)}));const t=[],n=le(a.body),l={type:"BODY",text:a.body,...n.length>0&&((p=a.sampleContent)==null?void 0:p.bodyVariables)&&{example:{body_text:[Ce(a,n)]}}};if(t.push(l),(f=a.carousel)!=null&&f.cards.length){const m={type:"CAROUSEL",cards:a.carousel.cards.map(w=>{var U;return{components:[{type:"HEADER",format:((U=a.carousel)==null?void 0:U.type)||"IMAGE"},{type:"BODY",text:w.body,...le(w.body).length>0&&{example:{body_text:[la(w)]}}},...w.buttons.length>0?[{type:"BUTTONS",buttons:w.buttons.map(o=>{var E;const k={type:o.type==="CALL"?"PHONE_NUMBER":o.type,text:o.text};if(o.type==="URL"&&o.value&&(k.url=o.value,o.urlType==="dynamic"&&o.value.includes("{{"))){const y=le(o.value);if(y.length>0){const g=((E=w==null?void 0:w.sampleContent)==null?void 0:E.buttonVariables)||{},x=y.map(({number:h})=>g[h]||`sample${h}`);k.example=x}}return(o.type==="CALL"||o.type==="PHONE_NUMBER")&&o.value&&(k.phone_number=Ne(o.value)),console.log("Carousel card button data:",k),k})}]:[]]}})};t.push(m)}return r.components=t,JSON.stringify(r)},la=a=>{var t;const s=le(a.body||""),r=((t=a==null?void 0:a.sampleContent)==null?void 0:t.bodyVariables)||{};return s.map(({number:n})=>r[n]||`Sample ${n}`)},Pe=(a,s)=>{var i,p;const r={name:a.name,lang:s,category:a.category,shortlink:a.enableClickTracking?"1":"0",components:[]};a.headerType==="MEDIA"&&a.mediaUrl&&a.mediaType!=="DOCUMENT"&&(r.media={header:a.mediaUrl});const t=[];if(a.type!=="CAROUSEL"){if(a.headerType==="TEXT"&&a.headerText){const f=le(a.headerText),m={type:"HEADER",format:"TEXT",text:a.headerText,...f.length>0&&((i=a.sampleContent)==null?void 0:i.headerVariables)&&{example:{header_text:xa(a,f)}}};t.push(m)}else if(a.headerType==="MEDIA"){const f={type:"HEADER",format:a.mediaType||"IMAGE"};t.push(f)}}const n=le(a.body),l={type:"BODY",text:a.body,...n.length>0&&((p=a.sampleContent)==null?void 0:p.bodyVariables)&&{example:{body_text:[Ce(a,n)]}}};if(t.push(l),a.footer&&a.type!=="CAROUSEL"&&t.push({type:"FOOTER",text:a.footer}),a.buttons.length>0){const f=a.buttons.map(m=>{var U;const w={type:m.type==="CALL"?"PHONE_NUMBER":m.type,text:m.text};if(m.type==="URL"&&m.value&&(w.url=m.value,m.urlType==="dynamic"&&m.value.includes("{{"))){const o=le(m.value);if(o.length>0&&((U=a.sampleContent)!=null&&U.buttonVariables)){const k=o.map(({number:E})=>{var y,g;return((g=(y=a.sampleContent)==null?void 0:y.buttonVariables)==null?void 0:g[E])||`sample${E}`});w.example=k}}return(m.type==="CALL"||m.type==="PHONE_NUMBER")&&m.value&&(w.phone_number=Ne(m.value)),w});t.push({type:"BUTTONS",buttons:f})}return r.components=t,JSON.stringify(r)},le=a=>(a.match(/\{\{(\d+)\}\}/g)||[]).map(r=>({variable:r.replace(/[{}]/g,""),number:r.replace(/[{}]/g,"")})),Ne=a=>a.startsWith("+")?a:`+${a}`,xa=(a,s)=>s.map(({number:r})=>{var t,n;return((n=(t=a.sampleContent)==null?void 0:t.headerVariables)==null?void 0:n[r])||`Sample ${r}`}),Ce=(a,s)=>s.map(({number:r})=>{var t,n;return((n=(t=a.sampleContent)==null?void 0:t.bodyVariables)==null?void 0:n[r])||`Sample ${r}`}),ca="https://wiz.resul.io",da="/communication/SaveWATemplate_new",Le={departmentId:1,clientId:3850,createdBy:7874,userId:7874,serviceproviderId:3,senderId:31},oa=async(a,s)=>{const r=a.type==="CAROUSEL"?va(a):wa(a),n={waTemplateId:typeof(s==null?void 0:s.waTemplateId)=="number"?s.waTemplateId:r.templateType,...pa(s),templateData:r},l=await fetch(fa(s),{method:"POST",headers:{"Content-Type":"application/json",...s!=null&&s.token?{Reqs:s.token}:{}},body:JSON.stringify(n)});if(!l.ok){const i=await ma(l);throw new Error(`SaveWATemplate_new failed with status ${l.status}: ${i}`)}},ma=async a=>{try{return await a.text()}catch{return"Unable to read response body"}},pa=a=>{if(!a)return{...Le};const{departmentId:s,clientId:r,createdBy:t,userId:n,serviceproviderId:l,senderId:i}=a;return{...Le,...typeof s=="number"?{departmentId:s}:{},...typeof r=="number"?{clientId:r}:{},...typeof t=="number"?{createdBy:t}:{},...typeof n=="number"?{userId:n}:{},...typeof l=="number"?{serviceproviderId:l}:{},...typeof i=="number"?{senderId:i}:{}}},fa=a=>{var r;return`${((r=a==null?void 0:a.baseUrl)==null?void 0:r.replace(/\/+$/,""))||ca}${da}`},De=a=>a.headerType==="TEXT"?a.headerText.trim().length>0:a.headerType==="MEDIA"?!!a.mediaUrl:!1,ha=a=>!!(te(a.body).length>0||a.headerType==="TEXT"&&te(a.headerText).length>0||a.footer&&te(a.footer).length>0),ua=a=>a.buttons.some(s=>s.type==="URL"&&s.urlType==="dynamic"&&s.value),ze=a=>{if(a.type==="CAROUSEL")return 11;const s=ha(a);if(ua(a))return s?9:10;if(a.headerType==="MEDIA")switch(a.mediaType){case"IMAGE":return s?2:6;case"DOCUMENT":return s?3:7;case"VIDEO":return s?4:8;default:return s?1:5}return s?1:5},ba=a=>De(a)?a.headerType==="TEXT"?"text":a.mediaType==="DOCUMENT"?"pdf":a.mediaType==="VIDEO"?"video":"image":"",ga=a=>a.headerType==="TEXT"?a.headerText||"":a.headerType==="MEDIA"&&a.mediaUrl||"",te=a=>a?(a.match(/\{\{?(\d+)\}\}?/g)||[]).map(r=>r.replace(/[{}]/g,"")):[],Te=(a,s)=>{const r=a.value||a.dynamicUrl||"",t=a.type==="URL"&&a.urlType==="dynamic",n=t?te(r):[];return{actionIndex:s,isNameEditable:!1,actionNameParam:[],actionName:a.text,actionType:ya(a),isValueEditable:t,actionValueParam:n,value:r,...a.type==="URL"&&{urlType:a.urlType==="dynamic"?"dynamic":"static"}}},ya=a=>{switch(a.type){case"URL":return"url";case"CALL":case"PHONE_NUMBER":return"call phone number";case"QUICK_REPLY":return"quick reply";case"FLOW":return"flow";default:return"unknown"}},wa=a=>{const s=te(a.body),r=a.headerType==="TEXT"?te(a.headerText):[],t=a.footer||"",n=t.trim().length>0,l=n?te(t):[],i=n&&l.length>0,p=De(a),f=a.mediaType?a.mediaType.toLowerCase():"",m=a.mediaUrl||"";return{templateName:a.name,templateType:ze(a),templateContent:a.body,bodyTags:s,languageId:a.language||"en",isUnicode:!0,isBodyEditable:s.length>0,bodyMaxLength:1024,isAction:a.buttons.length>0,actions:a.buttons.map(Te),isCarousel:!1,carousel:[],isHeader:p,isHeaderEditable:a.headerType==="TEXT"&&r.length>0,isHeaderType:ba(a),header:ga(a),headerTags:r,headerMaxLength:60,isFooter:n,isFooterEditable:i,footer:n?t:"",footerTags:l,footerMaxLength:60,isMedia:a.headerType==="MEDIA"&&!!m,isMediaEditable:!1,isMediaTypeEditable:!1,mediaType:f,mediaURL:m,mediaURLTags:[],mediaSizeInMB:10,mediaUrlMaxLength:1040}},va=a=>{var p;const s=te(a.body),r=a.footer||"",t=r.trim().length>0,n=t?te(r):[],l=((p=a.carousel)==null?void 0:p.cards)||[],i=ka(a);return{templateName:a.name,templateType:ze(a),templateContent:a.body,bodyTags:s,languageId:a.language||"en",isUnicode:!0,isBodyEditable:s.length>0,bodyMaxLength:1024,isAction:a.buttons.length>0,actions:a.buttons.map(Te),isCarousel:!0,carousel:l.map((f,m)=>ja(f,m,i)),isHeader:!1,isHeaderEditable:!1,isHeaderType:"",header:"",headerTags:[],headerMaxLength:60,isFooter:t,isFooterEditable:t&&n.length>0,footer:t?r:"",footerTags:n,footerMaxLength:60,isMedia:!1,isMediaEditable:!1,isMediaTypeEditable:!0,mediaType:"",mediaURL:"",mediaURLTags:[],mediaSizeInMB:10,mediaUrlMaxLength:1040}},ja=(a,s,r)=>{const t=te(a.body),n=r.toLowerCase(),l=a.mediaUrl||"";return{cardIndex:s,isUnicode:!0,bodyMaxLength:1024,cardBody:a.body,bodyTags:t,isCardBodyEditable:t.length>0,isMediaTypeEditable:!1,mediaType:n,mediaValue:l,actions:a.buttons.map(Te)}},ka=a=>{var n,l;const s=(n=a.carousel)==null?void 0:n.type;return s==="VIDEO"?"VIDEO":s==="IMAGE"?"IMAGE":(((l=a.carousel)==null?void 0:l.cards)||[]).some(i=>(i.mediaType||"").toUpperCase()==="VIDEO"?!0:i.mediaUrl?!!i.mediaUrl.toLowerCase().match(/\.(mp4|mov|m4v|avi|wmv|flv)(\?|$)/):!1)?"VIDEO":"IMAGE"},Na=async(a,s)=>{try{if(!s.name||!s.body)throw new Error("Missing required template fields: name and body are required");if(s.type==="CAROUSEL"&&(!s.carousel||!s.carousel.cards||s.carousel.cards.length===0))throw new Error("Carousel templates must have at least one card");if(!a.apiKey)throw new Error("Missing TrustSignal API key");const r=await ta(a.apiKey,s);if(r.status==="error")return r;try{await oa(s,a.resulMeta)}catch(t){console.error("Resul template submission failed (non-critical):",t)}return r}catch(r){return console.error("API Error:",r),{status:"error",message:r instanceof Error?r.message:"An unexpected error occurred while creating the template"}}};async function Ca(a,s,r){const t=ia(r),l={method:"POST",headers:{"Content-Type":"application/json"},body:t,redirect:"follow"},i=`https://wpapi.trustsignal.io/v1/user-templates/update/${encodeURIComponent(s)}?api_key=${encodeURIComponent(a)}`,p=await fetch(i,l),f=await p.text();if(!p.ok)return{success:!1,message:`Update failed (${p.status}): ${f}`,raw:t};try{const m=JSON.parse(f);return{success:!!((m==null?void 0:m.success)??!0),message:m==null?void 0:m.message,raw:t}}catch{return{success:!0,raw:t}}}async function Ta(a,s){var p;const r=`https://wpapi.trustsignal.io/api/v1/template/${encodeURIComponent(s)}?api_key=${encodeURIComponent(a)}`,t=await fetch(r,{method:"GET",redirect:"follow"});if(!t.ok)throw new Error(`Failed to fetch template ${s}: ${t.status}`);const n=await t.text(),l=JSON.parse(n),i=l.template||((p=l.data)==null?void 0:p.template)||l;if(!i)throw new Error("Invalid template details response");return Ea(i)}function Ea(a){var w,U;const s={headerVariables:{},bodyVariables:{},buttonVariables:{}};let r="NONE",t="",n,l,i="",p="";const f=[];if(a.jsonstruct)try{const o=JSON.parse(a.jsonstruct);if(o!=null&&o.header){const k=o.header.format;k&&k!=="TEXT"?(r="MEDIA",n=k,l=o.header.url||((w=a.medialist)==null?void 0:w.header)):k==="TEXT"&&(r="TEXT",t=o.header.text||"")}if(o!=null&&o.body&&(i=o.body.text||""),(U=o==null?void 0:o.buttons)!=null&&U.buttons&&Array.isArray(o.buttons.buttons))for(const k of o.buttons.buttons){if(!k||!k.type||!k.text)continue;const E={id:ue(),type:k.type==="PHONE_NUMBER"?"PHONE_NUMBER":k.type,text:k.text};k.type==="URL"&&(E.value=k.url,typeof k.url=="string"&&k.url.includes("{{")&&Array.isArray(k.example)?(Se(k.url).forEach((g,x)=>{s.buttonVariables[g]=k.example[x]??""}),E.urlType="dynamic"):E.urlType="static"),(k.type==="CALL"||k.type==="PHONE_NUMBER")&&(E.value=k.phone_number||""),f.push(E)}if(o!=null&&o.carousel){const k=Object.keys(o.carousel).filter(h=>/^card\d+$/.test(h));k.sort((h,u)=>{const v=parseInt(h.replace("card",""),10),L=parseInt(u.replace("card",""),10);return v-L});const E=k.map(h=>{const u=o.carousel[h]||{},v=u.header||{},L=u.body||{},V=u.buttons&&Array.isArray(u.buttons.buttons)?u.buttons.buttons:[],b=v.format,N=b==="IMAGE"||b==="VIDEO"||b==="DOCUMENT"?b:void 0,B=`card${h.replace("card","")}header`,P=v.url||(a.medialist&&typeof a.medialist=="object"&&B in a.medialist?a.medialist[B]:void 0),G=L.text||"",c=[];for(const C of V){if(!C||!C.type||!C.text)continue;const S={id:ue(),type:C.type==="PHONE_NUMBER"?"PHONE_NUMBER":C.type,text:C.text};C.type==="URL"&&(S.value=C.url,typeof C.url=="string"&&C.url.includes("{{")&&Array.isArray(C.example)?(Se(C.url).forEach((R,D)=>{}),S.urlType="dynamic"):S.urlType="static"),(C.type==="CALL"||C.type==="PHONE_NUMBER")&&(S.value=C.phone_number||""),c.push(S)}return{id:ue(),headerType:N?"MEDIA":"NONE",mediaType:N,mediaUrl:P,body:G,buttons:c,sampleContent:{headerVariables:{},bodyVariables:{},buttonVariables:{}}}});let y="IMAGE";const g=E[0];(g==null?void 0:g.mediaType)==="VIDEO"&&(y="VIDEO");const x={type:y,cards:E};return{name:a.name,category:a.category==="MARKETING"||a.category==="UTILITY"?a.category:"MARKETING",type:"CAROUSEL",language:a.lang||"en",enableClickTracking:!1,headerType:"NONE",headerText:"",body:i,footer:p,buttons:[],sampleContent:s,carousel:x}}}catch(o){console.warn("Failed to parse jsonstruct; falling back",o)}return{name:a.name,category:a.category==="MARKETING"||a.category==="UTILITY"?a.category:"MARKETING",type:"BASIC",language:a.lang||"en",enableClickTracking:!1,headerType:r,headerText:t,mediaType:n,mediaUrl:l,body:i,footer:p,buttons:f,sampleContent:s}}function Se(a){if(!a)return[];const s=a.match(/\{\{(\d+)\}\}/g)||[];return[...new Set(s.map(r=>r.replace(/[{}]/g,"")))]}function ue(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"id-"+Math.random().toString(36).slice(2)}const Ma=[{value:"af",label:"Afrikaans"},{value:"sq",label:"Albanian"},{value:"ar",label:"Arabic"},{value:"az",label:"Azerbaijani"},{value:"bn",label:"Bengali"},{value:"bg",label:"Bulgarian"},{value:"ca",label:"Catalan"},{value:"zh_CN",label:"Chinese (CHN)"},{value:"zh_HK",label:"Chinese (HKG)"},{value:"zh_TW",label:"Chinese (TAI)"},{value:"hr",label:"Croatian"},{value:"cs",label:"Czech"},{value:"da",label:"Danish"},{value:"nl",label:"Dutch"},{value:"en_GB",label:"English (UK)"},{value:"en_US",label:"English (US)"},{value:"en",label:"English"},{value:"et",label:"Estonian"},{value:"fil",label:"Filipino"},{value:"fi",label:"Finnish"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"el",label:"Greek"},{value:"gu",label:"Gujarati"},{value:"he",label:"Hebrew"},{value:"hi",label:"Hindi"},{value:"hu",label:"Hungarian"},{value:"id",label:"Indonesian"},{value:"ga",label:"Irish"},{value:"it",label:"Italian"},{value:"ja",label:"Japanese"},{value:"kn",label:"Kannada"},{value:"kk",label:"Kazakh"},{value:"ko",label:"Korean"},{value:"lo",label:"Lao"},{value:"lv",label:"Latvian"},{value:"lt",label:"Lithuanian"},{value:"mk",label:"Macedonian"},{value:"ms",label:"Malay"},{value:"mr",label:"Marathi"},{value:"nb",label:"Norwegian"},{value:"fa",label:"Persian"},{value:"pl",label:"Polish"},{value:"pt_BR",label:"Portuguese (BR)"},{value:"pt_PT",label:"Portuguese (POR)"},{value:"pa",label:"Punjabi"},{value:"ro",label:"Romanian"},{value:"ru",label:"Russian"},{value:"sr",label:"Serbian"},{value:"sk",label:"Slovak"},{value:"sl",label:"Slovenian"},{value:"es",label:"Spanish"},{value:"es_AR",label:"Spanish (ARG)"},{value:"es_ES",label:"Spanish (SPA)"},{value:"es_MX",label:"Spanish (MEX)"},{value:"sw",label:"Swahili"},{value:"sv",label:"Swedish"},{value:"ta",label:"Tamil"},{value:"te",label:"Telugu"},{value:"th",label:"Thai"},{value:"tr",label:"Turkish"},{value:"uk",label:"Ukrainian"},{value:"ur",label:"Urdu"},{value:"uz",label:"Uzbek"},{value:"vi",label:"Vietnamese"}],La=[{value:"NONE",label:"None"},{value:"TEXT",label:"Text"},{value:"MEDIA",label:"Media"}],Sa=[{value:"IMAGE",label:"Image"},{value:"VIDEO",label:"Video"},{value:"DOCUMENT",label:"Document"}],Aa=5*1024*1024,Ua=16*1024*1024,Va=100*1024*1024,be=["jpg","jpeg","png"],ge=["mp4","3gpp"],ye=["pdf","docx","xlsx","pptx","txt"];function Ia({template:a,setTemplate:s,onFileUpload:r}){var L,V;const[t,n]=j.useState(null),[l,i]=j.useState(!1),[p,f]=j.useState(null),[m,w]=j.useState(null),U=()=>{const N=(a.headerText||"").match(/{{\d+}}/g);if(!N)return 0;const M=N.map(B=>{const P=B.match(/{{(\d+)}}/);return P?parseInt(P[1],10):0});return M.length>0?Math.max(...M):0},o=()=>{const M=`{{${U()+1}}}`;if(p&&a.headerText.length+M.length<=60){const B=p.selectionStart||a.headerText.length,P=a.headerText.substring(0,B),G=a.headerText.substring(B),c=P+M+G;s({...a,headerText:c}),setTimeout(()=>{if(p){const C=B+M.length;p.setSelectionRange(C,C),p.focus()}},0)}},k=b=>{s(N=>({...N,headerType:b,headerText:b==="TEXT"?N.headerText:"",mediaType:b==="MEDIA"?N.mediaType||"IMAGE":void 0,mediaUrl:b==="MEDIA"?N.mediaUrl:void 0})),b!=="MEDIA"&&(n(null),w(null))},E=b=>{var N;return((N=b.split("?")[0].split(".").pop())==null?void 0:N.toLowerCase())||""},y=(b,N)=>{const M=E(b.name);switch(N){case"IMAGE":if(!be.includes(M))return"Invalid format. Only JPG, JPEG, PNG are allowed.";if(b.size>Aa)return"File is too large. Max size is 5 MB.";break;case"VIDEO":if(!ge.includes(M))return"Invalid format. Only MP4, 3GPP are allowed.";if(b.size>Ua)return"File is too large. Max size is 16 MB.";break;case"DOCUMENT":if(!ye.includes(M))return"Invalid format. Allowed types: PDF, DOCX, XLSX, PPTX, TXT.";if(b.size>Va)return"File is too large. Max size is 100 MB.";break;default:return"Invalid media type."}return null},g=(b,N)=>{if(!b)return null;const M=E(b);switch(N){case"IMAGE":if(!be.includes(M))return"URL does not point to a valid image (JPG, JPEG, PNG).";break;case"VIDEO":if(!ge.includes(M))return"URL does not point to a valid video (MP4, 3GPP).";break;case"DOCUMENT":if(!ye.includes(M))return"URL does not point to a valid document.";break}return null},x=()=>{n(null),s({...a,mediaUrl:""}),w(null)},h=async b=>{var B;const N=(B=b.target.files)==null?void 0:B[0];if(!N||!a.mediaType)return;w(null);const M=y(N,a.mediaType);if(M){w(M);return}i(!0),n(N);try{const P=await r(N);s({...a,mediaUrl:P})}catch(P){console.error("File upload failed:",P),x();const G=P instanceof Error?P.message:"File upload failed. Please try again.";w(G)}finally{i(!1)}},u=b=>{const N=b.target.value;if(n(null),s({...a,mediaUrl:N}),a.mediaType){const M=g(N,a.mediaType);w(M)}},v=()=>{switch(a.mediaType){case"IMAGE":return be.map(b=>`.${b}`).join(",");case"VIDEO":return ge.map(b=>`.${b}`).join(",");case"DOCUMENT":return ye.map(b=>`.${b}`).join(",");default:return"*/*"}};return e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Header Type"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("select",{value:a.headerType,onChange:b=>k(b.target.value),className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:La.map(b=>e.jsx("option",{value:b.value,children:b.label},b.value))}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500"})]})]}),a.headerType==="TEXT"&&e.jsxs("div",{className:"rsp-animate-fade-in",children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Header Text"}),e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{ref:f,type:"text",value:a.headerText,onChange:b=>s({...a,headerText:b.target.value}),maxLength:60,className:"rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",placeholder:"Add a 60 character title to your message"})}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-2",children:[e.jsx("button",{onClick:o,className:"rsp-px-2 rsp-py-1 rsp-text-xs hover:rsp-bg-gray-100 rsp-rounded rsp-text-gray-500 rsp-flex rsp-items-center rsp-gap-1",title:"Add variable to header",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500",children:[a.headerText.length,"/60"]})]}),(()=>{const b=[...new Set((a.headerText.match(/\{\{(\d+)\}\}/g)||[]).map(N=>N.replace(/[{}]/g,"")))];return b.length===0?null:e.jsxs("div",{className:"rsp-mt-3",children:[e.jsx("p",{className:"rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2",children:"Sample Values"}),e.jsx("div",{className:"rsp-grid rsp-grid-cols-3 rsp-gap-2",children:b.map(N=>{var M,B;return e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsxs("label",{className:"rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap",children:[`{{${N}}}`,":"]}),e.jsx("input",{type:"text",value:((B=(M=a.sampleContent)==null?void 0:M.headerVariables)==null?void 0:B[N])||"",onChange:P=>{var c,C,S;const G={...a.sampleContent,headerVariables:{...(c=a.sampleContent)==null?void 0:c.headerVariables,[N]:P.target.value},bodyVariables:((C=a.sampleContent)==null?void 0:C.bodyVariables)||{},buttonVariables:((S=a.sampleContent)==null?void 0:S.buttonVariables)||{}};s({...a,sampleContent:G})},className:"rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",placeholder:"Sample"}),e.jsx("button",{type:"button",onClick:()=>{var C,S,A;const P=new RegExp(`\\{\\{${N}\\}\\}`,"g"),G=(a.headerText||"").replace(P,""),c=Object.fromEntries(Object.entries(((C=a.sampleContent)==null?void 0:C.headerVariables)||{}).filter(([R])=>R!==N));s({...a,headerText:G,sampleContent:{...a.sampleContent,headerVariables:c,bodyVariables:((S=a.sampleContent)==null?void 0:S.bodyVariables)||{},buttonVariables:((A=a.sampleContent)==null?void 0:A.buttonVariables)||{}}})},className:"rsp-px-2 rsp-py-1 rsp-text-xs rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded",title:"Remove this variable",children:"×"})]},`header-sample-${N}`)})})]})})()]}),a.headerType==="MEDIA"&&e.jsxs("div",{className:"rsp-space-y-6 rsp-animate-fade-in",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Media Type"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("select",{value:a.mediaType||"IMAGE",onChange:b=>{s(N=>({...N,mediaType:b.target.value,mediaUrl:""})),n(null),w(null)},className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:Sa.map(b=>e.jsx("option",{value:b.value,children:b.label},b.value))}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700",children:"Media"}),a.mediaUrl?e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-p-3 rsp-bg-gray-50 rsp-border rsp-border-gray-200 rsp-rounded-md",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-space-x-3 overflow-hidden",children:[a.mediaType==="IMAGE"&&e.jsx("img",{src:a.mediaUrl,alt:"Preview",className:"rsp-w-12 rsp-h-12 rsp-object-cover rsp-rounded",onError:b=>{b.currentTarget.style.display="none",m||w("Could not load image preview from URL.")},onLoad:()=>{m!=null&&m.includes("Could not load")&&w(null)}}),a.mediaType==="VIDEO"&&e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0",children:e.jsx(Xe,{className:"rsp-w-6 rsp-h-6 rsp-text-gray-500"})}),a.mediaType==="DOCUMENT"&&e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0",children:e.jsx(Ke,{className:"rsp-w-6 rsp-h-6 rsp-text-gray-500"})}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("p",{className:"rsp-text-sm rsp-font-medium rsp-text-gray-900 rsp-truncate",children:t?t.name:a.mediaUrl}),t&&e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500",children:`${(t.size/1024/1024).toFixed(2)} MB`})]})]}),e.jsx("button",{onClick:x,className:"rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 rsp-transition-colors flex-shrink-0",children:e.jsx(ne,{className:"rsp-w-4 rsp-h-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:v(),onChange:h,className:"rsp-hidden",id:"media-upload",disabled:l}),e.jsxs("label",{htmlFor:"media-upload",className:`rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-dashed rsp-border-gray-300 rsp-rounded-md rsp-flex rsp-flex-col rsp-items-center rsp-justify-center rsp-cursor-pointer rsp-transition-colors hover:rsp-border-gray-400 hover:rsp-bg-gray-50 ${l?"rsp-opacity-50 rsp-cursor-not-allowed":""}`,children:[e.jsx(ea,{className:"rsp-w-6 rsp-h-6 rsp-text-gray-400 rsp-mb-2"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:l?"Uploading...":`Upload ${((L=a.mediaType)==null?void 0:L.toLowerCase())||"file"}`}),e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-400 rsp-mt-1",children:[a.mediaType==="IMAGE"&&"JPG, PNG up to 5MB",a.mediaType==="VIDEO"&&"MP4, 3GPP up to 16MB",a.mediaType==="DOCUMENT"&&"PDF, DOCX, etc. up to 100MB"]})]})]}),m&&e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-text-xs rsp-text-red-600",children:[e.jsx(ve,{className:"rsp-w-4 rsp-h-4"}),e.jsx("span",{children:m})]}),e.jsxs("div",{className:"rsp-flex rsp-items-center",children:[e.jsx("div",{className:"rsp-flex-1 rsp-border-t rsp-border-gray-300"}),e.jsx("span",{className:"rsp-px-3 rsp-text-sm rsp-text-gray-500",children:"OR"}),e.jsx("div",{className:"rsp-flex-1 rsp-border-t rsp-border-gray-300"})]}),e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{type:"url",value:a.mediaUrl||"",onChange:u,className:"rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",placeholder:`Enter ${(V=a.mediaType)==null?void 0:V.toLowerCase()} URL`})})]})]})]})}const Ae=[{name:"grinning-face",hexadecimal:"😀"},{name:"grinning-face-with-smiling-eyes",hexadecimal:"😁"},{name:"face-with-tears-of-joy",hexadecimal:"😂"},{name:"rolling-on-the-floor-laughing",hexadecimal:"🤣"},{name:"smiling-face-with-open-mouth",hexadecimal:"😃"},{name:"smiling-face-with-open-mouth-and-smiling-eyes",hexadecimal:"😄"},{name:"smiling-face-with-open-mouth-and-cold-sweat",hexadecimal:"😅"},{name:"smiling-face-with-open-mouth-and-tightly-closed-eyes",hexadecimal:"😆"},{name:"winking-face",hexadecimal:"😉"},{name:"smiling-face-with-smiling-eyes",hexadecimal:"😊"},{name:"face-savouring-delicious-food",hexadecimal:"😋"},{name:"smiling-face-with-sunglasses",hexadecimal:"😎"},{name:"smiling-face-with-heart-shaped-eyes",hexadecimal:"😍"},{name:"face-throwing-a-kiss",hexadecimal:"😘"},{name:"kissing-face",hexadecimal:"😗"},{name:"kissing-face-with-smiling-eyes",hexadecimal:"😙"},{name:"kissing-face-with-closed-eyes",hexadecimal:"😚"},{name:"slightly-smiling-face",hexadecimal:"🙂"},{name:"hugging-face",hexadecimal:"🤗"},{name:"thinking-face",hexadecimal:"🤔"},{name:"neutral-face",hexadecimal:"😐"},{name:"expressionless-face",hexadecimal:"😑"},{name:"face-without-mouth",hexadecimal:"😶"},{name:"face-with-rolling-eyes",hexadecimal:"🙄"},{name:"smirking-face",hexadecimal:"😏"},{name:"persevering-face",hexadecimal:"😣"},{name:"disappointed-but-relieved-face",hexadecimal:"😥"},{name:"face-with-open-mouth",hexadecimal:"😮"},{name:"zipper-mouth-face",hexadecimal:"🤐"},{name:"hushed-face",hexadecimal:"😯"},{name:"sleepy-face",hexadecimal:"😪"},{name:"tired-face",hexadecimal:"😫"},{name:"sleeping-face",hexadecimal:"😴"},{name:"relieved-face",hexadecimal:"😌"},{name:"nerd-face",hexadecimal:"🤓"},{name:"face-with-stuck-out-tongue",hexadecimal:"😛"},{name:"face-with-stuck-out-tongue-and-winking-eye",hexadecimal:"😜"},{name:"face-with-stuck-out-tongue-and-tightly-closed-eyes",hexadecimal:"😝"},{name:"drooling-face",hexadecimal:"🤤"},{name:"unamused-face",hexadecimal:"😒"},{name:"face-with-cold-sweat",hexadecimal:"😓"},{name:"pensive-face",hexadecimal:"😔"},{name:"confused-face",hexadecimal:"😕"},{name:"upside-down-face",hexadecimal:"🙃"},{name:"money-mouth-face",hexadecimal:"🤑"},{name:"astonished-face",hexadecimal:"😲"},{name:"slightly-frowning-face",hexadecimal:"🙁"},{name:"confounded-face",hexadecimal:"😖"},{name:"disappointed-face",hexadecimal:"😞"},{name:"worried-face",hexadecimal:"😟"},{name:"face-with-look-of-triumph",hexadecimal:"😤"},{name:"crying-face",hexadecimal:"😢"},{name:"loudly-crying-face",hexadecimal:"😭"},{name:"frowning-face-with-open-mouth",hexadecimal:"😦"},{name:"anguished-face",hexadecimal:"😧"},{name:"fearful-face",hexadecimal:"😨"},{name:"weary-face",hexadecimal:"😩"},{name:"grimacing-face",hexadecimal:"😬"},{name:"face-with-open-mouth-and-cold-sweat",hexadecimal:"😰"},{name:"face-screaming-in-fear",hexadecimal:"😱"},{name:"flushed-face",hexadecimal:"😳"},{name:"dizzy-face",hexadecimal:"😵"},{name:"pouting-face",hexadecimal:"😡"},{name:"angry-face",hexadecimal:"😠"},{name:"smiling-face-with-halo",hexadecimal:"😇"},{name:"face-with-cowboy-hat",hexadecimal:"🤠"},{name:"clown-face",hexadecimal:"🤡"},{name:"lying-face",hexadecimal:"🤥"},{name:"face-with-medical-mask",hexadecimal:"😷"},{name:"face-with-thermometer",hexadecimal:"🤒"},{name:"face-with-head-bandage",hexadecimal:"🤕"},{name:"nauseated-face",hexadecimal:"🤢"},{name:"sneezing-face",hexadecimal:"🤧"},{name:"smiling-face-with-horns",hexadecimal:"😈"},{name:"imp",hexadecimal:"👿"},{name:"japanese-ogre",hexadecimal:"👹"},{name:"japanese-goblin",hexadecimal:"👺"},{name:"skull",hexadecimal:"💀"},{name:"skull-and-crossbones",hexadecimal:"☠"},{name:"ghost",hexadecimal:"👻"},{name:"extraterrestrial-alien",hexadecimal:"👽"},{name:"alien-monster",hexadecimal:"👾"},{name:"robot-face",hexadecimal:"🤖"},{name:"pile-of-poo",hexadecimal:"💩"},{name:"smiling-cat-face-with-open-mouth",hexadecimal:"😺"},{name:"grinning-cat-face-with-smiling-eyes",hexadecimal:"😸"},{name:"cat-face-with-tears-of-joy",hexadecimal:"😹"},{name:"smiling-cat-face-with-heart-shaped-eyes",hexadecimal:"😻"},{name:"cat-face-with-wry-smile",hexadecimal:"😼"},{name:"kissing-cat-face-with-closed-eyes",hexadecimal:"😽"},{name:"weary-cat-face",hexadecimal:"🙀"},{name:"crying-cat-face",hexadecimal:"😿"},{name:"pouting-cat-face",hexadecimal:"😾"},{name:"see-no-evil-monkey",hexadecimal:"🙈"},{name:"hear-no-evil-monkey",hexadecimal:"🙉"},{name:"speak-no-evil-monkey",hexadecimal:"🙊"},{name:"boy",hexadecimal:"👦"},{name:"boy-type-1-2",hexadecimal:"👦🏻"},{name:"boy-type-3",hexadecimal:"👦🏼"},{name:"boy-type-4",hexadecimal:"👦🏽"},{name:"boy-type-5",hexadecimal:"👦🏾"},{name:"boy-type-6",hexadecimal:"👦🏿"},{name:"girl",hexadecimal:"👧"},{name:"girl-type-1-2",hexadecimal:"👧🏻"},{name:"girl-type-3",hexadecimal:"👧🏼"},{name:"girl-type-4",hexadecimal:"👧🏽"},{name:"girl-type-5",hexadecimal:"👧🏾"},{name:"girl-type-6",hexadecimal:"👧🏿"},{name:"man",hexadecimal:"👨"},{name:"man-type-1-2",hexadecimal:"👨🏻"},{name:"man-type-3",hexadecimal:"👨🏼"},{name:"man-type-4",hexadecimal:"👨🏽"},{name:"man-type-5",hexadecimal:"👨🏾"},{name:"man-type-6",hexadecimal:"👨🏿"},{name:"woman",hexadecimal:"👩"},{name:"woman-type-1-2",hexadecimal:"👩🏻"},{name:"woman-type-3",hexadecimal:"👩🏼"},{name:"woman-type-4",hexadecimal:"👩🏽"},{name:"woman-type-5",hexadecimal:"👩🏾"},{name:"woman-type-6",hexadecimal:"👩🏿"},{name:"older-man",hexadecimal:"👴"},{name:"old-man-type-1-2",hexadecimal:"👴🏻"},{name:"old-man-type-3",hexadecimal:"👴🏼"},{name:"old-man-type-4",hexadecimal:"👴🏽"},{name:"old-man-type-5",hexadecimal:"👴🏾"},{name:"old-man-type-6",hexadecimal:"👴🏿"},{name:"older-woman",hexadecimal:"👵"},{name:"old-woman-type-1-2",hexadecimal:"👵🏻"},{name:"old-woman-type-3",hexadecimal:"👵🏼"},{name:"old-woman-type-4",hexadecimal:"👵🏽"},{name:"old-woman-type-5",hexadecimal:"👵🏾"},{name:"old-woman-type-6",hexadecimal:"👵🏿"},{name:"baby",hexadecimal:"👶"},{name:"baby-type-1-2",hexadecimal:"👶🏻"},{name:"baby-type-3",hexadecimal:"👶🏼"},{name:"baby-type-4",hexadecimal:"👶🏽"},{name:"baby-type-5",hexadecimal:"👶🏾"},{name:"baby-type-6",hexadecimal:"👶🏿"},{name:"baby-angel",hexadecimal:"👼"},{name:"baby-angel-type-1-2",hexadecimal:"👼🏻"},{name:"baby-angel-type-3",hexadecimal:"👼🏼"},{name:"baby-angel-type-4",hexadecimal:"👼🏽"},{name:"baby-angel-type-5",hexadecimal:"👼🏾"},{name:"baby-angel-type-6",hexadecimal:"👼🏿"},{name:"police-officer",hexadecimal:"👮"},{name:"police-officer-type-1-2",hexadecimal:"👮🏻"},{name:"police-officer-type-3",hexadecimal:"👮🏼"},{name:"police-officer-type-4",hexadecimal:"👮🏽"},{name:"police-officer-type-5",hexadecimal:"👮🏾"},{name:"police-officer-type-6",hexadecimal:"👮🏿"},{name:"sleuth-or-spy",hexadecimal:"🕵"},{name:"detective-type-1-2",hexadecimal:"🕵🏻"},{name:"detective-type-3",hexadecimal:"🕵🏼"},{name:"detective-type-4",hexadecimal:"🕵🏽"},{name:"detective-type-5",hexadecimal:"🕵🏾"},{name:"detective-type-6",hexadecimal:"🕵🏿"},{name:"guardsman",hexadecimal:"💂"},{name:"guardsman-type-1-2",hexadecimal:"💂🏻"},{name:"guardsman-type-3",hexadecimal:"💂🏼"},{name:"guardsman-type-4",hexadecimal:"💂🏽"},{name:"guardsman-type-5",hexadecimal:"💂🏾"},{name:"guardsman-type-6",hexadecimal:"💂🏿"},{name:"construction-worker",hexadecimal:"👷"},{name:"construction-worker-type-1-2",hexadecimal:"👷🏻"},{name:"construction-worker-type-3",hexadecimal:"👷🏼"},{name:"construction-worker-type-4",hexadecimal:"👷🏽"},{name:"construction-worker-type-5",hexadecimal:"👷🏾"},{name:"construction-worker-type-6",hexadecimal:"👷🏿"},{name:"man-with-turban",hexadecimal:"👳"},{name:"person-with-turban-type-1-2",hexadecimal:"👳🏻"},{name:"person-with-turban-type-3",hexadecimal:"👳🏼"},{name:"person-with-turban-type-4",hexadecimal:"👳🏽"},{name:"person-with-turban-type-5",hexadecimal:"👳🏾"},{name:"person-with-turban-type-6",hexadecimal:"👳🏿"},{name:"person-with-blond-hair",hexadecimal:"👱"},{name:"blond-person-type-1-2",hexadecimal:"👱🏻"},{name:"blond-person-type-3",hexadecimal:"👱🏼"},{name:"blond-person-type-4",hexadecimal:"👱🏽"},{name:"blond-person-type-5",hexadecimal:"👱🏾"},{name:"blond-person-type-6",hexadecimal:"👱🏿"},{name:"father-christmas",hexadecimal:"🎅"},{name:"santa-claus-type-1-2",hexadecimal:"🎅🏻"},{name:"santa-claus-type-3",hexadecimal:"🎅🏼"},{name:"santa-claus-type-4",hexadecimal:"🎅🏽"},{name:"santa-claus-type-5",hexadecimal:"🎅🏾"},{name:"santa-claus-type-6",hexadecimal:"🎅🏿"},{name:"mother-christmas",hexadecimal:"🤶"},{name:"mother-christmas-type-1-2",hexadecimal:"🤶🏻"},{name:"mother-christmas-type-3",hexadecimal:"🤶🏼"},{name:"mother-christmas-type-4",hexadecimal:"🤶🏽"},{name:"mother-christmas-type-5",hexadecimal:"🤶🏾"},{name:"mother-christmas-type-6",hexadecimal:"🤶🏿"},{name:"princess",hexadecimal:"👸"},{name:"princess-type-1-2",hexadecimal:"👸🏻"},{name:"princess-type-3",hexadecimal:"👸🏼"},{name:"princess-type-4",hexadecimal:"👸🏽"},{name:"princess-type-5",hexadecimal:"👸🏾"},{name:"princess-type-6",hexadecimal:"👸🏿"},{name:"prince",hexadecimal:"🤴"},{name:"prince-type-1-2",hexadecimal:"🤴🏻"},{name:"prince-type-3",hexadecimal:"🤴🏼"},{name:"prince-type-4",hexadecimal:"🤴🏽"},{name:"prince-type-5",hexadecimal:"🤴🏾"},{name:"prince-type-6",hexadecimal:"🤴🏿"},{name:"bride-with-veil",hexadecimal:"👰"},{name:"bride-with-veil-type-1-2",hexadecimal:"👰🏻"},{name:"bride-with-veil-type-3",hexadecimal:"👰🏼"},{name:"bride-with-veil-type-4",hexadecimal:"👰🏽"},{name:"bride-with-veil-type-5",hexadecimal:"👰🏾"},{name:"bride-with-veil-type-6",hexadecimal:"👰🏿"},{name:"man-in-tuxedo",hexadecimal:"🤵"},{name:"man-in-tuxedo-type-1-2",hexadecimal:"🤵🏻"},{name:"man-in-tuxedo-type-3",hexadecimal:"🤵🏼"},{name:"man-in-tuxedo-type-4",hexadecimal:"🤵🏽"},{name:"man-in-tuxedo-type-5",hexadecimal:"🤵🏾"},{name:"man-in-tuxedo-type-6",hexadecimal:"🤵🏿"},{name:"pregnant-woman",hexadecimal:"🤰"},{name:"pregnant-woman-type-1-2",hexadecimal:"🤰🏻"},{name:"pregnant-woman-type-3",hexadecimal:"🤰🏼"},{name:"pregnant-woman-type-4",hexadecimal:"🤰🏽"},{name:"pregnant-woman-type-5",hexadecimal:"🤰🏾"},{name:"pregnant-woman-type-6",hexadecimal:"🤰🏿"},{name:"man-with-gua-pi-mao",hexadecimal:"👲"},{name:"man-with-chinese-cap-type-1-2",hexadecimal:"👲🏻"},{name:"man-with-chinese-cap-type-3",hexadecimal:"👲🏼"},{name:"man-with-chinese-cap-type-4",hexadecimal:"👲🏽"},{name:"man-with-chinese-cap-type-5",hexadecimal:"👲🏾"},{name:"man-with-chinese-cap-type-6",hexadecimal:"👲🏿"},{name:"person-frowning",hexadecimal:"🙍"},{name:"person-frowning-type-1-2",hexadecimal:"🙍🏻"},{name:"person-frowning-type-3",hexadecimal:"🙍🏼"},{name:"person-frowning-type-4",hexadecimal:"🙍🏽"},{name:"person-frowning-type-5",hexadecimal:"🙍🏾"},{name:"person-frowning-type-6",hexadecimal:"🙍🏿"},{name:"person-with-pouting-face",hexadecimal:"🙎"},{name:"person-pouting-type-1-2",hexadecimal:"🙎🏻"},{name:"person-pouting-type-3",hexadecimal:"🙎🏼"},{name:"person-pouting-type-4",hexadecimal:"🙎🏽"},{name:"person-pouting-type-5",hexadecimal:"🙎🏾"},{name:"person-pouting-type-6",hexadecimal:"🙎🏿"},{name:"face-with-no-good-gesture",hexadecimal:"🙅"},{name:"person-gesturing-not-ok-type-1-2",hexadecimal:"🙅🏻"},{name:"person-gesturing-not-ok-type-3",hexadecimal:"🙅🏼"},{name:"person-gesturing-not-ok-type-4",hexadecimal:"🙅🏽"},{name:"person-gesturing-not-ok-type-5",hexadecimal:"🙅🏾"},{name:"person-gesturing-not-ok-type-6",hexadecimal:"🙅🏿"},{name:"face-with-ok-gesture",hexadecimal:"🙆"},{name:"person-gesturing-ok-type-1-2",hexadecimal:"🙆🏻"},{name:"person-gesturing-ok-type-3",hexadecimal:"🙆🏼"},{name:"person-gesturing-ok-type-4",hexadecimal:"🙆🏽"},{name:"person-gesturing-ok-type-5",hexadecimal:"🙆🏾"},{name:"person-gesturing-ok-type-6",hexadecimal:"🙆🏿"},{name:"information-desk-person",hexadecimal:"💁"},{name:"person-tipping-hand-type-1-2",hexadecimal:"💁🏻"},{name:"person-tipping-hand-type-3",hexadecimal:"💁🏼"},{name:"person-tipping-hand-type-4",hexadecimal:"💁🏽"},{name:"person-tipping-hand-type-5",hexadecimal:"💁🏾"},{name:"person-tipping-hand-type-6",hexadecimal:"💁🏿"},{name:"happy-person-raising-one-hand",hexadecimal:"🙋"},{name:"person-raising-hand-type-1-2",hexadecimal:"🙋🏻"},{name:"person-raising-hand-type-3",hexadecimal:"🙋🏼"},{name:"person-raising-hand-type-4",hexadecimal:"🙋🏽"},{name:"person-raising-hand-type-5",hexadecimal:"🙋🏾"},{name:"person-raising-hand-type-6",hexadecimal:"🙋🏿"},{name:"person-bowing-deeply",hexadecimal:"🙇"},{name:"person-bowing-type-1-2",hexadecimal:"🙇🏻"},{name:"person-bowing-type-3",hexadecimal:"🙇🏼"},{name:"person-bowing-type-4",hexadecimal:"🙇🏽"},{name:"person-bowing-type-5",hexadecimal:"🙇🏾"},{name:"person-bowing-type-6",hexadecimal:"🙇🏿"},{name:"face-palm",hexadecimal:"🤦"},{name:"person-facepalming-type-1-2",hexadecimal:"🤦🏻"},{name:"person-facepalming-type-3",hexadecimal:"🤦🏼"},{name:"person-facepalming-type-4",hexadecimal:"🤦🏽"},{name:"person-facepalming-type-5",hexadecimal:"🤦🏾"},{name:"person-facepalming-type-6",hexadecimal:"🤦🏿"},{name:"shrug",hexadecimal:"🤷"},{name:"person-shrugging-type-1-2",hexadecimal:"🤷🏻"},{name:"person-shrugging-type-3",hexadecimal:"🤷🏼"},{name:"person-shrugging-type-4",hexadecimal:"🤷🏽"},{name:"person-shrugging-type-5",hexadecimal:"🤷🏾"},{name:"person-shrugging-type-6",hexadecimal:"🤷🏿"},{name:"face-massage",hexadecimal:"💆"},{name:"person-getting-massage-type-1-2",hexadecimal:"💆🏻"},{name:"person-getting-massage-type-3",hexadecimal:"💆🏼"},{name:"person-getting-massage-type-4",hexadecimal:"💆🏽"},{name:"person-getting-massage-type-5",hexadecimal:"💆🏾"},{name:"person-getting-massage-type-6",hexadecimal:"💆🏿"},{name:"haircut",hexadecimal:"💇"},{name:"person-getting-haircut-type-1-2",hexadecimal:"💇🏻"},{name:"person-getting-haircut-type-3",hexadecimal:"💇🏼"},{name:"person-getting-haircut-type-4",hexadecimal:"💇🏽"},{name:"person-getting-haircut-type-5",hexadecimal:"💇🏾"},{name:"person-getting-haircut-type-6",hexadecimal:"💇🏿"},{name:"pedestrian",hexadecimal:"🚶"},{name:"person-walking-type-1-2",hexadecimal:"🚶🏻"},{name:"person-walking-type-3",hexadecimal:"🚶🏼"},{name:"person-walking-type-4",hexadecimal:"🚶🏽"},{name:"person-walking-type-5",hexadecimal:"🚶🏾"},{name:"person-walking-type-6",hexadecimal:"🚶🏿"},{name:"runner",hexadecimal:"🏃"},{name:"person-running-type-1-2",hexadecimal:"🏃🏻"},{name:"person-running-type-3",hexadecimal:"🏃🏼"},{name:"person-running-type-4",hexadecimal:"🏃🏽"},{name:"person-running-type-5",hexadecimal:"🏃🏾"},{name:"person-running-type-6",hexadecimal:"🏃🏿"},{name:"dancer",hexadecimal:"💃"},{name:"woman-dancing-type-1-2",hexadecimal:"💃🏻"},{name:"woman-dancing-type-3",hexadecimal:"💃🏼"},{name:"woman-dancing-type-4",hexadecimal:"💃🏽"},{name:"woman-dancing-type-5",hexadecimal:"💃🏾"},{name:"woman-dancing-type-6",hexadecimal:"💃🏿"},{name:"man-dancing",hexadecimal:"🕺"},{name:"man-dancing-type-1-2",hexadecimal:"🕺🏻"},{name:"man-dancing-type-3",hexadecimal:"🕺🏼"},{name:"man-dancing-type-4",hexadecimal:"🕺🏽"},{name:"man-dancing-type-5",hexadecimal:"🕺🏾"},{name:"man-dancing-type-6",hexadecimal:"🕺🏿"},{name:"woman-with-bunny-ears",hexadecimal:"👯"},{name:"man-in-business-suit-levitating",hexadecimal:"🕴"},{name:"speaking-head-in-silhouette",hexadecimal:"🗣"},{name:"bust-in-silhouette",hexadecimal:"👤"},{name:"busts-in-silhouette",hexadecimal:"👥"},{name:"man-and-woman-holding-hands",hexadecimal:"👫"},{name:"two-men-holding-hands",hexadecimal:"👬"},{name:"two-women-holding-hands",hexadecimal:"👭"},{name:"kiss",hexadecimal:"💏"},{name:"kiss-woman-man",hexadecimal:"👩‍❤️‍💋‍👨"},{name:"kiss-man-man",hexadecimal:"👨‍❤️‍💋‍👨"},{name:"kiss-woman-woman",hexadecimal:"👩‍❤️‍💋‍👩"},{name:"couple-with-heart",hexadecimal:"💑"},{name:"couple-with-heart-woman-man",hexadecimal:"👩‍❤️‍👨"},{name:"couple-with-heart-man-man",hexadecimal:"👨‍❤️‍👨"},{name:"couple-with-heart-woman-woman",hexadecimal:"👩‍❤️‍👩"},{name:"family",hexadecimal:"👪"},{name:"family-man-woman-boy",hexadecimal:"👨‍👩‍👦"},{name:"family-man-woman-girl",hexadecimal:"👨‍👩‍👧"},{name:"family-man-woman-girl-boy",hexadecimal:"👨‍👩‍👧‍👦"},{name:"family-man-woman-boy-boy",hexadecimal:"👨‍👩‍👦‍👦"},{name:"family-man-woman-girl-girl",hexadecimal:"👨‍👩‍👧‍👧"},{name:"family-man-man-boy",hexadecimal:"👨‍👨‍👦"},{name:"family-man-man-girl",hexadecimal:"👨‍👨‍👧"},{name:"family-man-man-girl-boy",hexadecimal:"👨‍👨‍👧‍👦"},{name:"family-man-man-boy-boy",hexadecimal:"👨‍👨‍👦‍👦"},{name:"family-man-man-girl-girl",hexadecimal:"👨‍👨‍👧‍👧"},{name:"family-woman-woman-boy",hexadecimal:"👩‍👩‍👦"},{name:"family-woman-woman-girl",hexadecimal:"👩‍👩‍👧"},{name:"family-woman-woman-girl-boy",hexadecimal:"👩‍👩‍👧‍👦"},{name:"family-woman-woman-boy-boy",hexadecimal:"👩‍👩‍👦‍👦"},{name:"family-woman-woman-girl-girl",hexadecimal:"👩‍👩‍👧‍👧"},{name:"emoji-modifier-fitzpatrick-type-1-2",hexadecimal:"🏻"},{name:"emoji-modifier-fitzpatrick-type-3",hexadecimal:"🏼"},{name:"emoji-modifier-fitzpatrick-type-4",hexadecimal:"🏽"},{name:"emoji-modifier-fitzpatrick-type-5",hexadecimal:"🏾"},{name:"emoji-modifier-fitzpatrick-type-6",hexadecimal:"🏿"},{name:"flexed-biceps",hexadecimal:"💪"},{name:"flexed-biceps-type-1-2",hexadecimal:"💪🏻"},{name:"flexed-biceps-type-3",hexadecimal:"💪🏼"},{name:"flexed-biceps-type-4",hexadecimal:"💪🏽"},{name:"flexed-biceps-type-5",hexadecimal:"💪🏾"},{name:"flexed-biceps-type-6",hexadecimal:"💪🏿"},{name:"selfie",hexadecimal:"🤳"},{name:"selfie-type-1-2",hexadecimal:"🤳🏻"},{name:"selfie-type-3",hexadecimal:"🤳🏼"},{name:"selfie-type-4",hexadecimal:"🤳🏽"},{name:"selfie-type-5",hexadecimal:"🤳🏾"},{name:"selfie-type-6",hexadecimal:"🤳🏿"},{name:"white-left-pointing-backhand-index",hexadecimal:"👈"},{name:"backhand-index-pointing-left-type-1-2",hexadecimal:"👈🏻"},{name:"backhand-index-pointing-left-type-3",hexadecimal:"👈🏼"},{name:"backhand-index-pointing-left-type-4",hexadecimal:"👈🏽"},{name:"backhand-index-pointing-left-type-5",hexadecimal:"👈🏾"},{name:"backhand-index-pointing-left-type-6",hexadecimal:"👈🏿"},{name:"white-right-pointing-backhand-index",hexadecimal:"👉"},{name:"backhand-index-pointing-right-type-1-2",hexadecimal:"👉🏻"},{name:"backhand-index-pointing-right-type-3",hexadecimal:"👉🏼"},{name:"backhand-index-pointing-right-type-4",hexadecimal:"👉🏽"},{name:"backhand-index-pointing-right-type-5",hexadecimal:"👉🏾"},{name:"backhand-index-pointing-right-type-6",hexadecimal:"👉🏿"},{name:"white-up-pointing-index",hexadecimal:"☝"},{name:"index-pointing-up-type-1-2",hexadecimal:"☝🏻"},{name:"index-pointing-up-type-3",hexadecimal:"☝🏼"},{name:"index-pointing-up-type-4",hexadecimal:"☝🏽"},{name:"index-pointing-up-type-5",hexadecimal:"☝🏾"},{name:"index-pointing-up-type-6",hexadecimal:"☝🏿"},{name:"white-up-pointing-backhand-index",hexadecimal:"👆"},{name:"backhand-index-pointing-up-type-1-2",hexadecimal:"👆🏻"},{name:"backhand-index-pointing-up-type-3",hexadecimal:"👆🏼"},{name:"backhand-index-pointing-up-type-4",hexadecimal:"👆🏽"},{name:"backhand-index-pointing-up-type-5",hexadecimal:"👆🏾"},{name:"backhand-index-pointing-up-type-6",hexadecimal:"👆🏿"},{name:"reversed-hand-with-middle-finger-extended",hexadecimal:"🖕"},{name:"middle-finger-type-1-2",hexadecimal:"🖕🏻"},{name:"middle-finger-type-3",hexadecimal:"🖕🏼"},{name:"middle-finger-type-4",hexadecimal:"🖕🏽"},{name:"middle-finger-type-5",hexadecimal:"🖕🏾"},{name:"middle-finger-type-6",hexadecimal:"🖕🏿"},{name:"white-down-pointing-backhand-index",hexadecimal:"👇"},{name:"backhand-index-pointing-down-type-1-2",hexadecimal:"👇🏻"},{name:"backhand-index-pointing-down-type-3",hexadecimal:"👇🏼"},{name:"backhand-index-pointing-down-type-4",hexadecimal:"👇🏽"},{name:"backhand-index-pointing-down-type-5",hexadecimal:"👇🏾"},{name:"backhand-index-pointing-down-type-6",hexadecimal:"👇🏿"},{name:"victory-hand",hexadecimal:"✌"},{name:"victory-hand-type-1-2",hexadecimal:"✌🏻"},{name:"victory-hand-type-3",hexadecimal:"✌🏼"},{name:"victory-hand-type-4",hexadecimal:"✌🏽"},{name:"victory-hand-type-5",hexadecimal:"✌🏾"},{name:"victory-hand-type-6",hexadecimal:"✌🏿"},{name:"hand-with-index-and-middle-fingers-crossed",hexadecimal:"🤞"},{name:"crossed-fingers-type-1-2",hexadecimal:"🤞🏻"},{name:"crossed-fingers-type-3",hexadecimal:"🤞🏼"},{name:"crossed-fingers-type-4",hexadecimal:"🤞🏽"},{name:"crossed-fingers-type-5",hexadecimal:"🤞🏾"},{name:"crossed-fingers-type-6",hexadecimal:"🤞🏿"},{name:"raised-hand-with-part-between-middle-and-ring-fingers",hexadecimal:"🖖"},{name:"vulcan-salute-type-1-2",hexadecimal:"🖖🏻"},{name:"vulcan-salute-type-3",hexadecimal:"🖖🏼"},{name:"vulcan-salute-type-4",hexadecimal:"🖖🏽"},{name:"vulcan-salute-type-5",hexadecimal:"🖖🏾"},{name:"vulcan-salute-type-6",hexadecimal:"🖖🏿"},{name:"sign-of-the-horns",hexadecimal:"🤘"},{name:"sign-of-the-horns-type-1-2",hexadecimal:"🤘🏻"},{name:"sign-of-the-horns-type-3",hexadecimal:"🤘🏼"},{name:"sign-of-the-horns-type-4",hexadecimal:"🤘🏽"},{name:"sign-of-the-horns-type-5",hexadecimal:"🤘🏾"},{name:"sign-of-the-horns-type-6",hexadecimal:"🤘🏿"},{name:"call-me-hand",hexadecimal:"🤙"},{name:"call-me-hand-type-1-2",hexadecimal:"🤙🏻"},{name:"call-me-hand-type-3",hexadecimal:"🤙🏼"},{name:"call-me-hand-type-4",hexadecimal:"🤙🏽"},{name:"call-me-hand-type-5",hexadecimal:"🤙🏾"},{name:"call-me-hand-type-6",hexadecimal:"🤙🏿"},{name:"raised-hand-with-fingers-splayed",hexadecimal:"🖐"},{name:"raised-hand-with-fingers-splayed-type-1-2",hexadecimal:"🖐🏻"},{name:"raised-hand-with-fingers-splayed-type-3",hexadecimal:"🖐🏼"},{name:"raised-hand-with-fingers-splayed-type-4",hexadecimal:"🖐🏽"},{name:"raised-hand-with-fingers-splayed-type-5",hexadecimal:"🖐🏾"},{name:"raised-hand-with-fingers-splayed-type-6",hexadecimal:"🖐🏿"},{name:"raised-hand",hexadecimal:"✋"},{name:"raised-hand-type-1-2",hexadecimal:"✋🏻"},{name:"raised-hand-type-3",hexadecimal:"✋🏼"},{name:"raised-hand-type-4",hexadecimal:"✋🏽"},{name:"raised-hand-type-5",hexadecimal:"✋🏾"},{name:"raised-hand-type-6",hexadecimal:"✋🏿"},{name:"ok-hand-sign",hexadecimal:"👌"},{name:"ok-hand-type-1-2",hexadecimal:"👌🏻"},{name:"ok-hand-type-3",hexadecimal:"👌🏼"},{name:"ok-hand-type-4",hexadecimal:"👌🏽"},{name:"ok-hand-type-5",hexadecimal:"👌🏾"},{name:"ok-hand-type-6",hexadecimal:"👌🏿"},{name:"thumbs-up-sign",hexadecimal:"👍"},{name:"thumbs-up-type-1-2",hexadecimal:"👍🏻"},{name:"thumbs-up-type-3",hexadecimal:"👍🏼"},{name:"thumbs-up-type-4",hexadecimal:"👍🏽"},{name:"thumbs-up-type-5",hexadecimal:"👍🏾"},{name:"thumbs-up-type-6",hexadecimal:"👍🏿"},{name:"thumbs-down-sign",hexadecimal:"👎"},{name:"thumbs-down-type-1-2",hexadecimal:"👎🏻"},{name:"thumbs-down-type-3",hexadecimal:"👎🏼"},{name:"thumbs-down-type-4",hexadecimal:"👎🏽"},{name:"thumbs-down-type-5",hexadecimal:"👎🏾"},{name:"thumbs-down-type-6",hexadecimal:"👎🏿"},{name:"raised-fist",hexadecimal:"✊"},{name:"raised-fist-type-1-2",hexadecimal:"✊🏻"},{name:"raised-fist-type-3",hexadecimal:"✊🏼"},{name:"raised-fist-type-4",hexadecimal:"✊🏽"},{name:"raised-fist-type-5",hexadecimal:"✊🏾"},{name:"raised-fist-type-6",hexadecimal:"✊🏿"},{name:"fisted-hand-sign",hexadecimal:"👊"},{name:"oncoming-fist-type-1-2",hexadecimal:"👊🏻"},{name:"oncoming-fist-type-3",hexadecimal:"👊🏼"},{name:"oncoming-fist-type-4",hexadecimal:"👊🏽"},{name:"oncoming-fist-type-5",hexadecimal:"👊🏾"},{name:"oncoming-fist-type-6",hexadecimal:"👊🏿"},{name:"left-facing-fist",hexadecimal:"🤛"},{name:"left-facing-fist-type-1-2",hexadecimal:"🤛🏻"},{name:"left-facing-fist-type-3",hexadecimal:"🤛🏼"},{name:"left-facing-fist-type-4",hexadecimal:"🤛🏽"},{name:"left-facing-fist-type-5",hexadecimal:"🤛🏾"},{name:"left-facing-fist-type-6",hexadecimal:"🤛🏿"},{name:"right-facing-fist",hexadecimal:"🤜"},{name:"right-facing-fist-type-1-2",hexadecimal:"🤜🏻"},{name:"right-facing-fist-type-3",hexadecimal:"🤜🏼"},{name:"right-facing-fist-type-4",hexadecimal:"🤜🏽"},{name:"right-facing-fist-type-5",hexadecimal:"🤜🏾"},{name:"right-facing-fist-type-6",hexadecimal:"🤜🏿"},{name:"raised-back-of-hand",hexadecimal:"🤚"},{name:"raised-back-of-hand-type-1-2",hexadecimal:"🤚🏻"},{name:"raised-back-of-hand-type-3",hexadecimal:"🤚🏼"},{name:"raised-back-of-hand-type-4",hexadecimal:"🤚🏽"},{name:"raised-back-of-hand-type-5",hexadecimal:"🤚🏾"},{name:"raised-back-of-hand-type-6",hexadecimal:"🤚🏿"},{name:"waving-hand-sign",hexadecimal:"👋"},{name:"waving-hand-type-1-2",hexadecimal:"👋🏻"},{name:"waving-hand-type-3",hexadecimal:"👋🏼"},{name:"waving-hand-type-4",hexadecimal:"👋🏽"},{name:"waving-hand-type-5",hexadecimal:"👋🏾"},{name:"waving-hand-type-6",hexadecimal:"👋🏿"},{name:"clapping-hands-sign",hexadecimal:"👏"},{name:"clapping-hands-type-1-2",hexadecimal:"👏🏻"},{name:"clapping-hands-type-3",hexadecimal:"👏🏼"},{name:"clapping-hands-type-4",hexadecimal:"👏🏽"},{name:"clapping-hands-type-5",hexadecimal:"👏🏾"},{name:"clapping-hands-type-6",hexadecimal:"👏🏿"},{name:"writing-hand",hexadecimal:"✍"},{name:"writing-hand-type-1-2",hexadecimal:"✍🏻"},{name:"writing-hand-type-3",hexadecimal:"✍🏼"},{name:"writing-hand-type-4",hexadecimal:"✍🏽"},{name:"writing-hand-type-5",hexadecimal:"✍🏾"},{name:"writing-hand-type-6",hexadecimal:"✍🏿"},{name:"open-hands-sign",hexadecimal:"👐"},{name:"open-hands-type-1-2",hexadecimal:"👐🏻"},{name:"open-hands-type-3",hexadecimal:"👐🏼"},{name:"open-hands-type-4",hexadecimal:"👐🏽"},{name:"open-hands-type-5",hexadecimal:"👐🏾"},{name:"open-hands-type-6",hexadecimal:"👐🏿"},{name:"person-raising-both-hands-in-celebration",hexadecimal:"🙌"},{name:"person-raising-hands-type-1-2",hexadecimal:"🙌🏻"},{name:"person-raising-hands-type-3",hexadecimal:"🙌🏼"},{name:"person-raising-hands-type-4",hexadecimal:"🙌🏽"},{name:"person-raising-hands-type-5",hexadecimal:"🙌🏾"},{name:"person-raising-hands-type-6",hexadecimal:"🙌🏿"},{name:"person-with-folded-hands",hexadecimal:"🙏"},{name:"folded-hands-type-1-2",hexadecimal:"🙏🏻"},{name:"folded-hands-type-3",hexadecimal:"🙏🏼"},{name:"folded-hands-type-4",hexadecimal:"🙏🏽"},{name:"folded-hands-type-5",hexadecimal:"🙏🏾"},{name:"folded-hands-type-6",hexadecimal:"🙏🏿"},{name:"handshake",hexadecimal:"🤝"},{name:"handshake-type-1-2",hexadecimal:"🤝🏻"},{name:"handshake-type-3",hexadecimal:"🤝🏼"},{name:"handshake-type-4",hexadecimal:"🤝🏽"},{name:"handshake-type-5",hexadecimal:"🤝🏾"},{name:"handshake-type-6",hexadecimal:"🤝🏿"},{name:"nail-polish",hexadecimal:"💅"},{name:"nail-polish-type-1-2",hexadecimal:"💅🏻"},{name:"nail-polish-type-3",hexadecimal:"💅🏼"},{name:"nail-polish-type-4",hexadecimal:"💅🏽"},{name:"nail-polish-type-5",hexadecimal:"💅🏾"},{name:"nail-polish-type-6",hexadecimal:"💅🏿"},{name:"ear",hexadecimal:"👂"},{name:"ear-type-1-2",hexadecimal:"👂🏻"},{name:"ear-type-3",hexadecimal:"👂🏼"},{name:"ear-type-4",hexadecimal:"👂🏽"},{name:"ear-type-5",hexadecimal:"👂🏾"},{name:"ear-type-6",hexadecimal:"👂🏿"},{name:"nose",hexadecimal:"👃"},{name:"nose-type-1-2",hexadecimal:"👃🏻"},{name:"nose-type-3",hexadecimal:"👃🏼"},{name:"nose-type-4",hexadecimal:"👃🏽"},{name:"nose-type-5",hexadecimal:"👃🏾"},{name:"nose-type-6",hexadecimal:"👃🏿"},{name:"footprints",hexadecimal:"👣"},{name:"eyes",hexadecimal:"👀"},{name:"eye",hexadecimal:"👁"},{name:"eye-left-speech-bubble",hexadecimal:"👁‍🗨"},{name:"tongue",hexadecimal:"👅"},{name:"mouth",hexadecimal:"👄"},{name:"kiss-mark",hexadecimal:"💋"},{name:"heart-with-arrow",hexadecimal:"💘"},{name:"heavy-black-heart",hexadecimal:"❤"},{name:"beating-heart",hexadecimal:"💓"},{name:"broken-heart",hexadecimal:"💔"},{name:"two-hearts",hexadecimal:"💕"},{name:"sparkling-heart",hexadecimal:"💖"},{name:"growing-heart",hexadecimal:"💗"},{name:"blue-heart",hexadecimal:"💙"},{name:"green-heart",hexadecimal:"💚"},{name:"yellow-heart",hexadecimal:"💛"},{name:"purple-heart",hexadecimal:"💜"},{name:"black-heart",hexadecimal:"🖤"},{name:"heart-with-ribbon",hexadecimal:"💝"},{name:"revolving-hearts",hexadecimal:"💞"},{name:"heart-decoration",hexadecimal:"💟"},{name:"heavy-heart-exclamation-mark-ornament",hexadecimal:"❣"},{name:"love-letter",hexadecimal:"💌"},{name:"sleeping-symbol",hexadecimal:"💤"},{name:"anger-symbol",hexadecimal:"💢"},{name:"bomb",hexadecimal:"💣"},{name:"collision-symbol",hexadecimal:"💥"},{name:"splashing-sweat-symbol",hexadecimal:"💦"},{name:"dash-symbol",hexadecimal:"💨"},{name:"dizzy-symbol",hexadecimal:"💫"},{name:"speech-balloon",hexadecimal:"💬"},{name:"left-speech-bubble",hexadecimal:"🗨"},{name:"right-anger-bubble",hexadecimal:"🗯"},{name:"thought-balloon",hexadecimal:"💭"},{name:"hole",hexadecimal:"🕳"},{name:"eyeglasses",hexadecimal:"👓"},{name:"dark-sunglasses",hexadecimal:"🕶"},{name:"necktie",hexadecimal:"👔"},{name:"t-shirt",hexadecimal:"👕"},{name:"jeans",hexadecimal:"👖"},{name:"dress",hexadecimal:"👗"},{name:"kimono",hexadecimal:"👘"},{name:"bikini",hexadecimal:"👙"},{name:"womans-clothes",hexadecimal:"👚"},{name:"purse",hexadecimal:"👛"},{name:"handbag",hexadecimal:"👜"},{name:"pouch",hexadecimal:"👝"},{name:"shopping-bags",hexadecimal:"🛍"},{name:"school-satchel",hexadecimal:"🎒"},{name:"mans-shoe",hexadecimal:"👞"},{name:"athletic-shoe",hexadecimal:"👟"},{name:"high-heeled-shoe",hexadecimal:"👠"},{name:"womans-sandal",hexadecimal:"👡"},{name:"womans-boots",hexadecimal:"👢"},{name:"crown",hexadecimal:"👑"},{name:"womans-hat",hexadecimal:"👒"},{name:"top-hat",hexadecimal:"🎩"},{name:"graduation-cap",hexadecimal:"🎓"},{name:"helmet-with-white-cross",hexadecimal:"⛑"},{name:"prayer-beads",hexadecimal:"📿"},{name:"lipstick",hexadecimal:"💄"},{name:"ring",hexadecimal:"💍"},{name:"gem-stone",hexadecimal:"💎"},{name:"monkey-face",hexadecimal:"🐵"},{name:"monkey",hexadecimal:"🐒"},{name:"gorilla",hexadecimal:"🦍"},{name:"dog-face",hexadecimal:"🐶"},{name:"dog",hexadecimal:"🐕"},{name:"poodle",hexadecimal:"🐩"},{name:"wolf-face",hexadecimal:"🐺"},{name:"fox-face",hexadecimal:"🦊"},{name:"cat-face",hexadecimal:"🐱"},{name:"cat",hexadecimal:"🐈"},{name:"lion-face",hexadecimal:"🦁"},{name:"tiger-face",hexadecimal:"🐯"},{name:"tiger",hexadecimal:"🐅"},{name:"leopard",hexadecimal:"🐆"},{name:"horse-face",hexadecimal:"🐴"},{name:"horse",hexadecimal:"🐎"},{name:"deer",hexadecimal:"🦌"},{name:"unicorn-face",hexadecimal:"🦄"},{name:"cow-face",hexadecimal:"🐮"},{name:"ox",hexadecimal:"🐂"},{name:"water-buffalo",hexadecimal:"🐃"},{name:"cow",hexadecimal:"🐄"},{name:"pig-face",hexadecimal:"🐷"},{name:"pig",hexadecimal:"🐖"},{name:"boar",hexadecimal:"🐗"},{name:"pig-nose",hexadecimal:"🐽"},{name:"ram",hexadecimal:"🐏"},{name:"sheep",hexadecimal:"🐑"},{name:"goat",hexadecimal:"🐐"},{name:"dromedary-camel",hexadecimal:"🐪"},{name:"bactrian-camel",hexadecimal:"🐫"},{name:"elephant",hexadecimal:"🐘"},{name:"rhinoceros",hexadecimal:"🦏"},{name:"mouse-face",hexadecimal:"🐭"},{name:"mouse",hexadecimal:"🐁"},{name:"rat",hexadecimal:"🐀"},{name:"hamster-face",hexadecimal:"🐹"},{name:"rabbit-face",hexadecimal:"🐰"},{name:"rabbit",hexadecimal:"🐇"},{name:"chipmunk",hexadecimal:"🐿"},{name:"bat",hexadecimal:"🦇"},{name:"bear-face",hexadecimal:"🐻"},{name:"koala",hexadecimal:"🐨"},{name:"panda-face",hexadecimal:"🐼"},{name:"paw-prints",hexadecimal:"🐾"},{name:"turkey",hexadecimal:"🦃"},{name:"chicken",hexadecimal:"🐔"},{name:"rooster",hexadecimal:"🐓"},{name:"hatching-chick",hexadecimal:"🐣"},{name:"baby-chick",hexadecimal:"🐤"},{name:"front-facing-baby-chick",hexadecimal:"🐥"},{name:"bird",hexadecimal:"🐦"},{name:"penguin",hexadecimal:"🐧"},{name:"dove-of-peace",hexadecimal:"🕊"},{name:"eagle",hexadecimal:"🦅"},{name:"duck",hexadecimal:"🦆"},{name:"owl",hexadecimal:"🦉"},{name:"frog-face",hexadecimal:"🐸"},{name:"crocodile",hexadecimal:"🐊"},{name:"turtle",hexadecimal:"🐢"},{name:"lizard",hexadecimal:"🦎"},{name:"snake",hexadecimal:"🐍"},{name:"dragon-face",hexadecimal:"🐲"},{name:"dragon",hexadecimal:"🐉"},{name:"spouting-whale",hexadecimal:"🐳"},{name:"whale",hexadecimal:"🐋"},{name:"dolphin",hexadecimal:"🐬"},{name:"fish",hexadecimal:"🐟"},{name:"tropical-fish",hexadecimal:"🐠"},{name:"blowfish",hexadecimal:"🐡"},{name:"shark",hexadecimal:"🦈"},{name:"octopus",hexadecimal:"🐙"},{name:"spiral-shell",hexadecimal:"🐚"},{name:"crab",hexadecimal:"🦀"},{name:"shrimp",hexadecimal:"🦐"},{name:"squid",hexadecimal:"🦑"},{name:"butterfly",hexadecimal:"🦋"},{name:"snail",hexadecimal:"🐌"},{name:"bug",hexadecimal:"🐛"},{name:"ant",hexadecimal:"🐜"},{name:"honeybee",hexadecimal:"🐝"},{name:"lady-beetle",hexadecimal:"🐞"},{name:"spider",hexadecimal:"🕷"},{name:"spider-web",hexadecimal:"🕸"},{name:"scorpion",hexadecimal:"🦂"},{name:"bouquet",hexadecimal:"💐"},{name:"cherry-blossom",hexadecimal:"🌸"},{name:"white-flower",hexadecimal:"💮"},{name:"rosette",hexadecimal:"🏵"},{name:"rose",hexadecimal:"🌹"},{name:"wilted-flower",hexadecimal:"🥀"},{name:"hibiscus",hexadecimal:"🌺"},{name:"sunflower",hexadecimal:"🌻"},{name:"blossom",hexadecimal:"🌼"},{name:"tulip",hexadecimal:"🌷"},{name:"seedling",hexadecimal:"🌱"},{name:"evergreen-tree",hexadecimal:"🌲"},{name:"deciduous-tree",hexadecimal:"🌳"},{name:"palm-tree",hexadecimal:"🌴"},{name:"cactus",hexadecimal:"🌵"},{name:"ear-of-rice",hexadecimal:"🌾"},{name:"herb",hexadecimal:"🌿"},{name:"shamrock",hexadecimal:"☘"},{name:"four-leaf-clover",hexadecimal:"🍀"},{name:"maple-leaf",hexadecimal:"🍁"},{name:"fallen-leaf",hexadecimal:"🍂"},{name:"leaf-fluttering-in-wind",hexadecimal:"🍃"},{name:"grapes",hexadecimal:"🍇"},{name:"melon",hexadecimal:"🍈"},{name:"watermelon",hexadecimal:"🍉"},{name:"tangerine",hexadecimal:"🍊"},{name:"lemon",hexadecimal:"🍋"},{name:"banana",hexadecimal:"🍌"},{name:"pineapple",hexadecimal:"🍍"},{name:"red-apple",hexadecimal:"🍎"},{name:"green-apple",hexadecimal:"🍏"},{name:"pear",hexadecimal:"🍐"},{name:"peach",hexadecimal:"🍑"},{name:"cherries",hexadecimal:"🍒"},{name:"strawberry",hexadecimal:"🍓"},{name:"kiwifruit",hexadecimal:"🥝"},{name:"tomato",hexadecimal:"🍅"},{name:"avocado",hexadecimal:"🥑"},{name:"aubergine",hexadecimal:"🍆"},{name:"potato",hexadecimal:"🥔"},{name:"carrot",hexadecimal:"🥕"},{name:"ear-of-maize",hexadecimal:"🌽"},{name:"hot-pepper",hexadecimal:"🌶"},{name:"cucumber",hexadecimal:"🥒"},{name:"mushroom",hexadecimal:"🍄"},{name:"peanuts",hexadecimal:"🥜"},{name:"chestnut",hexadecimal:"🌰"},{name:"bread",hexadecimal:"🍞"},{name:"croissant",hexadecimal:"🥐"},{name:"baguette-bread",hexadecimal:"🥖"},{name:"pancakes",hexadecimal:"🥞"},{name:"cheese-wedge",hexadecimal:"🧀"},{name:"meat-on-bone",hexadecimal:"🍖"},{name:"poultry-leg",hexadecimal:"🍗"},{name:"bacon",hexadecimal:"🥓"},{name:"hamburger",hexadecimal:"🍔"},{name:"french-fries",hexadecimal:"🍟"},{name:"slice-of-pizza",hexadecimal:"🍕"},{name:"hot-dog",hexadecimal:"🌭"},{name:"taco",hexadecimal:"🌮"},{name:"burrito",hexadecimal:"🌯"},{name:"stuffed-flatbread",hexadecimal:"🥙"},{name:"egg",hexadecimal:"🥚"},{name:"cooking",hexadecimal:"🍳"},{name:"shallow-pan-of-food",hexadecimal:"🥘"},{name:"pot-of-food",hexadecimal:"🍲"},{name:"green-salad",hexadecimal:"🥗"},{name:"popcorn",hexadecimal:"🍿"},{name:"bento-box",hexadecimal:"🍱"},{name:"rice-cracker",hexadecimal:"🍘"},{name:"rice-ball",hexadecimal:"🍙"},{name:"cooked-rice",hexadecimal:"🍚"},{name:"curry-and-rice",hexadecimal:"🍛"},{name:"steaming-bowl",hexadecimal:"🍜"},{name:"spaghetti",hexadecimal:"🍝"},{name:"roasted-sweet-potato",hexadecimal:"🍠"},{name:"oden",hexadecimal:"🍢"},{name:"sushi",hexadecimal:"🍣"},{name:"fried-shrimp",hexadecimal:"🍤"},{name:"fish-cake-with-swirl-design",hexadecimal:"🍥"},{name:"dango",hexadecimal:"🍡"},{name:"soft-ice-cream",hexadecimal:"🍦"},{name:"shaved-ice",hexadecimal:"🍧"},{name:"ice-cream",hexadecimal:"🍨"},{name:"doughnut",hexadecimal:"🍩"},{name:"cookie",hexadecimal:"🍪"},{name:"birthday-cake",hexadecimal:"🎂"},{name:"shortcake",hexadecimal:"🍰"},{name:"chocolate-bar",hexadecimal:"🍫"},{name:"candy",hexadecimal:"🍬"},{name:"lollipop",hexadecimal:"🍭"},{name:"custard",hexadecimal:"🍮"},{name:"honey-pot",hexadecimal:"🍯"},{name:"baby-bottle",hexadecimal:"🍼"},{name:"glass-of-milk",hexadecimal:"🥛"},{name:"hot-beverage",hexadecimal:"☕"},{name:"teacup-without-handle",hexadecimal:"🍵"},{name:"sake-bottle-and-cup",hexadecimal:"🍶"},{name:"bottle-with-popping-cork",hexadecimal:"🍾"},{name:"wine-glass",hexadecimal:"🍷"},{name:"cocktail-glass",hexadecimal:"🍸"},{name:"tropical-drink",hexadecimal:"🍹"},{name:"beer-mug",hexadecimal:"🍺"},{name:"clinking-beer-mugs",hexadecimal:"🍻"},{name:"clinking-glasses",hexadecimal:"🥂"},{name:"tumbler-glass",hexadecimal:"🥃"},{name:"fork-and-knife-with-plate",hexadecimal:"🍽"},{name:"fork-and-knife",hexadecimal:"🍴"},{name:"spoon",hexadecimal:"🥄"},{name:"hocho",hexadecimal:"🔪"},{name:"amphora",hexadecimal:"🏺"},{name:"earth-globe-europe-africa",hexadecimal:"🌍"},{name:"earth-globe-americas",hexadecimal:"🌎"},{name:"earth-globe-asia-australia",hexadecimal:"🌏"},{name:"globe-with-meridians",hexadecimal:"🌐"},{name:"world-map",hexadecimal:"🗺"},{name:"silhouette-of-japan",hexadecimal:"🗾"},{name:"snow-capped-mountain",hexadecimal:"🏔"},{name:"mountain",hexadecimal:"⛰"},{name:"volcano",hexadecimal:"🌋"},{name:"mount-fuji",hexadecimal:"🗻"},{name:"camping",hexadecimal:"🏕"},{name:"beach-with-umbrella",hexadecimal:"🏖"},{name:"desert",hexadecimal:"🏜"},{name:"desert-island",hexadecimal:"🏝"},{name:"national-park",hexadecimal:"🏞"},{name:"stadium",hexadecimal:"🏟"},{name:"classical-building",hexadecimal:"🏛"},{name:"building-construction",hexadecimal:"🏗"},{name:"house-buildings",hexadecimal:"🏘"},{name:"cityscape",hexadecimal:"🏙"},{name:"derelict-house-building",hexadecimal:"🏚"},{name:"house-building",hexadecimal:"🏠"},{name:"house-with-garden",hexadecimal:"🏡"},{name:"office-building",hexadecimal:"🏢"},{name:"japanese-post-office",hexadecimal:"🏣"},{name:"european-post-office",hexadecimal:"🏤"},{name:"hospital",hexadecimal:"🏥"},{name:"bank",hexadecimal:"🏦"},{name:"hotel",hexadecimal:"🏨"},{name:"love-hotel",hexadecimal:"🏩"},{name:"convenience-store",hexadecimal:"🏪"},{name:"school",hexadecimal:"🏫"},{name:"department-store",hexadecimal:"🏬"},{name:"factory",hexadecimal:"🏭"},{name:"japanese-castle",hexadecimal:"🏯"},{name:"european-castle",hexadecimal:"🏰"},{name:"wedding",hexadecimal:"💒"},{name:"tokyo-tower",hexadecimal:"🗼"},{name:"statue-of-liberty",hexadecimal:"🗽"},{name:"church",hexadecimal:"⛪"},{name:"mosque",hexadecimal:"🕌"},{name:"synagogue",hexadecimal:"🕍"},{name:"shinto-shrine",hexadecimal:"⛩"},{name:"kaaba",hexadecimal:"🕋"},{name:"fountain",hexadecimal:"⛲"},{name:"tent",hexadecimal:"⛺"},{name:"foggy",hexadecimal:"🌁"},{name:"night-with-stars",hexadecimal:"🌃"},{name:"sunrise-over-mountains",hexadecimal:"🌄"},{name:"sunrise",hexadecimal:"🌅"},{name:"cityscape-at-dusk",hexadecimal:"🌆"},{name:"sunset-over-buildings",hexadecimal:"🌇"},{name:"bridge-at-night",hexadecimal:"🌉"},{name:"hot-springs",hexadecimal:"♨"},{name:"milky-way",hexadecimal:"🌌"},{name:"carousel-horse",hexadecimal:"🎠"},{name:"ferris-wheel",hexadecimal:"🎡"},{name:"roller-coaster",hexadecimal:"🎢"},{name:"barber-pole",hexadecimal:"💈"},{name:"circus-tent",hexadecimal:"🎪"},{name:"performing-arts",hexadecimal:"🎭"},{name:"frame-with-picture",hexadecimal:"🖼"},{name:"artist-palette",hexadecimal:"🎨"},{name:"slot-machine",hexadecimal:"🎰"},{name:"steam-locomotive",hexadecimal:"🚂"},{name:"railway-car",hexadecimal:"🚃"},{name:"high-speed-train",hexadecimal:"🚄"},{name:"high-speed-train-with-bullet-nose",hexadecimal:"🚅"},{name:"train",hexadecimal:"🚆"},{name:"metro",hexadecimal:"🚇"},{name:"light-rail",hexadecimal:"🚈"},{name:"station",hexadecimal:"🚉"},{name:"tram",hexadecimal:"🚊"},{name:"monorail",hexadecimal:"🚝"},{name:"mountain-railway",hexadecimal:"🚞"},{name:"tram-car",hexadecimal:"🚋"},{name:"bus",hexadecimal:"🚌"},{name:"oncoming-bus",hexadecimal:"🚍"},{name:"trolleybus",hexadecimal:"🚎"},{name:"minibus",hexadecimal:"🚐"},{name:"ambulance",hexadecimal:"🚑"},{name:"fire-engine",hexadecimal:"🚒"},{name:"police-car",hexadecimal:"🚓"},{name:"oncoming-police-car",hexadecimal:"🚔"},{name:"taxi",hexadecimal:"🚕"},{name:"oncoming-taxi",hexadecimal:"🚖"},{name:"automobile",hexadecimal:"🚗"},{name:"oncoming-automobile",hexadecimal:"🚘"},{name:"recreational-vehicle",hexadecimal:"🚙"},{name:"delivery-truck",hexadecimal:"🚚"},{name:"articulated-lorry",hexadecimal:"🚛"},{name:"tractor",hexadecimal:"🚜"},{name:"bicycle",hexadecimal:"🚲"},{name:"scooter",hexadecimal:"🛴"},{name:"motor-scooter",hexadecimal:"🛵"},{name:"racing-car",hexadecimal:"🏎"},{name:"racing-motorcycle",hexadecimal:"🏍"},{name:"bus-stop",hexadecimal:"🚏"},{name:"motorway",hexadecimal:"🛣"},{name:"railway-track",hexadecimal:"🛤"},{name:"fuel-pump",hexadecimal:"⛽"},{name:"police-cars-revolving-light",hexadecimal:"🚨"},{name:"horizontal-traffic-light",hexadecimal:"🚥"},{name:"vertical-traffic-light",hexadecimal:"🚦"},{name:"construction-sign",hexadecimal:"🚧"},{name:"octagonal-sign",hexadecimal:"🛑"},{name:"anchor",hexadecimal:"⚓"},{name:"sailboat",hexadecimal:"⛵"},{name:"canoe",hexadecimal:"🛶"},{name:"speedboat",hexadecimal:"🚤"},{name:"passenger-ship",hexadecimal:"🛳"},{name:"ferry",hexadecimal:"⛴"},{name:"motor-boat",hexadecimal:"🛥"},{name:"ship",hexadecimal:"🚢"},{name:"airplane",hexadecimal:"✈"},{name:"small-airplane",hexadecimal:"🛩"},{name:"airplane-departure",hexadecimal:"🛫"},{name:"airplane-arriving",hexadecimal:"🛬"},{name:"seat",hexadecimal:"💺"},{name:"helicopter",hexadecimal:"🚁"},{name:"suspension-railway",hexadecimal:"🚟"},{name:"mountain-cableway",hexadecimal:"🚠"},{name:"aerial-tramway",hexadecimal:"🚡"},{name:"rocket",hexadecimal:"🚀"},{name:"satellite",hexadecimal:"🛰"},{name:"bellhop-bell",hexadecimal:"🛎"},{name:"door",hexadecimal:"🚪"},{name:"sleeping-accommodation",hexadecimal:"🛌"},{name:"bed",hexadecimal:"🛏"},{name:"couch-and-lamp",hexadecimal:"🛋"},{name:"toilet",hexadecimal:"🚽"},{name:"shower",hexadecimal:"🚿"},{name:"bath",hexadecimal:"🛀"},{name:"person-taking-bath-type-1-2",hexadecimal:"🛀🏻"},{name:"person-taking-bath-type-3",hexadecimal:"🛀🏼"},{name:"person-taking-bath-type-4",hexadecimal:"🛀🏽"},{name:"person-taking-bath-type-5",hexadecimal:"🛀🏾"},{name:"person-taking-bath-type-6",hexadecimal:"🛀🏿"},{name:"bathtub",hexadecimal:"🛁"},{name:"hourglass",hexadecimal:"⌛"},{name:"hourglass-with-flowing-sand",hexadecimal:"⏳"},{name:"watch",hexadecimal:"⌚"},{name:"alarm-clock",hexadecimal:"⏰"},{name:"stopwatch",hexadecimal:"⏱"},{name:"timer-clock",hexadecimal:"⏲"},{name:"mantelpiece-clock",hexadecimal:"🕰"},{name:"clock-face-twelve-oclock",hexadecimal:"🕛"},{name:"clock-face-twelve-thirty",hexadecimal:"🕧"},{name:"clock-face-one-oclock",hexadecimal:"🕐"},{name:"clock-face-one-thirty",hexadecimal:"🕜"},{name:"clock-face-two-oclock",hexadecimal:"🕑"},{name:"clock-face-two-thirty",hexadecimal:"🕝"},{name:"clock-face-three-oclock",hexadecimal:"🕒"},{name:"clock-face-three-thirty",hexadecimal:"🕞"},{name:"clock-face-four-oclock",hexadecimal:"🕓"},{name:"clock-face-four-thirty",hexadecimal:"🕟"},{name:"clock-face-five-oclock",hexadecimal:"🕔"},{name:"clock-face-five-thirty",hexadecimal:"🕠"},{name:"clock-face-six-oclock",hexadecimal:"🕕"},{name:"clock-face-six-thirty",hexadecimal:"🕡"},{name:"clock-face-seven-oclock",hexadecimal:"🕖"},{name:"clock-face-seven-thirty",hexadecimal:"🕢"},{name:"clock-face-eight-oclock",hexadecimal:"🕗"},{name:"clock-face-eight-thirty",hexadecimal:"🕣"},{name:"clock-face-nine-oclock",hexadecimal:"🕘"},{name:"clock-face-nine-thirty",hexadecimal:"🕤"},{name:"clock-face-ten-oclock",hexadecimal:"🕙"},{name:"clock-face-ten-thirty",hexadecimal:"🕥"},{name:"clock-face-eleven-oclock",hexadecimal:"🕚"},{name:"clock-face-eleven-thirty",hexadecimal:"🕦"},{name:"new-moon-symbol",hexadecimal:"🌑"},{name:"waxing-crescent-moon-symbol",hexadecimal:"🌒"},{name:"first-quarter-moon-symbol",hexadecimal:"🌓"},{name:"waxing-gibbous-moon-symbol",hexadecimal:"🌔"},{name:"full-moon-symbol",hexadecimal:"🌕"},{name:"waning-gibbous-moon-symbol",hexadecimal:"🌖"},{name:"last-quarter-moon-symbol",hexadecimal:"🌗"},{name:"waning-crescent-moon-symbol",hexadecimal:"🌘"},{name:"crescent-moon",hexadecimal:"🌙"},{name:"new-moon-with-face",hexadecimal:"🌚"},{name:"first-quarter-moon-with-face",hexadecimal:"🌛"},{name:"last-quarter-moon-with-face",hexadecimal:"🌜"},{name:"thermometer",hexadecimal:"🌡"},{name:"black-sun-with-rays",hexadecimal:"☀"},{name:"full-moon-with-face",hexadecimal:"🌝"},{name:"sun-with-face",hexadecimal:"🌞"},{name:"white-medium-star",hexadecimal:"⭐"},{name:"glowing-star",hexadecimal:"🌟"},{name:"shooting-star",hexadecimal:"🌠"},{name:"cloud",hexadecimal:"☁"},{name:"sun-behind-cloud",hexadecimal:"⛅"},{name:"thunder-cloud-and-rain",hexadecimal:"⛈"},{name:"white-sun-with-small-cloud",hexadecimal:"🌤"},{name:"white-sun-behind-cloud",hexadecimal:"🌥"},{name:"white-sun-behind-cloud-with-rain",hexadecimal:"🌦"},{name:"cloud-with-rain",hexadecimal:"🌧"},{name:"cloud-with-snow",hexadecimal:"🌨"},{name:"cloud-with-lightning",hexadecimal:"🌩"},{name:"cloud-with-tornado",hexadecimal:"🌪"},{name:"fog",hexadecimal:"🌫"},{name:"wind-blowing-face",hexadecimal:"🌬"},{name:"cyclone",hexadecimal:"🌀"},{name:"rainbow",hexadecimal:"🌈"},{name:"closed-umbrella",hexadecimal:"🌂"},{name:"umbrella",hexadecimal:"☂"},{name:"umbrella-with-rain-drops",hexadecimal:"☔"},{name:"umbrella-on-ground",hexadecimal:"⛱"},{name:"high-voltage-sign",hexadecimal:"⚡"},{name:"snowflake",hexadecimal:"❄"},{name:"snowman",hexadecimal:"☃"},{name:"snowman-without-snow",hexadecimal:"⛄"},{name:"comet",hexadecimal:"☄"},{name:"fire",hexadecimal:"🔥"},{name:"droplet",hexadecimal:"💧"},{name:"water-wave",hexadecimal:"🌊"},{name:"jack-o-lantern",hexadecimal:"🎃"},{name:"christmas-tree",hexadecimal:"🎄"},{name:"fireworks",hexadecimal:"🎆"},{name:"firework-sparkler",hexadecimal:"🎇"},{name:"sparkles",hexadecimal:"✨"},{name:"balloon",hexadecimal:"🎈"},{name:"party-popper",hexadecimal:"🎉"},{name:"confetti-ball",hexadecimal:"🎊"},{name:"tanabata-tree",hexadecimal:"🎋"},{name:"pine-decoration",hexadecimal:"🎍"},{name:"japanese-dolls",hexadecimal:"🎎"},{name:"carp-streamer",hexadecimal:"🎏"},{name:"wind-chime",hexadecimal:"🎐"},{name:"moon-viewing-ceremony",hexadecimal:"🎑"},{name:"ribbon",hexadecimal:"🎀"},{name:"wrapped-present",hexadecimal:"🎁"},{name:"reminder-ribbon",hexadecimal:"🎗"},{name:"admission-tickets",hexadecimal:"🎟"},{name:"ticket",hexadecimal:"🎫"},{name:"military-medal",hexadecimal:"🎖"},{name:"trophy",hexadecimal:"🏆"},{name:"sports-medal",hexadecimal:"🏅"},{name:"first-place-medal",hexadecimal:"🥇"},{name:"second-place-medal",hexadecimal:"🥈"},{name:"third-place-medal",hexadecimal:"🥉"},{name:"soccer-ball",hexadecimal:"⚽"},{name:"baseball",hexadecimal:"⚾"},{name:"basketball-and-hoop",hexadecimal:"🏀"},{name:"volleyball",hexadecimal:"🏐"},{name:"american-football",hexadecimal:"🏈"},{name:"rugby-football",hexadecimal:"🏉"},{name:"tennis-racquet-and-ball",hexadecimal:"🎾"},{name:"billiards",hexadecimal:"🎱"},{name:"bowling",hexadecimal:"🎳"},{name:"cricket-bat-and-ball",hexadecimal:"🏏"},{name:"field-hockey-stick-and-ball",hexadecimal:"🏑"},{name:"ice-hockey-stick-and-puck",hexadecimal:"🏒"},{name:"table-tennis-paddle-and-ball",hexadecimal:"🏓"},{name:"badminton-racquet-and-shuttlecock",hexadecimal:"🏸"},{name:"boxing-glove",hexadecimal:"🥊"},{name:"martial-arts-uniform",hexadecimal:"🥋"},{name:"goal-net",hexadecimal:"🥅"},{name:"direct-hit",hexadecimal:"🎯"},{name:"flag-in-hole",hexadecimal:"⛳"},{name:"ice-skate",hexadecimal:"⛸"},{name:"fishing-pole-and-fish",hexadecimal:"🎣"},{name:"running-shirt-with-sash",hexadecimal:"🎽"},{name:"ski-and-ski-boot",hexadecimal:"🎿"},{name:"fencer",hexadecimal:"🤺"},{name:"horse-racing",hexadecimal:"🏇"},{name:"skier",hexadecimal:"⛷"},{name:"snowboarder",hexadecimal:"🏂"},{name:"golfer",hexadecimal:"🏌"},{name:"surfer",hexadecimal:"🏄"},{name:"person-surfing-type-1-2",hexadecimal:"🏄🏻"},{name:"person-surfing-type-3",hexadecimal:"🏄🏼"},{name:"person-surfing-type-4",hexadecimal:"🏄🏽"},{name:"person-surfing-type-5",hexadecimal:"🏄🏾"},{name:"person-surfing-type-6",hexadecimal:"🏄🏿"},{name:"rowboat",hexadecimal:"🚣"},{name:"person-rowing-boat-type-1-2",hexadecimal:"🚣🏻"},{name:"person-rowing-boat-type-3",hexadecimal:"🚣🏼"},{name:"person-rowing-boat-type-4",hexadecimal:"🚣🏽"},{name:"person-rowing-boat-type-5",hexadecimal:"🚣🏾"},{name:"person-rowing-boat-type-6",hexadecimal:"🚣🏿"},{name:"swimmer",hexadecimal:"🏊"},{name:"person-swimming-type-1-2",hexadecimal:"🏊🏻"},{name:"person-swimming-type-3",hexadecimal:"🏊🏼"},{name:"person-swimming-type-4",hexadecimal:"🏊🏽"},{name:"person-swimming-type-5",hexadecimal:"🏊🏾"},{name:"person-swimming-type-6",hexadecimal:"🏊🏿"},{name:"person-with-ball",hexadecimal:"⛹"},{name:"person-with-ball-type-1-2",hexadecimal:"⛹🏻"},{name:"person-with-ball-type-3",hexadecimal:"⛹🏼"},{name:"person-with-ball-type-4",hexadecimal:"⛹🏽"},{name:"person-with-ball-type-5",hexadecimal:"⛹🏾"},{name:"person-with-ball-type-6",hexadecimal:"⛹🏿"},{name:"weight-lifter",hexadecimal:"🏋"},{name:"person-weight-lifting-type-1-2",hexadecimal:"🏋🏻"},{name:"person-weight-lifting-type-3",hexadecimal:"🏋🏼"},{name:"person-weight-lifting-type-4",hexadecimal:"🏋🏽"},{name:"person-weight-lifting-type-5",hexadecimal:"🏋🏾"},{name:"person-weight-lifting-type-6",hexadecimal:"🏋🏿"},{name:"bicyclist",hexadecimal:"🚴"},{name:"person-biking-type-1-2",hexadecimal:"🚴🏻"},{name:"person-biking-type-3",hexadecimal:"🚴🏼"},{name:"person-biking-type-4",hexadecimal:"🚴🏽"},{name:"person-biking-type-5",hexadecimal:"🚴🏾"},{name:"person-biking-type-6",hexadecimal:"🚴🏿"},{name:"mountain-bicyclist",hexadecimal:"🚵"},{name:"person-mountain-biking-type-1-2",hexadecimal:"🚵🏻"},{name:"person-mountain-biking-type-3",hexadecimal:"🚵🏼"},{name:"person-mountain-biking-type-4",hexadecimal:"🚵🏽"},{name:"person-mountain-biking-type-5",hexadecimal:"🚵🏾"},{name:"person-mountain-biking-type-6",hexadecimal:"🚵🏿"},{name:"person-doing-cartwheel",hexadecimal:"🤸"},{name:"person-doing-cartwheel-type-1-2",hexadecimal:"🤸🏻"},{name:"person-doing-cartwheel-type-3",hexadecimal:"🤸🏼"},{name:"person-doing-cartwheel-type-4",hexadecimal:"🤸🏽"},{name:"person-doing-cartwheel-type-5",hexadecimal:"🤸🏾"},{name:"person-doing-cartwheel-type-6",hexadecimal:"🤸🏿"},{name:"wrestlers",hexadecimal:"🤼"},{name:"people-wrestling-type-1-2",hexadecimal:"🤼🏻"},{name:"people-wrestling-type-3",hexadecimal:"🤼🏼"},{name:"people-wrestling-type-4",hexadecimal:"🤼🏽"},{name:"people-wrestling-type-5",hexadecimal:"🤼🏾"},{name:"people-wrestling-type-6",hexadecimal:"🤼🏿"},{name:"water-polo",hexadecimal:"🤽"},{name:"person-playing-water-polo-type-1-2",hexadecimal:"🤽🏻"},{name:"person-playing-water-polo-type-3",hexadecimal:"🤽🏼"},{name:"person-playing-water-polo-type-4",hexadecimal:"🤽🏽"},{name:"person-playing-water-polo-type-5",hexadecimal:"🤽🏾"},{name:"person-playing-water-polo-type-6",hexadecimal:"🤽🏿"},{name:"handball",hexadecimal:"🤾"},{name:"person-playing-handball-type-1-2",hexadecimal:"🤾🏻"},{name:"person-playing-handball-type-3",hexadecimal:"🤾🏼"},{name:"person-playing-handball-type-4",hexadecimal:"🤾🏽"},{name:"person-playing-handball-type-5",hexadecimal:"🤾🏾"},{name:"person-playing-handball-type-6",hexadecimal:"🤾🏿"},{name:"juggling",hexadecimal:"🤹"},{name:"person-juggling-type-1-2",hexadecimal:"🤹🏻"},{name:"person-juggling-type-3",hexadecimal:"🤹🏼"},{name:"person-juggling-type-4",hexadecimal:"🤹🏽"},{name:"person-juggling-type-5",hexadecimal:"🤹🏾"},{name:"person-juggling-type-6",hexadecimal:"🤹🏿"},{name:"video-game",hexadecimal:"🎮"},{name:"joystick",hexadecimal:"🕹"},{name:"game-die",hexadecimal:"🎲"},{name:"black-spade-suit",hexadecimal:"♠"},{name:"black-heart-suit",hexadecimal:"♥"},{name:"black-diamond-suit",hexadecimal:"♦"},{name:"black-club-suit",hexadecimal:"♣"},{name:"playing-card-black-joker",hexadecimal:"🃏"},{name:"mahjong-tile-red-dragon",hexadecimal:"🀄"},{name:"flower-playing-cards",hexadecimal:"🎴"},{name:"speaker-with-cancellation-stroke",hexadecimal:"🔇"},{name:"speaker",hexadecimal:"🔈"},{name:"speaker-with-one-sound-wave",hexadecimal:"🔉"},{name:"speaker-with-three-sound-waves",hexadecimal:"🔊"},{name:"public-address-loudspeaker",hexadecimal:"📢"},{name:"cheering-megaphone",hexadecimal:"📣"},{name:"postal-horn",hexadecimal:"📯"},{name:"bell",hexadecimal:"🔔"},{name:"bell-with-cancellation-stroke",hexadecimal:"🔕"},{name:"musical-score",hexadecimal:"🎼"},{name:"musical-note",hexadecimal:"🎵"},{name:"multiple-musical-notes",hexadecimal:"🎶"},{name:"studio-microphone",hexadecimal:"🎙"},{name:"level-slider",hexadecimal:"🎚"},{name:"control-knobs",hexadecimal:"🎛"},{name:"microphone",hexadecimal:"🎤"},{name:"headphone",hexadecimal:"🎧"},{name:"radio",hexadecimal:"📻"},{name:"saxophone",hexadecimal:"🎷"},{name:"guitar",hexadecimal:"🎸"},{name:"musical-keyboard",hexadecimal:"🎹"},{name:"trumpet",hexadecimal:"🎺"},{name:"violin",hexadecimal:"🎻"},{name:"drum-with-drumsticks",hexadecimal:"🥁"},{name:"mobile-phone",hexadecimal:"📱"},{name:"mobile-phone-with-rightwards-arrow-at-left",hexadecimal:"📲"},{name:"black-telephone",hexadecimal:"☎"},{name:"telephone-receiver",hexadecimal:"📞"},{name:"pager",hexadecimal:"📟"},{name:"fax-machine",hexadecimal:"📠"},{name:"battery",hexadecimal:"🔋"},{name:"electric-plug",hexadecimal:"🔌"},{name:"personal-computer",hexadecimal:"💻"},{name:"desktop-computer",hexadecimal:"🖥"},{name:"printer",hexadecimal:"🖨"},{name:"keyboard",hexadecimal:"⌨"},{name:"three-button-mouse",hexadecimal:"🖱"},{name:"trackball",hexadecimal:"🖲"},{name:"minidisc",hexadecimal:"💽"},{name:"floppy-disk",hexadecimal:"💾"},{name:"optical-disc",hexadecimal:"💿"},{name:"dvd",hexadecimal:"📀"},{name:"movie-camera",hexadecimal:"🎥"},{name:"film-frames",hexadecimal:"🎞"},{name:"film-projector",hexadecimal:"📽"},{name:"clapper-board",hexadecimal:"🎬"},{name:"television",hexadecimal:"📺"},{name:"camera",hexadecimal:"📷"},{name:"camera-with-flash",hexadecimal:"📸"},{name:"video-camera",hexadecimal:"📹"},{name:"videocassette",hexadecimal:"📼"},{name:"left-pointing-magnifying-glass",hexadecimal:"🔍"},{name:"right-pointing-magnifying-glass",hexadecimal:"🔎"},{name:"microscope",hexadecimal:"🔬"},{name:"telescope",hexadecimal:"🔭"},{name:"satellite-antenna",hexadecimal:"📡"},{name:"candle",hexadecimal:"🕯"},{name:"electric-light-bulb",hexadecimal:"💡"},{name:"electric-torch",hexadecimal:"🔦"},{name:"izakaya-lantern",hexadecimal:"🏮"},{name:"notebook-with-decorative-cover",hexadecimal:"📔"},{name:"closed-book",hexadecimal:"📕"},{name:"open-book",hexadecimal:"📖"},{name:"green-book",hexadecimal:"📗"},{name:"blue-book",hexadecimal:"📘"},{name:"orange-book",hexadecimal:"📙"},{name:"books",hexadecimal:"📚"},{name:"notebook",hexadecimal:"📓"},{name:"ledger",hexadecimal:"📒"},{name:"page-with-curl",hexadecimal:"📃"},{name:"scroll",hexadecimal:"📜"},{name:"page-facing-up",hexadecimal:"📄"},{name:"newspaper",hexadecimal:"📰"},{name:"rolled-up-newspaper",hexadecimal:"🗞"},{name:"bookmark-tabs",hexadecimal:"📑"},{name:"bookmark",hexadecimal:"🔖"},{name:"label",hexadecimal:"🏷"},{name:"money-bag",hexadecimal:"💰"},{name:"banknote-with-yen-sign",hexadecimal:"💴"},{name:"banknote-with-dollar-sign",hexadecimal:"💵"},{name:"banknote-with-euro-sign",hexadecimal:"💶"},{name:"banknote-with-pound-sign",hexadecimal:"💷"},{name:"money-with-wings",hexadecimal:"💸"},{name:"credit-card",hexadecimal:"💳"},{name:"chart-with-upwards-trend-and-yen-sign",hexadecimal:"💹"},{name:"currency-exchange",hexadecimal:"💱"},{name:"heavy-dollar-sign",hexadecimal:"💲"},{name:"envelope",hexadecimal:"✉"},{name:"e-mail-symbol",hexadecimal:"📧"},{name:"incoming-envelope",hexadecimal:"📨"},{name:"envelope-with-downwards-arrow-above",hexadecimal:"📩"},{name:"outbox-tray",hexadecimal:"📤"},{name:"inbox-tray",hexadecimal:"📥"},{name:"package",hexadecimal:"📦"},{name:"closed-mailbox-with-raised-flag",hexadecimal:"📫"},{name:"closed-mailbox-with-lowered-flag",hexadecimal:"📪"},{name:"open-mailbox-with-raised-flag",hexadecimal:"📬"},{name:"open-mailbox-with-lowered-flag",hexadecimal:"📭"},{name:"postbox",hexadecimal:"📮"},{name:"ballot-box-with-ballot",hexadecimal:"🗳"},{name:"pencil",hexadecimal:"✏"},{name:"black-nib",hexadecimal:"✒"},{name:"lower-left-fountain-pen",hexadecimal:"🖋"},{name:"lower-left-ballpoint-pen",hexadecimal:"🖊"},{name:"lower-left-paintbrush",hexadecimal:"🖌"},{name:"lower-left-crayon",hexadecimal:"🖍"},{name:"memo",hexadecimal:"📝"},{name:"briefcase",hexadecimal:"💼"},{name:"file-folder",hexadecimal:"📁"},{name:"open-file-folder",hexadecimal:"📂"},{name:"card-index-dividers",hexadecimal:"🗂"},{name:"calendar",hexadecimal:"📅"},{name:"tear-off-calendar",hexadecimal:"📆"},{name:"spiral-note-pad",hexadecimal:"🗒"},{name:"spiral-calendar-pad",hexadecimal:"🗓"},{name:"card-index",hexadecimal:"📇"},{name:"chart-with-upwards-trend",hexadecimal:"📈"},{name:"chart-with-downwards-trend",hexadecimal:"📉"},{name:"bar-chart",hexadecimal:"📊"},{name:"clipboard",hexadecimal:"📋"},{name:"pushpin",hexadecimal:"📌"},{name:"round-pushpin",hexadecimal:"📍"},{name:"paperclip",hexadecimal:"📎"},{name:"linked-paperclips",hexadecimal:"🖇"},{name:"straight-ruler",hexadecimal:"📏"},{name:"triangular-ruler",hexadecimal:"📐"},{name:"black-scissors",hexadecimal:"✂"},{name:"card-file-box",hexadecimal:"🗃"},{name:"file-cabinet",hexadecimal:"🗄"},{name:"wastebasket",hexadecimal:"🗑"},{name:"lock",hexadecimal:"🔒"},{name:"open-lock",hexadecimal:"🔓"},{name:"lock-with-ink-pen",hexadecimal:"🔏"},{name:"closed-lock-with-key",hexadecimal:"🔐"},{name:"key",hexadecimal:"🔑"},{name:"old-key",hexadecimal:"🗝"},{name:"hammer",hexadecimal:"🔨"},{name:"pick",hexadecimal:"⛏"},{name:"hammer-and-pick",hexadecimal:"⚒"},{name:"hammer-and-wrench",hexadecimal:"🛠"},{name:"dagger-knife",hexadecimal:"🗡"},{name:"crossed-swords",hexadecimal:"⚔"},{name:"pistol",hexadecimal:"🔫"},{name:"bow-and-arrow",hexadecimal:"🏹"},{name:"shield",hexadecimal:"🛡"},{name:"wrench",hexadecimal:"🔧"},{name:"nut-and-bolt",hexadecimal:"🔩"},{name:"gear",hexadecimal:"⚙"},{name:"compression",hexadecimal:"🗜"},{name:"alembic",hexadecimal:"⚗"},{name:"scales",hexadecimal:"⚖"},{name:"link-symbol",hexadecimal:"🔗"},{name:"chains",hexadecimal:"⛓"},{name:"syringe",hexadecimal:"💉"},{name:"pill",hexadecimal:"💊"},{name:"smoking-symbol",hexadecimal:"🚬"},{name:"coffin",hexadecimal:"⚰"},{name:"funeral-urn",hexadecimal:"⚱"},{name:"moyai",hexadecimal:"🗿"},{name:"oil-drum",hexadecimal:"🛢"},{name:"crystal-ball",hexadecimal:"🔮"},{name:"shopping-trolley",hexadecimal:"🛒"},{name:"automated-teller-machine",hexadecimal:"🏧"},{name:"put-litter-in-its-place-symbol",hexadecimal:"🚮"},{name:"potable-water-symbol",hexadecimal:"🚰"},{name:"wheelchair-symbol",hexadecimal:"♿"},{name:"mens-symbol",hexadecimal:"🚹"},{name:"womens-symbol",hexadecimal:"🚺"},{name:"restroom",hexadecimal:"🚻"},{name:"baby-symbol",hexadecimal:"🚼"},{name:"water-closet",hexadecimal:"🚾"},{name:"passport-control",hexadecimal:"🛂"},{name:"customs",hexadecimal:"🛃"},{name:"baggage-claim",hexadecimal:"🛄"},{name:"left-luggage",hexadecimal:"🛅"},{name:"warning-sign",hexadecimal:"⚠"},{name:"children-crossing",hexadecimal:"🚸"},{name:"no-entry",hexadecimal:"⛔"},{name:"no-entry-sign",hexadecimal:"🚫"},{name:"no-bicycles",hexadecimal:"🚳"},{name:"no-smoking-symbol",hexadecimal:"🚭"},{name:"do-not-litter-symbol",hexadecimal:"🚯"},{name:"non-potable-water-symbol",hexadecimal:"🚱"},{name:"no-pedestrians",hexadecimal:"🚷"},{name:"no-mobile-phones",hexadecimal:"📵"},{name:"no-one-under-eighteen-symbol",hexadecimal:"🔞"},{name:"radioactive-sign",hexadecimal:"☢"},{name:"biohazard-sign",hexadecimal:"☣"},{name:"upwards-black-arrow",hexadecimal:"⬆"},{name:"north-east-arrow",hexadecimal:"↗"},{name:"black-rightwards-arrow",hexadecimal:"➡"},{name:"south-east-arrow",hexadecimal:"↘"},{name:"downwards-black-arrow",hexadecimal:"⬇"},{name:"south-west-arrow",hexadecimal:"↙"},{name:"leftwards-black-arrow",hexadecimal:"⬅"},{name:"north-west-arrow",hexadecimal:"↖"},{name:"up-down-arrow",hexadecimal:"↕"},{name:"left-right-arrow",hexadecimal:"↔"},{name:"leftwards-arrow-with-hook",hexadecimal:"↩"},{name:"rightwards-arrow-with-hook",hexadecimal:"↪"},{name:"arrow-pointing-rightwards-then-curving-upwards",hexadecimal:"⤴"},{name:"arrow-pointing-rightwards-then-curving-downwards",hexadecimal:"⤵"},{name:"clockwise-downwards-and-upwards-open-circle-arrows",hexadecimal:"🔃"},{name:"anticlockwise-downwards-and-upwards-open-circle-arrows",hexadecimal:"🔄"},{name:"back-with-leftwards-arrow-above",hexadecimal:"🔙"},{name:"end-with-leftwards-arrow-above",hexadecimal:"🔚"},{name:"on-with-exclamation-mark-with-left-right-arrow-above",hexadecimal:"🔛"},{name:"soon-with-rightwards-arrow-above",hexadecimal:"🔜"},{name:"top-with-upwards-arrow-above",hexadecimal:"🔝"},{name:"place-of-worship",hexadecimal:"🛐"},{name:"atom-symbol",hexadecimal:"⚛"},{name:"om-symbol",hexadecimal:"🕉"},{name:"star-of-david",hexadecimal:"✡"},{name:"wheel-of-dharma",hexadecimal:"☸"},{name:"yin-yang",hexadecimal:"☯"},{name:"latin-cross",hexadecimal:"✝"},{name:"orthodox-cross",hexadecimal:"☦"},{name:"star-and-crescent",hexadecimal:"☪"},{name:"peace-symbol",hexadecimal:"☮"},{name:"menorah-with-nine-branches",hexadecimal:"🕎"},{name:"six-pointed-star-with-middle-dot",hexadecimal:"🔯"},{name:"black-universal-recycling-symbol",hexadecimal:"♻"},{name:"name-badge",hexadecimal:"📛"},{name:"fleur-de-lis",hexadecimal:"⚜"},{name:"japanese-symbol-for-beginner",hexadecimal:"🔰"},{name:"trident-emblem",hexadecimal:"🔱"},{name:"heavy-large-circle",hexadecimal:"⭕"},{name:"white-heavy-check-mark",hexadecimal:"✅"},{name:"ballot-box-with-check",hexadecimal:"☑"},{name:"heavy-check-mark",hexadecimal:"✔"},{name:"heavy-multiplication-x",hexadecimal:"✖"},{name:"cross-mark",hexadecimal:"❌"},{name:"negative-squared-cross-mark",hexadecimal:"❎"},{name:"heavy-plus-sign",hexadecimal:"➕"},{name:"heavy-minus-sign",hexadecimal:"➖"},{name:"heavy-division-sign",hexadecimal:"➗"},{name:"curly-loop",hexadecimal:"➰"},{name:"double-curly-loop",hexadecimal:"➿"},{name:"part-alternation-mark",hexadecimal:"〽"},{name:"eight-spoked-asterisk",hexadecimal:"✳"},{name:"eight-pointed-black-star",hexadecimal:"✴"},{name:"sparkle",hexadecimal:"❇"},{name:"double-exclamation-mark",hexadecimal:"‼"},{name:"exclamation-question-mark",hexadecimal:"⁉"},{name:"black-question-mark-ornament",hexadecimal:"❓"},{name:"white-question-mark-ornament",hexadecimal:"❔"},{name:"white-exclamation-mark-ornament",hexadecimal:"❕"},{name:"heavy-exclamation-mark-symbol",hexadecimal:"❗"},{name:"wavy-dash",hexadecimal:"〰"},{name:"copyright-sign",hexadecimal:"©"},{name:"registered-sign",hexadecimal:"®"},{name:"trade-mark-sign",hexadecimal:"™"},{name:"aries",hexadecimal:"♈"},{name:"taurus",hexadecimal:"♉"},{name:"gemini",hexadecimal:"♊"},{name:"cancer",hexadecimal:"♋"},{name:"leo",hexadecimal:"♌"},{name:"virgo",hexadecimal:"♍"},{name:"libra",hexadecimal:"♎"},{name:"scorpius",hexadecimal:"♏"},{name:"sagittarius",hexadecimal:"♐"},{name:"capricorn",hexadecimal:"♑"},{name:"aquarius",hexadecimal:"♒"},{name:"pisces",hexadecimal:"♓"},{name:"ophiuchus",hexadecimal:"⛎"},{name:"twisted-rightwards-arrows",hexadecimal:"🔀"},{name:"clockwise-rightwards-and-leftwards-open-circle-arrows",hexadecimal:"🔁"},{name:"clockwise-rightwards-and-leftwards-open-circle-arrows-with-circled-one-overlay",hexadecimal:"🔂"},{name:"black-right-pointing-triangle",hexadecimal:"▶"},{name:"black-right-pointing-double-triangle",hexadecimal:"⏩"},{name:"black-right-pointing-double-triangle-with-vertical-bar",hexadecimal:"⏭"},{name:"black-right-pointing-triangle-with-double-vertical-bar",hexadecimal:"⏯"},{name:"black-left-pointing-triangle",hexadecimal:"◀"},{name:"black-left-pointing-double-triangle",hexadecimal:"⏪"},{name:"black-left-pointing-double-triangle-with-vertical-bar",hexadecimal:"⏮"},{name:"up-pointing-small-red-triangle",hexadecimal:"🔼"},{name:"black-up-pointing-double-triangle",hexadecimal:"⏫"},{name:"down-pointing-small-red-triangle",hexadecimal:"🔽"},{name:"black-down-pointing-double-triangle",hexadecimal:"⏬"},{name:"double-vertical-bar",hexadecimal:"⏸"},{name:"black-square-for-stop",hexadecimal:"⏹"},{name:"black-circle-for-record",hexadecimal:"⏺"},{name:"eject-symbol",hexadecimal:"⏏"},{name:"cinema",hexadecimal:"🎦"},{name:"low-brightness-symbol",hexadecimal:"🔅"},{name:"high-brightness-symbol",hexadecimal:"🔆"},{name:"antenna-with-bars",hexadecimal:"📶"},{name:"vibration-mode",hexadecimal:"📳"},{name:"mobile-phone-off",hexadecimal:"📴"},{name:"keycap-#",hexadecimal:"#️⃣"},{name:"keycap-*",hexadecimal:"*️⃣"},{name:"keycap-0",hexadecimal:"0️⃣"},{name:"keycap-1",hexadecimal:"1️⃣"},{name:"keycap-2",hexadecimal:"2️⃣"},{name:"keycap-3",hexadecimal:"3️⃣"},{name:"keycap-4",hexadecimal:"4️⃣"},{name:"keycap-5",hexadecimal:"5️⃣"},{name:"keycap-6",hexadecimal:"6️⃣"},{name:"keycap-7",hexadecimal:"7️⃣"},{name:"keycap-8",hexadecimal:"8️⃣"},{name:"keycap-9",hexadecimal:"9️⃣"},{name:"keycap-ten",hexadecimal:"🔟"},{name:"hundred-points-symbol",hexadecimal:"💯"},{name:"input-symbol-for-latin-capital-letters",hexadecimal:"🔠"},{name:"input-symbol-for-latin-small-letters",hexadecimal:"🔡"},{name:"input-symbol-for-numbers",hexadecimal:"🔢"},{name:"input-symbol-for-symbols",hexadecimal:"🔣"},{name:"input-symbol-for-latin-letters",hexadecimal:"🔤"},{name:"negative-squared-latin-capital-letter-a",hexadecimal:"🅰"},{name:"negative-squared-ab",hexadecimal:"🆎"},{name:"negative-squared-latin-capital-letter-b",hexadecimal:"🅱"},{name:"squared-cl",hexadecimal:"🆑"},{name:"squared-cool",hexadecimal:"🆒"},{name:"squared-free",hexadecimal:"🆓"},{name:"information-source",hexadecimal:"ℹ"},{name:"squared-id",hexadecimal:"🆔"},{name:"circled-latin-capital-letter-m",hexadecimal:"Ⓜ"},{name:"squared-new",hexadecimal:"🆕"},{name:"squared-ng",hexadecimal:"🆖"},{name:"negative-squared-latin-capital-letter-o",hexadecimal:"🅾"},{name:"squared-ok",hexadecimal:"🆗"},{name:"negative-squared-latin-capital-letter-p",hexadecimal:"🅿"},{name:"squared-sos",hexadecimal:"🆘"},{name:"squared-up-with-exclamation-mark",hexadecimal:"🆙"},{name:"squared-vs",hexadecimal:"🆚"},{name:"squared-katakana-koko",hexadecimal:"🈁"},{name:"squared-katakana-sa",hexadecimal:"🈂"},{name:"squared-cjk-unified-ideograph-6708",hexadecimal:"🈷"},{name:"squared-cjk-unified-ideograph-6709",hexadecimal:"🈶"},{name:"squared-cjk-unified-ideograph-6307",hexadecimal:"🈯"},{name:"circled-ideograph-advantage",hexadecimal:"🉐"},{name:"squared-cjk-unified-ideograph-5272",hexadecimal:"🈹"},{name:"squared-cjk-unified-ideograph-7121",hexadecimal:"🈚"},{name:"squared-cjk-unified-ideograph-7981",hexadecimal:"🈲"},{name:"circled-ideograph-accept",hexadecimal:"🉑"},{name:"squared-cjk-unified-ideograph-7533",hexadecimal:"🈸"},{name:"squared-cjk-unified-ideograph-5408",hexadecimal:"🈴"},{name:"squared-cjk-unified-ideograph-7a7a",hexadecimal:"🈳"},{name:"circled-ideograph-congratulation",hexadecimal:"㊗"},{name:"circled-ideograph-secret",hexadecimal:"㊙"},{name:"squared-cjk-unified-ideograph-55b6",hexadecimal:"🈺"},{name:"squared-cjk-unified-ideograph-6e80",hexadecimal:"🈵"},{name:"black-small-square",hexadecimal:"▪"},{name:"white-small-square",hexadecimal:"▫"},{name:"white-medium-square",hexadecimal:"◻"},{name:"black-medium-square",hexadecimal:"◼"},{name:"white-medium-small-square",hexadecimal:"◽"},{name:"black-medium-small-square",hexadecimal:"◾"},{name:"black-large-square",hexadecimal:"⬛"},{name:"white-large-square",hexadecimal:"⬜"},{name:"large-orange-diamond",hexadecimal:"🔶"},{name:"large-blue-diamond",hexadecimal:"🔷"},{name:"small-orange-diamond",hexadecimal:"🔸"},{name:"small-blue-diamond",hexadecimal:"🔹"},{name:"up-pointing-red-triangle",hexadecimal:"🔺"},{name:"down-pointing-red-triangle",hexadecimal:"🔻"},{name:"diamond-shape-with-a-dot-inside",hexadecimal:"💠"},{name:"radio-button",hexadecimal:"🔘"},{name:"black-square-button",hexadecimal:"🔲"},{name:"white-square-button",hexadecimal:"🔳"},{name:"medium-white-circle",hexadecimal:"⚪"},{name:"medium-black-circle",hexadecimal:"⚫"},{name:"large-red-circle",hexadecimal:"🔴"},{name:"large-blue-circle",hexadecimal:"🔵"},{name:"chequered-flag",hexadecimal:"🏁"},{name:"triangular-flag-on-post",hexadecimal:"🚩"},{name:"crossed-flags",hexadecimal:"🎌"},{name:"waving-black-flag",hexadecimal:"🏴"},{name:"waving-white-flag",hexadecimal:"🏳"},{name:"ascension-island",hexadecimal:"🇦🇨"},{name:"andorra",hexadecimal:"🇦🇩"},{name:"united-arab-emirates",hexadecimal:"🇦🇪"},{name:"afghanistan",hexadecimal:"🇦🇫"},{name:"antigua-&-barbuda",hexadecimal:"🇦🇬"},{name:"anguilla",hexadecimal:"🇦🇮"},{name:"albania",hexadecimal:"🇦🇱"},{name:"armenia",hexadecimal:"🇦🇲"},{name:"angola",hexadecimal:"🇦🇴"},{name:"antarctica",hexadecimal:"🇦🇶"},{name:"argentina",hexadecimal:"🇦🇷"},{name:"american-samoa",hexadecimal:"🇦🇸"},{name:"austria",hexadecimal:"🇦🇹"},{name:"australia",hexadecimal:"🇦🇺"},{name:"aruba",hexadecimal:"🇦🇼"},{name:"ã…land-islands",hexadecimal:"🇦🇽"},{name:"azerbaijan",hexadecimal:"🇦🇿"},{name:"bosnia-&-herzegovina",hexadecimal:"🇧🇦"},{name:"barbados",hexadecimal:"🇧🇧"},{name:"bangladesh",hexadecimal:"🇧🇩"},{name:"belgium",hexadecimal:"🇧🇪"},{name:"burkina-faso",hexadecimal:"🇧🇫"},{name:"bulgaria",hexadecimal:"🇧🇬"},{name:"bahrain",hexadecimal:"🇧🇭"},{name:"burundi",hexadecimal:"🇧🇮"},{name:"benin",hexadecimal:"🇧🇯"},{name:"st.-barthã©lemy",hexadecimal:"🇧🇱"},{name:"bermuda",hexadecimal:"🇧🇲"},{name:"brunei",hexadecimal:"🇧🇳"},{name:"bolivia",hexadecimal:"🇧🇴"},{name:"caribbean-netherlands",hexadecimal:"🇧🇶"},{name:"brazil",hexadecimal:"🇧🇷"},{name:"bahamas",hexadecimal:"🇧🇸"},{name:"bhutan",hexadecimal:"🇧🇹"},{name:"bouvet-island",hexadecimal:"🇧🇻"},{name:"botswana",hexadecimal:"🇧🇼"},{name:"belarus",hexadecimal:"🇧🇾"},{name:"belize",hexadecimal:"🇧🇿"},{name:"canada",hexadecimal:"🇨🇦"},{name:"cocos-(keeling)-islands",hexadecimal:"🇨🇨"},{name:"congo-kinshasa",hexadecimal:"🇨🇩"},{name:"central-african-republic",hexadecimal:"🇨🇫"},{name:"congo-brazzaville",hexadecimal:"🇨🇬"},{name:"switzerland",hexadecimal:"🇨🇭"},{name:"cã´te-d’ivoire",hexadecimal:"🇨🇮"},{name:"cook-islands",hexadecimal:"🇨🇰"},{name:"chile",hexadecimal:"🇨🇱"},{name:"cameroon",hexadecimal:"🇨🇲"},{name:"china",hexadecimal:"🇨🇳"},{name:"colombia",hexadecimal:"🇨🇴"},{name:"clipperton-island",hexadecimal:"🇨🇵"},{name:"costa-rica",hexadecimal:"🇨🇷"},{name:"cuba",hexadecimal:"🇨🇺"},{name:"cape-verde",hexadecimal:"🇨🇻"},{name:"curaã§ao",hexadecimal:"🇨🇼"},{name:"christmas-island",hexadecimal:"🇨🇽"},{name:"cyprus",hexadecimal:"🇨🇾"},{name:"czech-republic",hexadecimal:"🇨🇿"},{name:"germany",hexadecimal:"🇩🇪"},{name:"diego-garcia",hexadecimal:"🇩🇬"},{name:"djibouti",hexadecimal:"🇩🇯"},{name:"denmark",hexadecimal:"🇩🇰"},{name:"dominica",hexadecimal:"🇩🇲"},{name:"dominican-republic",hexadecimal:"🇩🇴"},{name:"algeria",hexadecimal:"🇩🇿"},{name:"ceuta-&-melilla",hexadecimal:"🇪🇦"},{name:"ecuador",hexadecimal:"🇪🇨"},{name:"estonia",hexadecimal:"🇪🇪"},{name:"egypt",hexadecimal:"🇪🇬"},{name:"western-sahara",hexadecimal:"🇪🇭"},{name:"eritrea",hexadecimal:"🇪🇷"},{name:"spain",hexadecimal:"🇪🇸"},{name:"ethiopia",hexadecimal:"🇪🇹"},{name:"european-union",hexadecimal:"🇪🇺"},{name:"finland",hexadecimal:"🇫🇮"},{name:"fiji",hexadecimal:"🇫🇯"},{name:"falkland-islands",hexadecimal:"🇫🇰"},{name:"micronesia",hexadecimal:"🇫🇲"},{name:"faroe-islands",hexadecimal:"🇫🇴"},{name:"france",hexadecimal:"🇫🇷"},{name:"gabon",hexadecimal:"🇬🇦"},{name:"united-kingdom",hexadecimal:"🇬🇧"},{name:"grenada",hexadecimal:"🇬🇩"},{name:"georgia",hexadecimal:"🇬🇪"},{name:"french-guiana",hexadecimal:"🇬🇫"},{name:"guernsey",hexadecimal:"🇬🇬"},{name:"ghana",hexadecimal:"🇬🇭"},{name:"gibraltar",hexadecimal:"🇬🇮"},{name:"greenland",hexadecimal:"🇬🇱"},{name:"gambia",hexadecimal:"🇬🇲"},{name:"guinea",hexadecimal:"🇬🇳"},{name:"guadeloupe",hexadecimal:"🇬🇵"},{name:"equatorial-guinea",hexadecimal:"🇬🇶"},{name:"greece",hexadecimal:"🇬🇷"},{name:"south-georgia-&-south-sandwich-islands",hexadecimal:"🇬🇸"},{name:"guatemala",hexadecimal:"🇬🇹"},{name:"guam",hexadecimal:"🇬🇺"},{name:"guinea-bissau",hexadecimal:"🇬🇼"},{name:"guyana",hexadecimal:"🇬🇾"},{name:"hong-kong-sar-china",hexadecimal:"🇭🇰"},{name:"heard-&-mcdonald-islands",hexadecimal:"🇭🇲"},{name:"honduras",hexadecimal:"🇭🇳"},{name:"croatia",hexadecimal:"🇭🇷"},{name:"haiti",hexadecimal:"🇭🇹"},{name:"hungary",hexadecimal:"🇭🇺"},{name:"canary-islands",hexadecimal:"🇮🇨"},{name:"indonesia",hexadecimal:"🇮🇩"},{name:"ireland",hexadecimal:"🇮🇪"},{name:"israel",hexadecimal:"🇮🇱"},{name:"isle-of-man",hexadecimal:"🇮🇲"},{name:"india",hexadecimal:"🇮🇳"},{name:"british-indian-ocean-territory",hexadecimal:"🇮🇴"},{name:"iraq",hexadecimal:"🇮🇶"},{name:"iran",hexadecimal:"🇮🇷"},{name:"iceland",hexadecimal:"🇮🇸"},{name:"italy",hexadecimal:"🇮🇹"},{name:"jersey",hexadecimal:"🇯🇪"},{name:"jamaica",hexadecimal:"🇯🇲"},{name:"jordan",hexadecimal:"🇯🇴"},{name:"japan",hexadecimal:"🇯🇵"},{name:"kenya",hexadecimal:"🇰🇪"},{name:"kyrgyzstan",hexadecimal:"🇰🇬"},{name:"cambodia",hexadecimal:"🇰🇭"},{name:"kiribati",hexadecimal:"🇰🇮"},{name:"comoros",hexadecimal:"🇰🇲"},{name:"st.-kitts-&-nevis",hexadecimal:"🇰🇳"},{name:"north-korea",hexadecimal:"🇰🇵"},{name:"south-korea",hexadecimal:"🇰🇷"},{name:"kuwait",hexadecimal:"🇰🇼"},{name:"cayman-islands",hexadecimal:"🇰🇾"},{name:"kazakhstan",hexadecimal:"🇰🇿"},{name:"laos",hexadecimal:"🇱🇦"},{name:"lebanon",hexadecimal:"🇱🇧"},{name:"st.-lucia",hexadecimal:"🇱🇨"},{name:"liechtenstein",hexadecimal:"🇱🇮"},{name:"sri-lanka",hexadecimal:"🇱🇰"},{name:"liberia",hexadecimal:"🇱🇷"},{name:"lesotho",hexadecimal:"🇱🇸"},{name:"lithuania",hexadecimal:"🇱🇹"},{name:"luxembourg",hexadecimal:"🇱🇺"},{name:"latvia",hexadecimal:"🇱🇻"},{name:"libya",hexadecimal:"🇱🇾"},{name:"morocco",hexadecimal:"🇲🇦"},{name:"monaco",hexadecimal:"🇲🇨"},{name:"moldova",hexadecimal:"🇲🇩"},{name:"montenegro",hexadecimal:"🇲🇪"},{name:"st.-martin",hexadecimal:"🇲🇫"},{name:"madagascar",hexadecimal:"🇲🇬"},{name:"marshall-islands",hexadecimal:"🇲🇭"},{name:"macedonia",hexadecimal:"🇲🇰"},{name:"mali",hexadecimal:"🇲🇱"},{name:"myanmar-(burma)",hexadecimal:"🇲🇲"},{name:"mongolia",hexadecimal:"🇲🇳"},{name:"macau-sar-china",hexadecimal:"🇲🇴"},{name:"northern-mariana-islands",hexadecimal:"🇲🇵"},{name:"martinique",hexadecimal:"🇲🇶"},{name:"mauritania",hexadecimal:"🇲🇷"},{name:"montserrat",hexadecimal:"🇲🇸"},{name:"malta",hexadecimal:"🇲🇹"},{name:"mauritius",hexadecimal:"🇲🇺"},{name:"maldives",hexadecimal:"🇲🇻"},{name:"malawi",hexadecimal:"🇲🇼"},{name:"mexico",hexadecimal:"🇲🇽"},{name:"malaysia",hexadecimal:"🇲🇾"},{name:"mozambique",hexadecimal:"🇲🇿"},{name:"namibia",hexadecimal:"🇳🇦"},{name:"new-caledonia",hexadecimal:"🇳🇨"},{name:"niger",hexadecimal:"🇳🇪"},{name:"norfolk-island",hexadecimal:"🇳🇫"},{name:"nigeria",hexadecimal:"🇳🇬"},{name:"nicaragua",hexadecimal:"🇳🇮"},{name:"netherlands",hexadecimal:"🇳🇱"},{name:"norway",hexadecimal:"🇳🇴"},{name:"nepal",hexadecimal:"🇳🇵"},{name:"nauru",hexadecimal:"🇳🇷"},{name:"niue",hexadecimal:"🇳🇺"},{name:"new-zealand",hexadecimal:"🇳🇿"},{name:"oman",hexadecimal:"🇴🇲"},{name:"panama",hexadecimal:"🇵🇦"},{name:"peru",hexadecimal:"🇵🇪"},{name:"french-polynesia",hexadecimal:"🇵🇫"},{name:"papua-new-guinea",hexadecimal:"🇵🇬"},{name:"philippines",hexadecimal:"🇵🇭"},{name:"pakistan",hexadecimal:"🇵🇰"},{name:"poland",hexadecimal:"🇵🇱"},{name:"st.-pierre-&-miquelon",hexadecimal:"🇵🇲"},{name:"pitcairn-islands",hexadecimal:"🇵🇳"},{name:"puerto-rico",hexadecimal:"🇵🇷"},{name:"palestinian-territories",hexadecimal:"🇵🇸"},{name:"portugal",hexadecimal:"🇵🇹"},{name:"palau",hexadecimal:"🇵🇼"},{name:"paraguay",hexadecimal:"🇵🇾"},{name:"qatar",hexadecimal:"🇶🇦"},{name:"rã©union",hexadecimal:"🇷🇪"},{name:"romania",hexadecimal:"🇷🇴"},{name:"serbia",hexadecimal:"🇷🇸"},{name:"russia",hexadecimal:"🇷🇺"},{name:"rwanda",hexadecimal:"🇷🇼"},{name:"saudi-arabia",hexadecimal:"🇸🇦"},{name:"solomon-islands",hexadecimal:"🇸🇧"},{name:"seychelles",hexadecimal:"🇸🇨"},{name:"sudan",hexadecimal:"🇸🇩"},{name:"sweden",hexadecimal:"🇸🇪"},{name:"singapore",hexadecimal:"🇸🇬"},{name:"st.-helena",hexadecimal:"🇸🇭"},{name:"slovenia",hexadecimal:"🇸🇮"},{name:"svalbard-&-jan-mayen",hexadecimal:"🇸🇯"},{name:"slovakia",hexadecimal:"🇸🇰"},{name:"sierra-leone",hexadecimal:"🇸🇱"},{name:"san-marino",hexadecimal:"🇸🇲"},{name:"senegal",hexadecimal:"🇸🇳"},{name:"somalia",hexadecimal:"🇸🇴"},{name:"suriname",hexadecimal:"🇸🇷"},{name:"south-sudan",hexadecimal:"🇸🇸"},{name:"sã£o-tomã©-&-prãncipe",hexadecimal:"🇸🇹"},{name:"el-salvador",hexadecimal:"🇸🇻"},{name:"sint-maarten",hexadecimal:"🇸🇽"},{name:"syria",hexadecimal:"🇸🇾"},{name:"swaziland",hexadecimal:"🇸🇿"},{name:"tristan-da-cunha",hexadecimal:"🇹🇦"},{name:"turks-&-caicos-islands",hexadecimal:"🇹🇨"},{name:"chad",hexadecimal:"🇹🇩"},{name:"french-southern-territories",hexadecimal:"🇹🇫"},{name:"togo",hexadecimal:"🇹🇬"},{name:"thailand",hexadecimal:"🇹🇭"},{name:"tajikistan",hexadecimal:"🇹🇯"},{name:"tokelau",hexadecimal:"🇹🇰"},{name:"timor-leste",hexadecimal:"🇹🇱"},{name:"turkmenistan",hexadecimal:"🇹🇲"},{name:"tunisia",hexadecimal:"🇹🇳"},{name:"tonga",hexadecimal:"🇹🇴"},{name:"turkey",hexadecimal:"🇹🇷"},{name:"trinidad-&-tobago",hexadecimal:"🇹🇹"},{name:"tuvalu",hexadecimal:"🇹🇻"},{name:"taiwan",hexadecimal:"🇹🇼"},{name:"tanzania",hexadecimal:"🇹🇿"},{name:"ukraine",hexadecimal:"🇺🇦"},{name:"uganda",hexadecimal:"🇺🇬"},{name:"u.s.-outlying-islands",hexadecimal:"🇺🇲"},{name:"united-states",hexadecimal:"🇺🇸"},{name:"uruguay",hexadecimal:"🇺🇾"},{name:"uzbekistan",hexadecimal:"🇺🇿"},{name:"vatican-city",hexadecimal:"🇻🇦"},{name:"st.-vincent-&-grenadines",hexadecimal:"🇻🇨"},{name:"venezuela",hexadecimal:"🇻🇪"},{name:"british-virgin-islands",hexadecimal:"🇻🇬"},{name:"u.s.-virgin-islands",hexadecimal:"🇻🇮"},{name:"vietnam",hexadecimal:"🇻🇳"},{name:"vanuatu",hexadecimal:"🇻🇺"},{name:"wallis-&-futuna",hexadecimal:"🇼🇫"},{name:"samoa",hexadecimal:"🇼🇸"},{name:"kosovo",hexadecimal:"🇽🇰"},{name:"yemen",hexadecimal:"🇾🇪"},{name:"mayotte",hexadecimal:"🇾🇹"},{name:"south-africa",hexadecimal:"🇿🇦"},{name:"zambia",hexadecimal:"🇿🇲"},{name:"zimbabwe",hexadecimal:"🇿🇼"}],Ra=({emojis:a,onSelect:s,onClose:r})=>{const[t,n]=j.useState({start:0,end:80}),l=8,i=40,p=400,f=j.useCallback(o=>{const k=o.currentTarget.scrollTop,E=Math.floor(k/i),y=Math.min(E+Math.ceil(p/i)+2,Math.ceil(a.length/l));n({start:E*l,end:y*l})},[a.length,i,p,l]),m=j.useCallback(o=>{const k=o.match(/&#x([0-9A-Fa-f]+);/g);if(!k)return"";const E=k.map(y=>{const g=y.replace(/&#x|;/g,"");return parseInt(g,16)});return String.fromCodePoint(...E)},[]),w=Math.ceil(a.length/l)*i,U=a.slice(t.start,t.end);return e.jsx("div",{className:"rsp-h-[400px] rsp-overflow-y-auto rsp-relative",onScroll:f,children:e.jsx("div",{style:{height:w},className:"rsp-relative",children:e.jsx("div",{className:"rsp-absolute rsp-w-full rsp-grid rsp-grid-cols-8 rsp-gap-1",style:{top:Math.floor(t.start/l)*i,transform:"translateY(0px)"},children:U.map((o,k)=>{const E=t.start+k;return e.jsx("button",{onClick:()=>{s(m(o.hexadecimal))},className:"rsp-w-10 rsp-h-10 rsp-flex rsp-items-center rsp-justify-center rsp-text-xl hover:rsp-bg-gray-100 rsp-rounded rsp-transition-colors",title:o.name,style:{height:i},children:m(o.hexadecimal)},E)})})})})};function Ee({isOpen:a,onClose:s,onSelect:r}){const[t,n]=j.useState(""),l=j.useMemo(()=>t?Ae.filter(i=>i.name.toLowerCase().includes(t.toLowerCase())):Ae,[t]);return j.useEffect(()=>{a||n("")},[a]),e.jsx(me,{isOpen:a,onClose:s,title:"Select Emoji",children:e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",placeholder:"Search emojis...",value:t,onChange:i=>n(i.target.value),className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500"}),t&&e.jsx("button",{onClick:()=>n(""),className:"rsp-absolute rsp-right-2 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-gray-400 hover:rsp-text-gray-600",children:"×"})]}),e.jsx("div",{className:"rsp-flex rsp-gap-2 rsp-flex-wrap",children:["😀","🎉","❤️","👍","🔥","💯","✨","🎯"].map(i=>e.jsx("button",{onClick:()=>{r(i)},className:"rsp-w-8 rsp-h-8 rsp-flex rsp-items-center rsp-justify-center rsp-text-lg hover:rsp-bg-gray-100 rsp-rounded rsp-transition-colors",children:i},i))}),e.jsxs("div",{className:"rsp-text-sm rsp-text-gray-500",children:[l.length," emojis found"]}),e.jsx(Ra,{emojis:l,onSelect:r,onClose:s})]})})}const de=(a,s,r)=>{if(!a)return{newText:s,cursorPosition:s.length};const t=a.selectionStart||0,n=a.selectionEnd||0,l=s.substring(t,n);let i=s.substring(0,t),p=s.substring(n),f,m;return l?r==="bold"?(f=`${i}*${l}*${p}`,m=t+l.length+2):(f=`${i}_${l}_${p}`,m=t+l.length+2):r==="bold"?(f=`${i}**${p}`,m=t+1):(f=`${i}__${p}`,m=t+1),{newText:f,cursorPosition:m}};function Ba({template:a,setTemplate:s}){const[r,t]=j.useState(!1),[n,l]=j.useState(null),[i,p]=j.useState(null),[f,m]=j.useState(null),[w,U]=j.useState(!1),o=()=>{const x=(a.body||"").match(/{{\d+}}/g);if(!x)return 0;const h=x.map(u=>{const v=u.match(/{{(\d+)}}/);return v?parseInt(v[1],10):0});return h.length>0?Math.max(...h):0},k=()=>{const h=`{{${o()+1}}}`;if(i&&a.body.length+h.length<=1024){const u=i.selectionStart||a.body.length,v=a.body.substring(0,u),L=a.body.substring(u),V=v+h+L;s({...a,body:V}),setTimeout(()=>{if(i){const b=u+h.length;i.setSelectionRange(b,b),i.focus()}},0)}},E=()=>{l("body"),t(!0),setTimeout(()=>{i&&i.focus()},0)},y=g=>{if(n==="body"){if(!i)return;const x=i.selectionStart||a.body.length,h=1024,u=a.body;if(u.length+g.length<=h){const v=u.substring(0,x),L=u.substring(x),V=v+g+L;s({...a,body:V}),setTimeout(()=>{if(i){const b=x+g.length;i.setSelectionRange(b,b),i.focus()}},0)}}else if(n==="footer"){if(!f)return;const x=f.selectionStart||a.footer.length,h=60,u=a.footer;if(u.length+g.length<=h){const v=u.substring(0,x),L=u.substring(x),V=v+g+L;s({...a,footer:V}),setTimeout(()=>{if(f){const b=x+g.length;f.setSelectionRange(b,b),f.focus()}},0)}}};return e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Body"}),e.jsx("div",{className:"rsp-relative",children:e.jsx("textarea",{ref:p,value:a.body,onChange:g=>s({...a,body:g.target.value}),maxLength:1024,rows:6,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none rsp-shadow-sm",placeholder:"Enter the text for your message",onFocus:()=>l("body"),onBlur:()=>U(!0)})}),!a.body&&w&&e.jsx("p",{className:"rsp-text-xs rsp-text-red-600 rsp-mt-1",children:"Body is required."}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-2",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("button",{onClick:k,className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add Variable",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsx("button",{onClick:E,className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add emoji",children:e.jsx(ke,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>{if(!i)return;const{newText:g,cursorPosition:x}=de(i,a.body,"bold");s({...a,body:g}),requestAnimationFrame(()=>{setTimeout(()=>{i&&(i.setSelectionRange(x,x),i.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Bold text (*text*)",children:e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"})]})}),e.jsx("button",{onClick:()=>{if(!i)return;const{newText:g,cursorPosition:x}=de(i,a.body,"italic");s({...a,body:g}),requestAnimationFrame(()=>{setTimeout(()=>{i&&(i.setSelectionRange(x,x),i.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Italic text (_text_)",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 4h4M8 20h4M12 4l-2 16"})})})]}),e.jsx("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500",children:[a.body.length,"/1024 (1 WhatsAppAudience)"]})})]}),(()=>{const g=a.body.match(/\{\{(\d+)\}\}/g)||[],x=[...new Set(g.map(h=>h.replace(/[{}]/g,"")))];return x.length===0?null:e.jsxs("div",{className:"rsp-mt-3",children:[e.jsx("p",{className:"rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2",children:"Sample Values"}),e.jsx("div",{className:"rsp-grid rsp-grid-cols-3 rsp-gap-2",children:x.map(h=>{var u,v;return e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsxs("label",{className:"rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap",children:["{{",h,"}}",":"]}),e.jsx("input",{type:"text",value:((v=(u=a.sampleContent)==null?void 0:u.bodyVariables)==null?void 0:v[h])||"",onChange:L=>{var b,N,M;const V={...a.sampleContent,bodyVariables:{...(b=a.sampleContent)==null?void 0:b.bodyVariables,[h]:L.target.value},headerVariables:((N=a.sampleContent)==null?void 0:N.headerVariables)||{},buttonVariables:((M=a.sampleContent)==null?void 0:M.buttonVariables)||{}};s({...a,sampleContent:V})},className:"rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",placeholder:"Sample"}),e.jsx("button",{type:"button",onClick:()=>{var N,M,B;const L=new RegExp(`\\{\\{${h}\\}\\}`,"g"),V=(a.body||"").replace(L,""),b=Object.fromEntries(Object.entries(((N=a.sampleContent)==null?void 0:N.bodyVariables)||{}).filter(([P])=>P!==h));s({...a,body:V,sampleContent:{...a.sampleContent,bodyVariables:b,headerVariables:((M=a.sampleContent)==null?void 0:M.headerVariables)||{},buttonVariables:((B=a.sampleContent)==null?void 0:B.buttonVariables)||{}}})},className:"rsp-px-2 rsp-py-1 rsp-text-xs rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded",title:"Remove this variable",children:"×"})]},`body-sample-${h}`)})})]})})()]}),e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Footer (optional)"}),e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{ref:m,type:"text",value:a.footer,onChange:g=>s({...a,footer:g.target.value}),maxLength:60,className:"rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",placeholder:"Footer Text",onFocus:()=>l("footer")})}),e.jsxs("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:[a.footer.length,"/60 characters"]})]}),e.jsx(Ee,{isOpen:r,onClose:()=>t(!1),onSelect:y})]})}function Oa({template:a,setTemplate:s}){var g;const[r,t]=j.useState(null),[n,l]=j.useState(!1),[i,p]=j.useState({text:"",value:"",urlType:"static"}),m={quickReply:a.buttons.filter(x=>x.type==="QUICK_REPLY").length,url:a.buttons.filter(x=>x.type==="URL").length,call:a.buttons.filter(x=>x.type==="CALL").length,flow:a.buttons.filter(x=>x.type==="FLOW").length},w=()=>{p({text:"",value:"",urlType:"static"}),t(null),l(!1)},U=x=>{if(!i.text.trim())return;let h=x==="QUICK_REPLY"?i.text:i.value;x==="CALL"&&h&&!h.startsWith("+")&&(h="+"+h);const u={id:Math.random().toString(36).substr(2,9),type:x,text:i.text,value:h,urlType:x==="URL"?i.urlType:void 0};s({...a,buttons:[...a.buttons,u]}),w()},o=x=>{s({...a,buttons:a.buttons.filter(h=>h.id!==x)})},k=(x,h,u)=>{const v=a.buttons.find(b=>b.id===x),L=h==="text"?25:h==="value"&&(v==null?void 0:v.type)==="URL"?2e3:20;let V=u.slice(0,L);h==="value"&&(v==null?void 0:v.type)==="CALL"&&V&&!V.startsWith("+")&&(V="+"+V),s({...a,buttons:a.buttons.map(b=>b.id===x?{...b,[h]:V}:b)})},E=()=>{const h=[...a.buttons.filter(v=>v.type==="URL"&&v.urlType==="dynamic").map(v=>v.value||""),i.value].join(" ").match(/{{\d+}}/g);if(!h)return 0;const u=h.map(v=>{const L=v.match(/{{(\d+)}}/);return L?parseInt(L[1],10):0});return u.length>0?Math.max(...u):0},y=[{type:"QUICK_REPLY",icon:he,label:"Quick Reply",description:"Add quick response options",limit:10,current:m.quickReply,color:"blue"},{type:"URL",icon:Ge,label:"Web URL",description:"Link to websites or pages",limit:2,current:m.url,color:"green"},{type:"CALL",icon:Ie,label:"Call Button",description:"Add phone number to call",limit:1,current:m.call,color:"purple"}];return e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Interactive Buttons"}),e.jsx("p",{className:"rsp-text-sm rsp-text-gray-500 rsp-mt-1",children:"Add buttons to make your message interactive"})]}),e.jsx("div",{className:"rsp-text-sm rsp-text-gray-500"})]}),e.jsx("div",{className:"rsp-bg-blue-50 rsp-border-l-4 rsp-border-blue-500 rsp-p-4 rsp-rounded-r-md",children:e.jsxs("div",{className:"rsp-flex",children:[e.jsx("div",{className:"rsp-flex-shrink-0",children:e.jsx("svg",{className:"rsp-h-5 rsp-w-5 rsp-text-blue-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),e.jsx("div",{className:"rsp-ml-3",children:e.jsx("p",{className:"rsp-text-sm rsp-text-blue-700",children:"We recommend adding the marketing opt-out button. This can help reduce blocks from customers and increase your quality rating."})})]})}),!r&&e.jsx("div",{className:"rsp-grid rsp-grid-cols-1 md:rsp-grid-cols-2 rsp-gap-4",children:y.map(x=>{const h=x.icon,u=x.current>=x.limit;return e.jsxs("button",{onClick:()=>!u&&t(x.type),disabled:u,className:`rsp-group rsp-p-5 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 rsp-relative rsp-overflow-hidden ${u?"rsp-border-gray-200 rsp-bg-gray-50 rsp-text-gray-400 rsp-cursor-not-allowed rsp-opacity-60":"rsp-cursor-pointer rsp-border-gray-200 rsp-bg-white hover:rsp-border-blue-400 hover:rsp-shadow-lg hover:rsp-shadow-blue-100/50 rsp-shadow-sm"}`,children:[!u&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-gradient-to-br rsp-from-blue-50/0 rsp-via-blue-50/0 rsp-to-blue-50/0 group-hover:rsp-from-blue-50/30 group-hover:rsp-via-blue-50/20 group-hover:rsp-to-blue-50/10 rsp-transition-all rsp-duration-200"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-start rsp-justify-between",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-4",children:[e.jsx("div",{className:`rsp-p-3 rsp-rounded-xl rsp-transition-all rsp-duration-200 ${u?"rsp-bg-gray-200":"rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-blue-100 group-hover:rsp-from-blue-100 group-hover:rsp-to-blue-200 rsp-shadow-sm"}`,children:e.jsx(h,{className:`rsp-w-5 rsp-h-5 rsp-transition-colors ${u?"rsp-text-gray-400":"rsp-text-blue-600"}`})}),e.jsxs("div",{children:[e.jsx("h4",{className:`rsp-font-semibold rsp-text-sm rsp-mb-1 ${u?"rsp-text-gray-400":"rsp-text-gray-900"}`,children:x.label}),e.jsx("p",{className:`rsp-text-xs rsp-mt-1 ${u?"rsp-text-gray-400":"rsp-text-gray-600"}`,children:x.description})]})]}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsxs("span",{className:`rsp-text-xs rsp-font-semibold rsp-px-2.5 rsp-py-1 rsp-rounded-full rsp-transition-colors ${u?"rsp-bg-gray-200 rsp-text-gray-500":"rsp-bg-blue-100 rsp-text-blue-700 group-hover:rsp-bg-blue-200"}`,children:[x.current,"/",x.limit]}),!u&&e.jsx("div",{className:"rsp-p-1.5 rsp-rounded-lg rsp-bg-blue-100 group-hover:rsp-bg-blue-200 rsp-transition-colors",children:e.jsx(je,{className:"rsp-w-4 rsp-h-4 rsp-text-blue-600"})})]})]})]},x.type)})}),r&&e.jsxs("div",{className:"rsp-bg-white rsp-border-2 rsp-border-blue-200 rsp-rounded-xl rsp-p-6 rsp-shadow-lg rsp-shadow-blue-100/50",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mb-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900 rsp-mb-1",children:["Add ",(g=y.find(x=>x.type===r))==null?void 0:g.label]}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500",children:"Fill in the details below to add a new button"})]}),e.jsx("button",{onClick:w,className:"rsp-p-2 rsp-text-gray-400 hover:rsp-text-gray-600 hover:rsp-bg-gray-100 rsp-rounded-lg rsp-transition-colors",children:e.jsx(ne,{className:"rsp-w-5 rsp-h-5"})})]}),e.jsxs("div",{className:"rsp-space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-2",children:["Button Text ",e.jsx("span",{className:"rsp-text-red-500",children:"*"})]}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",value:i.text,onChange:x=>p({...i,text:x.target.value.slice(0,25)}),className:"rsp-w-full rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-bg-white rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all",placeholder:"Enter button text (max 25 characters)",maxLength:25}),e.jsxs("span",{className:"rsp-absolute rsp-right-3 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1.5",children:[i.text.length,"/25"]})]})]}),r!=="QUICK_REPLY"&&e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-2",children:[r==="URL"?"Website URL":r==="CALL"?"Phone Number":"Flow ID"," ",e.jsx("span",{className:"rsp-text-red-500",children:"*"})]}),r==="URL"&&e.jsxs("div",{className:"rsp-mb-4",children:[e.jsxs("div",{className:"rsp-flex rsp-gap-4 rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg rsp-border rsp-border-gray-200",children:[e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer rsp-group",children:[e.jsx("input",{type:"radio",checked:i.urlType==="static",onChange:()=>p({...i,urlType:"static"}),className:"rsp-mr-2 rsp-w-4 rsp-h-4 rsp-text-blue-600 rsp-border-gray-300 focus:rsp-ring-2 focus:rsp-ring-blue-500"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium rsp-text-gray-700 group-hover:rsp-text-gray-900",children:"Static URL"})]}),e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer rsp-group",children:[e.jsx("input",{type:"radio",checked:i.urlType==="dynamic",onChange:()=>p({...i,urlType:"dynamic"}),className:"rsp-mr-2 rsp-w-4 rsp-h-4 rsp-text-blue-600 rsp-border-gray-300 focus:rsp-ring-2 focus:rsp-ring-blue-500"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium rsp-text-gray-700 group-hover:rsp-text-gray-900",children:"Dynamic URL"})]})]}),i.urlType==="dynamic"&&e.jsxs("div",{className:"rsp-mt-3 rsp-p-4 rsp-bg-blue-50 rsp-rounded-lg rsp-border-2 rsp-border-blue-200",children:[e.jsxs("h4",{className:"rsp-text-sm rsp-font-semibold rsp-text-blue-900 rsp-mb-2 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Dynamic URL Guidelines"]}),e.jsxs("ul",{className:"rsp-text-xs rsp-text-blue-800 rsp-space-y-1.5 rsp-list-disc rsp-list-inside",children:[e.jsxs("li",{children:["Use placeholders like: ",e.jsx("code",{className:"rsp-bg-blue-100 rsp-px-1 rsp-rounded",children:"https://example.com/order/{{1}}"})]}),e.jsx("li",{children:"Maximum 1 placeholder per URL ({{1}})"}),e.jsx("li",{children:"Only HTTPS URLs are allowed"}),e.jsx("li",{children:"WhatsApp verifies only the domain"})]})]})]}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:r==="CALL"?"tel":r==="URL"?"url":"text",value:i.value,onChange:x=>{const h=r==="URL"?2e3:20;p({...i,value:x.target.value.slice(0,h)})},className:"rsp-w-full rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-bg-white rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all",placeholder:r==="URL"?i.urlType==="dynamic"?"https://example.com/order/{{1}}":"https://example.com":r==="CALL"?"+1234567890":"Flow ID",maxLength:r==="URL"?2e3:20}),e.jsxs("span",{className:"rsp-absolute rsp-right-3 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1.5",children:[i.value.length,"/",r==="URL"?2e3:20]})]}),r==="URL"&&i.urlType==="dynamic"&&e.jsxs("div",{className:"rsp-mt-3",children:[e.jsx("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-mb-2",children:e.jsxs("button",{type:"button",onClick:()=>{if((i.value.match(/\{\{(\d+)\}\}/g)||[]).length>=1)return;const u=E()+1,v=i.value+`{{${u}}}`;p({...i,value:v}),l(!0)},disabled:(i.value.match(/\{\{(\d+)\}\}/g)||[]).length>=1,className:"rsp-px-4 rsp-py-2 rsp-text-xs rsp-font-semibold rsp-bg-blue-100 hover:rsp-bg-blue-200 rsp-rounded-lg rsp-text-blue-700 disabled:rsp-bg-gray-200 disabled:rsp-text-gray-500 disabled:rsp-cursor-not-allowed rsp-transition-all rsp-shadow-sm hover:rsp-shadow-md rsp-flex rsp-items-center rsp-gap-1.5",children:[e.jsx("svg",{className:"rsp-w-3.5 rsp-h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Variable"]})}),(i.value.match(/\{\{(\d+)\}\}/g)||[]).length>=1&&e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:"Maximum 1 variable allowed."}),n&&e.jsxs("div",{className:"rsp-mt-4 rsp-p-5 rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-indigo-50 rsp-rounded-xl rsp-border-2 rsp-border-blue-200 rsp-shadow-sm",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mb-4",children:[e.jsxs("h4",{className:"rsp-text-sm rsp-font-semibold rsp-text-blue-900 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),"Sample Values for URL Variables"]}),e.jsx("button",{type:"button",onClick:()=>l(!1),className:"rsp-p-1 rsp-text-blue-600 hover:rsp-text-blue-800 hover:rsp-bg-blue-100 rsp-rounded-lg rsp-transition-colors",children:e.jsx(ne,{className:"rsp-w-4 rsp-h-4"})})]}),e.jsx("div",{className:"rsp-space-y-3",children:(()=>{const x=i.value.match(/\{\{(\d+)\}\}/g)||[];return[...new Set(x.map(u=>u.replace(/[{}]/g,"")))].map(u=>{var v,L;return e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-3",children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-blue-800 rsp-whitespace-nowrap rsp-bg-blue-100 rsp-px-3 rsp-py-2 rsp-rounded-lg rsp-min-w-[100px]",children:["{{",u,"}}"]}),e.jsx("input",{type:"text",value:((L=(v=a.sampleContent)==null?void 0:v.buttonVariables)==null?void 0:L[u])||"",onChange:V=>{var N,M,B;const b={...a.sampleContent,headerVariables:((N=a.sampleContent)==null?void 0:N.headerVariables)||{},bodyVariables:((M=a.sampleContent)==null?void 0:M.bodyVariables)||{},buttonVariables:{...(B=a.sampleContent)==null?void 0:B.buttonVariables,[u]:V.target.value}};s({...a,sampleContent:b})},className:"rsp-flex-1 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-blue-200 rsp-rounded-lg rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-bg-white rsp-shadow-sm rsp-transition-all",placeholder:`Sample value (e.g., ${u==="1"?"order123":"user456"})`}),e.jsx("button",{type:"button",onClick:()=>{var M,B,P;const V=new RegExp(`\\{\\{${u}\\}\\}`,"g"),b=(i.value||"").replace(V,"");p({...i,value:b});const N=Object.fromEntries(Object.entries(((M=a.sampleContent)==null?void 0:M.buttonVariables)||{}).filter(([G])=>G!==u));s({...a,sampleContent:{...a.sampleContent,headerVariables:((B=a.sampleContent)==null?void 0:B.headerVariables)||{},bodyVariables:((P=a.sampleContent)==null?void 0:P.bodyVariables)||{},buttonVariables:N}})},className:"rsp-p-2 rsp-text-red-600 hover:rsp-text-red-700 hover:rsp-bg-red-50 rsp-rounded-lg rsp-transition-all rsp-border-2 rsp-border-red-200 hover:rsp-border-red-300",title:"Remove this variable",children:e.jsx(ne,{className:"rsp-w-4 rsp-h-4"})})]},`sample-${u}`)})})()}),e.jsxs("div",{className:"rsp-mt-4 rsp-p-4 rsp-bg-white rsp-rounded-lg rsp-border-2 rsp-border-blue-200 rsp-shadow-sm",children:[e.jsxs("p",{className:"rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsxs("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),"Preview URL"]}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-700 rsp-font-mono rsp-break-all rsp-bg-gray-50 rsp-p-2 rsp-rounded rsp-border rsp-border-gray-200",children:i.value.replace(/\{\{(\d+)\}\}/g,(x,h)=>{var u,v;return((v=(u=a.sampleContent)==null?void 0:u.buttonVariables)==null?void 0:v[h])||`[${x}]`})})]})]})]})]}),e.jsxs("div",{className:"rsp-flex rsp-gap-3 rsp-pt-4 rsp-border-t rsp-border-gray-200",children:[e.jsx("button",{onClick:()=>U(r),disabled:!i.text.trim()||r!=="QUICK_REPLY"&&!i.value.trim(),className:"rsp-flex-1 rsp-bg-gradient-to-r rsp-from-blue-600 rsp-to-blue-700 rsp-text-white rsp-py-3 rsp-px-6 rsp-rounded-lg rsp-font-semibold rsp-text-sm rsp-transition-all hover:rsp-from-blue-700 hover:rsp-to-blue-800 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-shadow-md hover:rsp-shadow-lg rsp-transform hover:rsp-scale-[1.02] active:rsp-scale-[0.98]",children:"Add Button"}),e.jsx("button",{onClick:w,className:"rsp-px-6 rsp-py-3 rsp-text-gray-700 rsp-bg-white rsp-border-2 rsp-border-gray-300 rsp-rounded-lg rsp-font-semibold rsp-text-sm rsp-transition-all hover:rsp-bg-gray-50 hover:rsp-border-gray-400 rsp-shadow-sm hover:rsp-shadow-md",children:"Cancel"})]})]})]}),a.buttons.length>0&&e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("h4",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Added Buttons"}),e.jsxs("span",{className:"rsp-text-xs rsp-font-medium rsp-text-gray-500 rsp-bg-gray-100 rsp-px-3 rsp-py-1 rsp-rounded-full",children:[a.buttons.length," ",a.buttons.length===1?"button":"buttons"]})]}),e.jsx("div",{className:"rsp-space-y-3",children:a.buttons.map(x=>{const h=y.find(v=>v.type===x.type),u=(h==null?void 0:h.icon)||he;return e.jsx("div",{className:"rsp-bg-white rsp-border-2 rsp-border-gray-200 rsp-rounded-xl rsp-p-5 rsp-shadow-sm hover:rsp-shadow-md hover:rsp-border-gray-300 rsp-transition-all",children:e.jsxs("div",{className:"rsp-flex rsp-items-start rsp-gap-4",children:[e.jsx("div",{className:"rsp-p-3 rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-blue-100 rsp-rounded-xl rsp-shadow-sm",children:e.jsx(u,{className:"rsp-w-5 rsp-h-5 rsp-text-blue-600"})}),e.jsxs("div",{className:"rsp-flex-1 rsp-space-y-4",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("span",{className:"rsp-text-xs rsp-font-bold rsp-text-blue-700 rsp-uppercase rsp-tracking-wider rsp-bg-blue-50 rsp-px-2.5 rsp-py-1 rsp-rounded-md",children:x.type.replace("_"," ")}),e.jsx("button",{onClick:()=>o(x.id),className:"rsp-p-2 rsp-text-red-400 hover:rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded-lg rsp-transition-all",title:"Remove button",children:e.jsx(ne,{className:"rsp-w-4 rsp-h-4"})})]}),e.jsxs("div",{className:"rsp-grid rsp-grid-cols-1 rsp-gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2",children:"Button Text"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",value:x.text,onChange:v=>k(x.id,"text",v.target.value),maxLength:25,className:"rsp-w-full rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all rsp-bg-white"}),e.jsxs("span",{className:"rsp-absolute rsp-right-2.5 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1",children:[x.text.length,"/25"]})]})]}),x.type!=="QUICK_REPLY"&&e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2",children:x.type==="URL"?"Website URL":x.type==="CALL"?"Phone Number":"Flow ID"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:x.type==="CALL"?"tel":x.type==="URL"?"url":"text",value:x.value||"",onChange:v=>k(x.id,"value",v.target.value),maxLength:x.type==="URL"?2e3:20,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all rsp-bg-white"}),e.jsxs("span",{className:"rsp-absolute rsp-right-2.5 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1",children:[(x.value||"").length,"/",x.type==="URL"?2e3:20]})]})]})]})]})]})},x.id)})})]}),a.buttons.length===0&&!r&&e.jsxs("div",{className:"rsp-text-center rsp-py-12 rsp-bg-gray-50 rsp-rounded-xl rsp-border-2 rsp-border-dashed rsp-border-gray-300",children:[e.jsx("div",{className:"rsp-w-16 rsp-h-16 rsp-bg-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-4 rsp-shadow-sm",children:e.jsx(he,{className:"rsp-w-8 rsp-h-8 rsp-text-gray-400"})}),e.jsx("h3",{className:"rsp-text-lg rsp-font-medium rsp-text-gray-900 rsp-mb-2",children:"No buttons added yet"}),e.jsx("p",{className:"rsp-text-gray-500 rsp-text-sm rsp-mb-4",children:"Add interactive buttons to make your message more engaging"}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-400",children:"Choose from Quick Reply, Web URL, Call, or Flow buttons above"})]})]})}const Pa=async a=>{try{if(!a)throw new Error("No file provided");const s=100*1024*1024;if(a.size>s)throw new Error(`File size too large. Maximum allowed size is ${s/(1024*1024)}MB`);const r=new FormData;r.append("file",a),console.log("Uploading file:",a.name,"Size:",a.size,"Type:",a.type);const t=await fetch("https://wiz.resul.io/Communication/UploadDocuments",{method:"POST",body:r});console.log("Upload response status:",t.status),console.log("Upload response headers:",Object.fromEntries(t.headers.entries()));const n=await t.text();console.log("Raw upload response:",n);let l;try{l=JSON.parse(n)}catch(i){throw console.error("Failed to parse upload response:",i),new Error("Invalid response from upload server")}if(console.log("Parsed upload response:",l),console.log("Upload status:",l.status),console.log("Upload message:",l.message),console.log("Upload data:",l.data),!l.status)throw new Error(l.message||"Upload failed");if(l.data&&Array.isArray(l.data)&&l.data.length>0){const i=l.data[0];if(i.url)return console.log("File uploaded successfully:",{url:i.url,filename:i.filename,originalName:i.originalName,size:i.size}),i.url;throw new Error("No file URL in upload response data")}else throw new Error("No files in upload response data")}catch(s){throw console.error("File upload error:",s),s instanceof Error?s:new Error("Unknown error occurred during file upload")}},Da=(a,s)=>{const t=a.name.toLowerCase().split(".").pop();switch(s){case"IMAGE":return["jpg","jpeg","png","gif","bmp","tiff","svg"].includes(t||"");case"VIDEO":return["mp4","mov","avi","3gpp"].includes(t||"");case"DOCUMENT":return["pdf","doc","docx","xls","xlsx","ppt","pptx","txt"].includes(t||"");default:return!1}},za=a=>{switch(a){case"IMAGE":return 5*1024*1024;case"VIDEO":return 16*1024*1024;case"DOCUMENT":return 100*1024*1024;default:return 10*1024*1024}};function _a({template:a,setTemplate:s,onFileUpload:r}){var N,M,B,P,G;const[t,n]=j.useState({}),[,l]=j.useState({}),[i,p]=j.useState({open:!1,message:""}),[f,m]=j.useState(!1),[w,U]=j.useState(null),o=j.useRef({}),k=()=>{var C;const c={id:Math.random().toString(36).substr(2,9),headerType:"MEDIA",mediaType:((C=a.carousel)==null?void 0:C.type)==="VIDEO"?"VIDEO":"IMAGE",body:"",buttons:[]};s(S=>{var A,R;return{...S,carousel:{type:((A=a.carousel)==null?void 0:A.type)||"IMAGE",cards:[...((R=a.carousel)==null?void 0:R.cards)||[],c]}}})},E=c=>{s(C=>({...C,carousel:{...C.carousel,cards:C.carousel.cards.filter(S=>S.id!==c)}}))},y=(c,C,S)=>{s(A=>({...A,carousel:{...A.carousel,cards:A.carousel.cards.map(R=>R.id===c?{...R,[C]:S}:R)}}))},g=c=>{s(C=>{const A=((C.carousel||{type:c,cards:[]}).cards||[]).map(R=>({...R,mediaType:c,mediaUrl:""}));return{...C,carousel:{type:c,cards:A}}})},x=(c,C)=>{var X;const S=(X=a.carousel)==null?void 0:X.cards.find(se=>se.id===c);if(!S)return;const D=`{{${u(c)+1}}}`,$=S[C]+D;y(c,C,$)},h=c=>{var $;if(!w)return;const C=o.current[w],S=($=a.carousel)==null?void 0:$.cards.find(X=>X.id===w);if(!S)return;const A=C&&typeof C.selectionStart=="number"?C.selectionStart:S.body.length,R=S.body.substring(0,A),D=S.body.substring(A),_=R+c+D;y(w,"body",_),setTimeout(()=>{const X=o.current[w];if(X){const se=A+c.length;X.setSelectionRange(se,se),X.focus()}},0),m(!1)},u=c=>{var D;const C=(D=a.carousel)==null?void 0:D.cards.find(_=>_.id===c);if(!C)return 0;const A=(C.body||"").match(/\{\{(\d+)\}\}/g);if(!A)return 0;const R=A.map(_=>{const $=_.match(/{{(\d+)}}/);return $?parseInt($[1],10):0});return R.length>0?Math.max(...R):0},v=(c,C)=>{var R;const S=(R=a.carousel)==null?void 0:R.cards.find(D=>D.id===c);if(!S||S.buttons.length>=2)return;const A={id:Math.random().toString(36).substr(2,9),type:C,text:"",value:"",urlType:"static"};y(c,"buttons",[...S.buttons,A])},L=(c,C,S,A)=>{var _;const R=(_=a.carousel)==null?void 0:_.cards.find($=>$.id===c);if(!R)return;const D=R.buttons.map($=>$.id===C?{...$,[S]:A}:$);y(c,"buttons",D)},V=(c,C)=>{var R;const S=(R=a.carousel)==null?void 0:R.cards.find(D=>D.id===c);if(!S)return;const A=S.buttons.filter(D=>D.id!==C);y(c,"buttons",A)},b=async(c,C)=>{var S;try{n(_=>({..._,[c]:!0})),l(_=>({..._,[c]:!1}));const A=((S=a.carousel)==null?void 0:S.type)==="VIDEO"?"VIDEO":"IMAGE";if(!Da(C,A))throw new Error(`Invalid file type. Expected ${A.toLowerCase()} file.`);const R=za(A);if(C.size>R){const _=R/1048576;throw new Error(`File size too large. Maximum allowed size is ${_}MB.`)}const D=await r(C);y(c,"mediaUrl",D)}catch(A){console.error("File upload failed:",A),p({open:!0,message:A instanceof Error?A.message:"File upload failed"})}finally{n(A=>({...A,[c]:!1}))}};return e.jsxs("div",{className:"rsp-space-y-6",children:[i.open&&e.jsxs("div",{className:"rsp-fixed rsp-inset-0 rsp-z-50 rsp-flex rsp-items-center rsp-justify-center",children:[e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-40",onClick:()=>p({open:!1,message:""})}),e.jsxs("div",{className:"rsp-relative rsp-z-10 rsp-bg-white rsp-rounded-lg rsp-shadow-lg rsp-w-full rsp-max-w-md rsp-p-5",children:[e.jsx("div",{className:"rsp-mb-3 rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Upload Error"}),e.jsx("div",{className:"rsp-text-sm rsp-text-gray-700 rsp-break-words rsp-whitespace-pre-wrap",children:i.message}),e.jsx("div",{className:"rsp-flex rsp-justify-end rsp-mt-4",children:e.jsx("button",{onClick:()=>p({open:!1,message:""}),className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-white rsp-bg-blue-600 rsp-rounded-md hover:rsp-bg-blue-700",children:"OK"})})]})]}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("h3",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Carousel Cards"}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-4",children:[e.jsxs("span",{className:"rsp-text-sm rsp-text-gray-500",children:["Total Cards: ",((N=a.carousel)==null?void 0:N.cards.length)||0,"/10"]}),e.jsxs("button",{onClick:k,disabled:(((M=a.carousel)==null?void 0:M.cards.length)||0)>=10,className:"rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-rounded-md hover:rsp-bg-blue-700 disabled:rsp-bg-gray-400 disabled:rsp-cursor-not-allowed rsp-text-sm rsp-font-medium",children:[e.jsx(je,{className:"rsp-w-4 rsp-h-4 rsp-inline rsp-mr-2"}),"Add Card"]})]})]}),e.jsxs("div",{className:"rsp-bg-white rsp-p-4 rsp-rounded-lg rsp-border rsp-border-gray-200",children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-3",children:"Carousel Type"}),e.jsxs("div",{className:"rsp-flex rsp-gap-4",children:[e.jsxs("label",{className:"rsp-flex rsp-items-center",children:[e.jsx("input",{type:"radio",name:"carouselType",value:"IMAGE",checked:((B=a.carousel)==null?void 0:B.type)==="IMAGE",onChange:c=>g(c.target.value),className:"rsp-mr-2"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Image"})]}),e.jsxs("label",{className:"rsp-flex rsp-items-center",children:[e.jsx("input",{type:"radio",name:"carouselType",value:"VIDEO",checked:((P=a.carousel)==null?void 0:P.type)==="VIDEO",onChange:c=>g(c.target.value),className:"rsp-mr-2"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Video"})]})]})]}),e.jsx("div",{className:"rsp-space-y-6",children:(G=a.carousel)==null?void 0:G.cards.map((c,C)=>{var S,A,R,D,_,$,X,se;return e.jsxs("div",{className:"rsp-bg-white rsp-rounded-xl rsp-border-2 rsp-border-gray-200 rsp-overflow-hidden rsp-shadow-lg rsp-transition-all hover:rsp-shadow-xl hover:rsp-border-blue-300",children:[e.jsxs("div",{className:"rsp-bg-gradient-to-r rsp-from-blue-50 rsp-to-blue-100 rsp-px-5 rsp-py-3 rsp-flex rsp-items-center rsp-justify-between rsp-border-b rsp-border-gray-200",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-3",children:[e.jsx("div",{className:"rsp-w-8 rsp-h-8 rsp-bg-blue-500 rsp-text-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-font-bold rsp-text-sm rsp-shadow-md",children:C+1}),e.jsxs("h4",{className:"rsp-text-base rsp-font-semibold rsp-text-gray-800",children:["Card ",C+1]})]}),e.jsx("button",{onClick:()=>E(c.id),className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-white hover:rsp-bg-red-500 rsp-rounded-full rsp-transition-colors",title:"Remove Card",children:e.jsx(ne,{className:"rsp-w-4 rsp-h-4"})})]}),e.jsx("div",{className:"rsp-p-6",children:e.jsxs("div",{className:"rsp-grid rsp-grid-cols-1 lg:rsp-grid-cols-2 rsp-gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:((S=a.carousel)==null?void 0:S.type)==="VIDEO"?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),((A=a.carousel)==null?void 0:A.type)==="VIDEO"?"Video":"Image"," Upload"]}),e.jsxs("div",{className:"rsp-border-2 rsp-border-dashed rsp-border-blue-200 rsp-rounded-xl rsp-p-6 rsp-text-center rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-transition-all hover:rsp-border-blue-400 hover:rsp-from-blue-100 rsp-relative",children:[c.mediaUrl?e.jsxs("div",{className:"rsp-relative rsp-group",children:[((R=a.carousel)==null?void 0:R.type)==="IMAGE"?e.jsx("img",{src:c.mediaUrl,alt:`Card ${C+1}`,className:"rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",onLoad:()=>l(T=>({...T,[c.id]:!0})),onError:()=>l(T=>({...T,[c.id]:!1}))}):e.jsx("video",{src:c.mediaUrl,className:"rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",controls:!0,onLoadedData:()=>l(T=>({...T,[c.id]:!0})),onError:()=>l(T=>({...T,[c.id]:!1}))}),e.jsx("button",{onClick:()=>y(c.id,"mediaUrl",""),className:"rsp-absolute rsp-top-2 rsp-right-2 rsp-p-2 rsp-bg-red-500 rsp-text-white rsp-rounded-full hover:rsp-bg-red-600 rsp-shadow-lg rsp-opacity-0 group-hover:rsp-opacity-100 rsp-transition-opacity",title:"Remove media",children:e.jsx(ne,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-2 rsp-left-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-xs rsp-px-2 rsp-py-1 rsp-rounded rsp-backdrop-blur-sm",children:((D=a.carousel)==null?void 0:D.type)==="VIDEO"?"📹 Video":"🖼️ Image"})]}):e.jsxs("div",{children:[e.jsx("div",{className:"rsp-w-20 rsp-h-20 rsp-mx-auto rsp-mb-4 rsp-bg-gradient-to-br rsp-from-blue-100 rsp-to-blue-200 rsp-rounded-xl rsp-flex rsp-items-center rsp-justify-center rsp-shadow-md",children:e.jsx("svg",{className:"rsp-w-10 rsp-h-10 rsp-text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:((_=a.carousel)==null?void 0:_.type)==="VIDEO"?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsx("input",{type:"file",accept:(($=a.carousel)==null?void 0:$.type)==="VIDEO"?"video/*":"image/*",onChange:T=>{var O;const ae=(O=T.target.files)==null?void 0:O[0];ae&&!t[c.id]&&b(c.id,ae)},className:"rsp-hidden",id:`file-upload-${c.id}`,disabled:!!t[c.id]}),e.jsxs("label",{htmlFor:`file-upload-${c.id}`,className:`rsp-inline-flex rsp-items-center rsp-gap-2 rsp-px-5 rsp-py-2.5 rsp-border rsp-border-blue-300 rsp-rounded-lg rsp-shadow-sm rsp-text-sm rsp-font-semibold rsp-text-blue-600 rsp-bg-white rsp-transition-colors ${t[c.id]?"rsp-opacity-50 rsp-cursor-not-allowed":"hover:rsp-bg-blue-50 rsp-cursor-pointer"}`,"aria-disabled":!!t[c.id],children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),"Upload ",((X=a.carousel)==null?void 0:X.type)==="VIDEO"?"Video":"Image"]}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-3 rsp-px-2",children:((se=a.carousel)==null?void 0:se.type)==="VIDEO"?"📹 MP4, MOV, AVI (Max 16MB)":"🖼️ PNG, JPG, GIF, TIFF, SVG, BMP (Max 5MB)"})]}),t[c.id]&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-30 rsp-flex rsp-items-center rsp-justify-center",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-bg-white rsp-px-3 rsp-py-2 rsp-rounded-md rsp-shadow",children:[e.jsxs("svg",{className:"rsp-w-4 rsp-h-4 rsp-animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25",strokeWidth:"4"}),e.jsx("path",{d:"M22 12a10 10 0 00-10-10",strokeWidth:"4"})]}),e.jsx("span",{className:"rsp-text-xs rsp-text-gray-700",children:"Uploading..."})]})})]})]}),e.jsxs("div",{className:"rsp-space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),"Body Text",e.jsx("span",{className:"rsp-text-xs rsp-text-gray-500 rsp-font-normal",children:"(Max 160 characters)"})]}),e.jsx("div",{className:"rsp-relative",children:e.jsx("textarea",{ref:T=>{o.current[c.id]=T},value:c.body,onChange:T=>y(c.id,"body",T.target.value),maxLength:160,rows:4,className:"rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-400 rsp-bg-white rsp-resize-none rsp-shadow-sm rsp-transition-colors",placeholder:"Enter Card Body Message"})}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-2",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-1",children:[e.jsx("button",{onClick:()=>x(c.id,"body"),className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Add Variable",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsx("button",{onClick:()=>{U(c.id),m(!0)},className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Add Emoji",children:e.jsx(ke,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>{const T=o.current[c.id];if(!T)return;const{newText:ae,cursorPosition:O}=de(T,c.body,"bold");y(c.id,"body",ae),requestAnimationFrame(()=>{setTimeout(()=>{T&&(T.setSelectionRange(O,O),T.focus())},0)})},className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Bold text (*text*)",children:e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"})]})}),e.jsx("button",{onClick:()=>{const T=o.current[c.id];if(!T)return;const{newText:ae,cursorPosition:O}=de(T,c.body,"italic");y(c.id,"body",ae),requestAnimationFrame(()=>{setTimeout(()=>{T&&(T.setSelectionRange(O,O),T.focus())},0)})},className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Italic text (_text_)",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 4h4M8 20h4M12 4l-2 16"})})})]}),e.jsxs("span",{className:`rsp-text-xs rsp-font-medium ${c.body.length>140?"rsp-text-orange-500":"rsp-text-gray-500"}`,children:[c.body.length,"/160"]})]}),(()=>{const T=c.body.match(/\{\{(\d+)\}\}/g)||[],ae=[...new Set(T.map(O=>O.replace(/[{}]/g,"")))];return ae.length===0?null:e.jsxs("div",{className:"rsp-mt-3 rsp-p-3 rsp-bg-blue-50 rsp-rounded-lg rsp-border rsp-border-blue-200",children:[e.jsx("p",{className:"rsp-text-xs rsp-font-semibold rsp-text-blue-800 rsp-mb-2",children:"Sample Values for This Card"}),e.jsx("div",{className:"rsp-grid rsp-grid-cols-1 rsp-gap-2",children:ae.map(O=>{var xe,H;return e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsxs("label",{className:"rsp-text-xs rsp-text-gray-700 rsp-font-medium rsp-whitespace-nowrap",children:["{{",O,"}}",":"]}),e.jsx("input",{type:"text",value:((H=(xe=c.sampleContent)==null?void 0:xe.bodyVariables)==null?void 0:H[O])||"",onChange:ie=>{const re=ie.target.value;s(Y=>({...Y,carousel:{...Y.carousel,cards:Y.carousel.cards.map(z=>{var K,q,d;return z.id!==c.id?z:{...z,sampleContent:{headerVariables:((K=z.sampleContent)==null?void 0:K.headerVariables)||{},bodyVariables:{...((q=z.sampleContent)==null?void 0:q.bodyVariables)||{},[O]:re},buttonVariables:((d=z.sampleContent)==null?void 0:d.buttonVariables)||{}}}})}}))},className:"rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white",placeholder:"Sample value"}),e.jsx("button",{type:"button",onClick:()=>{const ie=new RegExp(`\\{\\{${O}\\}\\}`,"g"),re=(c.body||"").replace(ie,"");s(Y=>({...Y,carousel:{...Y.carousel,cards:Y.carousel.cards.map(z=>{var K,q,d;if(z.id!==c.id)return z;const Q=Object.fromEntries(Object.entries(((K=z.sampleContent)==null?void 0:K.bodyVariables)||{}).filter(([I])=>I!==O));return{...z,body:re,sampleContent:{headerVariables:((q=z.sampleContent)==null?void 0:q.headerVariables)||{},bodyVariables:Q,buttonVariables:((d=z.sampleContent)==null?void 0:d.buttonVariables)||{}}}})}}))},className:"rsp-px-2 rsp-py-1 rsp-text-xs rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded",title:"Remove this variable",children:"×"})]},`card-${c.id}-sample-${O}`)})})]})})()]}),c.buttons.length<2&&e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"})}),"Add Action Button",e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500 rsp-font-normal",children:["(",c.buttons.length,"/2)"]})]}),e.jsxs("div",{className:"rsp-grid rsp-grid-cols-3 rsp-gap-2",children:[e.jsxs("button",{onClick:()=>v(c.id,"QUICK_REPLY"),className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),e.jsx("span",{className:"rsp-text-xs",children:"Quick Reply"})]}),e.jsxs("button",{onClick:()=>v(c.id,"URL"),className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),e.jsx("span",{className:"rsp-text-xs",children:"Website"})]}),e.jsxs("button",{onClick:()=>v(c.id,"PHONE_NUMBER"),className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"})}),e.jsx("span",{className:"rsp-text-xs",children:"Phone"})]})]})]}),c.buttons.length>0&&e.jsxs("div",{className:"rsp-space-y-3",children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Configured Buttons"]}),c.buttons.map((T,ae)=>e.jsxs("div",{className:"rsp-p-4 rsp-border-2 rsp-border-blue-200 rsp-rounded-lg rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-shadow-sm",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mb-3",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("div",{className:"rsp-w-6 rsp-h-6 rsp-bg-blue-500 rsp-text-white rsp-rounded rsp-flex rsp-items-center rsp-justify-center rsp-text-xs rsp-font-bold",children:ae+1}),e.jsx("span",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800",children:T.type==="QUICK_REPLY"?"Quick Reply":T.type==="URL"?"Website":"Phone"})]}),e.jsx("button",{onClick:()=>V(c.id,T.id),className:"rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",title:"Remove button",children:e.jsx(ne,{className:"rsp-w-4 rsp-h-4"})})]}),e.jsxs("div",{className:"rsp-space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1",children:"Button Text"}),e.jsx("input",{type:"text",value:T.text,onChange:O=>L(c.id,T.id,"text",O.target.value),placeholder:`Enter Button Text (Max ${T.type==="QUICK_REPLY"?"25":"20"} characters)`,maxLength:T.type==="QUICK_REPLY"?25:20,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"})]}),T.type==="URL"&&e.jsxs("div",{className:"rsp-space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2",children:"URL Type"}),e.jsxs("div",{className:"rsp-flex rsp-gap-4",children:[e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer",children:[e.jsx("input",{type:"radio",checked:T.urlType!=="dynamic",onChange:()=>L(c.id,T.id,"urlType","static"),className:"rsp-mr-2 rsp-text-blue-600"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Static URL"})]}),e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer",children:[e.jsx("input",{type:"radio",checked:T.urlType==="dynamic",onChange:()=>L(c.id,T.id,"urlType","dynamic"),className:"rsp-mr-2 rsp-text-blue-600"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Dynamic URL"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1",children:"Website URL"}),e.jsx("input",{type:"text",value:T.value||"",onChange:O=>L(c.id,T.id,"value",O.target.value),placeholder:T.urlType==="dynamic"?"https://example.com/order/{{1}}":"https://example.com",className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"})]}),T.urlType==="dynamic"&&e.jsxs("div",{className:"rsp-space-y-2",children:[e.jsx("div",{className:"rsp-p-2 rsp-bg-blue-50 rsp-rounded rsp-border rsp-border-blue-200",children:e.jsxs("p",{className:"rsp-text-xs rsp-text-blue-700",children:[e.jsx("strong",{children:"Tip:"})," Use ","{{"," and ","}}}"," to add variables (e.g., https://example.com/","{{"," 1","}}",")"]})}),e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>{if(((T.value||"").match(/\{\{(\d+)\}\}/g)||[]).length>=1)return;const H=((T.value||"").match(/\{\{(\d+)\}\}/g)||[]).map(z=>{const Q=z.match(/{{(\d+)}}/);return Q?parseInt(Q[1],10):0}),re=(H.length>0?Math.max(...H):0)+1,Y=(T.value||"")+`{{${re}}}`;L(c.id,T.id,"value",Y)},disabled:((T.value||"").match(/\{\{(\d+)\}\}/g)||[]).length>=1,className:"rsp-px-3 rsp-py-1.5 rsp-text-xs rsp-bg-blue-500 hover:rsp-bg-blue-600 rsp-text-white rsp-rounded disabled:rsp-bg-gray-300 disabled:rsp-cursor-not-allowed rsp-transition-colors",children:"+ Add Variable"}),((T.value||"").match(/\{\{(\d+)\}\}/g)||[]).length>=1&&e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:"Maximum 1 variable allowed"})]}),(()=>{const O=(T.value||"").match(/\{\{(\d+)\}\}/g)||[],xe=[...new Set(O.map(H=>H.replace(/[{}]/g,"")))];return xe.length===0?null:e.jsxs("div",{className:"rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg rsp-border rsp-border-gray-200",children:[e.jsx("h4",{className:"rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2",children:"Sample Values for URL Variables"}),e.jsx("div",{className:"rsp-space-y-2",children:xe.map(H=>{var ie,re;return e.jsxs("div",{className:"rsp-space-y-1",children:[e.jsxs("label",{className:"rsp-block rsp-text-xs rsp-text-gray-600 rsp-mb-1",children:["Variable ","{{",H,"}}"]}),e.jsx("input",{type:"text",value:((re=(ie=c.sampleContent)==null?void 0:ie.buttonVariables)==null?void 0:re[H])||"",onChange:Y=>{const z=Y.target.value;s(Q=>({...Q,carousel:{...Q.carousel,cards:Q.carousel.cards.map(K=>{var q,d,I;return K.id!==c.id?K:{...K,sampleContent:{headerVariables:((q=K.sampleContent)==null?void 0:q.headerVariables)||{},bodyVariables:((d=K.sampleContent)==null?void 0:d.bodyVariables)||{},buttonVariables:{...((I=K.sampleContent)==null?void 0:I.buttonVariables)||{},[H]:z}}}})}}))},className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-bg-white",placeholder:`Sample value (e.g., ${H==="1"?"order123":"user456"})`}),e.jsx("button",{type:"button",onClick:()=>{const Y=T.value||"",z=new RegExp(`\\{\\{${H}\\}\\}`,"g"),Q=Y.replace(z,"");L(c.id,T.id,"value",Q),s(K=>({...K,carousel:{...K.carousel,cards:K.carousel.cards.map(q=>{var I,W,F;if(q.id!==c.id)return q;const d=Object.fromEntries(Object.entries(((I=q.sampleContent)==null?void 0:I.buttonVariables)||{}).filter(([Z])=>Z!==H));return{...q,sampleContent:{headerVariables:((W=q.sampleContent)==null?void 0:W.headerVariables)||{},bodyVariables:((F=q.sampleContent)==null?void 0:F.bodyVariables)||{},buttonVariables:d}}})}}))},className:"rsp-px-2 rsp-py-1 rsp-text- rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded",title:"Remove this variable",children:"×"})]},`button-${T.id}-sample-${H}`)})})]})})()]})]}),T.type==="PHONE_NUMBER"&&e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1",children:"Phone Number"}),e.jsx("input",{type:"text",value:T.value||"",onChange:O=>L(c.id,T.id,"value",O.target.value),placeholder:"+1234567890",className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"})]})]})]},T.id))]})]})]})})]},c.id)})}),e.jsx("div",{className:"rsp-bg-blue-50 rsp-border-l-4 rsp-border-blue-500 rsp-p-4 rsp-rounded-r-md",children:e.jsxs("div",{className:"rsp-flex",children:[e.jsx("div",{className:"rsp-flex-shrink-0",children:e.jsx("svg",{className:"rsp-h-5 rsp-w-5 rsp-text-blue-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"rsp-ml-3",children:[e.jsx("h3",{className:"rsp-text-sm rsp-font-medium rsp-text-blue-800",children:"Meta WhatsApp HSM Guidelines"}),e.jsx("div",{className:"rsp-mt-2 rsp-text-sm rsp-text-blue-700",children:e.jsxs("ul",{className:"rsp-list-disc rsp-list-inside rsp-space-y-1",children:[e.jsx("li",{children:"Maximum 10 carousel cards per template"}),e.jsx("li",{children:"Maximum 2 buttons per card"}),e.jsx("li",{children:"Card body text limited to 160 characters"}),e.jsx("li",{children:"Button text limited to 20-25 characters depending on type"}),e.jsx("li",{children:"Images: PNG, JPG, GIF, TIFF, SVG, BMP formats supported"}),e.jsx("li",{children:"Videos: MP4, MOV, AVI formats supported"})]})})]})]})}),e.jsx(Ee,{isOpen:f,onClose:()=>m(!1),onSelect:h})]})}const Ue=async a=>{try{console.log(`Starting file upload: ${a.name}`);const s=await Pa(a);return console.log(`File uploaded successfully: ${s}`),s}catch(s){throw console.error("Upload failed in parent:",s),s}},Fa=a=>{const r=(a.body||"").match(/\{\{(\d+)\}\}/g);if(!r)return 0;const t=r.map(n=>{const l=n.match(/{{(\d+)}}/);return l?parseInt(l[1],10):0});return t.length>0?Math.max(...t):0};function $a({template:a,setTemplate:s}){const[r,t]=j.useState(!1),n=j.useRef(null),l=()=>{t(!0),setTimeout(()=>{n.current&&n.current.focus()},0)},i=p=>{const f=n.current,m=a.body,w=f&&typeof f.selectionStart=="number"?f.selectionStart:m.length,U=m.substring(0,w),o=m.substring(w),k=U+p+o;s({...a,body:k}),setTimeout(()=>{if(n.current){const E=w+p.length;n.current.setSelectionRange(E,E),n.current.focus()}},0),t(!1)};return e.jsxs("div",{className:"rsp-space-y-6",children:[a.type!=="CAROUSEL"&&e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsx("h2",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Message Content"}),e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsx(Ia,{template:a,setTemplate:s,onFileUpload:Ue}),e.jsx(Ba,{template:a,setTemplate:s})]})]}),a.type==="CAROUSEL"&&e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsx("h2",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Message Content"}),e.jsx("div",{className:"rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm",children:e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:["Body ",e.jsx("span",{className:"rsp-text-gray-500",children:"(Global message for carousel)"})]}),e.jsx("div",{className:"rsp-relative",children:e.jsx("textarea",{ref:n,value:a.body,onChange:p=>s({...a,body:p.target.value}),maxLength:1024,rows:4,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none",placeholder:"Enter Template Message"})}),!a.body&&e.jsx("p",{className:"rsp-text-xs rsp-text-red-600 rsp-mt-1",children:"Body is required."}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-1",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("button",{onClick:()=>{const m=`{{${Fa(a)+1}}}`;s({...a,body:a.body+m})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add Variable",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsx("button",{onClick:l,className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add emoji",children:e.jsx(ke,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>{if(!n.current)return;const{newText:p,cursorPosition:f}=de(n.current,a.body,"bold");s({...a,body:p}),requestAnimationFrame(()=>{setTimeout(()=>{n.current&&(n.current.setSelectionRange(f,f),n.current.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Bold text (*text*)",children:e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"})]})}),e.jsx("button",{onClick:()=>{if(!n.current)return;const{newText:p,cursorPosition:f}=de(n.current,a.body,"italic");s({...a,body:p}),requestAnimationFrame(()=>{setTimeout(()=>{n.current&&(n.current.setSelectionRange(f,f),n.current.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Italic text (_text_)",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 4h4M8 20h4M12 4l-2 16"})})})]}),e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500",children:[a.body.length,"/1024"]})]}),(()=>{const p=a.body.match(/\{\{(\d+)\}\}/g)||[],f=[...new Set(p.map(m=>m.replace(/[{}]/g,"")))];return f.length===0?null:e.jsxs("div",{className:"rsp-mt-3",children:[e.jsx("p",{className:"rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2",children:"Sample Values"}),e.jsx("div",{className:"rsp-grid rsp-grid-cols-3 rsp-gap-2",children:f.map(m=>{var w,U;return e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsxs("label",{className:"rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap",children:["{{",m,"}}",":"]}),e.jsx("input",{type:"text",value:((U=(w=a.sampleContent)==null?void 0:w.bodyVariables)==null?void 0:U[m])||"",onChange:o=>{var E,y,g;const k={...a.sampleContent,headerVariables:((E=a.sampleContent)==null?void 0:E.headerVariables)||{},bodyVariables:{...(y=a.sampleContent)==null?void 0:y.bodyVariables,[m]:o.target.value},buttonVariables:((g=a.sampleContent)==null?void 0:g.buttonVariables)||{}};s({...a,sampleContent:k})},className:"rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",placeholder:"Sample"}),e.jsx("button",{type:"button",onClick:()=>{var y,g,x;const o=new RegExp(`\\{\\{${m}\\}\\}`,"g"),k=(a.body||"").replace(o,""),E=Object.fromEntries(Object.entries(((y=a.sampleContent)==null?void 0:y.bodyVariables)||{}).filter(([h])=>h!==m));s({...a,body:k,sampleContent:{...a.sampleContent,bodyVariables:E,headerVariables:((g=a.sampleContent)==null?void 0:g.headerVariables)||{},buttonVariables:((x=a.sampleContent)==null?void 0:x.buttonVariables)||{}}})},className:"rsp-px-2 rsp-py-1 rsp-text-xs rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded",title:"Remove this variable",children:"×"})]},`global-body-sample-${m}`)})})]})})()]})})]}),a.type==="CAROUSEL"&&e.jsx("div",{className:"rsp-space-y-6",children:e.jsx(_a,{template:a,setTemplate:s,onFileUpload:Ue})}),a.type!=="CAROUSEL"&&e.jsx("div",{className:"rsp-space-y-6",children:e.jsx(Oa,{template:a,setTemplate:s})}),e.jsx(Ee,{isOpen:r,onClose:()=>t(!1),onSelect:i})]})}function Ha({type:a}){switch(a){case"QUICK_REPLY":return e.jsx(Qe,{className:"w-4 h-4"});case"URL":return e.jsx(Je,{className:"w-4 h-4"});case"CALL":return e.jsx(Ie,{className:"w-4 h-4"});case"FLOW":return e.jsx(aa,{className:"w-4 h-4"});default:return null}}function qa({buttons:a,flowButtonText:s,onShowAllOptions:r}){const t=[...a];s&&t.push({id:"flow-button",type:"QUICK_REPLY",text:s});const n=t.slice(0,2);return e.jsxs("div",{className:"rsp-divide-y rsp-divide-gray-200",children:[n.map(l=>e.jsxs("button",{className:"rsp-w-full rsp-py-4 rsp-text-[#128C7E] rsp-text-[15px] rsp-font-medium rsp-bg-white hover:rsp-bg-gray-50 rsp-flex rsp-items-center rsp-gap-3 rsp-px-4 rsp-transition-colors",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[e.jsx("div",{className:"rsp-text-[#128C7E]",children:e.jsx(Ha,{type:l.type})}),e.jsx("span",{className:"rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap",children:l.text}),l.id==="flow-button"&&e.jsx(We,{className:"rsp-w-5 rsp-h-5 rsp-text-[#128C7E] rsp-ml-auto"})]},l.id)),t.length>2&&e.jsxs("button",{onClick:r,className:"rsp-w-full rsp-py-4 rsp-text-[#128C7E] rsp-text-[15px] rsp-font-medium rsp-bg-white hover:rsp-bg-gray-50 rsp-flex rsp-items-center rsp-justify-center rsp-transition-colors",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[e.jsx("span",{className:"rsp-text-lg rsp-mr-2",children:"⋯"}),"See all options"]})]})}const Wa=a=>{const s=[];let r=0;for(;r<a.length;)if(a[r]==="*"&&r+1<a.length&&a[r+1]==="_"){const t=r+2;let n=t;for(;n<a.length-1;){if(a[n]==="_"&&a[n+1]==="*"){const l=a.substring(t,n);s.push({type:"boldItalic",content:l}),r=n+2;break}n++}n>=a.length-1&&(s.push({type:"text",content:a[r]}),r++)}else if(a[r]==="*"){const t=r+1;let n=t;for(;n<a.length;){if(a[n]==="*"&&(n===t||a[n-1]!=="_")){const l=a.substring(t,n);s.push({type:"bold",content:l}),r=n+1;break}n++}n>=a.length&&(s.push({type:"text",content:a[r]}),r++)}else if(a[r]==="_"){const t=r+1;let n=t;for(;n<a.length;){if(a[n]==="_"&&(n===t||a[n-1]!=="*")){const l=a.substring(t,n);s.push({type:"italic",content:l}),r=n+1;break}n++}n>=a.length&&(s.push({type:"text",content:a[r]}),r++)}else{let t=r;for(;r<a.length&&a[r]!=="*"&&a[r]!=="_";)r++;const n=a.substring(t,r);n&&s.push({type:"text",content:n})}return s},we=(a,s)=>{if(!a)return"";let r=a;s&&(r=r.replace(/\{\{(\d+)\}\}/g,(i,p)=>s[p]||`[Variable ${p}]`));const t=Wa(r),n=[];let l=0;return t.forEach(i=>{switch(i.type){case"text":n.push(e.jsx(j.Fragment,{children:i.content},`text-${l++}`));break;case"bold":n.push(e.jsx("strong",{children:i.content},`format-${l++}`));break;case"italic":n.push(e.jsx("em",{children:i.content},`format-${l++}`));break;case"boldItalic":n.push(e.jsx("strong",{children:e.jsx("em",{children:i.content})},`format-${l++}`));break}}),e.jsx(e.Fragment,{children:n})};function Ga({template:a}){var U,o,k,E;const[s,r]=j.useState(!1),[t,n]=j.useState(0),l=(U=a.carousel)!=null&&U.cards?a.carousel.cards.length:0;j.useEffect(()=>{a.type==="CAROUSEL"&&l>0?t>=l&&n(0):n(0)},[l,a.type]);const i=y=>{var g;return y?we(y,(g=a.sampleContent)==null?void 0:g.headerVariables):""},p=y=>{var g;return y?we(y,(g=a.sampleContent)==null?void 0:g.bodyVariables):""},f=y=>{var h;const g=(y==null?void 0:y.body)??"";if(!g)return"";const x=((h=y==null?void 0:y.sampleContent)==null?void 0:h.bodyVariables)??{};return we(g,x)},m=a.headerType!=="NONE"||a.body||a.footer||a.buttons.length>0||a.type==="CAROUSEL"&&((o=a.carousel)==null?void 0:o.cards.length),w=a.headerText||a.body||a.footer;return e.jsxs("div",{className:"rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200",children:[e.jsxs("div",{className:"rsp-p-4 rsp-border-b rsp-border-gray-200",children:[e.jsx("h3",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Preview"}),e.jsx("p",{className:"rsp-text-sm rsp-text-gray-500",children:"See how your template will look"})]}),e.jsx("div",{className:"rsp-p-6 rsp-flex rsp-justify-center",children:e.jsx("div",{className:"rsp-relative",children:e.jsxs("div",{className:"rsp-w-[280px] rsp-h-[580px] rsp-bg-gradient-to-b rsp-from-[#1a1a1a] rsp-via-[#2d2d2f] rsp-to-[#000000] rsp-rounded-[35px] rsp-p-[2px] rsp-relative rsp-shadow-[0_20px_40px_-10px_rgba(0,0,0,0.7)] rsp-border-[1px] rsp-border-[#404040]",children:[e.jsx("div",{className:"rsp-absolute rsp-right-[-2px] rsp-top-[120px] rsp-w-[2px] rsp-h-[50px] rsp-bg-gradient-to-b rsp-from-[#404040] rsp-to-[#1a1a1a] rsp-rounded-l-[1px] rsp-shadow-md"}),e.jsx("div",{className:"rsp-absolute rsp-left-[-2px] rsp-top-[100px] rsp-w-[2px] rsp-h-[25px] rsp-bg-gradient-to-b rsp-from-[#404040] rsp-to-[#1a1a1a] rsp-rounded-r-[1px] rsp-shadow-sm"}),e.jsx("div",{className:"rsp-absolute rsp-left-[-2px] rsp-top-[135px] rsp-w-[2px] rsp-h-[40px] rsp-bg-gradient-to-b rsp-from-[#404040] rsp-to-[#1a1a1a] rsp-rounded-r-[1px] rsp-shadow-sm"}),e.jsx("div",{className:"rsp-absolute rsp-left-[-2px] rsp-top-[70px] rsp-w-[2px] rsp-h-[20px] rsp-bg-gradient-to-b rsp-from-[#ff8c42] rsp-to-[#ff6b35] rsp-rounded-r-[1px] rsp-shadow-md"}),e.jsxs("div",{className:"rsp-w-full rsp-h-full rsp-bg-black rsp-rounded-[33px] rsp-overflow-hidden rsp-relative rsp-shadow-[inset_0_1px_3px_rgba(0,0,0,0.3)]",children:[e.jsx("div",{className:"rsp-absolute rsp-top-[14px] rsp-left-1/2 rsp-transform -rsp-translate-x-1/2 rsp-w-[70px] rsp-h-[18px] rsp-bg-gradient-to-b rsp-from-[#0a0a0a] rsp-to-[#000000] rsp-rounded-[9px] rsp-z-20 rsp-shadow-[0_1px_4px_rgba(0,0,0,0.6)] rsp-border rsp-border-[#1a1a1a] rsp-flex rsp-items-center rsp-justify-center",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-gap-[8px]",children:[e.jsx("div",{className:"rsp-w-[3px] rsp-h-[3px] rsp-bg-gradient-to-br rsp-from-[#1a1a1a] rsp-to-[#000000] rsp-rounded-full rsp-shadow-inner"}),e.jsx("div",{className:"rsp-w-[2px] rsp-h-[2px] rsp-bg-gradient-to-br rsp-from-[#333] rsp-to-[#000] rsp-rounded-full"})]})}),e.jsxs("div",{className:"rsp-w-full rsp-h-full rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[33px] rsp-relative rsp-overflow-hidden rsp-shadow-[inset_0_1px_2px_rgba(0,0,0,0.1)]",children:[e.jsxs("div",{className:"rsp-absolute rsp-top-0 rsp-left-0 rsp-right-0 rsp-h-[45px] rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-flex rsp-items-center rsp-justify-between rsp-px-[30px] rsp-z-10",children:[e.jsx("div",{className:"rsp-text-[13px] rsp-font-semibold rsp-text-black rsp-tracking-tight",children:"9:41"}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-[5px]",children:[e.jsxs("div",{className:"rsp-flex rsp-gap-[2px] rsp-items-end",children:[e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[2px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"}),e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[3px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"}),e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[4px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"}),e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[5px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"})]}),e.jsx("svg",{className:"rsp-w-[11px] rsp-h-[8px] rsp-text-black rsp-opacity-90",viewBox:"0 0 15 11",fill:"currentColor",children:e.jsx("path",{d:"M1.5 4.5C3.5 2.5 6 1.5 7.5 1.5S11.5 2.5 13.5 4.5M3 6.5C4.5 5 6 4.5 7.5 4.5S10.5 5 12 6.5M5 8.5C6 7.5 6.75 7.25 7.5 7.25S9 7.5 10 8.5M7.5 10.5C7.5 10.5 7.5 10.5 7.5 10.5"})}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center",children:[e.jsx("div",{className:"rsp-w-[18px] rsp-h-[9px] rsp-border-[1px] rsp-border-black rsp-border-opacity-60 rsp-rounded-[2px] rsp-relative",children:e.jsx("div",{className:"rsp-absolute rsp-inset-[1px] rsp-bg-gradient-to-r rsp-from-[#34d399] rsp-to-[#10b981] rsp-rounded-[1px] rsp-w-[13px] rsp-shadow-inner"})}),e.jsx("div",{className:"rsp-absolute rsp-right-[-2px] rsp-top-[2px] rsp-w-[1px] rsp-h-[5px] rsp-bg-black rsp-bg-opacity-60 rsp-rounded-[0.5px]"})]})]})]}),e.jsxs("div",{className:"rsp-absolute rsp-top-[45px] rsp-left-0 rsp-right-0 rsp-h-[60px] rsp-bg-gradient-to-r rsp-from-[#075E54] rsp-via-[#0a6b5f] rsp-to-[#128C7E] rsp-flex rsp-items-center rsp-px-4 rsp-gap-3 rsp-z-10 rsp-shadow-[0_2px_8px_rgba(0,0,0,0.15)]",children:[e.jsx("svg",{className:"rsp-w-5 rsp-h-5 rsp-text-white rsp-opacity-95 rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.42-1.41L7.83 13H20v-2z"})}),e.jsx("div",{className:"rsp-w-[36px] rsp-h-[36px] rsp-bg-gradient-to-br rsp-from-[#25D366] rsp-via-[#20c55e] rsp-to-[#128C7E] rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-[0_2px_6px_rgba(0,0,0,0.2)] rsp-border-[2px] rsp-border-white rsp-border-opacity-30",children:e.jsx("span",{className:"rsp-text-white rsp-text-[14px] rsp-font-bold rsp-drop-shadow-sm",children:"B"})}),e.jsxs("div",{className:"rsp-flex-1",children:[e.jsx("div",{className:"rsp-text-white rsp-text-[14px] rsp-font-semibold rsp-drop-shadow-sm rsp-tracking-tight",children:"Business"}),e.jsx("div",{className:"rsp-text-[#B8E6D1] rsp-text-[11px] rsp-opacity-85 rsp-font-medium",children:"WhatsApp Business"})]}),e.jsxs("div",{className:"rsp-flex rsp-gap-4",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-white rsp-opacity-90 rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})}),e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-white rsp-opacity-90 rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})})]})]}),e.jsxs("div",{className:"rsp-absolute rsp-top-[105px] rsp-left-0 rsp-right-0 rsp-bottom-[60px] rsp-bg-gradient-to-b rsp-from-[#E8E2DB] rsp-via-[#E5DDD5] rsp-to-[#DDD5CC] rsp-overflow-y-auto",children:[e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-opacity-[0.03]",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.08'%3E%3Cpath d='M40 40c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm0-32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm32 32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`}}),e.jsx("div",{className:"rsp-relative rsp-px-4 rsp-py-4",children:m?e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-items-start",children:[(w||a.headerType==="MEDIA"||a.buttons.length>0)&&e.jsx("div",{className:"rsp-flex rsp-justify-start rsp-mb-1.5",children:e.jsxs("div",{className:"rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-max-w-[220px] rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-relative rsp-border rsp-border-gray-100 rsp-animate-slide-up rsp-overflow-hidden",children:[a.headerType==="MEDIA"&&a.mediaUrl&&e.jsxs("div",{className:"rsp-w-full rsp-overflow-hidden",children:[a.mediaType==="IMAGE"&&e.jsx("img",{src:a.mediaUrl,alt:"Header media",className:"rsp-w-full rsp-max-h-[150px] rsp-object-cover rsp-block",onError:y=>{y.currentTarget.style.display="none"}}),a.mediaType==="VIDEO"&&e.jsxs("div",{className:"rsp-relative rsp-min-w-[150px] rsp-w-full rsp-h-[150px] rsp-bg-gradient-to-br rsp-from-gray-800 rsp-to-gray-900 rsp-flex rsp-items-center rsp-justify-center",children:[e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-black rsp-bg-opacity-70 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-lg rsp-border rsp-border-white rsp-border-opacity-20",children:e.jsx("div",{className:"rsp-w-0 rsp-h-0 rsp-border-l-[8px] rsp-border-l-white rsp-border-t-[6px] rsp-border-t-transparent rsp-border-b-[6px] rsp-border-b-transparent rsp-ml-1"})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-2 rsp-right-2 rsp-bg-black rsp-bg-opacity-75 rsp-text-white rsp-text-[10px] rsp-px-2 rsp-py-1 rsp-rounded-full rsp-shadow-md rsp-backdrop-blur-sm",children:"📹 Video"})]}),a.mediaType==="DOCUMENT"&&e.jsx("div",{className:"rsp-p-3 rsp-bg-gradient-to-r rsp-from-gray-50 rsp-to-gray-100",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("div",{className:"rsp-w-10 rsp-h-10 rsp-bg-gradient-to-br rsp-from-red-500 rsp-to-red-600 rsp-rounded-lg rsp-flex rsp-items-center rsp-justify-center rsp-shadow-md",children:e.jsx("span",{className:"rsp-text-white rsp-text-[9px] rsp-font-bold",children:"PDF"})}),e.jsxs("div",{children:[e.jsx("div",{className:"rsp-text-[12px] rsp-font-semibold rsp-text-gray-800",children:"Document"}),e.jsx("div",{className:"rsp-text-[10px] rsp-text-gray-600",children:"PDF • 1.2 MB"})]})]})})]}),a.headerType==="TEXT"&&a.headerText&&e.jsx("div",{className:"rsp-px-4 rsp-pt-3 rsp-pb-2",children:e.jsx("div",{className:"rsp-text-[15px] rsp-font-semibold rsp-text-[#111b21] rsp-leading-[1.3] rsp-tracking-normal rsp-break-words",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:i(a.headerText)})}),a.body&&e.jsx("div",{className:`rsp-px-4 ${a.headerType==="MEDIA"?"rsp-pt-2":"rsp-pt-3"} ${a.footer||a.buttons.length>0,"rsp-pb-2"}`,children:e.jsx("div",{className:"rsp-text-[14px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-whitespace-pre-wrap rsp-tracking-normal rsp-break-words",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:p(a.body)})}),a.footer&&e.jsx("div",{className:`rsp-px-4 ${a.buttons.length>0,"rsp-pb-2"}`,children:e.jsx("div",{className:"rsp-text-[12px] rsp-text-[#667781] rsp-pt-2 rsp-border-t rsp-border-gray-100 rsp-break-words rsp-break-all rsp-whitespace-pre-wrap",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:a.footer})}),a.buttons.length>0&&e.jsx("div",{className:"rsp-border-t rsp-border-gray-100",children:e.jsx(qa,{buttons:a.buttons,onShowAllOptions:()=>r(!0)})}),a.buttons.length===0&&e.jsx("div",{className:"rsp-px-4 rsp-pb-2 rsp-text-right",children:e.jsxs("div",{className:"rsp-text-[11px] rsp-text-[#667781] rsp-flex rsp-items-center rsp-justify-end rsp-gap-1 rsp-opacity-80",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:["9:41 AM",e.jsx("svg",{className:"rsp-w-3 rsp-h-3 rsp-text-[#53bdeb]",viewBox:"0 0 16 15",fill:"currentColor",children:e.jsx("path",{d:"M15.01 3.316l-.478-.372a.365.365 0 0 0-.51.063L8.666 9.879a.32.32 0 0 1-.484.033l-.358-.325a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l1.32 1.266c.143.14.361.125.484-.033l6.272-8.048a.366.366 0 0 0-.064-.512zm-4.1 0l-.478-.372a.365.365 0 0 0-.51.063L4.566 9.879a.32.32 0 0 1-.484.033L1.891 7.769a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l3.61 3.463c.143.14.361.125.484-.033l6.272-8.048a.365.365 0 0 0-.064-.512z"})})]})})]})}),a.type==="CAROUSEL"&&(((E=(k=a.carousel)==null?void 0:k.cards)==null?void 0:E.length)||0)>0&&e.jsx("div",{className:"rsp-flex rsp-justify-start rsp-mb-1.5",children:e.jsx("div",{className:"rsp-w-[220px] rsp-animate-slide-up",children:e.jsx("div",{className:"rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-overflow-hidden rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-border rsp-border-gray-100 rsp-relative rsp-min-h-[280px] rsp-flex rsp-flex-col",children:e.jsxs("div",{className:"rsp-relative rsp-flex-1 rsp-flex rsp-flex-col",children:[(()=>{var g,x;const y=a.carousel&&a.carousel.cards.length>0?a.carousel.cards[t]||a.carousel.cards[0]:void 0;return e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-h-full",children:[e.jsx("div",{className:"rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0",children:y&&y.mediaUrl?e.jsxs(e.Fragment,{children:[((g=a.carousel)==null?void 0:g.type)==="IMAGE"?e.jsx("img",{src:y.mediaUrl,alt:"Carousel card",className:"rsp-w-full rsp-h-full rsp-object-cover",onError:h=>{h.currentTarget.style.display="none"}}):e.jsx("div",{className:"rsp-relative rsp-w-full rsp-h-full rsp-bg-gradient-to-br rsp-from-gray-800 rsp-to-gray-900 rsp-flex rsp-items-center rsp-justify-center",children:e.jsx("div",{className:"rsp-w-10 rsp-h-10 rsp-bg-black rsp-bg-opacity-70 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-lg",children:e.jsx("div",{className:"rsp-w-0 rsp-h-0 rsp-border-l-[6px] rsp-border-l-white rsp-border-t-[5px] rsp-border-t-transparent rsp-border-b-[5px] rsp-border-b-transparent rsp-ml-1"})})}),a.carousel&&a.carousel.cards.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>n(h=>h>0?h-1:a.carousel.cards.length-1),className:"rsp-absolute rsp-left-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),e.jsx("button",{onClick:()=>n(h=>h<a.carousel.cards.length-1?h+1:0),className:"rsp-absolute rsp-right-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),e.jsxs("div",{className:"rsp-absolute rsp-top-2 rsp-right-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-[10px] rsp-px-2 rsp-py-0.5 rsp-rounded-full rsp-backdrop-blur-sm",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[t+1,"/",a.carousel?a.carousel.cards.length:0]})]}):e.jsx("div",{className:"rsp-w-full rsp-h-full rsp-flex rsp-items-center rsp-justify-center",children:e.jsxs("div",{className:"rsp-text-center",children:[e.jsx("svg",{className:"rsp-w-12 rsp-h-12 rsp-mx-auto rsp-text-gray-400 rsp-mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:((x=a.carousel)==null?void 0:x.type)==="VIDEO"?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:"No media"})]})})}),e.jsx("div",{className:"rsp-px-4 rsp-py-3 rsp-flex-1 rsp-flex rsp-items-start",children:e.jsx("p",{className:"rsp-text-[13px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-line-clamp-3",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:y?f(y):"Card body text..."})}),e.jsx("div",{className:"rsp-border-t rsp-border-gray-100 rsp-mt-auto",children:y&&y.buttons.length>0?e.jsx(e.Fragment,{children:y.buttons.map((h,u)=>e.jsx("div",{className:`rsp-px-4 rsp-py-3 rsp-text-center rsp-text-[14px] rsp-text-[#128C7E] rsp-font-medium rsp-break-words rsp-whitespace-pre-wrap ${u<y.buttons.length-1?"rsp-border-b rsp-border-gray-100":""}`,style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-gap-2",children:[h.type==="URL"&&e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),(h.type==="CALL"||h.type==="PHONE_NUMBER")&&e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"})}),e.jsx("span",{className:"rsp-inline-block rsp-max-w-[180px] rsp-break-words rsp-break-all rsp-whitespace-pre-wrap rsp-text-center",children:h.text})]})},h.id))}):e.jsx("div",{className:"rsp-px-4 rsp-py-3 rsp-text-center rsp-text-xs rsp-text-gray-400",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:"No buttons"})})]})})(),a.carousel&&a.carousel.cards.length>1&&e.jsx("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-gap-1.5 rsp-py-3 rsp-bg-white rsp-border-t rsp-border-gray-100",children:a.carousel&&a.carousel.cards.map((y,g)=>e.jsx("button",{onClick:()=>n(g),className:`rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${g===t?"rsp-bg-[#128C7E] rsp-w-6":"rsp-bg-gray-300 hover:rsp-bg-gray-400"}`},g))})]})})})})]}):e.jsx("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-h-[300px]",children:e.jsxs("div",{className:"rsp-text-center rsp-text-gray-500 rsp-animate-fade-in",children:[e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-gradient-to-br rsp-from-gray-50 rsp-to-gray-100 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-2 rsp-shadow-md rsp-border rsp-border-gray-200",children:e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-gray-400",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4l4 4 4-4h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"})})}),e.jsx("p",{className:"rsp-text-xs rsp-font-medium rsp-text-gray-600",children:"Start building your template"}),e.jsx("p",{className:"rsp-text-xs rsp-mt-1 rsp-text-gray-500",children:"Add content to see a live preview"})]})})})]}),e.jsxs("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-right-0 rsp-h-[60px] rsp-bg-gradient-to-r rsp-from-[#F0F2F5] rsp-via-[#EBEDF0] rsp-to-[#E8EAED] rsp-flex rsp-items-center rsp-px-4 rsp-gap-2 rsp-border-t rsp-border-gray-200 rsp-shadow-[0_-1px_4px_rgba(0,0,0,0.05)]",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-[#54656F] rsp-opacity-60",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"})}),e.jsx("div",{className:"rsp-flex-1 rsp-bg-gradient-to-r rsp-from-white rsp-to-[#fafafa] rsp-rounded-[24px] rsp-px-4 rsp-py-2 rsp-flex rsp-items-center rsp-min-h-[36px] rsp-shadow-[0_1px_2px_rgba(0,0,0,0.1)] rsp-border rsp-border-gray-200",children:e.jsx("span",{className:"rsp-text-[13px] rsp-text-[#667781] rsp-opacity-70 rsp-font-normal",children:"Type a message"})}),e.jsx("div",{className:"rsp-w-9 rsp-h-9 rsp-bg-gradient-to-br rsp-from-[#25D366] rsp-via-[#20c55e] rsp-to-[#00A884] rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-[0_2px_6px_rgba(37,211,102,0.3)] rsp-border rsp-border-[#20c55e] rsp-border-opacity-30",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-white rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"})})})]}),s&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-40 rsp-z-30 rsp-flex rsp-items-end rsp-animate-fade-in",children:e.jsxs("div",{className:"rsp-w-full rsp-bg-[#F0F2F5] rsp-rounded-t-2xl rsp-shadow-lg rsp-animate-slide-up",children:[e.jsx("div",{className:"rsp-p-4 rsp-border-b rsp-border-gray-300",children:e.jsx("h4",{className:"rsp-font-bold rsp-text-center rsp-text-gray-800 rsp-text-md",children:a.body||"Options"})}),e.jsx("div",{className:"rsp-max-h-[250px] rsp-overflow-y-auto",children:a.buttons.map((y,g)=>e.jsx("div",{className:`rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${g<a.buttons.length-1?"rsp-border-b rsp-border-gray-300":""}`,style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:y.text},y.id))}),e.jsx("div",{onClick:()=>r(!1),className:"rsp-mt-2 rsp-p-4 rsp-text-center rsp-font-bold rsp-text-[#128C7E] rsp-bg-white rsp-cursor-pointer rsp-shadow-inner",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:"Close"})]})})]})]})]})})})]})}const Ve={name:"",category:"MARKETING",type:"BASIC",language:"en",enableClickTracking:!1,headerType:"NONE",headerText:"",body:"",footer:"",buttons:[]};function Ka({editId:a,onCancel:s}){var g,x,h;const[r,t]=j.useState(Ve),[n,l]=j.useState(!0),[i,p]=j.useState(!1),[f,m]=j.useState(!1),[w,U]=j.useState(null),[o,k]=j.useState({isOpen:!1});j.useState({isOpen:!1}),j.useEffect(()=>{if(w){const u=setTimeout(()=>{U(null)},5e3);return()=>clearTimeout(u)}},[w]);const E=async()=>{var u,v,L;try{if(m(!0),U(null),!r.name||!r.body)throw new Error("Template name and body are required");const V=localStorage.getItem("account"),b=V?JSON.parse(V):{apiKey:""};if(!b.apiKey)throw new Error("Please set your API key in the dashboard first");let N;if(a){const M=await Ca(b.apiKey,a,r);if(!M.success)throw new Error(M.message||"Update failed");N={status:"success",message:"Template updated successfully",data:{details:[{template_name:r.name,template_id:a}]}}}else if(N=await Na(b,r),N.status==="error")throw new Error(N.message);if(N.status==="error")throw new Error(N.message);k({isOpen:!0,templateName:(u=N.data)==null?void 0:u.details[0].template_name,templateId:(v=N.data)==null?void 0:v.details[0].template_id,template:(L=N.data)==null?void 0:L.template}),t(Ve)}catch(V){U(V instanceof Error?V.message:"An error occurred while creating the template")}finally{m(!1)}};j.useEffect(()=>{if(!a)return;(async()=>{try{const v=localStorage.getItem("account"),L=v?JSON.parse(v):{apiKey:""};if(!L.apiKey)throw new Error("Please set your API key in the dashboard first");const V=await Ta(L.apiKey,a);t(b=>({...b,...V}))}catch(v){console.error("Failed to load template for edit",v),U(v instanceof Error?v.message:"Failed to load template")}})()},[a]);const y=()=>{k({isOpen:!1}),s&&s()};return e.jsxs("div",{className:"rsp-min-h-screen rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm",children:[e.jsxs("div",{className:"rsp-max-w-[1200px] rsp-mx-auto rsp-px-6 rsp-h-full",children:[e.jsx("div",{className:"rsp-py-6 rsp-border-b rsp-border-gray-200",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("h1",{className:"rsp-text-2xl rsp-font-semibold rsp-text-[#0043ff]",children:a?"Edit Template":"Add Template"}),e.jsx("div",{className:"rsp-flex rsp-items-center rsp-gap-3",children:e.jsxs("button",{onClick:()=>l(!n),className:`rsp-flex rsp-items-center rsp-gap-2 rsp-px-4 rsp-py-2 rsp-rounded-md rsp-text-sm rsp-font-medium rsp-transition-colors
|
|
103
|
-
${n?"rsp-bg-blue-100 rsp-text-blue-700 rsp-border rsp-border-blue-200":"rsp-bg-gray-100 rsp-text-gray-700 rsp-border rsp-border-gray-200"}`,children:[e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),n?"Hide Preview":"Show Preview"]})})]})}),e.jsxs("div",{className:`rsp-py-8 ${n?"rsp-grid xl:rsp-grid-cols-[1fr,400px] rsp-gap-8":""}`,children:[e.jsxs("div",{className:`rsp-space-y-8 ${n?"":"rsp-max-w-4xl rsp-mx-auto"}`,children:[e.jsxs("div",{className:"rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:["Template Name ",e.jsx("span",{className:"rsp-text-red-500",children:"*"})]}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",value:
|
|
104
|
-
${
|
|
101
|
+
*/const pe=ee("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ye({isOpen:a,onClose:r,title:s,children:t}){const n=k.useRef(null);return k.useEffect(()=>{const l=x=>{n.current&&!n.current.contains(x.target)&&r()};return a&&document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[a,r]),a?e.jsx("div",{className:"rsp-fixed rsp-inset-0 rsp-bg-black rsp-bg-opacity-50 rsp-flex rsp-items-center rsp-justify-center rsp-p-4 rsp-z-50",children:e.jsxs("div",{ref:n,className:"rsp-bg-white rsp-rounded-lg rsp-shadow-xl rsp-w-full rsp-max-w-[600px] rsp-animate-modal-appear",style:{backgroundColor:"#f5f7fc"},children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-px-6 rsp-py-4 rsp-border-b",children:[e.jsx("h2",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900 rsp-text-center rsp-w-full rsp-break-words rsp-break-all rsp-whitespace-pre-wrap",children:s}),e.jsx("button",{onClick:r,className:"rsp-p-1 hover:rsp-bg-gray-100 rsp-rounded-full",children:e.jsx(pe,{className:"rsp-w-5 rsp-h-5 rsp-text-gray-500"})})]}),e.jsx("div",{className:"rsp-px-6 rsp-py-4 rsp-overflow-y-auto rsp-max-h-[70vh] rsp-break-words rsp-whitespace-pre-wrap",children:t})]})}):null}const Fe=k.createContext({});function da({apiKey:a,pConfig:r,children:s}){const t=k.useMemo(()=>({apiKey:a,resulMeta:r}),[a,r]),n=k.useRef(null);return k.useEffect(()=>{if(typeof window>"u"||a===void 0&&!r)return;let l={};try{const g=localStorage.getItem("account");g&&(l=JSON.parse(g))}catch(g){console.error("TrustSignalProvider: Failed to read account from storage",g)}const x={...l,...a!==void 0?{apiKey:a}:{},...r?{resulMeta:r}:{}},u=JSON.stringify(x);if(u!==n.current)try{localStorage.setItem("account",u),n.current=u}catch(g){console.error("TrustSignalProvider: Failed to persist account to storage",g)}},[a,r]),e.jsx(Fe.Provider,{value:t,children:s})}function ze(){return k.useContext(Fe)}const we="https://wiz.resul.io",ma="/communication/SaveWATemplate_new",pa="/Communication/GetServiceProviderWA",fa="/Communication/UploadDocuments",ha="/Communication/GetWATemplateID",Be={departmentId:1,clientId:3850,createdBy:7874,userId:7874,serviceproviderId:3,senderId:31},$e=async(a,r,s,t=0)=>{const n=a.type==="CAROUSEL"?Ta(a,s):Ca(a,s),l={waTemplateId:t,...We(r),templateData:n},x=await fetch(ua(r),{method:"POST",headers:{"Content-Type":"application/json",...r!=null&&r.token?{Reqs:r.token}:{}},body:JSON.stringify(l)});if(!x.ok){const u=await He(x);throw new Error(`SaveWATemplate_new failed with status ${x.status}: ${u}`)}},He=async a=>{try{return await a.text()}catch{return"Unable to read response body"}},We=a=>{if(!a)return{...Be};const{departmentId:r,clientId:s,createdBy:t,userId:n,serviceproviderId:l,senderId:x}=a;return{...Be,...typeof r=="number"?{departmentId:r}:{},...typeof s=="number"?{clientId:s}:{},...typeof t=="number"?{createdBy:t}:{},...typeof n=="number"?{userId:n}:{},...typeof l=="number"?{serviceproviderId:l}:{},...typeof x=="number"?{senderId:x}:{}}},ua=a=>{var s;return`${((s=a==null?void 0:a.baseUrl)==null?void 0:s.replace(/\/+$/,""))||we}${ma}`},ba=a=>{var s;return`${((s=a==null?void 0:a.baseUrl)==null?void 0:s.replace(/\/+$/,""))||we}${pa}`},ga=a=>{var s;return`${((s=a==null?void 0:a.baseUrl)==null?void 0:s.replace(/\/+$/,""))||we}${fa}`},ya=async(a,r)=>{var c;console.log("🔍 ===== GetWATemplateID API Called ====="),console.log("🔍 Template Name:",a),console.log("🔍 ResulMeta provided?",!!r),console.log("🔍 ResulMeta config:",r);const s=We(r);console.log("🔍 Built meta config (with defaults):",s);const t=r==null?void 0:r.token;if(!t)return console.warn("⚠️ Token not provided in ResulMeta, cannot fetch WATemplateID"),null;const{clientId:n,departmentId:l,userId:x,serviceproviderId:u,senderId:g}=s;if(!n||!l||!x||!u||!g)return console.warn("⚠️ Missing required Resul meta fields for GetWATemplateID",{clientId:!!n,departmentId:!!l,userId:!!x,serviceproviderId:!!u,senderId:!!g,token:!!t}),null;const h=`${((c=r==null?void 0:r.baseUrl)==null?void 0:c.replace(/\/+$/,""))||we}${ha}`,M={clientId:n,departmentId:l,userId:x,Serviceproviderid:u,SenderID:g,TemplateName:a};console.log("🔍 GetWATemplateID API URL:",h),console.log("🔍 GetWATemplateID API Payload:",JSON.stringify(M,null,2));try{const w=await fetch(h,{method:"POST",headers:{"Content-Type":"application/json",reqs:t},body:JSON.stringify(M)});console.log("🔍 GetWATemplateID API Response Status:",w.status);const T=await w.text();if(console.log("🔍 GetWATemplateID API Raw Response:",T),!w.ok){const d=await He(w);return console.error(`❌ GetWATemplateID failed with status ${w.status}: ${d}`),null}const i=JSON.parse(T);return console.log("🔍 GetWATemplateID API Parsed Response:",i),i.success&&typeof i.WATemplateID=="number"?(console.log("✅ GetWATemplateID Success - WATemplateID:",i.WATemplateID),i.WATemplateID):(console.warn("⚠️ GetWATemplateID response missing WATemplateID or success flag",i),null)}catch(w){return console.error("❌ Error calling GetWATemplateID:",w),null}},qe=a=>a.headerType==="TEXT"?a.headerText.trim().length>0:a.headerType==="MEDIA"?!!a.mediaUrl:!1,wa=a=>!!(oe(a.body).length>0||a.headerType==="TEXT"&&oe(a.headerText).length>0||a.footer&&oe(a.footer).length>0),va=a=>a.buttons.some(r=>r.type==="URL"&&r.urlType==="dynamic"&&r.value),Ge=a=>{if(a.type==="CAROUSEL")return 11;const r=wa(a);if(va(a))return r?9:10;if(a.headerType==="MEDIA")switch(a.mediaType){case"IMAGE":return r?2:6;case"DOCUMENT":return r?3:7;case"VIDEO":return r?4:8;default:return r?1:5}return r?1:5},ja=a=>qe(a)?a.headerType==="TEXT"?"text":a.mediaType==="DOCUMENT"?"pdf":a.mediaType==="VIDEO"?"video":"image":"",ka=a=>a.headerType==="TEXT"?a.headerText||"":a.headerType==="MEDIA"&&a.mediaUrl||"",oe=a=>a?(a.match(/\{\{?(\d+)\}\}?/g)||[]).map(s=>s.replace(/[{}]/g,"")):[],Ae=(a,r)=>{const s=a.value||a.dynamicUrl||"",t=a.type==="URL"&&a.urlType==="dynamic",n=t?oe(s):[];return{actionIndex:r,isNameEditable:!1,actionNameParam:[],actionName:a.text,actionType:Na(a),isValueEditable:t,actionValueParam:n,value:s,...a.type==="URL"&&{urlType:a.urlType==="dynamic"?"dynamic":"static"}}},Na=a=>{switch(a.type){case"URL":return"url";case"CALL":case"PHONE_NUMBER":return"call phone number";case"QUICK_REPLY":return"quick reply";case"FLOW":return"flow";default:return"unknown"}},Ca=(a,r)=>{const s=oe(a.body),t=a.headerType==="TEXT"?oe(a.headerText):[],n=a.footer||"",l=n.trim().length>0,x=l?oe(n):[],u=l&&x.length>0,g=qe(a),b=a.mediaType?a.mediaType.toLowerCase():"",h=a.mediaUrl||"";return{templateName:r||a.name,templateType:Ge(a),templateContent:a.body,bodyTags:s,languageId:a.language||"en",isUnicode:!0,isBodyEditable:s.length>0,bodyMaxLength:1024,isAction:a.buttons.length>0,actions:a.buttons.map(Ae),isCarousel:!1,carousel:[],isHeader:g,isHeaderEditable:a.headerType==="TEXT"&&t.length>0,isHeaderType:ja(a),header:ka(a),headerTags:t,headerMaxLength:60,isFooter:l,isFooterEditable:u,footer:l?n:"",footerTags:x,footerMaxLength:60,isMedia:a.headerType==="MEDIA"&&!!h,isMediaEditable:!1,isMediaTypeEditable:!1,mediaType:b,mediaURL:h,mediaURLTags:[],mediaSizeInMB:10,mediaUrlMaxLength:1040}},Ta=(a,r)=>{var g;const s=oe(a.body),t=a.footer||"",n=t.trim().length>0,l=n?oe(t):[],x=((g=a.carousel)==null?void 0:g.cards)||[],u=Ma(a);return{templateName:r||a.name,templateType:Ge(a),templateContent:a.body,bodyTags:s,languageId:a.language||"en",isUnicode:!0,isBodyEditable:s.length>0,bodyMaxLength:1024,isAction:a.buttons.length>0,actions:a.buttons.map(Ae),isCarousel:!0,carousel:x.map((b,h)=>Ea(b,h,u)),isHeader:!1,isHeaderEditable:!1,isHeaderType:"",header:"",headerTags:[],headerMaxLength:60,isFooter:n,isFooterEditable:n&&l.length>0,footer:n?t:"",footerTags:l,footerMaxLength:60,isMedia:!1,isMediaEditable:!1,isMediaTypeEditable:!0,mediaType:"",mediaURL:"",mediaURLTags:[],mediaSizeInMB:10,mediaUrlMaxLength:1040}},Ea=(a,r,s)=>{const t=oe(a.body),n=s.toLowerCase(),l=a.mediaUrl||"";return{cardIndex:r,isUnicode:!0,bodyMaxLength:1024,cardBody:a.body,bodyTags:t,isCardBodyEditable:t.length>0,isMediaTypeEditable:!1,mediaType:n,mediaValue:l,actions:a.buttons.map(Ae)}},Ma=a=>{var n,l;const r=(n=a.carousel)==null?void 0:n.type;return r==="VIDEO"?"VIDEO":r==="IMAGE"?"IMAGE":(((l=a.carousel)==null?void 0:l.cards)||[]).some(x=>(x.mediaType||"").toUpperCase()==="VIDEO"?!0:x.mediaUrl?!!x.mediaUrl.toLowerCase().match(/\.(mp4|mov|m4v|avi|wmv|flv)(\?|$)/):!1)?"VIDEO":"IMAGE"},he=a=>a?/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(a):!1;function Sa({onCreateTemplate:a,onEditTemplate:r}){const[s,t]=k.useState([]),[n,l]=k.useTransition(),[x,u]=k.useState([]),[g,b]=k.useState(!1),{resulMeta:h,apiKey:M}=ze(),[c,w]=k.useState(()=>{const m=localStorage.getItem("account");return m?JSON.parse(m):{apiKey:""}}),T=k.useRef(c);T.current=c;const i=k.useCallback(()=>{const m=localStorage.getItem("account");let R={apiKey:""};try{m&&(R=JSON.parse(m))}catch(te){console.error("Failed to parse account from localStorage:",te)}const H=M||R.apiKey||"",_=h||R.resulMeta,q=T.current;if(H!==q.apiKey||_&&JSON.stringify(_)!==JSON.stringify(q.resulMeta)){const te={...R,apiKey:H,resulMeta:_};if(l(()=>{w(te)}),M||h)try{localStorage.setItem("account",JSON.stringify(te))}catch(ve){console.error("Failed to save account to localStorage:",ve)}}},[M,h,l]);k.useEffect(()=>{i()},[i]),k.useEffect(()=>{const m=R=>{R.key==="account"&&i()};return window.addEventListener("storage",m),()=>{window.removeEventListener("storage",m)}},[i]);const[d,p]=k.useState(!1);k.useEffect(()=>{if(!h)return;(async()=>{b(!0);try{const R={"Content-Type":"application/json",reqs:`${h.token}`},H={clientId:h.clientId,departmentId:h.departmentId,userId:h.userId,senderId:0},q=await(await fetch(ba(h),{method:"POST",headers:R,body:JSON.stringify(H)})).json();console.log("WA Sender Details:",q);const G=((q==null?void 0:q.data)||[]).filter(te=>String((te==null?void 0:te.ServiceProviderName)||"").toLowerCase().includes("trustsignal"));l(()=>{u(Array.isArray(G)?G:[])}),console.log("filterData",G)}catch(R){console.error("Error fetching WA sender details:",R),l(()=>{u([])})}finally{b(!1)}})()},[h,l]);const[f,C]=k.useState(()=>{const m=localStorage.getItem("account"),R=m?JSON.parse(m).apiKey:"";return he(R)}),[E,I]=k.useState(!1),[B,v]=k.useState(null),[j,A]=k.useState(null),[V,D]=k.useState({isOpen:!1}),[F,o]=k.useState({type:null,text:""}),y=k.useRef(null),[S,L]=k.useState(""),[U,z]=k.useState("all"),[O,ne]=k.useState("all"),[J,Z]=k.useState("all"),[N,K]=k.useState(1),$=20;k.useEffect(()=>{K(1)},[S,U,O,J]);const[W,P]=k.useState({isOpen:!1});k.useEffect(()=>{(async()=>{var H;const R=c.apiKey;if(!he(R)){y.current&&R!==y.current&&(l(()=>{t([])}),y.current=null),C(!1),I(!1);return}I(!0),v(null);try{const _=await Re(c,{limit:1});if((_==null?void 0:_.status)==="error")throw new Error(_.message||"Template list error");const q=(H=_==null?void 0:_.meta)==null?void 0:H.total;if(!q||q===0){l(()=>{t([])}),y.current=R,C(!1),I(!1);return}const G=await Re(c,{limit:q});if((G==null?void 0:G.status)==="error")throw new Error(G.message||"Template list error");l(()=>{t(Array.isArray(G.data)?G.data:[])}),y.current=R,C(!1)}catch(_){v(_ instanceof Error?_.message:"Failed to fetch templates"),y.current||l(()=>{t([])}),y.current=null,C(!1)}finally{I(!1)}})()},[c,l]);const ae=m=>{const R=m.target.value,H={...c,apiKey:R};l(()=>{w(H)}),localStorage.setItem("account",JSON.stringify(H))},re=(m,R)=>{P({isOpen:!0,url:m,templateName:R}),p(!0)},X=()=>{P({isOpen:!1}),p(!1)},Y=async m=>{try{const R=localStorage.getItem("account"),H=R?JSON.parse(R):{apiKey:""};if(!H.apiKey){o({type:"error",text:"Please enter your TrustSignal API key"});return}A(String(m)),o({type:null,text:""});const{deleteTemplateById:_}=await Promise.resolve().then(()=>require("./delete-CZKt5rSC.cjs")),q=await _(H.apiKey,m);if(!q.success){o({type:"error",text:q.message||"Delete failed"});return}o({type:"success",text:q.message||"Template deleted successfully"}),setTimeout(()=>{t(G=>G.filter(te=>String(te.id)!==String(m))),D({isOpen:!1}),o({type:null,text:""})},1500)}catch(R){o({type:"error",text:R instanceof Error?R.message:"Failed to delete template"})}finally{A(null)}},se=s.filter(m=>{const R=S.trim(),H=R.toLowerCase(),_=m.id!=null?String(m.id):"",q=m.name?String(m.name).toLowerCase():"",G=R===""||_.includes(R)||q.includes(H),te=U==="all"||String(m.status||"").toLowerCase()===U.toLowerCase(),ve=O==="all"||String(m.category||"").toLowerCase()===O.toLowerCase(),Ye=J==="all"||String(m.language||"").toLowerCase()===J.toLowerCase();return G&&te&&ve&&Ye}),ie=Array.from(new Set(s.map(m=>m.language).filter(Boolean))).sort(),le=Array.from(new Set(s.map(m=>m.category).filter(Boolean))).sort(),xe=Array.from(new Set(s.map(m=>m.status).filter(Boolean))).sort(),Q=Math.max(1,Math.ceil(se.length/$)),me=(N-1)*$,ce=me+$,fe=se.slice(me,ce);return e.jsxs("div",{className:"rsp-container rsp-mx-auto rsp-px-4 rsp-py-1 rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm",children:[e.jsx("div",{className:"rsp-flex rsp-justify-end rsp-items-center"}),e.jsx("div",{className:" rsp-p-4 rsp-pl-0 rsp-rounded-lg rsp-shadow-sm rsp-mb-6",children:e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-1",children:"TrustSignal Account"}),e.jsxs("div",{className:"rsp-flex rsp-items-end rsp-gap-2",children:[e.jsx("div",{className:"rsp-relative rsp-flex-1",children:e.jsxs("div",{className:"rsp-relative",children:[(E||g)&&e.jsx("div",{className:"rsp-absolute rsp-right-6 rsp-top-1/2 -rsp-translate-y-1/2 rsp-z-10",children:e.jsx(be,{className:"rsp-w-4 rsp-h-4 rsp-text-blue-600 rsp-animate-spin"})}),e.jsxs("select",{name:"trustsignalAccount",value:c.apiKey,onChange:ae,disabled:E||g,className:"rsp-w-full rsp-h-[50px] rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent disabled:rsp-opacity-70 disabled:rsp-cursor-wait rsp-transition-all",children:[e.jsx("option",{value:"",children:g?"Loading senders...":"Select TrustSignal sender"}),x.map(m=>{const R=m.SenderID??m.UserName??"trustsignal-sender",H=m.SenderName??m.ServiceProviderName??"TrustSignal Sender",_=m.UserName??"";return he(_)?e.jsx("option",{value:_,children:H},R):null})]})]})}),e.jsx("div",{className:"rsp-p-2",children:e.jsx("button",{onClick:()=>a==null?void 0:a(),disabled:!he(c.apiKey),className:"rsp-bg-blue-600 rsp-text-white rsp-p-1 rsp-rounded-full hover:rsp-bg-blue-700 rsp-flex rsp-items-center rsp-gap-2 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed disabled:hover:rsp-bg-blue-600 rsp-transition-all",title:he(c.apiKey)?"Add Template":"Please select a TrustSignal account first",children:e.jsx(Se,{className:"rsp-w-6 rsp-h-6"})})})]})]})}),B&&e.jsx("div",{className:"rsp-bg-red-50 rsp-border-l-4 rsp-border-red-500 rsp-p-4 rsp-mb-6",children:e.jsxs("div",{className:"rsp-flex",children:[e.jsx("div",{className:"rsp-flex-shrink-0",children:e.jsx(ge,{className:"rsp-h-5 rsp-w-5 rsp-text-red-400"})}),e.jsx("div",{className:"rsp-ml-3",children:e.jsx("p",{className:"rsp-text-sm rsp-text-red-700",children:B})})]})}),e.jsx("div",{className:"rsp-mb-6",children:e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{type:"text",placeholder:"Search by name or ID...",value:S,onChange:m=>L(m.target.value),className:"rsp-w-full rsp-px-0 rsp-py-3 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent"})})}),e.jsxs("div",{className:"rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200 rsp-overflow-hidden rsp-relative",children:[(E||n)&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-white/60 rsp-backdrop-blur-sm rsp-z-10 rsp-flex rsp-items-center rsp-justify-center rsp-transition-opacity",children:e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2",children:[e.jsx(be,{className:"rsp-w-6 rsp-h-6 rsp-text-blue-600 rsp-animate-spin"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:"Loading templates..."})]})}),e.jsx("div",{className:"rsp-overflow-x-auto",children:e.jsxs("table",{className:`rsp-min-w-full rsp-transition-opacity ${n?"rsp-opacity-70":"rsp-opacity-100"}`,children:[e.jsx("thead",{children:e.jsxs("tr",{className:"rsp-bg-blue-600 rsp-text-white",children:[e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"ID"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Name"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-gap-2",children:[e.jsx("span",{children:"Category"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center rsp-min-w-[120px]",children:[e.jsxs("select",{value:O,onChange:m=>ne(m.target.value),className:"rsp-pr-7 rsp-pl-2 rsp-py-1 rsp-border rsp-border-white rsp-border-opacity-30 rsp-rounded-md rsp-text-sm rsp-bg-blue-400 rsp-bg-opacity-30 rsp-appearance-none rsp-h-auto rsp-leading-normal focus:rsp-outline-none focus:rsp-border-opacity-60 focus:rsp-bg-opacity-50 rsp-cursor-pointer rsp-text-white hover:rsp-bg-opacity-40 hover:rsp-border-opacity-50 rsp-transition-all",onClick:m=>m.stopPropagation(),children:[e.jsx("option",{value:"all",className:"rsp-text-gray-900 rsp-bg-white",children:"All"}),le.map(m=>e.jsx("option",{value:m.toLowerCase(),className:"rsp-text-gray-900 rsp-bg-white",children:m.charAt(0).toUpperCase()+m.slice(1)},m))]}),e.jsx(je,{className:"rsp-absolute rsp-right-1.5 rsp-w-4 rsp-h-4 rsp-text-white rsp-pointer-events-none"})]})]})}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-gap-2",children:[e.jsx("span",{children:"Language"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center rsp-min-w-[120px]",children:[e.jsxs("select",{value:J,onChange:m=>Z(m.target.value),className:"rsp-pr-7 rsp-pl-2 rsp-py-1 rsp-border rsp-border-white rsp-border-opacity-30 rsp-rounded-md rsp-text-sm rsp-bg-blue-400 rsp-bg-opacity-30 rsp-appearance-none rsp-h-auto rsp-leading-normal focus:rsp-outline-none focus:rsp-border-opacity-60 focus:rsp-bg-opacity-50 rsp-cursor-pointer rsp-text-white hover:rsp-bg-opacity-40 hover:rsp-border-opacity-50 rsp-transition-all",onClick:m=>m.stopPropagation(),children:[e.jsx("option",{value:"all",className:"rsp-text-gray-900 rsp-bg-white",children:"All"}),ie.map(m=>e.jsx("option",{value:m,className:"rsp-text-gray-900 rsp-bg-white",children:String(m).toUpperCase()},m))]}),e.jsx(je,{className:"rsp-absolute rsp-right-1.5 rsp-w-4 rsp-h-4 rsp-text-white rsp-pointer-events-none"})]})]})}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Type"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-gap-2",children:[e.jsx("span",{children:"Status"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center rsp-min-w-[120px]",children:[e.jsxs("select",{value:U,onChange:m=>z(m.target.value),className:"rsp-pr-7 rsp-pl-2 rsp-py-1 rsp-border rsp-border-white rsp-border-opacity-30 rsp-rounded-md rsp-text-sm rsp-bg-blue-400 rsp-bg-opacity-30 rsp-appearance-none rsp-h-auto rsp-leading-normal focus:rsp-outline-none focus:rsp-border-opacity-60 focus:rsp-bg-opacity-50 rsp-cursor-pointer rsp-text-white hover:rsp-bg-opacity-40 hover:rsp-border-opacity-50 rsp-transition-all",onClick:m=>m.stopPropagation(),children:[e.jsx("option",{value:"all",className:"rsp-text-gray-900 rsp-bg-white",children:"All"}),xe.map(m=>e.jsx("option",{value:m.toLowerCase(),className:"rsp-text-gray-900 rsp-bg-white",children:m.charAt(0).toUpperCase()+m.slice(1)},m))]}),e.jsx(je,{className:"rsp-absolute rsp-right-1.5 rsp-w-4 rsp-h-4 rsp-text-white rsp-pointer-events-none"})]})]})}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Error"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Created"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Updated"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Media"}),e.jsx("th",{className:"rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium",children:"Actions"})]})}),e.jsx("tbody",{children:f&&fe.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:11,className:"rsp-px-6 rsp-py-12 rsp-text-center",children:e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-3",children:[e.jsx(be,{className:"rsp-w-8 rsp-h-8 rsp-text-blue-600 rsp-animate-spin"}),e.jsx("span",{className:"rsp-text-gray-600",children:"Loading templates..."})]})})}):fe.length>0?fe.map((m,R)=>{const H=String(m.status||"").toLowerCase();return e.jsxs("tr",{className:`rsp-border-b rsp-border-gray-200 ${R%2===0?"rsp-bg-white":"rsp-bg-blue-50"} hover:rsp-bg-blue-100 rsp-transition-colors`,children:[e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900",children:m.id??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900 rsp-font-medium",children:m.name??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700 rsp-capitalize",children:m.category??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:m.language??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:m.type??"—"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4",children:e.jsx("span",{className:`rsp-inline-flex rsp-px-3 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium
|
|
102
|
+
${H==="approved"?"rsp-bg-green-100 rsp-text-green-800":H==="rejected"?"rsp-bg-red-100 rsp-text-red-800":"rsp-bg-yellow-100 rsp-text-yellow-800"}`,children:m.status??"Unknown"})}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:H==="approved"?e.jsx("span",{className:"rsp-text-gray-400",children:"—"}):m.temp_error&&m.temp_error.trim()?e.jsx("span",{className:"rsp-inline-block rsp-px-2 rsp-py-1 rsp-rounded rsp-text-xs rsp-font-medium rsp-bg-red-100 rsp-text-red-800 rsp-max-w-xs rsp-truncate rsp-overflow-hidden rsp-text-ellipsis rsp-whitespace-nowrap",title:m.temp_error,style:{maxWidth:"300px"},children:m.temp_error}):e.jsx("span",{className:"rsp-text-gray-400",children:"—"})}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:m.creation_time?new Date(m.creation_time).toLocaleDateString():"N/A"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:m.updation_time?new Date(m.updation_time).toLocaleDateString():"N/A"}),e.jsx("td",{className:"rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700",children:m.medialist&&typeof m.medialist=="object"&&"header"in m.medialist&&m.medialist.header?e.jsxs("button",{onClick:()=>re(String(m.medialist.header||""),m.name||""),className:"rsp-inline-flex rsp-items-center rsp-px-3 rsp-py-1 rsp-rounded rsp-text-xs rsp-font-medium rsp-bg-blue-100 rsp-text-blue-800 hover:rsp-bg-blue-200 rsp-transition-colors",children:[e.jsxs("svg",{className:"rsp-w-3 rsp-h-3 rsp-mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),e.jsx("span",{children:"View Media"})]}):e.jsx("span",{className:"rsp-inline-flex rsp-px-2 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium rsp-bg-gray-100 rsp-text-gray-800",children:"No Media"})}),e.jsx("td",{className:"rsp-px-6 rsp-py-4",children:e.jsxs("div",{className:"rsp-flex rsp-gap-2",children:[e.jsx("button",{onClick:()=>{const _=String(m.id),q=String(m.status||"").toLowerCase();r==null||r(_),c.resulMeta&&q==="approved"?ya(_,c.resulMeta).then(G=>{if(G!==null){const te=`waTemplateId_${_}`;localStorage.setItem(te,String(G)),console.log("✅ Stored WATemplateID:",G,"for template:",_)}}).catch(G=>{console.error("Failed to fetch WATemplateID on edit click (non-critical):",G)}):q!=="approved"&&console.log("⚠️ Skipping GetWATemplateID - template status is not approved:",q)},className:"rsp-inline-flex rsp-items-center rsp-justify-center rsp-w-8 rsp-h-8 rsp-rounded rsp-bg-blue-600 rsp-text-white hover:rsp-bg-blue-700 rsp-transition-colors",title:"Update",children:e.jsx(ia,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>D({isOpen:!0,templateId:String(m.id),templateName:m.name}),disabled:j===String(m.id),className:`rsp-inline-flex rsp-items-center rsp-justify-center rsp-w-8 rsp-h-8 rsp-rounded rsp-text-white rsp-transition-colors ${j===String(m.id)?"rsp-bg-red-400":"rsp-bg-red-600 hover:rsp-bg-red-700"}`,title:j===String(m.id)?"Deleting...":"Delete",children:e.jsx(ca,{className:"rsp-w-4 rsp-h-4"})})]})})]},String(m.id)||R)}):f?null:e.jsx("tr",{children:e.jsx("td",{colSpan:11,className:"rsp-px-6 rsp-py-8 rsp-text-center rsp-text-gray-500",children:he(c.apiKey)?"No templates found":"Please select a TrustSignal account"})})})]})})]}),fe.length>0&&e.jsxs("div",{className:"rsp-flex rsp-justify-between rsp-items-center rsp-mt-6 rsp-px-6 rsp-py-4 rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200",children:[e.jsxs("div",{className:"rsp-text-sm rsp-text-gray-700",children:["Showing ",e.jsx("span",{className:"rsp-font-medium",children:me+1})," to ",e.jsx("span",{className:"rsp-font-medium",children:Math.min(ce,se.length)})," of ",e.jsx("span",{className:"rsp-font-medium",children:se.length})," results"]}),e.jsxs("div",{className:"rsp-flex rsp-gap-2",children:[e.jsx("button",{onClick:()=>K(m=>Math.max(m-1,1)),disabled:N===1,className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",children:"Previous"}),e.jsxs("span",{className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700",children:["Page ",N," of ",Q]}),e.jsx("button",{onClick:()=>K(m=>Math.min(m+1,Q)),disabled:N===Q,className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",children:"Next"})]})]}),e.jsx(ye,{isOpen:W.isOpen,onClose:X,title:`Media - ${W.templateName||"Template"}`,children:e.jsxs("div",{className:"rsp-space-y-4",children:[W.url&&e.jsxs("div",{className:"rsp-text-center",children:[e.jsxs("div",{className:"rsp-relative rsp-bg-gray-50 rsp-rounded-lg rsp-p-4 rsp-min-h-[200px] rsp-flex rsp-items-center rsp-justify-center",children:[e.jsx("img",{src:W.url,alt:"Template media",className:"rsp-max-w-full rsp-max-h-[400px] rsp-mx-auto rsp-rounded-lg rsp-shadow-md rsp-object-contain",onLoad:()=>{p(!1)},onError:()=>{p(!1)}}),d&&e.jsx("div",{className:"loading-placeholder rsp-absolute rsp-inset-0 rsp-flex rsp-items-center rsp-justify-center",children:e.jsx("div",{className:"rsp-text-gray-500 rsp-text-sm",children:"Loading media..."})}),!d&&e.jsxs("div",{className:"error-placeholder rsp-absolute rsp-inset-0 rsp-flex rsp-flex-col rsp-items-center rsp-justify-center",style:{display:"none"},children:[e.jsx("svg",{className:"rsp-w-[100%] rsp-h-12 rsp-text-gray-400 rsp-m-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e.jsx("p",{className:"rsp-text-gray-500 rsp-text-sm rsp-mb-2",children:"Load media on new tab"})]})]}),e.jsxs("div",{className:"rsp-mt-4 rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg",children:[e.jsx("p",{className:"rsp-text-xs rsp-text-gray-600 rsp-mb-1",children:"Media URL:"}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-800 rsp-break-all rsp-font-mono",children:W.url})]})]}),e.jsx("div",{className:"rsp-flex rsp-justify-end rsp-pt-4",children:e.jsxs("a",{href:W.url,target:"_blank",rel:"noopener noreferrer",className:"rsp-inline-flex rsp-items-center rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-text-sm rsp-font-medium rsp-rounded-md hover:rsp-bg-blue-700 rsp-transition-colors",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),"Open in New Tab"]})})]})}),e.jsx(ye,{isOpen:V.isOpen,onClose:()=>{D({isOpen:!1}),o({type:null,text:""})},title:"Delete Template",children:e.jsxs("div",{className:"rsp-space-y-4",children:[F.type===null?e.jsxs("p",{className:"rsp-text-sm rsp-text-gray-700",children:["Are you sure you want to delete the template ",e.jsx("span",{className:"rsp-font-medium",children:V.templateName}),"?"]}):F.type==="success"?e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-p-3 rsp-bg-green-50 rsp-border rsp-border-green-200 rsp-rounded-md",children:[e.jsx("svg",{className:"rsp-w-5 rsp-h-5 rsp-text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e.jsx("p",{className:"rsp-text-sm rsp-font-medium rsp-text-green-800",children:F.text})]}):e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-p-3 rsp-bg-red-50 rsp-border rsp-border-red-200 rsp-rounded-md",children:[e.jsx(ge,{className:"rsp-w-5 rsp-h-5 rsp-text-red-600"}),e.jsx("p",{className:"rsp-text-sm rsp-font-medium rsp-text-red-800",children:F.text})]}),e.jsxs("div",{className:"rsp-flex rsp-justify-end rsp-gap-3",children:[F.type===null&&e.jsx("button",{onClick:()=>{D({isOpen:!1}),o({type:null,text:""})},className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50",children:"Cancel"}),e.jsx("button",{onClick:()=>V.templateId&&Y(V.templateId),disabled:j===V.templateId,className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-white rsp-bg-red-600 rsp-rounded-md hover:rsp-bg-red-700 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-flex rsp-items-center rsp-gap-2",children:j===V.templateId?e.jsxs(e.Fragment,{children:[e.jsx(be,{className:"rsp-w-4 rsp-h-4 rsp-animate-spin"}),"Deleting..."]}):F.type==="success"?"Close":"Delete"})]})]})})]})}const La=async(a,r)=>{var s,t,n,l,x,u,g;try{console.log("Creating template with data:",r);const b=r.language,h=r.headerType==="MEDIA"&&r.mediaType==="DOCUMENT",M=r.type==="CAROUSEL";let c="";h?c=Ke(r,b):M?c=Je(r,b):c=Xe(r,b),console.log("Raw JSON string being sent:",c);const w={method:"POST",headers:{"Content-Type":"application/json"},body:c,redirect:"follow"};console.log("Making request to:",`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`),console.log("Request options:",w);const T=await fetch(`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`,w);console.log("Response status:",T.status),console.log("Response headers:",Object.fromEntries(T.headers.entries()));const i=await T.text();console.log("Raw response:",i);let d;try{d=JSON.parse(i)}catch(p){throw new Error(`Invalid JSON response from TrustSignal API: ${p instanceof Error?p.message:"Unknown error"}`)}if(console.log("Parsed response:",d),!d.success){if(d.errors&&Array.isArray(d.errors)&&d.errors.length>0){const p=d.errors.map(f=>typeof f=="string"?f:f.message||f.codeMsg||f.code||"Unknown error");throw new Error(p.join("; "))}throw new Error(d.message||"Template creation failed")}return{status:"success",message:"Template created successfully",data:{template:d.template,details:[{template_name:((s=d.template)==null?void 0:s.name)||r.name,template_id:((t=d.template)==null?void 0:t.id)||"unknown",meta_tid:(n=d.template)==null?void 0:n.meta_tid,status:(l=d.template)==null?void 0:l.status,quality:(x=d.template)==null?void 0:x.quality,temp_route:(u=d.template)==null?void 0:u.temp_route,temptype:(g=d.template)==null?void 0:g.temptype}]}}}catch(b){return console.error("TrustSignal API Error:",b),{status:"error",message:b instanceof Error?b.message:"Failed to create template"}}};function Aa(a){const r=a.language,s=a.headerType==="MEDIA"&&a.mediaType==="DOCUMENT",t=a.type==="CAROUSEL";return s?Ke(a,r):t?Je(a,r):Xe(a,r)}const Ke=(a,r)=>{var l,x;const s={name:a.name,lang:r,category:a.category,components:[]};a.headerType==="MEDIA"&&a.mediaUrl&&(s.media={header:a.mediaUrl},s.components.push({type:"HEADER",format:"DOCUMENT"}));const t=de(a.body),n={type:"BODY",text:a.body};if(t.length>0&&((l=a.sampleContent)!=null&&l.bodyVariables)){const u=Ue(a,t);n.example={body_text:[u]}}if(s.components.push(n),(x=a.footer)!=null&&x.trim()&&s.components.push({type:"FOOTER",text:a.footer}),a.buttons&&a.buttons.length>0){const u=a.buttons.map(g=>{const b={type:g.type==="CALL"?"PHONE_NUMBER":g.type,text:g.text};if(g.type==="URL"&&g.value&&(b.url=g.value,g.urlType==="dynamic"&&g.value.includes("{{"))){const h=de(g.value);if(h.length>0){const M=h.map(({number:c})=>{var w,T;return((T=(w=a.sampleContent)==null?void 0:w.buttonVariables)==null?void 0:T[c])||`sample${c}`});b.example=M}}return(g.type==="CALL"||g.type==="PHONE_NUMBER")&&g.value&&(b.phone_number=Ie(g.value)),b});s.components.push({type:"BUTTONS",buttons:u})}return JSON.stringify(s)},Je=(a,r)=>{var x,u,g;const s={name:a.name,lang:r,category:a.category,shortlink:a.enableClickTracking?"1":"0",components:[]};(x=a.carousel)!=null&&x.cards.length&&(s.media={},a.carousel.cards.forEach((b,h)=>{b.mediaUrl&&(s.media[`card${h}header`]=b.mediaUrl)}));const t=[],n=de(a.body),l={type:"BODY",text:a.body,...n.length>0&&((u=a.sampleContent)==null?void 0:u.bodyVariables)&&{example:{body_text:[Ue(a,n)]}}};if(t.push(l),(g=a.carousel)!=null&&g.cards.length){const b={type:"CAROUSEL",cards:a.carousel.cards.map(h=>{var M;return{components:[{type:"HEADER",format:((M=a.carousel)==null?void 0:M.type)||"IMAGE"},{type:"BODY",text:h.body,...de(h.body).length>0&&{example:{body_text:[Ia(h)]}}},...h.buttons.length>0?[{type:"BUTTONS",buttons:h.buttons.map(c=>{var T;const w={type:c.type==="CALL"?"PHONE_NUMBER":c.type,text:c.text};if(c.type==="URL"&&c.value&&(w.url=c.value,c.urlType==="dynamic"&&c.value.includes("{{"))){const i=de(c.value);if(i.length>0){const d=((T=h==null?void 0:h.sampleContent)==null?void 0:T.buttonVariables)||{},p=i.map(({number:f})=>d[f]||`sample${f}`);w.example=p}}return(c.type==="CALL"||c.type==="PHONE_NUMBER")&&c.value&&(w.phone_number=Ie(c.value)),console.log("Carousel card button data:",w),w})}]:[]]}})};t.push(b)}return s.components=t,JSON.stringify(s)},Ia=a=>{var t;const r=de(a.body||""),s=((t=a==null?void 0:a.sampleContent)==null?void 0:t.bodyVariables)||{};return r.map(({number:n})=>s[n]||`Sample ${n}`)},Xe=(a,r)=>{var x,u;const s={name:a.name,lang:r,category:a.category,shortlink:a.enableClickTracking?"1":"0",components:[]};a.headerType==="MEDIA"&&a.mediaUrl&&a.mediaType!=="DOCUMENT"&&(s.media={header:a.mediaUrl});const t=[];if(a.type!=="CAROUSEL"){if(a.headerType==="TEXT"&&a.headerText){const g=de(a.headerText),b={type:"HEADER",format:"TEXT",text:a.headerText,...g.length>0&&((x=a.sampleContent)==null?void 0:x.headerVariables)&&{example:{header_text:Ua(a,g)}}};t.push(b)}else if(a.headerType==="MEDIA"){const g={type:"HEADER",format:a.mediaType||"IMAGE"};t.push(g)}}const n=de(a.body),l={type:"BODY",text:a.body,...n.length>0&&((u=a.sampleContent)==null?void 0:u.bodyVariables)&&{example:{body_text:[Ue(a,n)]}}};if(t.push(l),a.footer&&a.type!=="CAROUSEL"&&t.push({type:"FOOTER",text:a.footer}),a.buttons.length>0){const g=a.buttons.map(b=>{const h={type:b.type==="CALL"?"PHONE_NUMBER":b.type,text:b.text};if(b.type==="URL"&&b.value&&(h.url=b.value,b.urlType==="dynamic"&&b.value.includes("{{"))){const M=de(b.value);if(M.length>0){const c=M.map(({number:w})=>{var T,i;return((i=(T=a.sampleContent)==null?void 0:T.buttonVariables)==null?void 0:i[w])||`sample${w}`});h.example=c}}return(b.type==="CALL"||b.type==="PHONE_NUMBER")&&b.value&&(h.phone_number=Ie(b.value)),h});t.push({type:"BUTTONS",buttons:g})}return s.components=t,JSON.stringify(s)},de=a=>(a.match(/\{\{(\d+)\}\}/g)||[]).map(s=>({variable:s.replace(/[{}]/g,""),number:s.replace(/[{}]/g,"")})),Ie=a=>a.startsWith("+")?a:`+${a}`,Ua=(a,r)=>r.map(({number:s})=>{var t,n;return((n=(t=a.sampleContent)==null?void 0:t.headerVariables)==null?void 0:n[s])||`Sample ${s}`}),Ue=(a,r)=>r.map(({number:s})=>{var t,n;return((n=(t=a.sampleContent)==null?void 0:t.bodyVariables)==null?void 0:n[s])||`Sample ${s}`}),Va=async(a,r)=>{var s;try{if(!r.name||!r.body)throw new Error("Missing required template fields: name and body are required");if(r.type==="CAROUSEL"&&(!r.carousel||!r.carousel.cards||r.carousel.cards.length===0))throw new Error("Carousel templates must have at least one card");if(!a.apiKey)throw new Error("Missing TrustSignal API key");const t=await La(a.apiKey,r);if(t.status==="error")return t;const n=t.data&&!Array.isArray(t.data)?(s=t.data.template)==null?void 0:s.id:void 0;try{await $e(r,a.resulMeta,n)}catch(l){console.error("Resul template submission failed (non-critical):",l)}return t}catch(t){return console.error("API Error:",t),{status:"error",message:t instanceof Error?t.message:"An unexpected error occurred while creating the template"}}},Ra=a=>(a.match(/{{(\d+)}}/g)||[]).map(s=>s.replace(/[{}]/g,""));async function Ba(a,r,s){var M;const t=Aa(s),l={method:"POST",headers:{"Content-Type":"application/json"},body:t,redirect:"follow"},x=`https://wpapi.trustsignal.io/v1/user-templates/update/${encodeURIComponent(r)}?api_key=${encodeURIComponent(a.apiKey)}`,u=`waTemplateId_${r}`;let g=null;try{const c=localStorage.getItem(u);c?(g=parseInt(c,10),console.log("✅ Retrieved WATemplateID from storage:",g,"for template:",r)):console.log("⚠️ No WATemplateID found in storage for template:",r)}catch(c){console.error("Failed to retrieve WATemplateID from storage:",c)}const b=await fetch(x,l),h=await b.text();try{const c=JSON.parse(h);if(!b.ok||!c.success){let i="Update failed";return c.errors&&Array.isArray(c.errors)&&c.errors.length>0?i=c.errors.map(p=>typeof p=="string"?p:p&&typeof p=="object"&&"message"in p?p.message||"Unknown error":p&&typeof p=="object"&&"codeMsg"in p?p.codeMsg||"Unknown error":p&&typeof p=="object"&&"code"in p&&String(p.code)||"Unknown error").join("; "):c.message?i=c.message:b.ok||(i=`Update failed (${b.status}): ${h}`),{success:!1,message:i,raw:t}}const w=((M=c.template)==null?void 0:M.id)||r,T=g!==null?g:0;try{await $e(s,a.resulMeta,w,T)}catch(i){console.error("Resul template submission failed (non-critical):",i)}try{localStorage.removeItem(u),console.log("✅ Cleaned up stored WATemplateID for template:",r)}catch(i){console.error("Failed to clean up stored WATemplateID:",i)}return{success:!0,message:c==null?void 0:c.message,raw:t}}catch{return b.ok?{success:!0,raw:t}:{success:!1,message:`Update failed (${b.status}): ${h}`,raw:t}}}async function Da(a,r){var u;const s=`https://wpapi.trustsignal.io/api/v1/template/${encodeURIComponent(r)}?api_key=${encodeURIComponent(a)}`,t=await fetch(s,{method:"GET",redirect:"follow"});if(!t.ok)throw new Error(`Failed to fetch template ${r}: ${t.status}`);const n=await t.text(),l=JSON.parse(n),x=l.template||((u=l.data)==null?void 0:u.template)||l;if(!x)throw new Error("Invalid template details response");return Pa(x)}function Pa(a){var h,M;const r={headerVariables:{},bodyVariables:{},buttonVariables:{}};let s="NONE",t="",n,l,x="",u="";const g=[];if(a.jsonstruct)try{const c=JSON.parse(a.jsonstruct);if(c!=null&&c.header){const w=c.header.format;w&&w!=="TEXT"?(s="MEDIA",n=w,l=c.header.url||((h=a.medialist)==null?void 0:h.header)):w==="TEXT"&&(s="TEXT",t=c.header.text||"")}if(c!=null&&c.body&&(x=c.body.text||""),(M=c==null?void 0:c.buttons)!=null&&M.buttons&&Array.isArray(c.buttons.buttons))for(const w of c.buttons.buttons){if(!w||!w.type||!w.text)continue;const T={id:Ne(),type:w.type==="PHONE_NUMBER"?"PHONE_NUMBER":w.type,text:w.text};w.type==="URL"&&(T.value=w.url,typeof w.url=="string"&&w.url.includes("{{")&&Array.isArray(w.example)?(De(w.url).forEach((d,p)=>{r.buttonVariables[d]=w.example[p]??""}),T.urlType="dynamic"):T.urlType="static"),(w.type==="CALL"||w.type==="PHONE_NUMBER")&&(T.value=w.phone_number||""),g.push(T)}if(c!=null&&c.carousel){const w=Object.keys(c.carousel).filter(f=>/^card\d+$/.test(f));w.sort((f,C)=>{const E=parseInt(f.replace("card",""),10),I=parseInt(C.replace("card",""),10);return E-I});const T=w.map(f=>{const C=c.carousel[f]||{},E=C.header||{},I=C.body||{},B=C.buttons&&Array.isArray(C.buttons.buttons)?C.buttons.buttons:[],v=E.format,j=v==="IMAGE"||v==="VIDEO"||v==="DOCUMENT"?v:void 0,V=`card${f.replace("card","")}header`,D=E.url||(a.medialist&&typeof a.medialist=="object"&&V in a.medialist?a.medialist[V]:void 0),F=I.text||"",o=[];for(const y of B){if(!y||!y.type||!y.text)continue;const S={id:Ne(),type:y.type==="PHONE_NUMBER"?"PHONE_NUMBER":y.type,text:y.text};y.type==="URL"&&(S.value=y.url,typeof y.url=="string"&&y.url.includes("{{")&&Array.isArray(y.example)?(De(y.url).forEach((U,z)=>{}),S.urlType="dynamic"):S.urlType="static"),(y.type==="CALL"||y.type==="PHONE_NUMBER")&&(S.value=y.phone_number||""),o.push(S)}return{id:Ne(),headerType:j?"MEDIA":"NONE",mediaType:j,mediaUrl:D,body:F,buttons:o,sampleContent:{headerVariables:{},bodyVariables:{},buttonVariables:{}}}});let i="IMAGE";const d=T[0];(d==null?void 0:d.mediaType)==="VIDEO"&&(i="VIDEO");const p={type:i,cards:T};return{name:a.name,category:a.category==="MARKETING"||a.category==="UTILITY"?a.category:"MARKETING",type:"CAROUSEL",language:a.lang||"en",enableClickTracking:!1,headerType:"NONE",headerText:"",body:x,footer:u,buttons:[],sampleContent:r,carousel:p}}}catch(c){console.warn("Failed to parse jsonstruct; falling back",c)}return{name:a.name,category:a.category==="MARKETING"||a.category==="UTILITY"?a.category:"MARKETING",type:"BASIC",language:a.lang||"en",enableClickTracking:!1,headerType:s,headerText:t,mediaType:n,mediaUrl:l,body:x,footer:u,buttons:g,sampleContent:r}}function De(a){if(!a)return[];const r=a.match(/\{\{(\d+)\}\}/g)||[];return[...new Set(r.map(s=>s.replace(/[{}]/g,"")))]}function Ne(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"id-"+Math.random().toString(36).slice(2)}const _a=[{value:"af",label:"Afrikaans"},{value:"sq",label:"Albanian"},{value:"ar",label:"Arabic"},{value:"az",label:"Azerbaijani"},{value:"bn",label:"Bengali"},{value:"bg",label:"Bulgarian"},{value:"ca",label:"Catalan"},{value:"zh_CN",label:"Chinese (CHN)"},{value:"zh_HK",label:"Chinese (HKG)"},{value:"zh_TW",label:"Chinese (TAI)"},{value:"hr",label:"Croatian"},{value:"cs",label:"Czech"},{value:"da",label:"Danish"},{value:"nl",label:"Dutch"},{value:"en_GB",label:"English (UK)"},{value:"en_US",label:"English (US)"},{value:"en",label:"English"},{value:"et",label:"Estonian"},{value:"fil",label:"Filipino"},{value:"fi",label:"Finnish"},{value:"fr",label:"French"},{value:"de",label:"German"},{value:"el",label:"Greek"},{value:"gu",label:"Gujarati"},{value:"he",label:"Hebrew"},{value:"hi",label:"Hindi"},{value:"hu",label:"Hungarian"},{value:"id",label:"Indonesian"},{value:"ga",label:"Irish"},{value:"it",label:"Italian"},{value:"ja",label:"Japanese"},{value:"kn",label:"Kannada"},{value:"kk",label:"Kazakh"},{value:"ko",label:"Korean"},{value:"lo",label:"Lao"},{value:"lv",label:"Latvian"},{value:"lt",label:"Lithuanian"},{value:"mk",label:"Macedonian"},{value:"ms",label:"Malay"},{value:"mr",label:"Marathi"},{value:"nb",label:"Norwegian"},{value:"fa",label:"Persian"},{value:"pl",label:"Polish"},{value:"pt_BR",label:"Portuguese (BR)"},{value:"pt_PT",label:"Portuguese (POR)"},{value:"pa",label:"Punjabi"},{value:"ro",label:"Romanian"},{value:"ru",label:"Russian"},{value:"sr",label:"Serbian"},{value:"sk",label:"Slovak"},{value:"sl",label:"Slovenian"},{value:"es",label:"Spanish"},{value:"es_AR",label:"Spanish (ARG)"},{value:"es_ES",label:"Spanish (SPA)"},{value:"es_MX",label:"Spanish (MEX)"},{value:"sw",label:"Swahili"},{value:"sv",label:"Swedish"},{value:"ta",label:"Tamil"},{value:"te",label:"Telugu"},{value:"th",label:"Thai"},{value:"tr",label:"Turkish"},{value:"uk",label:"Ukrainian"},{value:"ur",label:"Urdu"},{value:"uz",label:"Uzbek"},{value:"vi",label:"Vietnamese"}],Oa=[{value:"NONE",label:"None"},{value:"TEXT",label:"Text"},{value:"MEDIA",label:"Media"}],Fa=[{value:"IMAGE",label:"Image"},{value:"VIDEO",label:"Video"},{value:"DOCUMENT",label:"Document"}],za=5*1024*1024,$a=16*1024*1024,Ha=100*1024*1024,Ce=["jpg","jpeg","png"],Te=["mp4","3gpp"],Ee=["pdf","docx","xlsx","pptx","txt"];function Wa({template:a,setTemplate:r,onFileUpload:s}){var I,B;const[t,n]=k.useState(null),[l,x]=k.useState(!1),[u,g]=k.useState(null),[b,h]=k.useState(null),M=()=>{const j=(a.headerText||"").match(/{{\d+}}/g);if(!j)return 0;const A=j.map(V=>{const D=V.match(/{{(\d+)}}/);return D?parseInt(D[1],10):0});return A.length>0?Math.max(...A):0},c=()=>{var V,D,F;const j=M()+1,A=`{{${j}}}`;if(u&&a.headerText.length+A.length<=60){const o=u.selectionStart||a.headerText.length,y=a.headerText.substring(0,o),S=a.headerText.substring(o),L=y+A+S,U={...a.sampleContent,headerVariables:{...(V=a.sampleContent)==null?void 0:V.headerVariables,[j.toString()]:`Header Sample ${j}`},bodyVariables:((D=a.sampleContent)==null?void 0:D.bodyVariables)||{},buttonVariables:((F=a.sampleContent)==null?void 0:F.buttonVariables)||{}};r({...a,headerText:L,sampleContent:U}),setTimeout(()=>{if(u){const z=o+A.length;u.setSelectionRange(z,z),u.focus()}},0)}},w=v=>{r(j=>({...j,headerType:v,headerText:v==="TEXT"?j.headerText:"",mediaType:v==="MEDIA"?j.mediaType||"IMAGE":void 0,mediaUrl:v==="MEDIA"?j.mediaUrl:void 0})),v!=="MEDIA"&&(n(null),h(null))},T=v=>{var j;return((j=v.split("?")[0].split(".").pop())==null?void 0:j.toLowerCase())||""},i=(v,j)=>{const A=T(v.name);switch(j){case"IMAGE":if(!Ce.includes(A))return"Invalid format. Only JPG, JPEG, PNG are allowed.";if(v.size>za)return"File is too large. Max size is 5 MB.";break;case"VIDEO":if(!Te.includes(A))return"Invalid format. Only MP4, 3GPP are allowed.";if(v.size>$a)return"File is too large. Max size is 16 MB.";break;case"DOCUMENT":if(!Ee.includes(A))return"Invalid format. Allowed types: PDF, DOCX, XLSX, PPTX, TXT.";if(v.size>Ha)return"File is too large. Max size is 100 MB.";break;default:return"Invalid media type."}return null},d=(v,j)=>{if(!v)return null;const A=T(v);switch(j){case"IMAGE":if(!Ce.includes(A))return"URL does not point to a valid image (JPG, JPEG, PNG).";break;case"VIDEO":if(!Te.includes(A))return"URL does not point to a valid video (MP4, 3GPP).";break;case"DOCUMENT":if(!Ee.includes(A))return"URL does not point to a valid document.";break}return null},p=()=>{n(null),r({...a,mediaUrl:""}),h(null)},f=async v=>{var V;const j=(V=v.target.files)==null?void 0:V[0];if(!j||!a.mediaType)return;h(null);const A=i(j,a.mediaType);if(A){h(A);return}x(!0),n(j);try{const D=await s(j);r({...a,mediaUrl:D})}catch(D){console.error("File upload failed:",D),p();const F=D instanceof Error?D.message:"File upload failed. Please try again.";h(F)}finally{x(!1)}},C=v=>{const j=v.target.value;if(n(null),r({...a,mediaUrl:j}),a.mediaType){const A=d(j,a.mediaType);h(A)}},E=()=>{switch(a.mediaType){case"IMAGE":return Ce.map(v=>`.${v}`).join(",");case"VIDEO":return Te.map(v=>`.${v}`).join(",");case"DOCUMENT":return Ee.map(v=>`.${v}`).join(",");default:return"*/*"}};return e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Header Type"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("select",{value:a.headerType,onChange:v=>w(v.target.value),className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:Oa.map(v=>e.jsx("option",{value:v.value,children:v.label},v.value))}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500"})]})]}),a.headerType==="TEXT"&&e.jsxs("div",{className:"rsp-animate-fade-in",children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Header Text"}),e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{ref:g,type:"text",value:a.headerText,onChange:v=>{var o,y,S;const j=v.target.value,A=j.match(/\{\{(\d+)\}\}/g)||[],V=[...new Set(A.map(L=>L.replace(/[{}]/g,"")))],D=((o=a.sampleContent)==null?void 0:o.headerVariables)||{},F={...D};V.forEach(L=>{D[L]||(F[L]=`Header Sample ${L}`)}),Object.keys(F).forEach(L=>{V.includes(L)||delete F[L]}),r({...a,headerText:j,sampleContent:{...a.sampleContent,headerVariables:F,bodyVariables:((y=a.sampleContent)==null?void 0:y.bodyVariables)||{},buttonVariables:((S=a.sampleContent)==null?void 0:S.buttonVariables)||{}}})},maxLength:60,className:"rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",placeholder:"Add a 60 character title to your message"})}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-2",children:[e.jsx("button",{onClick:c,className:"rsp-px-2 rsp-py-1 rsp-text-xs hover:rsp-bg-gray-100 rsp-rounded rsp-text-gray-500 rsp-flex rsp-items-center rsp-gap-1",title:"Add variable to header",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500",children:[a.headerText.length,"/60"]})]})]}),a.headerType==="MEDIA"&&e.jsxs("div",{className:"rsp-space-y-6 rsp-animate-fade-in",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Media Type"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("select",{value:a.mediaType||"IMAGE",onChange:v=>{r(j=>({...j,mediaType:v.target.value,mediaUrl:""})),n(null),h(null)},className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:Fa.map(v=>e.jsx("option",{value:v.value,children:v.label},v.value))}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]}),e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700",children:"Media"}),a.mediaUrl?e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-p-3 rsp-bg-gray-50 rsp-border rsp-border-gray-200 rsp-rounded-md",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-space-x-3 overflow-hidden",children:[a.mediaType==="IMAGE"&&e.jsx("img",{src:a.mediaUrl,alt:"Preview",className:"rsp-w-12 rsp-h-12 rsp-object-cover rsp-rounded",onError:v=>{v.currentTarget.style.display="none",b||h("Could not load image preview from URL.")},onLoad:()=>{b!=null&&b.includes("Could not load")&&h(null)}}),a.mediaType==="VIDEO"&&e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0",children:e.jsx(na,{className:"rsp-w-6 rsp-h-6 rsp-text-gray-500"})}),a.mediaType==="DOCUMENT"&&e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0",children:e.jsx(ra,{className:"rsp-w-6 rsp-h-6 rsp-text-gray-500"})}),e.jsxs("div",{className:"overflow-hidden",children:[e.jsx("p",{className:"rsp-text-sm rsp-font-medium rsp-text-gray-900 rsp-truncate",children:t?t.name:a.mediaUrl}),t&&e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500",children:`${(t.size/1024/1024).toFixed(2)} MB`})]})]}),e.jsx("button",{onClick:p,className:"rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 rsp-transition-colors flex-shrink-0",children:e.jsx(pe,{className:"rsp-w-4 rsp-h-4"})})]}):e.jsxs("div",{children:[e.jsx("input",{type:"file",accept:E(),onChange:f,className:"rsp-hidden",id:"media-upload",disabled:l}),e.jsxs("label",{htmlFor:"media-upload",className:`rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-dashed rsp-border-gray-300 rsp-rounded-md rsp-flex rsp-flex-col rsp-items-center rsp-justify-center rsp-cursor-pointer rsp-transition-colors hover:rsp-border-gray-400 hover:rsp-bg-gray-50 ${l?"rsp-opacity-50 rsp-cursor-not-allowed":""}`,children:[e.jsx(xa,{className:"rsp-w-6 rsp-h-6 rsp-text-gray-400 rsp-mb-2"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:l?"Uploading...":`Upload ${((I=a.mediaType)==null?void 0:I.toLowerCase())||"file"}`}),e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-400 rsp-mt-1",children:[a.mediaType==="IMAGE"&&"JPG, PNG up to 5MB",a.mediaType==="VIDEO"&&"MP4, 3GPP up to 16MB",a.mediaType==="DOCUMENT"&&"PDF, DOCX, etc. up to 100MB"]})]})]}),b&&e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-text-xs rsp-text-red-600",children:[e.jsx(ge,{className:"rsp-w-4 rsp-h-4"}),e.jsx("span",{children:b})]}),e.jsxs("div",{className:"rsp-flex rsp-items-center",children:[e.jsx("div",{className:"rsp-flex-1 rsp-border-t rsp-border-gray-300"}),e.jsx("span",{className:"rsp-px-3 rsp-text-sm rsp-text-gray-500",children:"OR"}),e.jsx("div",{className:"rsp-flex-1 rsp-border-t rsp-border-gray-300"})]}),e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{type:"url",value:a.mediaUrl||"",onChange:C,className:"rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",placeholder:`Enter ${(B=a.mediaType)==null?void 0:B.toLowerCase()} URL`})})]})]})]})}const Pe=[{name:"grinning-face",hexadecimal:"😀"},{name:"grinning-face-with-smiling-eyes",hexadecimal:"😁"},{name:"face-with-tears-of-joy",hexadecimal:"😂"},{name:"rolling-on-the-floor-laughing",hexadecimal:"🤣"},{name:"smiling-face-with-open-mouth",hexadecimal:"😃"},{name:"smiling-face-with-open-mouth-and-smiling-eyes",hexadecimal:"😄"},{name:"smiling-face-with-open-mouth-and-cold-sweat",hexadecimal:"😅"},{name:"smiling-face-with-open-mouth-and-tightly-closed-eyes",hexadecimal:"😆"},{name:"winking-face",hexadecimal:"😉"},{name:"smiling-face-with-smiling-eyes",hexadecimal:"😊"},{name:"face-savouring-delicious-food",hexadecimal:"😋"},{name:"smiling-face-with-sunglasses",hexadecimal:"😎"},{name:"smiling-face-with-heart-shaped-eyes",hexadecimal:"😍"},{name:"face-throwing-a-kiss",hexadecimal:"😘"},{name:"kissing-face",hexadecimal:"😗"},{name:"kissing-face-with-smiling-eyes",hexadecimal:"😙"},{name:"kissing-face-with-closed-eyes",hexadecimal:"😚"},{name:"slightly-smiling-face",hexadecimal:"🙂"},{name:"hugging-face",hexadecimal:"🤗"},{name:"thinking-face",hexadecimal:"🤔"},{name:"neutral-face",hexadecimal:"😐"},{name:"expressionless-face",hexadecimal:"😑"},{name:"face-without-mouth",hexadecimal:"😶"},{name:"face-with-rolling-eyes",hexadecimal:"🙄"},{name:"smirking-face",hexadecimal:"😏"},{name:"persevering-face",hexadecimal:"😣"},{name:"disappointed-but-relieved-face",hexadecimal:"😥"},{name:"face-with-open-mouth",hexadecimal:"😮"},{name:"zipper-mouth-face",hexadecimal:"🤐"},{name:"hushed-face",hexadecimal:"😯"},{name:"sleepy-face",hexadecimal:"😪"},{name:"tired-face",hexadecimal:"😫"},{name:"sleeping-face",hexadecimal:"😴"},{name:"relieved-face",hexadecimal:"😌"},{name:"nerd-face",hexadecimal:"🤓"},{name:"face-with-stuck-out-tongue",hexadecimal:"😛"},{name:"face-with-stuck-out-tongue-and-winking-eye",hexadecimal:"😜"},{name:"face-with-stuck-out-tongue-and-tightly-closed-eyes",hexadecimal:"😝"},{name:"drooling-face",hexadecimal:"🤤"},{name:"unamused-face",hexadecimal:"😒"},{name:"face-with-cold-sweat",hexadecimal:"😓"},{name:"pensive-face",hexadecimal:"😔"},{name:"confused-face",hexadecimal:"😕"},{name:"upside-down-face",hexadecimal:"🙃"},{name:"money-mouth-face",hexadecimal:"🤑"},{name:"astonished-face",hexadecimal:"😲"},{name:"slightly-frowning-face",hexadecimal:"🙁"},{name:"confounded-face",hexadecimal:"😖"},{name:"disappointed-face",hexadecimal:"😞"},{name:"worried-face",hexadecimal:"😟"},{name:"face-with-look-of-triumph",hexadecimal:"😤"},{name:"crying-face",hexadecimal:"😢"},{name:"loudly-crying-face",hexadecimal:"😭"},{name:"frowning-face-with-open-mouth",hexadecimal:"😦"},{name:"anguished-face",hexadecimal:"😧"},{name:"fearful-face",hexadecimal:"😨"},{name:"weary-face",hexadecimal:"😩"},{name:"grimacing-face",hexadecimal:"😬"},{name:"face-with-open-mouth-and-cold-sweat",hexadecimal:"😰"},{name:"face-screaming-in-fear",hexadecimal:"😱"},{name:"flushed-face",hexadecimal:"😳"},{name:"dizzy-face",hexadecimal:"😵"},{name:"pouting-face",hexadecimal:"😡"},{name:"angry-face",hexadecimal:"😠"},{name:"smiling-face-with-halo",hexadecimal:"😇"},{name:"face-with-cowboy-hat",hexadecimal:"🤠"},{name:"clown-face",hexadecimal:"🤡"},{name:"lying-face",hexadecimal:"🤥"},{name:"face-with-medical-mask",hexadecimal:"😷"},{name:"face-with-thermometer",hexadecimal:"🤒"},{name:"face-with-head-bandage",hexadecimal:"🤕"},{name:"nauseated-face",hexadecimal:"🤢"},{name:"sneezing-face",hexadecimal:"🤧"},{name:"smiling-face-with-horns",hexadecimal:"😈"},{name:"imp",hexadecimal:"👿"},{name:"japanese-ogre",hexadecimal:"👹"},{name:"japanese-goblin",hexadecimal:"👺"},{name:"skull",hexadecimal:"💀"},{name:"skull-and-crossbones",hexadecimal:"☠"},{name:"ghost",hexadecimal:"👻"},{name:"extraterrestrial-alien",hexadecimal:"👽"},{name:"alien-monster",hexadecimal:"👾"},{name:"robot-face",hexadecimal:"🤖"},{name:"pile-of-poo",hexadecimal:"💩"},{name:"smiling-cat-face-with-open-mouth",hexadecimal:"😺"},{name:"grinning-cat-face-with-smiling-eyes",hexadecimal:"😸"},{name:"cat-face-with-tears-of-joy",hexadecimal:"😹"},{name:"smiling-cat-face-with-heart-shaped-eyes",hexadecimal:"😻"},{name:"cat-face-with-wry-smile",hexadecimal:"😼"},{name:"kissing-cat-face-with-closed-eyes",hexadecimal:"😽"},{name:"weary-cat-face",hexadecimal:"🙀"},{name:"crying-cat-face",hexadecimal:"😿"},{name:"pouting-cat-face",hexadecimal:"😾"},{name:"see-no-evil-monkey",hexadecimal:"🙈"},{name:"hear-no-evil-monkey",hexadecimal:"🙉"},{name:"speak-no-evil-monkey",hexadecimal:"🙊"},{name:"boy",hexadecimal:"👦"},{name:"boy-type-1-2",hexadecimal:"👦🏻"},{name:"boy-type-3",hexadecimal:"👦🏼"},{name:"boy-type-4",hexadecimal:"👦🏽"},{name:"boy-type-5",hexadecimal:"👦🏾"},{name:"boy-type-6",hexadecimal:"👦🏿"},{name:"girl",hexadecimal:"👧"},{name:"girl-type-1-2",hexadecimal:"👧🏻"},{name:"girl-type-3",hexadecimal:"👧🏼"},{name:"girl-type-4",hexadecimal:"👧🏽"},{name:"girl-type-5",hexadecimal:"👧🏾"},{name:"girl-type-6",hexadecimal:"👧🏿"},{name:"man",hexadecimal:"👨"},{name:"man-type-1-2",hexadecimal:"👨🏻"},{name:"man-type-3",hexadecimal:"👨🏼"},{name:"man-type-4",hexadecimal:"👨🏽"},{name:"man-type-5",hexadecimal:"👨🏾"},{name:"man-type-6",hexadecimal:"👨🏿"},{name:"woman",hexadecimal:"👩"},{name:"woman-type-1-2",hexadecimal:"👩🏻"},{name:"woman-type-3",hexadecimal:"👩🏼"},{name:"woman-type-4",hexadecimal:"👩🏽"},{name:"woman-type-5",hexadecimal:"👩🏾"},{name:"woman-type-6",hexadecimal:"👩🏿"},{name:"older-man",hexadecimal:"👴"},{name:"old-man-type-1-2",hexadecimal:"👴🏻"},{name:"old-man-type-3",hexadecimal:"👴🏼"},{name:"old-man-type-4",hexadecimal:"👴🏽"},{name:"old-man-type-5",hexadecimal:"👴🏾"},{name:"old-man-type-6",hexadecimal:"👴🏿"},{name:"older-woman",hexadecimal:"👵"},{name:"old-woman-type-1-2",hexadecimal:"👵🏻"},{name:"old-woman-type-3",hexadecimal:"👵🏼"},{name:"old-woman-type-4",hexadecimal:"👵🏽"},{name:"old-woman-type-5",hexadecimal:"👵🏾"},{name:"old-woman-type-6",hexadecimal:"👵🏿"},{name:"baby",hexadecimal:"👶"},{name:"baby-type-1-2",hexadecimal:"👶🏻"},{name:"baby-type-3",hexadecimal:"👶🏼"},{name:"baby-type-4",hexadecimal:"👶🏽"},{name:"baby-type-5",hexadecimal:"👶🏾"},{name:"baby-type-6",hexadecimal:"👶🏿"},{name:"baby-angel",hexadecimal:"👼"},{name:"baby-angel-type-1-2",hexadecimal:"👼🏻"},{name:"baby-angel-type-3",hexadecimal:"👼🏼"},{name:"baby-angel-type-4",hexadecimal:"👼🏽"},{name:"baby-angel-type-5",hexadecimal:"👼🏾"},{name:"baby-angel-type-6",hexadecimal:"👼🏿"},{name:"police-officer",hexadecimal:"👮"},{name:"police-officer-type-1-2",hexadecimal:"👮🏻"},{name:"police-officer-type-3",hexadecimal:"👮🏼"},{name:"police-officer-type-4",hexadecimal:"👮🏽"},{name:"police-officer-type-5",hexadecimal:"👮🏾"},{name:"police-officer-type-6",hexadecimal:"👮🏿"},{name:"sleuth-or-spy",hexadecimal:"🕵"},{name:"detective-type-1-2",hexadecimal:"🕵🏻"},{name:"detective-type-3",hexadecimal:"🕵🏼"},{name:"detective-type-4",hexadecimal:"🕵🏽"},{name:"detective-type-5",hexadecimal:"🕵🏾"},{name:"detective-type-6",hexadecimal:"🕵🏿"},{name:"guardsman",hexadecimal:"💂"},{name:"guardsman-type-1-2",hexadecimal:"💂🏻"},{name:"guardsman-type-3",hexadecimal:"💂🏼"},{name:"guardsman-type-4",hexadecimal:"💂🏽"},{name:"guardsman-type-5",hexadecimal:"💂🏾"},{name:"guardsman-type-6",hexadecimal:"💂🏿"},{name:"construction-worker",hexadecimal:"👷"},{name:"construction-worker-type-1-2",hexadecimal:"👷🏻"},{name:"construction-worker-type-3",hexadecimal:"👷🏼"},{name:"construction-worker-type-4",hexadecimal:"👷🏽"},{name:"construction-worker-type-5",hexadecimal:"👷🏾"},{name:"construction-worker-type-6",hexadecimal:"👷🏿"},{name:"man-with-turban",hexadecimal:"👳"},{name:"person-with-turban-type-1-2",hexadecimal:"👳🏻"},{name:"person-with-turban-type-3",hexadecimal:"👳🏼"},{name:"person-with-turban-type-4",hexadecimal:"👳🏽"},{name:"person-with-turban-type-5",hexadecimal:"👳🏾"},{name:"person-with-turban-type-6",hexadecimal:"👳🏿"},{name:"person-with-blond-hair",hexadecimal:"👱"},{name:"blond-person-type-1-2",hexadecimal:"👱🏻"},{name:"blond-person-type-3",hexadecimal:"👱🏼"},{name:"blond-person-type-4",hexadecimal:"👱🏽"},{name:"blond-person-type-5",hexadecimal:"👱🏾"},{name:"blond-person-type-6",hexadecimal:"👱🏿"},{name:"father-christmas",hexadecimal:"🎅"},{name:"santa-claus-type-1-2",hexadecimal:"🎅🏻"},{name:"santa-claus-type-3",hexadecimal:"🎅🏼"},{name:"santa-claus-type-4",hexadecimal:"🎅🏽"},{name:"santa-claus-type-5",hexadecimal:"🎅🏾"},{name:"santa-claus-type-6",hexadecimal:"🎅🏿"},{name:"mother-christmas",hexadecimal:"🤶"},{name:"mother-christmas-type-1-2",hexadecimal:"🤶🏻"},{name:"mother-christmas-type-3",hexadecimal:"🤶🏼"},{name:"mother-christmas-type-4",hexadecimal:"🤶🏽"},{name:"mother-christmas-type-5",hexadecimal:"🤶🏾"},{name:"mother-christmas-type-6",hexadecimal:"🤶🏿"},{name:"princess",hexadecimal:"👸"},{name:"princess-type-1-2",hexadecimal:"👸🏻"},{name:"princess-type-3",hexadecimal:"👸🏼"},{name:"princess-type-4",hexadecimal:"👸🏽"},{name:"princess-type-5",hexadecimal:"👸🏾"},{name:"princess-type-6",hexadecimal:"👸🏿"},{name:"prince",hexadecimal:"🤴"},{name:"prince-type-1-2",hexadecimal:"🤴🏻"},{name:"prince-type-3",hexadecimal:"🤴🏼"},{name:"prince-type-4",hexadecimal:"🤴🏽"},{name:"prince-type-5",hexadecimal:"🤴🏾"},{name:"prince-type-6",hexadecimal:"🤴🏿"},{name:"bride-with-veil",hexadecimal:"👰"},{name:"bride-with-veil-type-1-2",hexadecimal:"👰🏻"},{name:"bride-with-veil-type-3",hexadecimal:"👰🏼"},{name:"bride-with-veil-type-4",hexadecimal:"👰🏽"},{name:"bride-with-veil-type-5",hexadecimal:"👰🏾"},{name:"bride-with-veil-type-6",hexadecimal:"👰🏿"},{name:"man-in-tuxedo",hexadecimal:"🤵"},{name:"man-in-tuxedo-type-1-2",hexadecimal:"🤵🏻"},{name:"man-in-tuxedo-type-3",hexadecimal:"🤵🏼"},{name:"man-in-tuxedo-type-4",hexadecimal:"🤵🏽"},{name:"man-in-tuxedo-type-5",hexadecimal:"🤵🏾"},{name:"man-in-tuxedo-type-6",hexadecimal:"🤵🏿"},{name:"pregnant-woman",hexadecimal:"🤰"},{name:"pregnant-woman-type-1-2",hexadecimal:"🤰🏻"},{name:"pregnant-woman-type-3",hexadecimal:"🤰🏼"},{name:"pregnant-woman-type-4",hexadecimal:"🤰🏽"},{name:"pregnant-woman-type-5",hexadecimal:"🤰🏾"},{name:"pregnant-woman-type-6",hexadecimal:"🤰🏿"},{name:"man-with-gua-pi-mao",hexadecimal:"👲"},{name:"man-with-chinese-cap-type-1-2",hexadecimal:"👲🏻"},{name:"man-with-chinese-cap-type-3",hexadecimal:"👲🏼"},{name:"man-with-chinese-cap-type-4",hexadecimal:"👲🏽"},{name:"man-with-chinese-cap-type-5",hexadecimal:"👲🏾"},{name:"man-with-chinese-cap-type-6",hexadecimal:"👲🏿"},{name:"person-frowning",hexadecimal:"🙍"},{name:"person-frowning-type-1-2",hexadecimal:"🙍🏻"},{name:"person-frowning-type-3",hexadecimal:"🙍🏼"},{name:"person-frowning-type-4",hexadecimal:"🙍🏽"},{name:"person-frowning-type-5",hexadecimal:"🙍🏾"},{name:"person-frowning-type-6",hexadecimal:"🙍🏿"},{name:"person-with-pouting-face",hexadecimal:"🙎"},{name:"person-pouting-type-1-2",hexadecimal:"🙎🏻"},{name:"person-pouting-type-3",hexadecimal:"🙎🏼"},{name:"person-pouting-type-4",hexadecimal:"🙎🏽"},{name:"person-pouting-type-5",hexadecimal:"🙎🏾"},{name:"person-pouting-type-6",hexadecimal:"🙎🏿"},{name:"face-with-no-good-gesture",hexadecimal:"🙅"},{name:"person-gesturing-not-ok-type-1-2",hexadecimal:"🙅🏻"},{name:"person-gesturing-not-ok-type-3",hexadecimal:"🙅🏼"},{name:"person-gesturing-not-ok-type-4",hexadecimal:"🙅🏽"},{name:"person-gesturing-not-ok-type-5",hexadecimal:"🙅🏾"},{name:"person-gesturing-not-ok-type-6",hexadecimal:"🙅🏿"},{name:"face-with-ok-gesture",hexadecimal:"🙆"},{name:"person-gesturing-ok-type-1-2",hexadecimal:"🙆🏻"},{name:"person-gesturing-ok-type-3",hexadecimal:"🙆🏼"},{name:"person-gesturing-ok-type-4",hexadecimal:"🙆🏽"},{name:"person-gesturing-ok-type-5",hexadecimal:"🙆🏾"},{name:"person-gesturing-ok-type-6",hexadecimal:"🙆🏿"},{name:"information-desk-person",hexadecimal:"💁"},{name:"person-tipping-hand-type-1-2",hexadecimal:"💁🏻"},{name:"person-tipping-hand-type-3",hexadecimal:"💁🏼"},{name:"person-tipping-hand-type-4",hexadecimal:"💁🏽"},{name:"person-tipping-hand-type-5",hexadecimal:"💁🏾"},{name:"person-tipping-hand-type-6",hexadecimal:"💁🏿"},{name:"happy-person-raising-one-hand",hexadecimal:"🙋"},{name:"person-raising-hand-type-1-2",hexadecimal:"🙋🏻"},{name:"person-raising-hand-type-3",hexadecimal:"🙋🏼"},{name:"person-raising-hand-type-4",hexadecimal:"🙋🏽"},{name:"person-raising-hand-type-5",hexadecimal:"🙋🏾"},{name:"person-raising-hand-type-6",hexadecimal:"🙋🏿"},{name:"person-bowing-deeply",hexadecimal:"🙇"},{name:"person-bowing-type-1-2",hexadecimal:"🙇🏻"},{name:"person-bowing-type-3",hexadecimal:"🙇🏼"},{name:"person-bowing-type-4",hexadecimal:"🙇🏽"},{name:"person-bowing-type-5",hexadecimal:"🙇🏾"},{name:"person-bowing-type-6",hexadecimal:"🙇🏿"},{name:"face-palm",hexadecimal:"🤦"},{name:"person-facepalming-type-1-2",hexadecimal:"🤦🏻"},{name:"person-facepalming-type-3",hexadecimal:"🤦🏼"},{name:"person-facepalming-type-4",hexadecimal:"🤦🏽"},{name:"person-facepalming-type-5",hexadecimal:"🤦🏾"},{name:"person-facepalming-type-6",hexadecimal:"🤦🏿"},{name:"shrug",hexadecimal:"🤷"},{name:"person-shrugging-type-1-2",hexadecimal:"🤷🏻"},{name:"person-shrugging-type-3",hexadecimal:"🤷🏼"},{name:"person-shrugging-type-4",hexadecimal:"🤷🏽"},{name:"person-shrugging-type-5",hexadecimal:"🤷🏾"},{name:"person-shrugging-type-6",hexadecimal:"🤷🏿"},{name:"face-massage",hexadecimal:"💆"},{name:"person-getting-massage-type-1-2",hexadecimal:"💆🏻"},{name:"person-getting-massage-type-3",hexadecimal:"💆🏼"},{name:"person-getting-massage-type-4",hexadecimal:"💆🏽"},{name:"person-getting-massage-type-5",hexadecimal:"💆🏾"},{name:"person-getting-massage-type-6",hexadecimal:"💆🏿"},{name:"haircut",hexadecimal:"💇"},{name:"person-getting-haircut-type-1-2",hexadecimal:"💇🏻"},{name:"person-getting-haircut-type-3",hexadecimal:"💇🏼"},{name:"person-getting-haircut-type-4",hexadecimal:"💇🏽"},{name:"person-getting-haircut-type-5",hexadecimal:"💇🏾"},{name:"person-getting-haircut-type-6",hexadecimal:"💇🏿"},{name:"pedestrian",hexadecimal:"🚶"},{name:"person-walking-type-1-2",hexadecimal:"🚶🏻"},{name:"person-walking-type-3",hexadecimal:"🚶🏼"},{name:"person-walking-type-4",hexadecimal:"🚶🏽"},{name:"person-walking-type-5",hexadecimal:"🚶🏾"},{name:"person-walking-type-6",hexadecimal:"🚶🏿"},{name:"runner",hexadecimal:"🏃"},{name:"person-running-type-1-2",hexadecimal:"🏃🏻"},{name:"person-running-type-3",hexadecimal:"🏃🏼"},{name:"person-running-type-4",hexadecimal:"🏃🏽"},{name:"person-running-type-5",hexadecimal:"🏃🏾"},{name:"person-running-type-6",hexadecimal:"🏃🏿"},{name:"dancer",hexadecimal:"💃"},{name:"woman-dancing-type-1-2",hexadecimal:"💃🏻"},{name:"woman-dancing-type-3",hexadecimal:"💃🏼"},{name:"woman-dancing-type-4",hexadecimal:"💃🏽"},{name:"woman-dancing-type-5",hexadecimal:"💃🏾"},{name:"woman-dancing-type-6",hexadecimal:"💃🏿"},{name:"man-dancing",hexadecimal:"🕺"},{name:"man-dancing-type-1-2",hexadecimal:"🕺🏻"},{name:"man-dancing-type-3",hexadecimal:"🕺🏼"},{name:"man-dancing-type-4",hexadecimal:"🕺🏽"},{name:"man-dancing-type-5",hexadecimal:"🕺🏾"},{name:"man-dancing-type-6",hexadecimal:"🕺🏿"},{name:"woman-with-bunny-ears",hexadecimal:"👯"},{name:"man-in-business-suit-levitating",hexadecimal:"🕴"},{name:"speaking-head-in-silhouette",hexadecimal:"🗣"},{name:"bust-in-silhouette",hexadecimal:"👤"},{name:"busts-in-silhouette",hexadecimal:"👥"},{name:"man-and-woman-holding-hands",hexadecimal:"👫"},{name:"two-men-holding-hands",hexadecimal:"👬"},{name:"two-women-holding-hands",hexadecimal:"👭"},{name:"kiss",hexadecimal:"💏"},{name:"kiss-woman-man",hexadecimal:"👩‍❤️‍💋‍👨"},{name:"kiss-man-man",hexadecimal:"👨‍❤️‍💋‍👨"},{name:"kiss-woman-woman",hexadecimal:"👩‍❤️‍💋‍👩"},{name:"couple-with-heart",hexadecimal:"💑"},{name:"couple-with-heart-woman-man",hexadecimal:"👩‍❤️‍👨"},{name:"couple-with-heart-man-man",hexadecimal:"👨‍❤️‍👨"},{name:"couple-with-heart-woman-woman",hexadecimal:"👩‍❤️‍👩"},{name:"family",hexadecimal:"👪"},{name:"family-man-woman-boy",hexadecimal:"👨‍👩‍👦"},{name:"family-man-woman-girl",hexadecimal:"👨‍👩‍👧"},{name:"family-man-woman-girl-boy",hexadecimal:"👨‍👩‍👧‍👦"},{name:"family-man-woman-boy-boy",hexadecimal:"👨‍👩‍👦‍👦"},{name:"family-man-woman-girl-girl",hexadecimal:"👨‍👩‍👧‍👧"},{name:"family-man-man-boy",hexadecimal:"👨‍👨‍👦"},{name:"family-man-man-girl",hexadecimal:"👨‍👨‍👧"},{name:"family-man-man-girl-boy",hexadecimal:"👨‍👨‍👧‍👦"},{name:"family-man-man-boy-boy",hexadecimal:"👨‍👨‍👦‍👦"},{name:"family-man-man-girl-girl",hexadecimal:"👨‍👨‍👧‍👧"},{name:"family-woman-woman-boy",hexadecimal:"👩‍👩‍👦"},{name:"family-woman-woman-girl",hexadecimal:"👩‍👩‍👧"},{name:"family-woman-woman-girl-boy",hexadecimal:"👩‍👩‍👧‍👦"},{name:"family-woman-woman-boy-boy",hexadecimal:"👩‍👩‍👦‍👦"},{name:"family-woman-woman-girl-girl",hexadecimal:"👩‍👩‍👧‍👧"},{name:"emoji-modifier-fitzpatrick-type-1-2",hexadecimal:"🏻"},{name:"emoji-modifier-fitzpatrick-type-3",hexadecimal:"🏼"},{name:"emoji-modifier-fitzpatrick-type-4",hexadecimal:"🏽"},{name:"emoji-modifier-fitzpatrick-type-5",hexadecimal:"🏾"},{name:"emoji-modifier-fitzpatrick-type-6",hexadecimal:"🏿"},{name:"flexed-biceps",hexadecimal:"💪"},{name:"flexed-biceps-type-1-2",hexadecimal:"💪🏻"},{name:"flexed-biceps-type-3",hexadecimal:"💪🏼"},{name:"flexed-biceps-type-4",hexadecimal:"💪🏽"},{name:"flexed-biceps-type-5",hexadecimal:"💪🏾"},{name:"flexed-biceps-type-6",hexadecimal:"💪🏿"},{name:"selfie",hexadecimal:"🤳"},{name:"selfie-type-1-2",hexadecimal:"🤳🏻"},{name:"selfie-type-3",hexadecimal:"🤳🏼"},{name:"selfie-type-4",hexadecimal:"🤳🏽"},{name:"selfie-type-5",hexadecimal:"🤳🏾"},{name:"selfie-type-6",hexadecimal:"🤳🏿"},{name:"white-left-pointing-backhand-index",hexadecimal:"👈"},{name:"backhand-index-pointing-left-type-1-2",hexadecimal:"👈🏻"},{name:"backhand-index-pointing-left-type-3",hexadecimal:"👈🏼"},{name:"backhand-index-pointing-left-type-4",hexadecimal:"👈🏽"},{name:"backhand-index-pointing-left-type-5",hexadecimal:"👈🏾"},{name:"backhand-index-pointing-left-type-6",hexadecimal:"👈🏿"},{name:"white-right-pointing-backhand-index",hexadecimal:"👉"},{name:"backhand-index-pointing-right-type-1-2",hexadecimal:"👉🏻"},{name:"backhand-index-pointing-right-type-3",hexadecimal:"👉🏼"},{name:"backhand-index-pointing-right-type-4",hexadecimal:"👉🏽"},{name:"backhand-index-pointing-right-type-5",hexadecimal:"👉🏾"},{name:"backhand-index-pointing-right-type-6",hexadecimal:"👉🏿"},{name:"white-up-pointing-index",hexadecimal:"☝"},{name:"index-pointing-up-type-1-2",hexadecimal:"☝🏻"},{name:"index-pointing-up-type-3",hexadecimal:"☝🏼"},{name:"index-pointing-up-type-4",hexadecimal:"☝🏽"},{name:"index-pointing-up-type-5",hexadecimal:"☝🏾"},{name:"index-pointing-up-type-6",hexadecimal:"☝🏿"},{name:"white-up-pointing-backhand-index",hexadecimal:"👆"},{name:"backhand-index-pointing-up-type-1-2",hexadecimal:"👆🏻"},{name:"backhand-index-pointing-up-type-3",hexadecimal:"👆🏼"},{name:"backhand-index-pointing-up-type-4",hexadecimal:"👆🏽"},{name:"backhand-index-pointing-up-type-5",hexadecimal:"👆🏾"},{name:"backhand-index-pointing-up-type-6",hexadecimal:"👆🏿"},{name:"reversed-hand-with-middle-finger-extended",hexadecimal:"🖕"},{name:"middle-finger-type-1-2",hexadecimal:"🖕🏻"},{name:"middle-finger-type-3",hexadecimal:"🖕🏼"},{name:"middle-finger-type-4",hexadecimal:"🖕🏽"},{name:"middle-finger-type-5",hexadecimal:"🖕🏾"},{name:"middle-finger-type-6",hexadecimal:"🖕🏿"},{name:"white-down-pointing-backhand-index",hexadecimal:"👇"},{name:"backhand-index-pointing-down-type-1-2",hexadecimal:"👇🏻"},{name:"backhand-index-pointing-down-type-3",hexadecimal:"👇🏼"},{name:"backhand-index-pointing-down-type-4",hexadecimal:"👇🏽"},{name:"backhand-index-pointing-down-type-5",hexadecimal:"👇🏾"},{name:"backhand-index-pointing-down-type-6",hexadecimal:"👇🏿"},{name:"victory-hand",hexadecimal:"✌"},{name:"victory-hand-type-1-2",hexadecimal:"✌🏻"},{name:"victory-hand-type-3",hexadecimal:"✌🏼"},{name:"victory-hand-type-4",hexadecimal:"✌🏽"},{name:"victory-hand-type-5",hexadecimal:"✌🏾"},{name:"victory-hand-type-6",hexadecimal:"✌🏿"},{name:"hand-with-index-and-middle-fingers-crossed",hexadecimal:"🤞"},{name:"crossed-fingers-type-1-2",hexadecimal:"🤞🏻"},{name:"crossed-fingers-type-3",hexadecimal:"🤞🏼"},{name:"crossed-fingers-type-4",hexadecimal:"🤞🏽"},{name:"crossed-fingers-type-5",hexadecimal:"🤞🏾"},{name:"crossed-fingers-type-6",hexadecimal:"🤞🏿"},{name:"raised-hand-with-part-between-middle-and-ring-fingers",hexadecimal:"🖖"},{name:"vulcan-salute-type-1-2",hexadecimal:"🖖🏻"},{name:"vulcan-salute-type-3",hexadecimal:"🖖🏼"},{name:"vulcan-salute-type-4",hexadecimal:"🖖🏽"},{name:"vulcan-salute-type-5",hexadecimal:"🖖🏾"},{name:"vulcan-salute-type-6",hexadecimal:"🖖🏿"},{name:"sign-of-the-horns",hexadecimal:"🤘"},{name:"sign-of-the-horns-type-1-2",hexadecimal:"🤘🏻"},{name:"sign-of-the-horns-type-3",hexadecimal:"🤘🏼"},{name:"sign-of-the-horns-type-4",hexadecimal:"🤘🏽"},{name:"sign-of-the-horns-type-5",hexadecimal:"🤘🏾"},{name:"sign-of-the-horns-type-6",hexadecimal:"🤘🏿"},{name:"call-me-hand",hexadecimal:"🤙"},{name:"call-me-hand-type-1-2",hexadecimal:"🤙🏻"},{name:"call-me-hand-type-3",hexadecimal:"🤙🏼"},{name:"call-me-hand-type-4",hexadecimal:"🤙🏽"},{name:"call-me-hand-type-5",hexadecimal:"🤙🏾"},{name:"call-me-hand-type-6",hexadecimal:"🤙🏿"},{name:"raised-hand-with-fingers-splayed",hexadecimal:"🖐"},{name:"raised-hand-with-fingers-splayed-type-1-2",hexadecimal:"🖐🏻"},{name:"raised-hand-with-fingers-splayed-type-3",hexadecimal:"🖐🏼"},{name:"raised-hand-with-fingers-splayed-type-4",hexadecimal:"🖐🏽"},{name:"raised-hand-with-fingers-splayed-type-5",hexadecimal:"🖐🏾"},{name:"raised-hand-with-fingers-splayed-type-6",hexadecimal:"🖐🏿"},{name:"raised-hand",hexadecimal:"✋"},{name:"raised-hand-type-1-2",hexadecimal:"✋🏻"},{name:"raised-hand-type-3",hexadecimal:"✋🏼"},{name:"raised-hand-type-4",hexadecimal:"✋🏽"},{name:"raised-hand-type-5",hexadecimal:"✋🏾"},{name:"raised-hand-type-6",hexadecimal:"✋🏿"},{name:"ok-hand-sign",hexadecimal:"👌"},{name:"ok-hand-type-1-2",hexadecimal:"👌🏻"},{name:"ok-hand-type-3",hexadecimal:"👌🏼"},{name:"ok-hand-type-4",hexadecimal:"👌🏽"},{name:"ok-hand-type-5",hexadecimal:"👌🏾"},{name:"ok-hand-type-6",hexadecimal:"👌🏿"},{name:"thumbs-up-sign",hexadecimal:"👍"},{name:"thumbs-up-type-1-2",hexadecimal:"👍🏻"},{name:"thumbs-up-type-3",hexadecimal:"👍🏼"},{name:"thumbs-up-type-4",hexadecimal:"👍🏽"},{name:"thumbs-up-type-5",hexadecimal:"👍🏾"},{name:"thumbs-up-type-6",hexadecimal:"👍🏿"},{name:"thumbs-down-sign",hexadecimal:"👎"},{name:"thumbs-down-type-1-2",hexadecimal:"👎🏻"},{name:"thumbs-down-type-3",hexadecimal:"👎🏼"},{name:"thumbs-down-type-4",hexadecimal:"👎🏽"},{name:"thumbs-down-type-5",hexadecimal:"👎🏾"},{name:"thumbs-down-type-6",hexadecimal:"👎🏿"},{name:"raised-fist",hexadecimal:"✊"},{name:"raised-fist-type-1-2",hexadecimal:"✊🏻"},{name:"raised-fist-type-3",hexadecimal:"✊🏼"},{name:"raised-fist-type-4",hexadecimal:"✊🏽"},{name:"raised-fist-type-5",hexadecimal:"✊🏾"},{name:"raised-fist-type-6",hexadecimal:"✊🏿"},{name:"fisted-hand-sign",hexadecimal:"👊"},{name:"oncoming-fist-type-1-2",hexadecimal:"👊🏻"},{name:"oncoming-fist-type-3",hexadecimal:"👊🏼"},{name:"oncoming-fist-type-4",hexadecimal:"👊🏽"},{name:"oncoming-fist-type-5",hexadecimal:"👊🏾"},{name:"oncoming-fist-type-6",hexadecimal:"👊🏿"},{name:"left-facing-fist",hexadecimal:"🤛"},{name:"left-facing-fist-type-1-2",hexadecimal:"🤛🏻"},{name:"left-facing-fist-type-3",hexadecimal:"🤛🏼"},{name:"left-facing-fist-type-4",hexadecimal:"🤛🏽"},{name:"left-facing-fist-type-5",hexadecimal:"🤛🏾"},{name:"left-facing-fist-type-6",hexadecimal:"🤛🏿"},{name:"right-facing-fist",hexadecimal:"🤜"},{name:"right-facing-fist-type-1-2",hexadecimal:"🤜🏻"},{name:"right-facing-fist-type-3",hexadecimal:"🤜🏼"},{name:"right-facing-fist-type-4",hexadecimal:"🤜🏽"},{name:"right-facing-fist-type-5",hexadecimal:"🤜🏾"},{name:"right-facing-fist-type-6",hexadecimal:"🤜🏿"},{name:"raised-back-of-hand",hexadecimal:"🤚"},{name:"raised-back-of-hand-type-1-2",hexadecimal:"🤚🏻"},{name:"raised-back-of-hand-type-3",hexadecimal:"🤚🏼"},{name:"raised-back-of-hand-type-4",hexadecimal:"🤚🏽"},{name:"raised-back-of-hand-type-5",hexadecimal:"🤚🏾"},{name:"raised-back-of-hand-type-6",hexadecimal:"🤚🏿"},{name:"waving-hand-sign",hexadecimal:"👋"},{name:"waving-hand-type-1-2",hexadecimal:"👋🏻"},{name:"waving-hand-type-3",hexadecimal:"👋🏼"},{name:"waving-hand-type-4",hexadecimal:"👋🏽"},{name:"waving-hand-type-5",hexadecimal:"👋🏾"},{name:"waving-hand-type-6",hexadecimal:"👋🏿"},{name:"clapping-hands-sign",hexadecimal:"👏"},{name:"clapping-hands-type-1-2",hexadecimal:"👏🏻"},{name:"clapping-hands-type-3",hexadecimal:"👏🏼"},{name:"clapping-hands-type-4",hexadecimal:"👏🏽"},{name:"clapping-hands-type-5",hexadecimal:"👏🏾"},{name:"clapping-hands-type-6",hexadecimal:"👏🏿"},{name:"writing-hand",hexadecimal:"✍"},{name:"writing-hand-type-1-2",hexadecimal:"✍🏻"},{name:"writing-hand-type-3",hexadecimal:"✍🏼"},{name:"writing-hand-type-4",hexadecimal:"✍🏽"},{name:"writing-hand-type-5",hexadecimal:"✍🏾"},{name:"writing-hand-type-6",hexadecimal:"✍🏿"},{name:"open-hands-sign",hexadecimal:"👐"},{name:"open-hands-type-1-2",hexadecimal:"👐🏻"},{name:"open-hands-type-3",hexadecimal:"👐🏼"},{name:"open-hands-type-4",hexadecimal:"👐🏽"},{name:"open-hands-type-5",hexadecimal:"👐🏾"},{name:"open-hands-type-6",hexadecimal:"👐🏿"},{name:"person-raising-both-hands-in-celebration",hexadecimal:"🙌"},{name:"person-raising-hands-type-1-2",hexadecimal:"🙌🏻"},{name:"person-raising-hands-type-3",hexadecimal:"🙌🏼"},{name:"person-raising-hands-type-4",hexadecimal:"🙌🏽"},{name:"person-raising-hands-type-5",hexadecimal:"🙌🏾"},{name:"person-raising-hands-type-6",hexadecimal:"🙌🏿"},{name:"person-with-folded-hands",hexadecimal:"🙏"},{name:"folded-hands-type-1-2",hexadecimal:"🙏🏻"},{name:"folded-hands-type-3",hexadecimal:"🙏🏼"},{name:"folded-hands-type-4",hexadecimal:"🙏🏽"},{name:"folded-hands-type-5",hexadecimal:"🙏🏾"},{name:"folded-hands-type-6",hexadecimal:"🙏🏿"},{name:"handshake",hexadecimal:"🤝"},{name:"handshake-type-1-2",hexadecimal:"🤝🏻"},{name:"handshake-type-3",hexadecimal:"🤝🏼"},{name:"handshake-type-4",hexadecimal:"🤝🏽"},{name:"handshake-type-5",hexadecimal:"🤝🏾"},{name:"handshake-type-6",hexadecimal:"🤝🏿"},{name:"nail-polish",hexadecimal:"💅"},{name:"nail-polish-type-1-2",hexadecimal:"💅🏻"},{name:"nail-polish-type-3",hexadecimal:"💅🏼"},{name:"nail-polish-type-4",hexadecimal:"💅🏽"},{name:"nail-polish-type-5",hexadecimal:"💅🏾"},{name:"nail-polish-type-6",hexadecimal:"💅🏿"},{name:"ear",hexadecimal:"👂"},{name:"ear-type-1-2",hexadecimal:"👂🏻"},{name:"ear-type-3",hexadecimal:"👂🏼"},{name:"ear-type-4",hexadecimal:"👂🏽"},{name:"ear-type-5",hexadecimal:"👂🏾"},{name:"ear-type-6",hexadecimal:"👂🏿"},{name:"nose",hexadecimal:"👃"},{name:"nose-type-1-2",hexadecimal:"👃🏻"},{name:"nose-type-3",hexadecimal:"👃🏼"},{name:"nose-type-4",hexadecimal:"👃🏽"},{name:"nose-type-5",hexadecimal:"👃🏾"},{name:"nose-type-6",hexadecimal:"👃🏿"},{name:"footprints",hexadecimal:"👣"},{name:"eyes",hexadecimal:"👀"},{name:"eye",hexadecimal:"👁"},{name:"eye-left-speech-bubble",hexadecimal:"👁‍🗨"},{name:"tongue",hexadecimal:"👅"},{name:"mouth",hexadecimal:"👄"},{name:"kiss-mark",hexadecimal:"💋"},{name:"heart-with-arrow",hexadecimal:"💘"},{name:"heavy-black-heart",hexadecimal:"❤"},{name:"beating-heart",hexadecimal:"💓"},{name:"broken-heart",hexadecimal:"💔"},{name:"two-hearts",hexadecimal:"💕"},{name:"sparkling-heart",hexadecimal:"💖"},{name:"growing-heart",hexadecimal:"💗"},{name:"blue-heart",hexadecimal:"💙"},{name:"green-heart",hexadecimal:"💚"},{name:"yellow-heart",hexadecimal:"💛"},{name:"purple-heart",hexadecimal:"💜"},{name:"black-heart",hexadecimal:"🖤"},{name:"heart-with-ribbon",hexadecimal:"💝"},{name:"revolving-hearts",hexadecimal:"💞"},{name:"heart-decoration",hexadecimal:"💟"},{name:"heavy-heart-exclamation-mark-ornament",hexadecimal:"❣"},{name:"love-letter",hexadecimal:"💌"},{name:"sleeping-symbol",hexadecimal:"💤"},{name:"anger-symbol",hexadecimal:"💢"},{name:"bomb",hexadecimal:"💣"},{name:"collision-symbol",hexadecimal:"💥"},{name:"splashing-sweat-symbol",hexadecimal:"💦"},{name:"dash-symbol",hexadecimal:"💨"},{name:"dizzy-symbol",hexadecimal:"💫"},{name:"speech-balloon",hexadecimal:"💬"},{name:"left-speech-bubble",hexadecimal:"🗨"},{name:"right-anger-bubble",hexadecimal:"🗯"},{name:"thought-balloon",hexadecimal:"💭"},{name:"hole",hexadecimal:"🕳"},{name:"eyeglasses",hexadecimal:"👓"},{name:"dark-sunglasses",hexadecimal:"🕶"},{name:"necktie",hexadecimal:"👔"},{name:"t-shirt",hexadecimal:"👕"},{name:"jeans",hexadecimal:"👖"},{name:"dress",hexadecimal:"👗"},{name:"kimono",hexadecimal:"👘"},{name:"bikini",hexadecimal:"👙"},{name:"womans-clothes",hexadecimal:"👚"},{name:"purse",hexadecimal:"👛"},{name:"handbag",hexadecimal:"👜"},{name:"pouch",hexadecimal:"👝"},{name:"shopping-bags",hexadecimal:"🛍"},{name:"school-satchel",hexadecimal:"🎒"},{name:"mans-shoe",hexadecimal:"👞"},{name:"athletic-shoe",hexadecimal:"👟"},{name:"high-heeled-shoe",hexadecimal:"👠"},{name:"womans-sandal",hexadecimal:"👡"},{name:"womans-boots",hexadecimal:"👢"},{name:"crown",hexadecimal:"👑"},{name:"womans-hat",hexadecimal:"👒"},{name:"top-hat",hexadecimal:"🎩"},{name:"graduation-cap",hexadecimal:"🎓"},{name:"helmet-with-white-cross",hexadecimal:"⛑"},{name:"prayer-beads",hexadecimal:"📿"},{name:"lipstick",hexadecimal:"💄"},{name:"ring",hexadecimal:"💍"},{name:"gem-stone",hexadecimal:"💎"},{name:"monkey-face",hexadecimal:"🐵"},{name:"monkey",hexadecimal:"🐒"},{name:"gorilla",hexadecimal:"🦍"},{name:"dog-face",hexadecimal:"🐶"},{name:"dog",hexadecimal:"🐕"},{name:"poodle",hexadecimal:"🐩"},{name:"wolf-face",hexadecimal:"🐺"},{name:"fox-face",hexadecimal:"🦊"},{name:"cat-face",hexadecimal:"🐱"},{name:"cat",hexadecimal:"🐈"},{name:"lion-face",hexadecimal:"🦁"},{name:"tiger-face",hexadecimal:"🐯"},{name:"tiger",hexadecimal:"🐅"},{name:"leopard",hexadecimal:"🐆"},{name:"horse-face",hexadecimal:"🐴"},{name:"horse",hexadecimal:"🐎"},{name:"deer",hexadecimal:"🦌"},{name:"unicorn-face",hexadecimal:"🦄"},{name:"cow-face",hexadecimal:"🐮"},{name:"ox",hexadecimal:"🐂"},{name:"water-buffalo",hexadecimal:"🐃"},{name:"cow",hexadecimal:"🐄"},{name:"pig-face",hexadecimal:"🐷"},{name:"pig",hexadecimal:"🐖"},{name:"boar",hexadecimal:"🐗"},{name:"pig-nose",hexadecimal:"🐽"},{name:"ram",hexadecimal:"🐏"},{name:"sheep",hexadecimal:"🐑"},{name:"goat",hexadecimal:"🐐"},{name:"dromedary-camel",hexadecimal:"🐪"},{name:"bactrian-camel",hexadecimal:"🐫"},{name:"elephant",hexadecimal:"🐘"},{name:"rhinoceros",hexadecimal:"🦏"},{name:"mouse-face",hexadecimal:"🐭"},{name:"mouse",hexadecimal:"🐁"},{name:"rat",hexadecimal:"🐀"},{name:"hamster-face",hexadecimal:"🐹"},{name:"rabbit-face",hexadecimal:"🐰"},{name:"rabbit",hexadecimal:"🐇"},{name:"chipmunk",hexadecimal:"🐿"},{name:"bat",hexadecimal:"🦇"},{name:"bear-face",hexadecimal:"🐻"},{name:"koala",hexadecimal:"🐨"},{name:"panda-face",hexadecimal:"🐼"},{name:"paw-prints",hexadecimal:"🐾"},{name:"turkey",hexadecimal:"🦃"},{name:"chicken",hexadecimal:"🐔"},{name:"rooster",hexadecimal:"🐓"},{name:"hatching-chick",hexadecimal:"🐣"},{name:"baby-chick",hexadecimal:"🐤"},{name:"front-facing-baby-chick",hexadecimal:"🐥"},{name:"bird",hexadecimal:"🐦"},{name:"penguin",hexadecimal:"🐧"},{name:"dove-of-peace",hexadecimal:"🕊"},{name:"eagle",hexadecimal:"🦅"},{name:"duck",hexadecimal:"🦆"},{name:"owl",hexadecimal:"🦉"},{name:"frog-face",hexadecimal:"🐸"},{name:"crocodile",hexadecimal:"🐊"},{name:"turtle",hexadecimal:"🐢"},{name:"lizard",hexadecimal:"🦎"},{name:"snake",hexadecimal:"🐍"},{name:"dragon-face",hexadecimal:"🐲"},{name:"dragon",hexadecimal:"🐉"},{name:"spouting-whale",hexadecimal:"🐳"},{name:"whale",hexadecimal:"🐋"},{name:"dolphin",hexadecimal:"🐬"},{name:"fish",hexadecimal:"🐟"},{name:"tropical-fish",hexadecimal:"🐠"},{name:"blowfish",hexadecimal:"🐡"},{name:"shark",hexadecimal:"🦈"},{name:"octopus",hexadecimal:"🐙"},{name:"spiral-shell",hexadecimal:"🐚"},{name:"crab",hexadecimal:"🦀"},{name:"shrimp",hexadecimal:"🦐"},{name:"squid",hexadecimal:"🦑"},{name:"butterfly",hexadecimal:"🦋"},{name:"snail",hexadecimal:"🐌"},{name:"bug",hexadecimal:"🐛"},{name:"ant",hexadecimal:"🐜"},{name:"honeybee",hexadecimal:"🐝"},{name:"lady-beetle",hexadecimal:"🐞"},{name:"spider",hexadecimal:"🕷"},{name:"spider-web",hexadecimal:"🕸"},{name:"scorpion",hexadecimal:"🦂"},{name:"bouquet",hexadecimal:"💐"},{name:"cherry-blossom",hexadecimal:"🌸"},{name:"white-flower",hexadecimal:"💮"},{name:"rosette",hexadecimal:"🏵"},{name:"rose",hexadecimal:"🌹"},{name:"wilted-flower",hexadecimal:"🥀"},{name:"hibiscus",hexadecimal:"🌺"},{name:"sunflower",hexadecimal:"🌻"},{name:"blossom",hexadecimal:"🌼"},{name:"tulip",hexadecimal:"🌷"},{name:"seedling",hexadecimal:"🌱"},{name:"evergreen-tree",hexadecimal:"🌲"},{name:"deciduous-tree",hexadecimal:"🌳"},{name:"palm-tree",hexadecimal:"🌴"},{name:"cactus",hexadecimal:"🌵"},{name:"ear-of-rice",hexadecimal:"🌾"},{name:"herb",hexadecimal:"🌿"},{name:"shamrock",hexadecimal:"☘"},{name:"four-leaf-clover",hexadecimal:"🍀"},{name:"maple-leaf",hexadecimal:"🍁"},{name:"fallen-leaf",hexadecimal:"🍂"},{name:"leaf-fluttering-in-wind",hexadecimal:"🍃"},{name:"grapes",hexadecimal:"🍇"},{name:"melon",hexadecimal:"🍈"},{name:"watermelon",hexadecimal:"🍉"},{name:"tangerine",hexadecimal:"🍊"},{name:"lemon",hexadecimal:"🍋"},{name:"banana",hexadecimal:"🍌"},{name:"pineapple",hexadecimal:"🍍"},{name:"red-apple",hexadecimal:"🍎"},{name:"green-apple",hexadecimal:"🍏"},{name:"pear",hexadecimal:"🍐"},{name:"peach",hexadecimal:"🍑"},{name:"cherries",hexadecimal:"🍒"},{name:"strawberry",hexadecimal:"🍓"},{name:"kiwifruit",hexadecimal:"🥝"},{name:"tomato",hexadecimal:"🍅"},{name:"avocado",hexadecimal:"🥑"},{name:"aubergine",hexadecimal:"🍆"},{name:"potato",hexadecimal:"🥔"},{name:"carrot",hexadecimal:"🥕"},{name:"ear-of-maize",hexadecimal:"🌽"},{name:"hot-pepper",hexadecimal:"🌶"},{name:"cucumber",hexadecimal:"🥒"},{name:"mushroom",hexadecimal:"🍄"},{name:"peanuts",hexadecimal:"🥜"},{name:"chestnut",hexadecimal:"🌰"},{name:"bread",hexadecimal:"🍞"},{name:"croissant",hexadecimal:"🥐"},{name:"baguette-bread",hexadecimal:"🥖"},{name:"pancakes",hexadecimal:"🥞"},{name:"cheese-wedge",hexadecimal:"🧀"},{name:"meat-on-bone",hexadecimal:"🍖"},{name:"poultry-leg",hexadecimal:"🍗"},{name:"bacon",hexadecimal:"🥓"},{name:"hamburger",hexadecimal:"🍔"},{name:"french-fries",hexadecimal:"🍟"},{name:"slice-of-pizza",hexadecimal:"🍕"},{name:"hot-dog",hexadecimal:"🌭"},{name:"taco",hexadecimal:"🌮"},{name:"burrito",hexadecimal:"🌯"},{name:"stuffed-flatbread",hexadecimal:"🥙"},{name:"egg",hexadecimal:"🥚"},{name:"cooking",hexadecimal:"🍳"},{name:"shallow-pan-of-food",hexadecimal:"🥘"},{name:"pot-of-food",hexadecimal:"🍲"},{name:"green-salad",hexadecimal:"🥗"},{name:"popcorn",hexadecimal:"🍿"},{name:"bento-box",hexadecimal:"🍱"},{name:"rice-cracker",hexadecimal:"🍘"},{name:"rice-ball",hexadecimal:"🍙"},{name:"cooked-rice",hexadecimal:"🍚"},{name:"curry-and-rice",hexadecimal:"🍛"},{name:"steaming-bowl",hexadecimal:"🍜"},{name:"spaghetti",hexadecimal:"🍝"},{name:"roasted-sweet-potato",hexadecimal:"🍠"},{name:"oden",hexadecimal:"🍢"},{name:"sushi",hexadecimal:"🍣"},{name:"fried-shrimp",hexadecimal:"🍤"},{name:"fish-cake-with-swirl-design",hexadecimal:"🍥"},{name:"dango",hexadecimal:"🍡"},{name:"soft-ice-cream",hexadecimal:"🍦"},{name:"shaved-ice",hexadecimal:"🍧"},{name:"ice-cream",hexadecimal:"🍨"},{name:"doughnut",hexadecimal:"🍩"},{name:"cookie",hexadecimal:"🍪"},{name:"birthday-cake",hexadecimal:"🎂"},{name:"shortcake",hexadecimal:"🍰"},{name:"chocolate-bar",hexadecimal:"🍫"},{name:"candy",hexadecimal:"🍬"},{name:"lollipop",hexadecimal:"🍭"},{name:"custard",hexadecimal:"🍮"},{name:"honey-pot",hexadecimal:"🍯"},{name:"baby-bottle",hexadecimal:"🍼"},{name:"glass-of-milk",hexadecimal:"🥛"},{name:"hot-beverage",hexadecimal:"☕"},{name:"teacup-without-handle",hexadecimal:"🍵"},{name:"sake-bottle-and-cup",hexadecimal:"🍶"},{name:"bottle-with-popping-cork",hexadecimal:"🍾"},{name:"wine-glass",hexadecimal:"🍷"},{name:"cocktail-glass",hexadecimal:"🍸"},{name:"tropical-drink",hexadecimal:"🍹"},{name:"beer-mug",hexadecimal:"🍺"},{name:"clinking-beer-mugs",hexadecimal:"🍻"},{name:"clinking-glasses",hexadecimal:"🥂"},{name:"tumbler-glass",hexadecimal:"🥃"},{name:"fork-and-knife-with-plate",hexadecimal:"🍽"},{name:"fork-and-knife",hexadecimal:"🍴"},{name:"spoon",hexadecimal:"🥄"},{name:"hocho",hexadecimal:"🔪"},{name:"amphora",hexadecimal:"🏺"},{name:"earth-globe-europe-africa",hexadecimal:"🌍"},{name:"earth-globe-americas",hexadecimal:"🌎"},{name:"earth-globe-asia-australia",hexadecimal:"🌏"},{name:"globe-with-meridians",hexadecimal:"🌐"},{name:"world-map",hexadecimal:"🗺"},{name:"silhouette-of-japan",hexadecimal:"🗾"},{name:"snow-capped-mountain",hexadecimal:"🏔"},{name:"mountain",hexadecimal:"⛰"},{name:"volcano",hexadecimal:"🌋"},{name:"mount-fuji",hexadecimal:"🗻"},{name:"camping",hexadecimal:"🏕"},{name:"beach-with-umbrella",hexadecimal:"🏖"},{name:"desert",hexadecimal:"🏜"},{name:"desert-island",hexadecimal:"🏝"},{name:"national-park",hexadecimal:"🏞"},{name:"stadium",hexadecimal:"🏟"},{name:"classical-building",hexadecimal:"🏛"},{name:"building-construction",hexadecimal:"🏗"},{name:"house-buildings",hexadecimal:"🏘"},{name:"cityscape",hexadecimal:"🏙"},{name:"derelict-house-building",hexadecimal:"🏚"},{name:"house-building",hexadecimal:"🏠"},{name:"house-with-garden",hexadecimal:"🏡"},{name:"office-building",hexadecimal:"🏢"},{name:"japanese-post-office",hexadecimal:"🏣"},{name:"european-post-office",hexadecimal:"🏤"},{name:"hospital",hexadecimal:"🏥"},{name:"bank",hexadecimal:"🏦"},{name:"hotel",hexadecimal:"🏨"},{name:"love-hotel",hexadecimal:"🏩"},{name:"convenience-store",hexadecimal:"🏪"},{name:"school",hexadecimal:"🏫"},{name:"department-store",hexadecimal:"🏬"},{name:"factory",hexadecimal:"🏭"},{name:"japanese-castle",hexadecimal:"🏯"},{name:"european-castle",hexadecimal:"🏰"},{name:"wedding",hexadecimal:"💒"},{name:"tokyo-tower",hexadecimal:"🗼"},{name:"statue-of-liberty",hexadecimal:"🗽"},{name:"church",hexadecimal:"⛪"},{name:"mosque",hexadecimal:"🕌"},{name:"synagogue",hexadecimal:"🕍"},{name:"shinto-shrine",hexadecimal:"⛩"},{name:"kaaba",hexadecimal:"🕋"},{name:"fountain",hexadecimal:"⛲"},{name:"tent",hexadecimal:"⛺"},{name:"foggy",hexadecimal:"🌁"},{name:"night-with-stars",hexadecimal:"🌃"},{name:"sunrise-over-mountains",hexadecimal:"🌄"},{name:"sunrise",hexadecimal:"🌅"},{name:"cityscape-at-dusk",hexadecimal:"🌆"},{name:"sunset-over-buildings",hexadecimal:"🌇"},{name:"bridge-at-night",hexadecimal:"🌉"},{name:"hot-springs",hexadecimal:"♨"},{name:"milky-way",hexadecimal:"🌌"},{name:"carousel-horse",hexadecimal:"🎠"},{name:"ferris-wheel",hexadecimal:"🎡"},{name:"roller-coaster",hexadecimal:"🎢"},{name:"barber-pole",hexadecimal:"💈"},{name:"circus-tent",hexadecimal:"🎪"},{name:"performing-arts",hexadecimal:"🎭"},{name:"frame-with-picture",hexadecimal:"🖼"},{name:"artist-palette",hexadecimal:"🎨"},{name:"slot-machine",hexadecimal:"🎰"},{name:"steam-locomotive",hexadecimal:"🚂"},{name:"railway-car",hexadecimal:"🚃"},{name:"high-speed-train",hexadecimal:"🚄"},{name:"high-speed-train-with-bullet-nose",hexadecimal:"🚅"},{name:"train",hexadecimal:"🚆"},{name:"metro",hexadecimal:"🚇"},{name:"light-rail",hexadecimal:"🚈"},{name:"station",hexadecimal:"🚉"},{name:"tram",hexadecimal:"🚊"},{name:"monorail",hexadecimal:"🚝"},{name:"mountain-railway",hexadecimal:"🚞"},{name:"tram-car",hexadecimal:"🚋"},{name:"bus",hexadecimal:"🚌"},{name:"oncoming-bus",hexadecimal:"🚍"},{name:"trolleybus",hexadecimal:"🚎"},{name:"minibus",hexadecimal:"🚐"},{name:"ambulance",hexadecimal:"🚑"},{name:"fire-engine",hexadecimal:"🚒"},{name:"police-car",hexadecimal:"🚓"},{name:"oncoming-police-car",hexadecimal:"🚔"},{name:"taxi",hexadecimal:"🚕"},{name:"oncoming-taxi",hexadecimal:"🚖"},{name:"automobile",hexadecimal:"🚗"},{name:"oncoming-automobile",hexadecimal:"🚘"},{name:"recreational-vehicle",hexadecimal:"🚙"},{name:"delivery-truck",hexadecimal:"🚚"},{name:"articulated-lorry",hexadecimal:"🚛"},{name:"tractor",hexadecimal:"🚜"},{name:"bicycle",hexadecimal:"🚲"},{name:"scooter",hexadecimal:"🛴"},{name:"motor-scooter",hexadecimal:"🛵"},{name:"racing-car",hexadecimal:"🏎"},{name:"racing-motorcycle",hexadecimal:"🏍"},{name:"bus-stop",hexadecimal:"🚏"},{name:"motorway",hexadecimal:"🛣"},{name:"railway-track",hexadecimal:"🛤"},{name:"fuel-pump",hexadecimal:"⛽"},{name:"police-cars-revolving-light",hexadecimal:"🚨"},{name:"horizontal-traffic-light",hexadecimal:"🚥"},{name:"vertical-traffic-light",hexadecimal:"🚦"},{name:"construction-sign",hexadecimal:"🚧"},{name:"octagonal-sign",hexadecimal:"🛑"},{name:"anchor",hexadecimal:"⚓"},{name:"sailboat",hexadecimal:"⛵"},{name:"canoe",hexadecimal:"🛶"},{name:"speedboat",hexadecimal:"🚤"},{name:"passenger-ship",hexadecimal:"🛳"},{name:"ferry",hexadecimal:"⛴"},{name:"motor-boat",hexadecimal:"🛥"},{name:"ship",hexadecimal:"🚢"},{name:"airplane",hexadecimal:"✈"},{name:"small-airplane",hexadecimal:"🛩"},{name:"airplane-departure",hexadecimal:"🛫"},{name:"airplane-arriving",hexadecimal:"🛬"},{name:"seat",hexadecimal:"💺"},{name:"helicopter",hexadecimal:"🚁"},{name:"suspension-railway",hexadecimal:"🚟"},{name:"mountain-cableway",hexadecimal:"🚠"},{name:"aerial-tramway",hexadecimal:"🚡"},{name:"rocket",hexadecimal:"🚀"},{name:"satellite",hexadecimal:"🛰"},{name:"bellhop-bell",hexadecimal:"🛎"},{name:"door",hexadecimal:"🚪"},{name:"sleeping-accommodation",hexadecimal:"🛌"},{name:"bed",hexadecimal:"🛏"},{name:"couch-and-lamp",hexadecimal:"🛋"},{name:"toilet",hexadecimal:"🚽"},{name:"shower",hexadecimal:"🚿"},{name:"bath",hexadecimal:"🛀"},{name:"person-taking-bath-type-1-2",hexadecimal:"🛀🏻"},{name:"person-taking-bath-type-3",hexadecimal:"🛀🏼"},{name:"person-taking-bath-type-4",hexadecimal:"🛀🏽"},{name:"person-taking-bath-type-5",hexadecimal:"🛀🏾"},{name:"person-taking-bath-type-6",hexadecimal:"🛀🏿"},{name:"bathtub",hexadecimal:"🛁"},{name:"hourglass",hexadecimal:"⌛"},{name:"hourglass-with-flowing-sand",hexadecimal:"⏳"},{name:"watch",hexadecimal:"⌚"},{name:"alarm-clock",hexadecimal:"⏰"},{name:"stopwatch",hexadecimal:"⏱"},{name:"timer-clock",hexadecimal:"⏲"},{name:"mantelpiece-clock",hexadecimal:"🕰"},{name:"clock-face-twelve-oclock",hexadecimal:"🕛"},{name:"clock-face-twelve-thirty",hexadecimal:"🕧"},{name:"clock-face-one-oclock",hexadecimal:"🕐"},{name:"clock-face-one-thirty",hexadecimal:"🕜"},{name:"clock-face-two-oclock",hexadecimal:"🕑"},{name:"clock-face-two-thirty",hexadecimal:"🕝"},{name:"clock-face-three-oclock",hexadecimal:"🕒"},{name:"clock-face-three-thirty",hexadecimal:"🕞"},{name:"clock-face-four-oclock",hexadecimal:"🕓"},{name:"clock-face-four-thirty",hexadecimal:"🕟"},{name:"clock-face-five-oclock",hexadecimal:"🕔"},{name:"clock-face-five-thirty",hexadecimal:"🕠"},{name:"clock-face-six-oclock",hexadecimal:"🕕"},{name:"clock-face-six-thirty",hexadecimal:"🕡"},{name:"clock-face-seven-oclock",hexadecimal:"🕖"},{name:"clock-face-seven-thirty",hexadecimal:"🕢"},{name:"clock-face-eight-oclock",hexadecimal:"🕗"},{name:"clock-face-eight-thirty",hexadecimal:"🕣"},{name:"clock-face-nine-oclock",hexadecimal:"🕘"},{name:"clock-face-nine-thirty",hexadecimal:"🕤"},{name:"clock-face-ten-oclock",hexadecimal:"🕙"},{name:"clock-face-ten-thirty",hexadecimal:"🕥"},{name:"clock-face-eleven-oclock",hexadecimal:"🕚"},{name:"clock-face-eleven-thirty",hexadecimal:"🕦"},{name:"new-moon-symbol",hexadecimal:"🌑"},{name:"waxing-crescent-moon-symbol",hexadecimal:"🌒"},{name:"first-quarter-moon-symbol",hexadecimal:"🌓"},{name:"waxing-gibbous-moon-symbol",hexadecimal:"🌔"},{name:"full-moon-symbol",hexadecimal:"🌕"},{name:"waning-gibbous-moon-symbol",hexadecimal:"🌖"},{name:"last-quarter-moon-symbol",hexadecimal:"🌗"},{name:"waning-crescent-moon-symbol",hexadecimal:"🌘"},{name:"crescent-moon",hexadecimal:"🌙"},{name:"new-moon-with-face",hexadecimal:"🌚"},{name:"first-quarter-moon-with-face",hexadecimal:"🌛"},{name:"last-quarter-moon-with-face",hexadecimal:"🌜"},{name:"thermometer",hexadecimal:"🌡"},{name:"black-sun-with-rays",hexadecimal:"☀"},{name:"full-moon-with-face",hexadecimal:"🌝"},{name:"sun-with-face",hexadecimal:"🌞"},{name:"white-medium-star",hexadecimal:"⭐"},{name:"glowing-star",hexadecimal:"🌟"},{name:"shooting-star",hexadecimal:"🌠"},{name:"cloud",hexadecimal:"☁"},{name:"sun-behind-cloud",hexadecimal:"⛅"},{name:"thunder-cloud-and-rain",hexadecimal:"⛈"},{name:"white-sun-with-small-cloud",hexadecimal:"🌤"},{name:"white-sun-behind-cloud",hexadecimal:"🌥"},{name:"white-sun-behind-cloud-with-rain",hexadecimal:"🌦"},{name:"cloud-with-rain",hexadecimal:"🌧"},{name:"cloud-with-snow",hexadecimal:"🌨"},{name:"cloud-with-lightning",hexadecimal:"🌩"},{name:"cloud-with-tornado",hexadecimal:"🌪"},{name:"fog",hexadecimal:"🌫"},{name:"wind-blowing-face",hexadecimal:"🌬"},{name:"cyclone",hexadecimal:"🌀"},{name:"rainbow",hexadecimal:"🌈"},{name:"closed-umbrella",hexadecimal:"🌂"},{name:"umbrella",hexadecimal:"☂"},{name:"umbrella-with-rain-drops",hexadecimal:"☔"},{name:"umbrella-on-ground",hexadecimal:"⛱"},{name:"high-voltage-sign",hexadecimal:"⚡"},{name:"snowflake",hexadecimal:"❄"},{name:"snowman",hexadecimal:"☃"},{name:"snowman-without-snow",hexadecimal:"⛄"},{name:"comet",hexadecimal:"☄"},{name:"fire",hexadecimal:"🔥"},{name:"droplet",hexadecimal:"💧"},{name:"water-wave",hexadecimal:"🌊"},{name:"jack-o-lantern",hexadecimal:"🎃"},{name:"christmas-tree",hexadecimal:"🎄"},{name:"fireworks",hexadecimal:"🎆"},{name:"firework-sparkler",hexadecimal:"🎇"},{name:"sparkles",hexadecimal:"✨"},{name:"balloon",hexadecimal:"🎈"},{name:"party-popper",hexadecimal:"🎉"},{name:"confetti-ball",hexadecimal:"🎊"},{name:"tanabata-tree",hexadecimal:"🎋"},{name:"pine-decoration",hexadecimal:"🎍"},{name:"japanese-dolls",hexadecimal:"🎎"},{name:"carp-streamer",hexadecimal:"🎏"},{name:"wind-chime",hexadecimal:"🎐"},{name:"moon-viewing-ceremony",hexadecimal:"🎑"},{name:"ribbon",hexadecimal:"🎀"},{name:"wrapped-present",hexadecimal:"🎁"},{name:"reminder-ribbon",hexadecimal:"🎗"},{name:"admission-tickets",hexadecimal:"🎟"},{name:"ticket",hexadecimal:"🎫"},{name:"military-medal",hexadecimal:"🎖"},{name:"trophy",hexadecimal:"🏆"},{name:"sports-medal",hexadecimal:"🏅"},{name:"first-place-medal",hexadecimal:"🥇"},{name:"second-place-medal",hexadecimal:"🥈"},{name:"third-place-medal",hexadecimal:"🥉"},{name:"soccer-ball",hexadecimal:"⚽"},{name:"baseball",hexadecimal:"⚾"},{name:"basketball-and-hoop",hexadecimal:"🏀"},{name:"volleyball",hexadecimal:"🏐"},{name:"american-football",hexadecimal:"🏈"},{name:"rugby-football",hexadecimal:"🏉"},{name:"tennis-racquet-and-ball",hexadecimal:"🎾"},{name:"billiards",hexadecimal:"🎱"},{name:"bowling",hexadecimal:"🎳"},{name:"cricket-bat-and-ball",hexadecimal:"🏏"},{name:"field-hockey-stick-and-ball",hexadecimal:"🏑"},{name:"ice-hockey-stick-and-puck",hexadecimal:"🏒"},{name:"table-tennis-paddle-and-ball",hexadecimal:"🏓"},{name:"badminton-racquet-and-shuttlecock",hexadecimal:"🏸"},{name:"boxing-glove",hexadecimal:"🥊"},{name:"martial-arts-uniform",hexadecimal:"🥋"},{name:"goal-net",hexadecimal:"🥅"},{name:"direct-hit",hexadecimal:"🎯"},{name:"flag-in-hole",hexadecimal:"⛳"},{name:"ice-skate",hexadecimal:"⛸"},{name:"fishing-pole-and-fish",hexadecimal:"🎣"},{name:"running-shirt-with-sash",hexadecimal:"🎽"},{name:"ski-and-ski-boot",hexadecimal:"🎿"},{name:"fencer",hexadecimal:"🤺"},{name:"horse-racing",hexadecimal:"🏇"},{name:"skier",hexadecimal:"⛷"},{name:"snowboarder",hexadecimal:"🏂"},{name:"golfer",hexadecimal:"🏌"},{name:"surfer",hexadecimal:"🏄"},{name:"person-surfing-type-1-2",hexadecimal:"🏄🏻"},{name:"person-surfing-type-3",hexadecimal:"🏄🏼"},{name:"person-surfing-type-4",hexadecimal:"🏄🏽"},{name:"person-surfing-type-5",hexadecimal:"🏄🏾"},{name:"person-surfing-type-6",hexadecimal:"🏄🏿"},{name:"rowboat",hexadecimal:"🚣"},{name:"person-rowing-boat-type-1-2",hexadecimal:"🚣🏻"},{name:"person-rowing-boat-type-3",hexadecimal:"🚣🏼"},{name:"person-rowing-boat-type-4",hexadecimal:"🚣🏽"},{name:"person-rowing-boat-type-5",hexadecimal:"🚣🏾"},{name:"person-rowing-boat-type-6",hexadecimal:"🚣🏿"},{name:"swimmer",hexadecimal:"🏊"},{name:"person-swimming-type-1-2",hexadecimal:"🏊🏻"},{name:"person-swimming-type-3",hexadecimal:"🏊🏼"},{name:"person-swimming-type-4",hexadecimal:"🏊🏽"},{name:"person-swimming-type-5",hexadecimal:"🏊🏾"},{name:"person-swimming-type-6",hexadecimal:"🏊🏿"},{name:"person-with-ball",hexadecimal:"⛹"},{name:"person-with-ball-type-1-2",hexadecimal:"⛹🏻"},{name:"person-with-ball-type-3",hexadecimal:"⛹🏼"},{name:"person-with-ball-type-4",hexadecimal:"⛹🏽"},{name:"person-with-ball-type-5",hexadecimal:"⛹🏾"},{name:"person-with-ball-type-6",hexadecimal:"⛹🏿"},{name:"weight-lifter",hexadecimal:"🏋"},{name:"person-weight-lifting-type-1-2",hexadecimal:"🏋🏻"},{name:"person-weight-lifting-type-3",hexadecimal:"🏋🏼"},{name:"person-weight-lifting-type-4",hexadecimal:"🏋🏽"},{name:"person-weight-lifting-type-5",hexadecimal:"🏋🏾"},{name:"person-weight-lifting-type-6",hexadecimal:"🏋🏿"},{name:"bicyclist",hexadecimal:"🚴"},{name:"person-biking-type-1-2",hexadecimal:"🚴🏻"},{name:"person-biking-type-3",hexadecimal:"🚴🏼"},{name:"person-biking-type-4",hexadecimal:"🚴🏽"},{name:"person-biking-type-5",hexadecimal:"🚴🏾"},{name:"person-biking-type-6",hexadecimal:"🚴🏿"},{name:"mountain-bicyclist",hexadecimal:"🚵"},{name:"person-mountain-biking-type-1-2",hexadecimal:"🚵🏻"},{name:"person-mountain-biking-type-3",hexadecimal:"🚵🏼"},{name:"person-mountain-biking-type-4",hexadecimal:"🚵🏽"},{name:"person-mountain-biking-type-5",hexadecimal:"🚵🏾"},{name:"person-mountain-biking-type-6",hexadecimal:"🚵🏿"},{name:"person-doing-cartwheel",hexadecimal:"🤸"},{name:"person-doing-cartwheel-type-1-2",hexadecimal:"🤸🏻"},{name:"person-doing-cartwheel-type-3",hexadecimal:"🤸🏼"},{name:"person-doing-cartwheel-type-4",hexadecimal:"🤸🏽"},{name:"person-doing-cartwheel-type-5",hexadecimal:"🤸🏾"},{name:"person-doing-cartwheel-type-6",hexadecimal:"🤸🏿"},{name:"wrestlers",hexadecimal:"🤼"},{name:"people-wrestling-type-1-2",hexadecimal:"🤼🏻"},{name:"people-wrestling-type-3",hexadecimal:"🤼🏼"},{name:"people-wrestling-type-4",hexadecimal:"🤼🏽"},{name:"people-wrestling-type-5",hexadecimal:"🤼🏾"},{name:"people-wrestling-type-6",hexadecimal:"🤼🏿"},{name:"water-polo",hexadecimal:"🤽"},{name:"person-playing-water-polo-type-1-2",hexadecimal:"🤽🏻"},{name:"person-playing-water-polo-type-3",hexadecimal:"🤽🏼"},{name:"person-playing-water-polo-type-4",hexadecimal:"🤽🏽"},{name:"person-playing-water-polo-type-5",hexadecimal:"🤽🏾"},{name:"person-playing-water-polo-type-6",hexadecimal:"🤽🏿"},{name:"handball",hexadecimal:"🤾"},{name:"person-playing-handball-type-1-2",hexadecimal:"🤾🏻"},{name:"person-playing-handball-type-3",hexadecimal:"🤾🏼"},{name:"person-playing-handball-type-4",hexadecimal:"🤾🏽"},{name:"person-playing-handball-type-5",hexadecimal:"🤾🏾"},{name:"person-playing-handball-type-6",hexadecimal:"🤾🏿"},{name:"juggling",hexadecimal:"🤹"},{name:"person-juggling-type-1-2",hexadecimal:"🤹🏻"},{name:"person-juggling-type-3",hexadecimal:"🤹🏼"},{name:"person-juggling-type-4",hexadecimal:"🤹🏽"},{name:"person-juggling-type-5",hexadecimal:"🤹🏾"},{name:"person-juggling-type-6",hexadecimal:"🤹🏿"},{name:"video-game",hexadecimal:"🎮"},{name:"joystick",hexadecimal:"🕹"},{name:"game-die",hexadecimal:"🎲"},{name:"black-spade-suit",hexadecimal:"♠"},{name:"black-heart-suit",hexadecimal:"♥"},{name:"black-diamond-suit",hexadecimal:"♦"},{name:"black-club-suit",hexadecimal:"♣"},{name:"playing-card-black-joker",hexadecimal:"🃏"},{name:"mahjong-tile-red-dragon",hexadecimal:"🀄"},{name:"flower-playing-cards",hexadecimal:"🎴"},{name:"speaker-with-cancellation-stroke",hexadecimal:"🔇"},{name:"speaker",hexadecimal:"🔈"},{name:"speaker-with-one-sound-wave",hexadecimal:"🔉"},{name:"speaker-with-three-sound-waves",hexadecimal:"🔊"},{name:"public-address-loudspeaker",hexadecimal:"📢"},{name:"cheering-megaphone",hexadecimal:"📣"},{name:"postal-horn",hexadecimal:"📯"},{name:"bell",hexadecimal:"🔔"},{name:"bell-with-cancellation-stroke",hexadecimal:"🔕"},{name:"musical-score",hexadecimal:"🎼"},{name:"musical-note",hexadecimal:"🎵"},{name:"multiple-musical-notes",hexadecimal:"🎶"},{name:"studio-microphone",hexadecimal:"🎙"},{name:"level-slider",hexadecimal:"🎚"},{name:"control-knobs",hexadecimal:"🎛"},{name:"microphone",hexadecimal:"🎤"},{name:"headphone",hexadecimal:"🎧"},{name:"radio",hexadecimal:"📻"},{name:"saxophone",hexadecimal:"🎷"},{name:"guitar",hexadecimal:"🎸"},{name:"musical-keyboard",hexadecimal:"🎹"},{name:"trumpet",hexadecimal:"🎺"},{name:"violin",hexadecimal:"🎻"},{name:"drum-with-drumsticks",hexadecimal:"🥁"},{name:"mobile-phone",hexadecimal:"📱"},{name:"mobile-phone-with-rightwards-arrow-at-left",hexadecimal:"📲"},{name:"black-telephone",hexadecimal:"☎"},{name:"telephone-receiver",hexadecimal:"📞"},{name:"pager",hexadecimal:"📟"},{name:"fax-machine",hexadecimal:"📠"},{name:"battery",hexadecimal:"🔋"},{name:"electric-plug",hexadecimal:"🔌"},{name:"personal-computer",hexadecimal:"💻"},{name:"desktop-computer",hexadecimal:"🖥"},{name:"printer",hexadecimal:"🖨"},{name:"keyboard",hexadecimal:"⌨"},{name:"three-button-mouse",hexadecimal:"🖱"},{name:"trackball",hexadecimal:"🖲"},{name:"minidisc",hexadecimal:"💽"},{name:"floppy-disk",hexadecimal:"💾"},{name:"optical-disc",hexadecimal:"💿"},{name:"dvd",hexadecimal:"📀"},{name:"movie-camera",hexadecimal:"🎥"},{name:"film-frames",hexadecimal:"🎞"},{name:"film-projector",hexadecimal:"📽"},{name:"clapper-board",hexadecimal:"🎬"},{name:"television",hexadecimal:"📺"},{name:"camera",hexadecimal:"📷"},{name:"camera-with-flash",hexadecimal:"📸"},{name:"video-camera",hexadecimal:"📹"},{name:"videocassette",hexadecimal:"📼"},{name:"left-pointing-magnifying-glass",hexadecimal:"🔍"},{name:"right-pointing-magnifying-glass",hexadecimal:"🔎"},{name:"microscope",hexadecimal:"🔬"},{name:"telescope",hexadecimal:"🔭"},{name:"satellite-antenna",hexadecimal:"📡"},{name:"candle",hexadecimal:"🕯"},{name:"electric-light-bulb",hexadecimal:"💡"},{name:"electric-torch",hexadecimal:"🔦"},{name:"izakaya-lantern",hexadecimal:"🏮"},{name:"notebook-with-decorative-cover",hexadecimal:"📔"},{name:"closed-book",hexadecimal:"📕"},{name:"open-book",hexadecimal:"📖"},{name:"green-book",hexadecimal:"📗"},{name:"blue-book",hexadecimal:"📘"},{name:"orange-book",hexadecimal:"📙"},{name:"books",hexadecimal:"📚"},{name:"notebook",hexadecimal:"📓"},{name:"ledger",hexadecimal:"📒"},{name:"page-with-curl",hexadecimal:"📃"},{name:"scroll",hexadecimal:"📜"},{name:"page-facing-up",hexadecimal:"📄"},{name:"newspaper",hexadecimal:"📰"},{name:"rolled-up-newspaper",hexadecimal:"🗞"},{name:"bookmark-tabs",hexadecimal:"📑"},{name:"bookmark",hexadecimal:"🔖"},{name:"label",hexadecimal:"🏷"},{name:"money-bag",hexadecimal:"💰"},{name:"banknote-with-yen-sign",hexadecimal:"💴"},{name:"banknote-with-dollar-sign",hexadecimal:"💵"},{name:"banknote-with-euro-sign",hexadecimal:"💶"},{name:"banknote-with-pound-sign",hexadecimal:"💷"},{name:"money-with-wings",hexadecimal:"💸"},{name:"credit-card",hexadecimal:"💳"},{name:"chart-with-upwards-trend-and-yen-sign",hexadecimal:"💹"},{name:"currency-exchange",hexadecimal:"💱"},{name:"heavy-dollar-sign",hexadecimal:"💲"},{name:"envelope",hexadecimal:"✉"},{name:"e-mail-symbol",hexadecimal:"📧"},{name:"incoming-envelope",hexadecimal:"📨"},{name:"envelope-with-downwards-arrow-above",hexadecimal:"📩"},{name:"outbox-tray",hexadecimal:"📤"},{name:"inbox-tray",hexadecimal:"📥"},{name:"package",hexadecimal:"📦"},{name:"closed-mailbox-with-raised-flag",hexadecimal:"📫"},{name:"closed-mailbox-with-lowered-flag",hexadecimal:"📪"},{name:"open-mailbox-with-raised-flag",hexadecimal:"📬"},{name:"open-mailbox-with-lowered-flag",hexadecimal:"📭"},{name:"postbox",hexadecimal:"📮"},{name:"ballot-box-with-ballot",hexadecimal:"🗳"},{name:"pencil",hexadecimal:"✏"},{name:"black-nib",hexadecimal:"✒"},{name:"lower-left-fountain-pen",hexadecimal:"🖋"},{name:"lower-left-ballpoint-pen",hexadecimal:"🖊"},{name:"lower-left-paintbrush",hexadecimal:"🖌"},{name:"lower-left-crayon",hexadecimal:"🖍"},{name:"memo",hexadecimal:"📝"},{name:"briefcase",hexadecimal:"💼"},{name:"file-folder",hexadecimal:"📁"},{name:"open-file-folder",hexadecimal:"📂"},{name:"card-index-dividers",hexadecimal:"🗂"},{name:"calendar",hexadecimal:"📅"},{name:"tear-off-calendar",hexadecimal:"📆"},{name:"spiral-note-pad",hexadecimal:"🗒"},{name:"spiral-calendar-pad",hexadecimal:"🗓"},{name:"card-index",hexadecimal:"📇"},{name:"chart-with-upwards-trend",hexadecimal:"📈"},{name:"chart-with-downwards-trend",hexadecimal:"📉"},{name:"bar-chart",hexadecimal:"📊"},{name:"clipboard",hexadecimal:"📋"},{name:"pushpin",hexadecimal:"📌"},{name:"round-pushpin",hexadecimal:"📍"},{name:"paperclip",hexadecimal:"📎"},{name:"linked-paperclips",hexadecimal:"🖇"},{name:"straight-ruler",hexadecimal:"📏"},{name:"triangular-ruler",hexadecimal:"📐"},{name:"black-scissors",hexadecimal:"✂"},{name:"card-file-box",hexadecimal:"🗃"},{name:"file-cabinet",hexadecimal:"🗄"},{name:"wastebasket",hexadecimal:"🗑"},{name:"lock",hexadecimal:"🔒"},{name:"open-lock",hexadecimal:"🔓"},{name:"lock-with-ink-pen",hexadecimal:"🔏"},{name:"closed-lock-with-key",hexadecimal:"🔐"},{name:"key",hexadecimal:"🔑"},{name:"old-key",hexadecimal:"🗝"},{name:"hammer",hexadecimal:"🔨"},{name:"pick",hexadecimal:"⛏"},{name:"hammer-and-pick",hexadecimal:"⚒"},{name:"hammer-and-wrench",hexadecimal:"🛠"},{name:"dagger-knife",hexadecimal:"🗡"},{name:"crossed-swords",hexadecimal:"⚔"},{name:"pistol",hexadecimal:"🔫"},{name:"bow-and-arrow",hexadecimal:"🏹"},{name:"shield",hexadecimal:"🛡"},{name:"wrench",hexadecimal:"🔧"},{name:"nut-and-bolt",hexadecimal:"🔩"},{name:"gear",hexadecimal:"⚙"},{name:"compression",hexadecimal:"🗜"},{name:"alembic",hexadecimal:"⚗"},{name:"scales",hexadecimal:"⚖"},{name:"link-symbol",hexadecimal:"🔗"},{name:"chains",hexadecimal:"⛓"},{name:"syringe",hexadecimal:"💉"},{name:"pill",hexadecimal:"💊"},{name:"smoking-symbol",hexadecimal:"🚬"},{name:"coffin",hexadecimal:"⚰"},{name:"funeral-urn",hexadecimal:"⚱"},{name:"moyai",hexadecimal:"🗿"},{name:"oil-drum",hexadecimal:"🛢"},{name:"crystal-ball",hexadecimal:"🔮"},{name:"shopping-trolley",hexadecimal:"🛒"},{name:"automated-teller-machine",hexadecimal:"🏧"},{name:"put-litter-in-its-place-symbol",hexadecimal:"🚮"},{name:"potable-water-symbol",hexadecimal:"🚰"},{name:"wheelchair-symbol",hexadecimal:"♿"},{name:"mens-symbol",hexadecimal:"🚹"},{name:"womens-symbol",hexadecimal:"🚺"},{name:"restroom",hexadecimal:"🚻"},{name:"baby-symbol",hexadecimal:"🚼"},{name:"water-closet",hexadecimal:"🚾"},{name:"passport-control",hexadecimal:"🛂"},{name:"customs",hexadecimal:"🛃"},{name:"baggage-claim",hexadecimal:"🛄"},{name:"left-luggage",hexadecimal:"🛅"},{name:"warning-sign",hexadecimal:"⚠"},{name:"children-crossing",hexadecimal:"🚸"},{name:"no-entry",hexadecimal:"⛔"},{name:"no-entry-sign",hexadecimal:"🚫"},{name:"no-bicycles",hexadecimal:"🚳"},{name:"no-smoking-symbol",hexadecimal:"🚭"},{name:"do-not-litter-symbol",hexadecimal:"🚯"},{name:"non-potable-water-symbol",hexadecimal:"🚱"},{name:"no-pedestrians",hexadecimal:"🚷"},{name:"no-mobile-phones",hexadecimal:"📵"},{name:"no-one-under-eighteen-symbol",hexadecimal:"🔞"},{name:"radioactive-sign",hexadecimal:"☢"},{name:"biohazard-sign",hexadecimal:"☣"},{name:"upwards-black-arrow",hexadecimal:"⬆"},{name:"north-east-arrow",hexadecimal:"↗"},{name:"black-rightwards-arrow",hexadecimal:"➡"},{name:"south-east-arrow",hexadecimal:"↘"},{name:"downwards-black-arrow",hexadecimal:"⬇"},{name:"south-west-arrow",hexadecimal:"↙"},{name:"leftwards-black-arrow",hexadecimal:"⬅"},{name:"north-west-arrow",hexadecimal:"↖"},{name:"up-down-arrow",hexadecimal:"↕"},{name:"left-right-arrow",hexadecimal:"↔"},{name:"leftwards-arrow-with-hook",hexadecimal:"↩"},{name:"rightwards-arrow-with-hook",hexadecimal:"↪"},{name:"arrow-pointing-rightwards-then-curving-upwards",hexadecimal:"⤴"},{name:"arrow-pointing-rightwards-then-curving-downwards",hexadecimal:"⤵"},{name:"clockwise-downwards-and-upwards-open-circle-arrows",hexadecimal:"🔃"},{name:"anticlockwise-downwards-and-upwards-open-circle-arrows",hexadecimal:"🔄"},{name:"back-with-leftwards-arrow-above",hexadecimal:"🔙"},{name:"end-with-leftwards-arrow-above",hexadecimal:"🔚"},{name:"on-with-exclamation-mark-with-left-right-arrow-above",hexadecimal:"🔛"},{name:"soon-with-rightwards-arrow-above",hexadecimal:"🔜"},{name:"top-with-upwards-arrow-above",hexadecimal:"🔝"},{name:"place-of-worship",hexadecimal:"🛐"},{name:"atom-symbol",hexadecimal:"⚛"},{name:"om-symbol",hexadecimal:"🕉"},{name:"star-of-david",hexadecimal:"✡"},{name:"wheel-of-dharma",hexadecimal:"☸"},{name:"yin-yang",hexadecimal:"☯"},{name:"latin-cross",hexadecimal:"✝"},{name:"orthodox-cross",hexadecimal:"☦"},{name:"star-and-crescent",hexadecimal:"☪"},{name:"peace-symbol",hexadecimal:"☮"},{name:"menorah-with-nine-branches",hexadecimal:"🕎"},{name:"six-pointed-star-with-middle-dot",hexadecimal:"🔯"},{name:"black-universal-recycling-symbol",hexadecimal:"♻"},{name:"name-badge",hexadecimal:"📛"},{name:"fleur-de-lis",hexadecimal:"⚜"},{name:"japanese-symbol-for-beginner",hexadecimal:"🔰"},{name:"trident-emblem",hexadecimal:"🔱"},{name:"heavy-large-circle",hexadecimal:"⭕"},{name:"white-heavy-check-mark",hexadecimal:"✅"},{name:"ballot-box-with-check",hexadecimal:"☑"},{name:"heavy-check-mark",hexadecimal:"✔"},{name:"heavy-multiplication-x",hexadecimal:"✖"},{name:"cross-mark",hexadecimal:"❌"},{name:"negative-squared-cross-mark",hexadecimal:"❎"},{name:"heavy-plus-sign",hexadecimal:"➕"},{name:"heavy-minus-sign",hexadecimal:"➖"},{name:"heavy-division-sign",hexadecimal:"➗"},{name:"curly-loop",hexadecimal:"➰"},{name:"double-curly-loop",hexadecimal:"➿"},{name:"part-alternation-mark",hexadecimal:"〽"},{name:"eight-spoked-asterisk",hexadecimal:"✳"},{name:"eight-pointed-black-star",hexadecimal:"✴"},{name:"sparkle",hexadecimal:"❇"},{name:"double-exclamation-mark",hexadecimal:"‼"},{name:"exclamation-question-mark",hexadecimal:"⁉"},{name:"black-question-mark-ornament",hexadecimal:"❓"},{name:"white-question-mark-ornament",hexadecimal:"❔"},{name:"white-exclamation-mark-ornament",hexadecimal:"❕"},{name:"heavy-exclamation-mark-symbol",hexadecimal:"❗"},{name:"wavy-dash",hexadecimal:"〰"},{name:"copyright-sign",hexadecimal:"©"},{name:"registered-sign",hexadecimal:"®"},{name:"trade-mark-sign",hexadecimal:"™"},{name:"aries",hexadecimal:"♈"},{name:"taurus",hexadecimal:"♉"},{name:"gemini",hexadecimal:"♊"},{name:"cancer",hexadecimal:"♋"},{name:"leo",hexadecimal:"♌"},{name:"virgo",hexadecimal:"♍"},{name:"libra",hexadecimal:"♎"},{name:"scorpius",hexadecimal:"♏"},{name:"sagittarius",hexadecimal:"♐"},{name:"capricorn",hexadecimal:"♑"},{name:"aquarius",hexadecimal:"♒"},{name:"pisces",hexadecimal:"♓"},{name:"ophiuchus",hexadecimal:"⛎"},{name:"twisted-rightwards-arrows",hexadecimal:"🔀"},{name:"clockwise-rightwards-and-leftwards-open-circle-arrows",hexadecimal:"🔁"},{name:"clockwise-rightwards-and-leftwards-open-circle-arrows-with-circled-one-overlay",hexadecimal:"🔂"},{name:"black-right-pointing-triangle",hexadecimal:"▶"},{name:"black-right-pointing-double-triangle",hexadecimal:"⏩"},{name:"black-right-pointing-double-triangle-with-vertical-bar",hexadecimal:"⏭"},{name:"black-right-pointing-triangle-with-double-vertical-bar",hexadecimal:"⏯"},{name:"black-left-pointing-triangle",hexadecimal:"◀"},{name:"black-left-pointing-double-triangle",hexadecimal:"⏪"},{name:"black-left-pointing-double-triangle-with-vertical-bar",hexadecimal:"⏮"},{name:"up-pointing-small-red-triangle",hexadecimal:"🔼"},{name:"black-up-pointing-double-triangle",hexadecimal:"⏫"},{name:"down-pointing-small-red-triangle",hexadecimal:"🔽"},{name:"black-down-pointing-double-triangle",hexadecimal:"⏬"},{name:"double-vertical-bar",hexadecimal:"⏸"},{name:"black-square-for-stop",hexadecimal:"⏹"},{name:"black-circle-for-record",hexadecimal:"⏺"},{name:"eject-symbol",hexadecimal:"⏏"},{name:"cinema",hexadecimal:"🎦"},{name:"low-brightness-symbol",hexadecimal:"🔅"},{name:"high-brightness-symbol",hexadecimal:"🔆"},{name:"antenna-with-bars",hexadecimal:"📶"},{name:"vibration-mode",hexadecimal:"📳"},{name:"mobile-phone-off",hexadecimal:"📴"},{name:"keycap-#",hexadecimal:"#️⃣"},{name:"keycap-*",hexadecimal:"*️⃣"},{name:"keycap-0",hexadecimal:"0️⃣"},{name:"keycap-1",hexadecimal:"1️⃣"},{name:"keycap-2",hexadecimal:"2️⃣"},{name:"keycap-3",hexadecimal:"3️⃣"},{name:"keycap-4",hexadecimal:"4️⃣"},{name:"keycap-5",hexadecimal:"5️⃣"},{name:"keycap-6",hexadecimal:"6️⃣"},{name:"keycap-7",hexadecimal:"7️⃣"},{name:"keycap-8",hexadecimal:"8️⃣"},{name:"keycap-9",hexadecimal:"9️⃣"},{name:"keycap-ten",hexadecimal:"🔟"},{name:"hundred-points-symbol",hexadecimal:"💯"},{name:"input-symbol-for-latin-capital-letters",hexadecimal:"🔠"},{name:"input-symbol-for-latin-small-letters",hexadecimal:"🔡"},{name:"input-symbol-for-numbers",hexadecimal:"🔢"},{name:"input-symbol-for-symbols",hexadecimal:"🔣"},{name:"input-symbol-for-latin-letters",hexadecimal:"🔤"},{name:"negative-squared-latin-capital-letter-a",hexadecimal:"🅰"},{name:"negative-squared-ab",hexadecimal:"🆎"},{name:"negative-squared-latin-capital-letter-b",hexadecimal:"🅱"},{name:"squared-cl",hexadecimal:"🆑"},{name:"squared-cool",hexadecimal:"🆒"},{name:"squared-free",hexadecimal:"🆓"},{name:"information-source",hexadecimal:"ℹ"},{name:"squared-id",hexadecimal:"🆔"},{name:"circled-latin-capital-letter-m",hexadecimal:"Ⓜ"},{name:"squared-new",hexadecimal:"🆕"},{name:"squared-ng",hexadecimal:"🆖"},{name:"negative-squared-latin-capital-letter-o",hexadecimal:"🅾"},{name:"squared-ok",hexadecimal:"🆗"},{name:"negative-squared-latin-capital-letter-p",hexadecimal:"🅿"},{name:"squared-sos",hexadecimal:"🆘"},{name:"squared-up-with-exclamation-mark",hexadecimal:"🆙"},{name:"squared-vs",hexadecimal:"🆚"},{name:"squared-katakana-koko",hexadecimal:"🈁"},{name:"squared-katakana-sa",hexadecimal:"🈂"},{name:"squared-cjk-unified-ideograph-6708",hexadecimal:"🈷"},{name:"squared-cjk-unified-ideograph-6709",hexadecimal:"🈶"},{name:"squared-cjk-unified-ideograph-6307",hexadecimal:"🈯"},{name:"circled-ideograph-advantage",hexadecimal:"🉐"},{name:"squared-cjk-unified-ideograph-5272",hexadecimal:"🈹"},{name:"squared-cjk-unified-ideograph-7121",hexadecimal:"🈚"},{name:"squared-cjk-unified-ideograph-7981",hexadecimal:"🈲"},{name:"circled-ideograph-accept",hexadecimal:"🉑"},{name:"squared-cjk-unified-ideograph-7533",hexadecimal:"🈸"},{name:"squared-cjk-unified-ideograph-5408",hexadecimal:"🈴"},{name:"squared-cjk-unified-ideograph-7a7a",hexadecimal:"🈳"},{name:"circled-ideograph-congratulation",hexadecimal:"㊗"},{name:"circled-ideograph-secret",hexadecimal:"㊙"},{name:"squared-cjk-unified-ideograph-55b6",hexadecimal:"🈺"},{name:"squared-cjk-unified-ideograph-6e80",hexadecimal:"🈵"},{name:"black-small-square",hexadecimal:"▪"},{name:"white-small-square",hexadecimal:"▫"},{name:"white-medium-square",hexadecimal:"◻"},{name:"black-medium-square",hexadecimal:"◼"},{name:"white-medium-small-square",hexadecimal:"◽"},{name:"black-medium-small-square",hexadecimal:"◾"},{name:"black-large-square",hexadecimal:"⬛"},{name:"white-large-square",hexadecimal:"⬜"},{name:"large-orange-diamond",hexadecimal:"🔶"},{name:"large-blue-diamond",hexadecimal:"🔷"},{name:"small-orange-diamond",hexadecimal:"🔸"},{name:"small-blue-diamond",hexadecimal:"🔹"},{name:"up-pointing-red-triangle",hexadecimal:"🔺"},{name:"down-pointing-red-triangle",hexadecimal:"🔻"},{name:"diamond-shape-with-a-dot-inside",hexadecimal:"💠"},{name:"radio-button",hexadecimal:"🔘"},{name:"black-square-button",hexadecimal:"🔲"},{name:"white-square-button",hexadecimal:"🔳"},{name:"medium-white-circle",hexadecimal:"⚪"},{name:"medium-black-circle",hexadecimal:"⚫"},{name:"large-red-circle",hexadecimal:"🔴"},{name:"large-blue-circle",hexadecimal:"🔵"},{name:"chequered-flag",hexadecimal:"🏁"},{name:"triangular-flag-on-post",hexadecimal:"🚩"},{name:"crossed-flags",hexadecimal:"🎌"},{name:"waving-black-flag",hexadecimal:"🏴"},{name:"waving-white-flag",hexadecimal:"🏳"},{name:"ascension-island",hexadecimal:"🇦🇨"},{name:"andorra",hexadecimal:"🇦🇩"},{name:"united-arab-emirates",hexadecimal:"🇦🇪"},{name:"afghanistan",hexadecimal:"🇦🇫"},{name:"antigua-&-barbuda",hexadecimal:"🇦🇬"},{name:"anguilla",hexadecimal:"🇦🇮"},{name:"albania",hexadecimal:"🇦🇱"},{name:"armenia",hexadecimal:"🇦🇲"},{name:"angola",hexadecimal:"🇦🇴"},{name:"antarctica",hexadecimal:"🇦🇶"},{name:"argentina",hexadecimal:"🇦🇷"},{name:"american-samoa",hexadecimal:"🇦🇸"},{name:"austria",hexadecimal:"🇦🇹"},{name:"australia",hexadecimal:"🇦🇺"},{name:"aruba",hexadecimal:"🇦🇼"},{name:"ã…land-islands",hexadecimal:"🇦🇽"},{name:"azerbaijan",hexadecimal:"🇦🇿"},{name:"bosnia-&-herzegovina",hexadecimal:"🇧🇦"},{name:"barbados",hexadecimal:"🇧🇧"},{name:"bangladesh",hexadecimal:"🇧🇩"},{name:"belgium",hexadecimal:"🇧🇪"},{name:"burkina-faso",hexadecimal:"🇧🇫"},{name:"bulgaria",hexadecimal:"🇧🇬"},{name:"bahrain",hexadecimal:"🇧🇭"},{name:"burundi",hexadecimal:"🇧🇮"},{name:"benin",hexadecimal:"🇧🇯"},{name:"st.-barthã©lemy",hexadecimal:"🇧🇱"},{name:"bermuda",hexadecimal:"🇧🇲"},{name:"brunei",hexadecimal:"🇧🇳"},{name:"bolivia",hexadecimal:"🇧🇴"},{name:"caribbean-netherlands",hexadecimal:"🇧🇶"},{name:"brazil",hexadecimal:"🇧🇷"},{name:"bahamas",hexadecimal:"🇧🇸"},{name:"bhutan",hexadecimal:"🇧🇹"},{name:"bouvet-island",hexadecimal:"🇧🇻"},{name:"botswana",hexadecimal:"🇧🇼"},{name:"belarus",hexadecimal:"🇧🇾"},{name:"belize",hexadecimal:"🇧🇿"},{name:"canada",hexadecimal:"🇨🇦"},{name:"cocos-(keeling)-islands",hexadecimal:"🇨🇨"},{name:"congo-kinshasa",hexadecimal:"🇨🇩"},{name:"central-african-republic",hexadecimal:"🇨🇫"},{name:"congo-brazzaville",hexadecimal:"🇨🇬"},{name:"switzerland",hexadecimal:"🇨🇭"},{name:"cã´te-d’ivoire",hexadecimal:"🇨🇮"},{name:"cook-islands",hexadecimal:"🇨🇰"},{name:"chile",hexadecimal:"🇨🇱"},{name:"cameroon",hexadecimal:"🇨🇲"},{name:"china",hexadecimal:"🇨🇳"},{name:"colombia",hexadecimal:"🇨🇴"},{name:"clipperton-island",hexadecimal:"🇨🇵"},{name:"costa-rica",hexadecimal:"🇨🇷"},{name:"cuba",hexadecimal:"🇨🇺"},{name:"cape-verde",hexadecimal:"🇨🇻"},{name:"curaã§ao",hexadecimal:"🇨🇼"},{name:"christmas-island",hexadecimal:"🇨🇽"},{name:"cyprus",hexadecimal:"🇨🇾"},{name:"czech-republic",hexadecimal:"🇨🇿"},{name:"germany",hexadecimal:"🇩🇪"},{name:"diego-garcia",hexadecimal:"🇩🇬"},{name:"djibouti",hexadecimal:"🇩🇯"},{name:"denmark",hexadecimal:"🇩🇰"},{name:"dominica",hexadecimal:"🇩🇲"},{name:"dominican-republic",hexadecimal:"🇩🇴"},{name:"algeria",hexadecimal:"🇩🇿"},{name:"ceuta-&-melilla",hexadecimal:"🇪🇦"},{name:"ecuador",hexadecimal:"🇪🇨"},{name:"estonia",hexadecimal:"🇪🇪"},{name:"egypt",hexadecimal:"🇪🇬"},{name:"western-sahara",hexadecimal:"🇪🇭"},{name:"eritrea",hexadecimal:"🇪🇷"},{name:"spain",hexadecimal:"🇪🇸"},{name:"ethiopia",hexadecimal:"🇪🇹"},{name:"european-union",hexadecimal:"🇪🇺"},{name:"finland",hexadecimal:"🇫🇮"},{name:"fiji",hexadecimal:"🇫🇯"},{name:"falkland-islands",hexadecimal:"🇫🇰"},{name:"micronesia",hexadecimal:"🇫🇲"},{name:"faroe-islands",hexadecimal:"🇫🇴"},{name:"france",hexadecimal:"🇫🇷"},{name:"gabon",hexadecimal:"🇬🇦"},{name:"united-kingdom",hexadecimal:"🇬🇧"},{name:"grenada",hexadecimal:"🇬🇩"},{name:"georgia",hexadecimal:"🇬🇪"},{name:"french-guiana",hexadecimal:"🇬🇫"},{name:"guernsey",hexadecimal:"🇬🇬"},{name:"ghana",hexadecimal:"🇬🇭"},{name:"gibraltar",hexadecimal:"🇬🇮"},{name:"greenland",hexadecimal:"🇬🇱"},{name:"gambia",hexadecimal:"🇬🇲"},{name:"guinea",hexadecimal:"🇬🇳"},{name:"guadeloupe",hexadecimal:"🇬🇵"},{name:"equatorial-guinea",hexadecimal:"🇬🇶"},{name:"greece",hexadecimal:"🇬🇷"},{name:"south-georgia-&-south-sandwich-islands",hexadecimal:"🇬🇸"},{name:"guatemala",hexadecimal:"🇬🇹"},{name:"guam",hexadecimal:"🇬🇺"},{name:"guinea-bissau",hexadecimal:"🇬🇼"},{name:"guyana",hexadecimal:"🇬🇾"},{name:"hong-kong-sar-china",hexadecimal:"🇭🇰"},{name:"heard-&-mcdonald-islands",hexadecimal:"🇭🇲"},{name:"honduras",hexadecimal:"🇭🇳"},{name:"croatia",hexadecimal:"🇭🇷"},{name:"haiti",hexadecimal:"🇭🇹"},{name:"hungary",hexadecimal:"🇭🇺"},{name:"canary-islands",hexadecimal:"🇮🇨"},{name:"indonesia",hexadecimal:"🇮🇩"},{name:"ireland",hexadecimal:"🇮🇪"},{name:"israel",hexadecimal:"🇮🇱"},{name:"isle-of-man",hexadecimal:"🇮🇲"},{name:"india",hexadecimal:"🇮🇳"},{name:"british-indian-ocean-territory",hexadecimal:"🇮🇴"},{name:"iraq",hexadecimal:"🇮🇶"},{name:"iran",hexadecimal:"🇮🇷"},{name:"iceland",hexadecimal:"🇮🇸"},{name:"italy",hexadecimal:"🇮🇹"},{name:"jersey",hexadecimal:"🇯🇪"},{name:"jamaica",hexadecimal:"🇯🇲"},{name:"jordan",hexadecimal:"🇯🇴"},{name:"japan",hexadecimal:"🇯🇵"},{name:"kenya",hexadecimal:"🇰🇪"},{name:"kyrgyzstan",hexadecimal:"🇰🇬"},{name:"cambodia",hexadecimal:"🇰🇭"},{name:"kiribati",hexadecimal:"🇰🇮"},{name:"comoros",hexadecimal:"🇰🇲"},{name:"st.-kitts-&-nevis",hexadecimal:"🇰🇳"},{name:"north-korea",hexadecimal:"🇰🇵"},{name:"south-korea",hexadecimal:"🇰🇷"},{name:"kuwait",hexadecimal:"🇰🇼"},{name:"cayman-islands",hexadecimal:"🇰🇾"},{name:"kazakhstan",hexadecimal:"🇰🇿"},{name:"laos",hexadecimal:"🇱🇦"},{name:"lebanon",hexadecimal:"🇱🇧"},{name:"st.-lucia",hexadecimal:"🇱🇨"},{name:"liechtenstein",hexadecimal:"🇱🇮"},{name:"sri-lanka",hexadecimal:"🇱🇰"},{name:"liberia",hexadecimal:"🇱🇷"},{name:"lesotho",hexadecimal:"🇱🇸"},{name:"lithuania",hexadecimal:"🇱🇹"},{name:"luxembourg",hexadecimal:"🇱🇺"},{name:"latvia",hexadecimal:"🇱🇻"},{name:"libya",hexadecimal:"🇱🇾"},{name:"morocco",hexadecimal:"🇲🇦"},{name:"monaco",hexadecimal:"🇲🇨"},{name:"moldova",hexadecimal:"🇲🇩"},{name:"montenegro",hexadecimal:"🇲🇪"},{name:"st.-martin",hexadecimal:"🇲🇫"},{name:"madagascar",hexadecimal:"🇲🇬"},{name:"marshall-islands",hexadecimal:"🇲🇭"},{name:"macedonia",hexadecimal:"🇲🇰"},{name:"mali",hexadecimal:"🇲🇱"},{name:"myanmar-(burma)",hexadecimal:"🇲🇲"},{name:"mongolia",hexadecimal:"🇲🇳"},{name:"macau-sar-china",hexadecimal:"🇲🇴"},{name:"northern-mariana-islands",hexadecimal:"🇲🇵"},{name:"martinique",hexadecimal:"🇲🇶"},{name:"mauritania",hexadecimal:"🇲🇷"},{name:"montserrat",hexadecimal:"🇲🇸"},{name:"malta",hexadecimal:"🇲🇹"},{name:"mauritius",hexadecimal:"🇲🇺"},{name:"maldives",hexadecimal:"🇲🇻"},{name:"malawi",hexadecimal:"🇲🇼"},{name:"mexico",hexadecimal:"🇲🇽"},{name:"malaysia",hexadecimal:"🇲🇾"},{name:"mozambique",hexadecimal:"🇲🇿"},{name:"namibia",hexadecimal:"🇳🇦"},{name:"new-caledonia",hexadecimal:"🇳🇨"},{name:"niger",hexadecimal:"🇳🇪"},{name:"norfolk-island",hexadecimal:"🇳🇫"},{name:"nigeria",hexadecimal:"🇳🇬"},{name:"nicaragua",hexadecimal:"🇳🇮"},{name:"netherlands",hexadecimal:"🇳🇱"},{name:"norway",hexadecimal:"🇳🇴"},{name:"nepal",hexadecimal:"🇳🇵"},{name:"nauru",hexadecimal:"🇳🇷"},{name:"niue",hexadecimal:"🇳🇺"},{name:"new-zealand",hexadecimal:"🇳🇿"},{name:"oman",hexadecimal:"🇴🇲"},{name:"panama",hexadecimal:"🇵🇦"},{name:"peru",hexadecimal:"🇵🇪"},{name:"french-polynesia",hexadecimal:"🇵🇫"},{name:"papua-new-guinea",hexadecimal:"🇵🇬"},{name:"philippines",hexadecimal:"🇵🇭"},{name:"pakistan",hexadecimal:"🇵🇰"},{name:"poland",hexadecimal:"🇵🇱"},{name:"st.-pierre-&-miquelon",hexadecimal:"🇵🇲"},{name:"pitcairn-islands",hexadecimal:"🇵🇳"},{name:"puerto-rico",hexadecimal:"🇵🇷"},{name:"palestinian-territories",hexadecimal:"🇵🇸"},{name:"portugal",hexadecimal:"🇵🇹"},{name:"palau",hexadecimal:"🇵🇼"},{name:"paraguay",hexadecimal:"🇵🇾"},{name:"qatar",hexadecimal:"🇶🇦"},{name:"rã©union",hexadecimal:"🇷🇪"},{name:"romania",hexadecimal:"🇷🇴"},{name:"serbia",hexadecimal:"🇷🇸"},{name:"russia",hexadecimal:"🇷🇺"},{name:"rwanda",hexadecimal:"🇷🇼"},{name:"saudi-arabia",hexadecimal:"🇸🇦"},{name:"solomon-islands",hexadecimal:"🇸🇧"},{name:"seychelles",hexadecimal:"🇸🇨"},{name:"sudan",hexadecimal:"🇸🇩"},{name:"sweden",hexadecimal:"🇸🇪"},{name:"singapore",hexadecimal:"🇸🇬"},{name:"st.-helena",hexadecimal:"🇸🇭"},{name:"slovenia",hexadecimal:"🇸🇮"},{name:"svalbard-&-jan-mayen",hexadecimal:"🇸🇯"},{name:"slovakia",hexadecimal:"🇸🇰"},{name:"sierra-leone",hexadecimal:"🇸🇱"},{name:"san-marino",hexadecimal:"🇸🇲"},{name:"senegal",hexadecimal:"🇸🇳"},{name:"somalia",hexadecimal:"🇸🇴"},{name:"suriname",hexadecimal:"🇸🇷"},{name:"south-sudan",hexadecimal:"🇸🇸"},{name:"sã£o-tomã©-&-prãncipe",hexadecimal:"🇸🇹"},{name:"el-salvador",hexadecimal:"🇸🇻"},{name:"sint-maarten",hexadecimal:"🇸🇽"},{name:"syria",hexadecimal:"🇸🇾"},{name:"swaziland",hexadecimal:"🇸🇿"},{name:"tristan-da-cunha",hexadecimal:"🇹🇦"},{name:"turks-&-caicos-islands",hexadecimal:"🇹🇨"},{name:"chad",hexadecimal:"🇹🇩"},{name:"french-southern-territories",hexadecimal:"🇹🇫"},{name:"togo",hexadecimal:"🇹🇬"},{name:"thailand",hexadecimal:"🇹🇭"},{name:"tajikistan",hexadecimal:"🇹🇯"},{name:"tokelau",hexadecimal:"🇹🇰"},{name:"timor-leste",hexadecimal:"🇹🇱"},{name:"turkmenistan",hexadecimal:"🇹🇲"},{name:"tunisia",hexadecimal:"🇹🇳"},{name:"tonga",hexadecimal:"🇹🇴"},{name:"turkey",hexadecimal:"🇹🇷"},{name:"trinidad-&-tobago",hexadecimal:"🇹🇹"},{name:"tuvalu",hexadecimal:"🇹🇻"},{name:"taiwan",hexadecimal:"🇹🇼"},{name:"tanzania",hexadecimal:"🇹🇿"},{name:"ukraine",hexadecimal:"🇺🇦"},{name:"uganda",hexadecimal:"🇺🇬"},{name:"u.s.-outlying-islands",hexadecimal:"🇺🇲"},{name:"united-states",hexadecimal:"🇺🇸"},{name:"uruguay",hexadecimal:"🇺🇾"},{name:"uzbekistan",hexadecimal:"🇺🇿"},{name:"vatican-city",hexadecimal:"🇻🇦"},{name:"st.-vincent-&-grenadines",hexadecimal:"🇻🇨"},{name:"venezuela",hexadecimal:"🇻🇪"},{name:"british-virgin-islands",hexadecimal:"🇻🇬"},{name:"u.s.-virgin-islands",hexadecimal:"🇻🇮"},{name:"vietnam",hexadecimal:"🇻🇳"},{name:"vanuatu",hexadecimal:"🇻🇺"},{name:"wallis-&-futuna",hexadecimal:"🇼🇫"},{name:"samoa",hexadecimal:"🇼🇸"},{name:"kosovo",hexadecimal:"🇽🇰"},{name:"yemen",hexadecimal:"🇾🇪"},{name:"mayotte",hexadecimal:"🇾🇹"},{name:"south-africa",hexadecimal:"🇿🇦"},{name:"zambia",hexadecimal:"🇿🇲"},{name:"zimbabwe",hexadecimal:"🇿🇼"}],qa=({emojis:a,onSelect:r,onClose:s})=>{const[t,n]=k.useState({start:0,end:80}),l=8,x=40,u=400,g=k.useCallback(c=>{const w=c.currentTarget.scrollTop,T=Math.floor(w/x),i=Math.min(T+Math.ceil(u/x)+2,Math.ceil(a.length/l));n({start:T*l,end:i*l})},[a.length,x,u,l]),b=k.useCallback(c=>{const w=c.match(/&#x([0-9A-Fa-f]+);/g);if(!w)return"";const T=w.map(i=>{const d=i.replace(/&#x|;/g,"");return parseInt(d,16)});return String.fromCodePoint(...T)},[]),h=Math.ceil(a.length/l)*x,M=a.slice(t.start,t.end);return e.jsx("div",{className:"rsp-h-[400px] rsp-overflow-y-auto rsp-relative",onScroll:g,children:e.jsx("div",{style:{height:h},className:"rsp-relative",children:e.jsx("div",{className:"rsp-absolute rsp-w-full rsp-grid rsp-grid-cols-8 rsp-gap-1",style:{top:Math.floor(t.start/l)*x,transform:"translateY(0px)"},children:M.map((c,w)=>{const T=t.start+w;return e.jsx("button",{onClick:()=>{r(b(c.hexadecimal))},className:"rsp-w-10 rsp-h-10 rsp-flex rsp-items-center rsp-justify-center rsp-text-xl hover:rsp-bg-gray-100 rsp-rounded rsp-transition-colors",title:c.name,style:{height:x},children:b(c.hexadecimal)},T)})})})})};function Ve({isOpen:a,onClose:r,onSelect:s}){const[t,n]=k.useState(""),l=k.useMemo(()=>t?Pe.filter(x=>x.name.toLowerCase().includes(t.toLowerCase())):Pe,[t]);return k.useEffect(()=>{a||n("")},[a]),e.jsx(ye,{isOpen:a,onClose:r,title:"Select Emoji",children:e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",placeholder:"Search emojis...",value:t,onChange:x=>n(x.target.value),className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500"}),t&&e.jsx("button",{onClick:()=>n(""),className:"rsp-absolute rsp-right-2 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-gray-400 hover:rsp-text-gray-600",children:"×"})]}),e.jsx("div",{className:"rsp-flex rsp-gap-2 rsp-flex-wrap",children:["😀","🎉","❤️","👍","🔥","💯","✨","🎯"].map(x=>e.jsx("button",{onClick:()=>{s(x)},className:"rsp-w-8 rsp-h-8 rsp-flex rsp-items-center rsp-justify-center rsp-text-lg hover:rsp-bg-gray-100 rsp-rounded rsp-transition-colors",children:x},x))}),e.jsxs("div",{className:"rsp-text-sm rsp-text-gray-500",children:[l.length," emojis found"]}),e.jsx(qa,{emojis:l,onSelect:s,onClose:r})]})})}const ue=(a,r,s)=>{if(!a)return{newText:r,cursorPosition:r.length};const t=a.selectionStart||0,n=a.selectionEnd||0,l=r.substring(t,n);let x=r.substring(0,t),u=r.substring(n),g,b;return l?s==="bold"?(g=`${x}*${l}*${u}`,b=t+l.length+2):(g=`${x}_${l}_${u}`,b=t+l.length+2):s==="bold"?(g=`${x}**${u}`,b=t+1):(g=`${x}__${u}`,b=t+1),{newText:g,cursorPosition:b}};function Ga({template:a,setTemplate:r}){const[s,t]=k.useState(!1),[n,l]=k.useState(null),[x,u]=k.useState(null),[g,b]=k.useState(null),[h,M]=k.useState(!1),c=()=>{const p=(a.body||"").match(/{{\d+}}/g);if(!p)return 0;const f=p.map(C=>{const E=C.match(/{{(\d+)}}/);return E?parseInt(E[1],10):0});return f.length>0?Math.max(...f):0},w=()=>{var C,E,I;const p=c()+1,f=`{{${p}}}`;if(x&&a.body.length+f.length<=1024){const B=x.selectionStart||a.body.length,v=a.body.substring(0,B),j=a.body.substring(B),A=v+f+j,V={...a.sampleContent,bodyVariables:{...(C=a.sampleContent)==null?void 0:C.bodyVariables,[p.toString()]:`Body Sample ${p}`},headerVariables:((E=a.sampleContent)==null?void 0:E.headerVariables)||{},buttonVariables:((I=a.sampleContent)==null?void 0:I.buttonVariables)||{}};r({...a,body:A,sampleContent:V}),setTimeout(()=>{if(x){const D=B+f.length;x.setSelectionRange(D,D),x.focus()}},0)}},T=()=>{l("body"),t(!0),setTimeout(()=>{x&&x.focus()},0)},i=d=>{if(n==="body"){if(!x)return;const p=x.selectionStart||a.body.length,f=1024,C=a.body;if(C.length+d.length<=f){const E=C.substring(0,p),I=C.substring(p),B=E+d+I;r({...a,body:B}),setTimeout(()=>{if(x){const v=p+d.length;x.setSelectionRange(v,v),x.focus()}},0)}}else if(n==="footer"){if(!g)return;const p=g.selectionStart||a.footer.length,f=60,C=a.footer;if(C.length+d.length<=f){const E=C.substring(0,p),I=C.substring(p),B=E+d+I;r({...a,footer:B}),setTimeout(()=>{if(g){const v=p+d.length;g.setSelectionRange(v,v),g.focus()}},0)}}};return e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Body"}),e.jsx("div",{className:"rsp-relative",children:e.jsx("textarea",{ref:u,value:a.body,onChange:d=>{var B,v,j;const p=d.target.value,f=p.match(/\{\{(\d+)\}\}/g)||[],C=[...new Set(f.map(A=>A.replace(/[{}]/g,"")))],E=((B=a.sampleContent)==null?void 0:B.bodyVariables)||{},I={...E};C.forEach(A=>{E[A]||(I[A]=`Body Sample ${A}`)}),Object.keys(I).forEach(A=>{C.includes(A)||delete I[A]}),r({...a,body:p,sampleContent:{...a.sampleContent,bodyVariables:I,headerVariables:((v=a.sampleContent)==null?void 0:v.headerVariables)||{},buttonVariables:((j=a.sampleContent)==null?void 0:j.buttonVariables)||{}}})},maxLength:1024,rows:6,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none rsp-shadow-sm",placeholder:"Enter the text for your message",onFocus:()=>l("body"),onBlur:()=>M(!0)})}),!a.body&&h&&e.jsx("p",{className:"rsp-text-xs rsp-text-red-600 rsp-mt-1",children:"Body is required."}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-2",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("button",{onClick:w,className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add Variable",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsx("button",{onClick:T,className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add emoji",children:e.jsx(Le,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>{if(!x)return;const{newText:d,cursorPosition:p}=ue(x,a.body,"bold");r({...a,body:d}),requestAnimationFrame(()=>{setTimeout(()=>{x&&(x.setSelectionRange(p,p),x.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Bold text (*text*)",children:e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"})]})}),e.jsx("button",{onClick:()=>{if(!x)return;const{newText:d,cursorPosition:p}=ue(x,a.body,"italic");r({...a,body:d}),requestAnimationFrame(()=>{setTimeout(()=>{x&&(x.setSelectionRange(p,p),x.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Italic text (_text_)",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 4h4M8 20h4M12 4l-2 16"})})})]}),e.jsx("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500",children:[a.body.length,"/1024 (1 WhatsAppAudience)"]})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Footer (optional)"}),e.jsx("div",{className:"rsp-relative",children:e.jsx("input",{ref:b,type:"text",value:a.footer,onChange:d=>r({...a,footer:d.target.value}),maxLength:60,className:"rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",placeholder:"Footer Text",onFocus:()=>l("footer")})}),e.jsxs("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:[a.footer.length,"/60 characters"]})]}),e.jsx(Ve,{isOpen:s,onClose:()=>t(!1),onSelect:i})]})}function Ka({template:a,setTemplate:r}){var T;const[s,t]=k.useState(null),[n,l]=k.useState({text:"",value:"",urlType:"static"}),u={quickReply:a.buttons.filter(i=>i.type==="QUICK_REPLY").length,url:a.buttons.filter(i=>i.type==="URL").length,call:a.buttons.filter(i=>i.type==="CALL").length,flow:a.buttons.filter(i=>i.type==="FLOW").length},g=()=>{l({text:"",value:"",urlType:"static"}),t(null)},b=i=>{if(!n.text.trim())return;let d=i==="QUICK_REPLY"?n.text:n.value;i==="CALL"&&d&&!d.startsWith("+")&&(d="+"+d);const p={id:Math.random().toString(36).substr(2,9),type:i,text:n.text,value:d,urlType:i==="URL"?n.urlType:void 0};r({...a,buttons:[...a.buttons,p]}),g()},h=i=>{r({...a,buttons:a.buttons.filter(d=>d.id!==i)})},M=(i,d,p)=>{var I,B,v;const f=a.buttons.find(j=>j.id===i),C=d==="text"?25:d==="value"&&(f==null?void 0:f.type)==="URL"?2e3:20;let E=p.slice(0,C);if(d==="value"&&((f==null?void 0:f.type)==="CALL"||(f==null?void 0:f.type)==="PHONE_NUMBER")&&E&&!E.startsWith("+")&&(E="+"+E),d==="value"&&(f==null?void 0:f.type)==="URL"&&(f==null?void 0:f.urlType)==="dynamic"){let j=E;if(/\{\{\d+\}\}/.test(j)){const y=j.match(/\{\{(\d+)\}\}/);if(y&&y.index!==void 0){const S=j.substring(0,y.index),L=y[0],U=j.substring(y.index+L.length);S&&!S.endsWith("/")&&!S.endsWith("{{")&&(j=S+"/"+L+U)}}const V=j.match(/\{\{(\d+)\}\}/g)||[],D=[...new Set(V.map(y=>y.replace(/[{}]/g,"")))],F=((I=a.sampleContent)==null?void 0:I.buttonVariables)||{},o={...F};D.forEach(y=>{F[y]||(o[y]=`Button Sample ${y}`)}),Object.keys(o).forEach(y=>{D.includes(y)||delete o[y]}),r({...a,buttons:a.buttons.map(y=>y.id===i?{...y,[d]:j}:y),sampleContent:{...a.sampleContent,headerVariables:((B=a.sampleContent)==null?void 0:B.headerVariables)||{},bodyVariables:((v=a.sampleContent)==null?void 0:v.bodyVariables)||{},buttonVariables:o}});return}r({...a,buttons:a.buttons.map(j=>j.id===i?{...j,[d]:E}:j)})},c=()=>{const d=[...a.buttons.filter(f=>f.type==="URL"&&f.urlType==="dynamic").map(f=>f.value||""),n.value].join(" ").match(/{{\d+}}/g);if(!d)return 0;const p=d.map(f=>{const C=f.match(/{{(\d+)}}/);return C?parseInt(C[1],10):0});return p.length>0?Math.max(...p):0},w=[{type:"QUICK_REPLY",icon:ke,label:"Quick Reply",description:"Add quick response options",limit:10,current:u.quickReply,color:"blue"},{type:"URL",icon:sa,label:"Web URL",description:"Link to websites or pages",limit:2,current:u.url,color:"green"},{type:"CALL",icon:Oe,label:"Call Button",description:"Add phone number to call",limit:1,current:u.call,color:"purple"}];return e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Interactive Buttons"}),e.jsx("p",{className:"rsp-text-sm rsp-text-gray-500 rsp-mt-1",children:"Add buttons to make your message interactive"})]}),e.jsx("div",{className:"rsp-text-sm rsp-text-gray-500"})]}),e.jsx("div",{className:"rsp-bg-blue-50 rsp-border-l-4 rsp-border-blue-500 rsp-p-4 rsp-rounded-r-md",children:e.jsxs("div",{className:"rsp-flex",children:[e.jsx("div",{className:"rsp-flex-shrink-0",children:e.jsx("svg",{className:"rsp-h-5 rsp-w-5 rsp-text-blue-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),e.jsx("div",{className:"rsp-ml-3",children:e.jsx("p",{className:"rsp-text-sm rsp-text-blue-700",children:"We recommend adding the marketing opt-out button. This can help reduce blocks from customers and increase your quality rating."})})]})}),!s&&e.jsx("div",{className:"rsp-grid rsp-grid-cols-1 md:rsp-grid-cols-2 rsp-gap-4",children:w.map(i=>{const d=i.icon,p=i.current>=i.limit;return e.jsxs("button",{onClick:()=>!p&&t(i.type),disabled:p,className:`rsp-group rsp-p-5 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 rsp-relative rsp-overflow-hidden ${p?"rsp-border-gray-200 rsp-bg-gray-50 rsp-text-gray-400 rsp-cursor-not-allowed rsp-opacity-60":"rsp-cursor-pointer rsp-border-gray-200 rsp-bg-white hover:rsp-border-blue-400 hover:rsp-shadow-lg hover:rsp-shadow-blue-100/50 rsp-shadow-sm"}`,children:[!p&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-gradient-to-br rsp-from-blue-50/0 rsp-via-blue-50/0 rsp-to-blue-50/0 group-hover:rsp-from-blue-50/30 group-hover:rsp-via-blue-50/20 group-hover:rsp-to-blue-50/10 rsp-transition-all rsp-duration-200"}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-start rsp-justify-between",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-4",children:[e.jsx("div",{className:`rsp-p-3 rsp-rounded-xl rsp-transition-all rsp-duration-200 ${p?"rsp-bg-gray-200":"rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-blue-100 group-hover:rsp-from-blue-100 group-hover:rsp-to-blue-200 rsp-shadow-sm"}`,children:e.jsx(d,{className:`rsp-w-5 rsp-h-5 rsp-transition-colors ${p?"rsp-text-gray-400":"rsp-text-blue-600"}`})}),e.jsxs("div",{children:[e.jsx("h4",{className:`rsp-font-semibold rsp-text-sm rsp-mb-1 ${p?"rsp-text-gray-400":"rsp-text-gray-900"}`,children:i.label}),e.jsx("p",{className:`rsp-text-xs rsp-mt-1 ${p?"rsp-text-gray-400":"rsp-text-gray-600"}`,children:i.description})]})]}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsxs("span",{className:`rsp-text-xs rsp-font-semibold rsp-px-2.5 rsp-py-1 rsp-rounded-full rsp-transition-colors ${p?"rsp-bg-gray-200 rsp-text-gray-500":"rsp-bg-blue-100 rsp-text-blue-700 group-hover:rsp-bg-blue-200"}`,children:[i.current,"/",i.limit]}),!p&&e.jsx("div",{className:"rsp-p-1.5 rsp-rounded-lg rsp-bg-blue-100 group-hover:rsp-bg-blue-200 rsp-transition-colors",children:e.jsx(Se,{className:"rsp-w-4 rsp-h-4 rsp-text-blue-600"})})]})]})]},i.type)})}),s&&e.jsxs("div",{className:"rsp-bg-white rsp-border-2 rsp-border-blue-200 rsp-rounded-xl rsp-p-6 rsp-shadow-lg rsp-shadow-blue-100/50",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mb-6",children:[e.jsxs("div",{children:[e.jsxs("h4",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900 rsp-mb-1",children:["Add ",(T=w.find(i=>i.type===s))==null?void 0:T.label]}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500",children:"Fill in the details below to add a new button"})]}),e.jsx("button",{onClick:g,className:"rsp-p-2 rsp-text-gray-400 hover:rsp-text-gray-600 hover:rsp-bg-gray-100 rsp-rounded-lg rsp-transition-colors",children:e.jsx(pe,{className:"rsp-w-5 rsp-h-5"})})]}),e.jsxs("div",{className:"rsp-space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-2",children:["Button Text ",e.jsx("span",{className:"rsp-text-red-500",children:"*"})]}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",value:n.text,onChange:i=>l({...n,text:i.target.value.slice(0,25)}),className:"rsp-w-full rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-bg-white rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all",placeholder:"Enter button text (max 25 characters)",maxLength:25}),e.jsxs("span",{className:"rsp-absolute rsp-right-3 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1.5",children:[n.text.length,"/25"]})]})]}),s!=="QUICK_REPLY"&&e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-2",children:[s==="URL"?"Website URL":s==="CALL"?"Phone Number":"Flow ID"," ",e.jsx("span",{className:"rsp-text-red-500",children:"*"})]}),s==="URL"&&e.jsxs("div",{className:"rsp-mb-4",children:[e.jsxs("div",{className:"rsp-flex rsp-gap-4 rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg rsp-border rsp-border-gray-200",children:[e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer rsp-group",children:[e.jsx("input",{type:"radio",checked:n.urlType==="static",onChange:()=>l({...n,urlType:"static"}),className:"rsp-mr-2 rsp-w-4 rsp-h-4 rsp-text-blue-600 rsp-border-gray-300 focus:rsp-ring-2 focus:rsp-ring-blue-500"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium rsp-text-gray-700 group-hover:rsp-text-gray-900",children:"Static URL"})]}),e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer rsp-group",children:[e.jsx("input",{type:"radio",checked:n.urlType==="dynamic",onChange:()=>l({...n,urlType:"dynamic"}),className:"rsp-mr-2 rsp-w-4 rsp-h-4 rsp-text-blue-600 rsp-border-gray-300 focus:rsp-ring-2 focus:rsp-ring-blue-500"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium rsp-text-gray-700 group-hover:rsp-text-gray-900",children:"Dynamic URL"})]})]}),n.urlType==="dynamic"&&e.jsxs("div",{className:"rsp-mt-3 rsp-p-4 rsp-bg-blue-50 rsp-rounded-lg rsp-border-2 rsp-border-blue-200",children:[e.jsxs("h4",{className:"rsp-text-sm rsp-font-semibold rsp-text-blue-900 rsp-mb-2 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Dynamic URL Guidelines"]}),e.jsxs("ul",{className:"rsp-text-xs rsp-text-blue-800 rsp-space-y-1.5 rsp-list-disc rsp-list-inside",children:[e.jsxs("li",{children:["Use placeholders like: ",e.jsx("code",{className:"rsp-bg-blue-100 rsp-px-1 rsp-rounded",children:"https://example.com/order/{{1}}"})]}),e.jsx("li",{children:"Maximum 1 placeholder per URL ({{1}})"}),e.jsx("li",{children:"Only HTTPS URLs are allowed"}),e.jsx("li",{children:"WhatsApp verifies only the domain"})]})]})]}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:s==="CALL"?"tel":s==="URL"?"url":"text",value:n.value,onChange:i=>{var f,C,E;const d=s==="URL"?2e3:20;let p=i.target.value.slice(0,d);if(s==="URL"&&n.urlType==="dynamic"){if(/\{\{\d+\}\}/.test(p)){const V=p.match(/\{\{(\d+)\}\}/);if(V&&V.index!==void 0){const D=p.substring(0,V.index),F=V[0],o=p.substring(V.index+F.length);D&&!D.endsWith("/")&&!D.endsWith("{{")&&(p=D+"/"+F+o)}}const B=p.match(/\{\{(\d+)\}\}/g)||[],v=[...new Set(B.map(V=>V.replace(/[{}]/g,"")))],j=((f=a.sampleContent)==null?void 0:f.buttonVariables)||{},A={...j};v.forEach(V=>{j[V]||(A[V]=`Button Sample ${V}`)}),Object.keys(A).forEach(V=>{v.includes(V)||delete A[V]}),r({...a,sampleContent:{...a.sampleContent,headerVariables:((C=a.sampleContent)==null?void 0:C.headerVariables)||{},bodyVariables:((E=a.sampleContent)==null?void 0:E.bodyVariables)||{},buttonVariables:A}})}l({...n,value:p})},className:"rsp-w-full rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-bg-white rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all",placeholder:s==="URL"?n.urlType==="dynamic"?"https://example.com/order/{{1}}":"https://example.com":s==="CALL"?"+1234567890":"Flow ID",maxLength:s==="URL"?2e3:20}),e.jsxs("span",{className:"rsp-absolute rsp-right-3 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1.5",children:[n.value.length,"/",s==="URL"?2e3:20]})]}),s==="URL"&&n.urlType==="dynamic"&&e.jsxs("div",{className:"rsp-mt-3",children:[e.jsx("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-mb-2",children:e.jsxs("button",{type:"button",onClick:()=>{var I,B,v;if((n.value.match(/\{\{(\d+)\}\}/g)||[]).length>=1)return;const p=c()+1;let f=n.value.trim();f&&!f.endsWith("/")&&!f.endsWith("{{")&&(f+="/");const C=f+`{{${p}}}`,E={...a.sampleContent,headerVariables:((I=a.sampleContent)==null?void 0:I.headerVariables)||{},bodyVariables:((B=a.sampleContent)==null?void 0:B.bodyVariables)||{},buttonVariables:{...(v=a.sampleContent)==null?void 0:v.buttonVariables,[p.toString()]:`Button Sample ${p}`}};r({...a,sampleContent:E}),l({...n,value:C})},disabled:(n.value.match(/\{\{(\d+)\}\}/g)||[]).length>=1,className:"rsp-px-4 rsp-py-2 rsp-text-xs rsp-font-semibold rsp-bg-blue-100 hover:rsp-bg-blue-200 rsp-rounded-lg rsp-text-blue-700 disabled:rsp-bg-gray-200 disabled:rsp-text-gray-500 disabled:rsp-cursor-not-allowed rsp-transition-all rsp-shadow-sm hover:rsp-shadow-md rsp-flex rsp-items-center rsp-gap-1.5",children:[e.jsx("svg",{className:"rsp-w-3.5 rsp-h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),"Add Variable"]})}),(n.value.match(/\{\{(\d+)\}\}/g)||[]).length>=1&&e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:"Maximum 1 variable allowed."})]})]}),e.jsxs("div",{className:"rsp-flex rsp-gap-3 rsp-pt-4 rsp-border-t rsp-border-gray-200",children:[e.jsx("button",{onClick:()=>b(s),disabled:!n.text.trim()||s!=="QUICK_REPLY"&&!n.value.trim(),className:"rsp-flex-1 rsp-bg-gradient-to-r rsp-from-blue-600 rsp-to-blue-700 rsp-text-white rsp-py-3 rsp-px-6 rsp-rounded-lg rsp-font-semibold rsp-text-sm rsp-transition-all hover:rsp-from-blue-700 hover:rsp-to-blue-800 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-shadow-md hover:rsp-shadow-lg rsp-transform hover:rsp-scale-[1.02] active:rsp-scale-[0.98]",children:"Add Button"}),e.jsx("button",{onClick:g,className:"rsp-px-6 rsp-py-3 rsp-text-gray-700 rsp-bg-white rsp-border-2 rsp-border-gray-300 rsp-rounded-lg rsp-font-semibold rsp-text-sm rsp-transition-all hover:rsp-bg-gray-50 hover:rsp-border-gray-400 rsp-shadow-sm hover:rsp-shadow-md",children:"Cancel"})]})]})]}),a.buttons.length>0&&e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("h4",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Added Buttons"}),e.jsxs("span",{className:"rsp-text-xs rsp-font-medium rsp-text-gray-500 rsp-bg-gray-100 rsp-px-3 rsp-py-1 rsp-rounded-full",children:[a.buttons.length," ",a.buttons.length===1?"button":"buttons"]})]}),e.jsx("div",{className:"rsp-space-y-3",children:a.buttons.map(i=>{const d=w.find(f=>f.type===i.type),p=(d==null?void 0:d.icon)||ke;return e.jsx("div",{className:"rsp-bg-white rsp-border-2 rsp-border-gray-200 rsp-rounded-xl rsp-p-5 rsp-shadow-sm hover:rsp-shadow-md hover:rsp-border-gray-300 rsp-transition-all",children:e.jsxs("div",{className:"rsp-flex rsp-items-start rsp-gap-4",children:[e.jsx("div",{className:"rsp-p-3 rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-blue-100 rsp-rounded-xl rsp-shadow-sm",children:e.jsx(p,{className:"rsp-w-5 rsp-h-5 rsp-text-blue-600"})}),e.jsxs("div",{className:"rsp-flex-1 rsp-space-y-4",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("span",{className:"rsp-text-xs rsp-font-bold rsp-text-blue-700 rsp-uppercase rsp-tracking-wider rsp-bg-blue-50 rsp-px-2.5 rsp-py-1 rsp-rounded-md",children:i.type.replace("_"," ")}),e.jsx("button",{onClick:()=>h(i.id),className:"rsp-p-2 rsp-text-red-400 hover:rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded-lg rsp-transition-all",title:"Remove button",children:e.jsx(pe,{className:"rsp-w-4 rsp-h-4"})})]}),e.jsxs("div",{className:"rsp-grid rsp-grid-cols-1 rsp-gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2",children:"Button Text"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",value:i.text,onChange:f=>M(i.id,"text",f.target.value),maxLength:25,className:"rsp-w-full rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all rsp-bg-white"}),e.jsxs("span",{className:"rsp-absolute rsp-right-2.5 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1",children:[i.text.length,"/25"]})]})]}),i.type!=="QUICK_REPLY"&&e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2",children:i.type==="URL"?"Website URL":i.type==="CALL"||i.type==="PHONE_NUMBER"?"Phone Number":"Flow ID"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:i.type==="CALL"||i.type==="PHONE_NUMBER"?"tel":i.type==="URL"?"url":"text",value:i.value||"",onChange:f=>M(i.id,"value",f.target.value),maxLength:i.type==="URL"?2e3:20,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-text-gray-900 placeholder:rsp-text-gray-400 focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-shadow-sm rsp-transition-all rsp-bg-white"}),e.jsxs("span",{className:"rsp-absolute rsp-right-2.5 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-font-medium rsp-text-gray-400 rsp-bg-white rsp-px-1",children:[(i.value||"").length,"/",i.type==="URL"?2e3:20]})]})]})]})]})]})},i.id)})})]}),a.buttons.length===0&&!s&&e.jsxs("div",{className:"rsp-text-center rsp-py-12 rsp-bg-gray-50 rsp-rounded-xl rsp-border-2 rsp-border-dashed rsp-border-gray-300",children:[e.jsx("div",{className:"rsp-w-16 rsp-h-16 rsp-bg-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-4 rsp-shadow-sm",children:e.jsx(ke,{className:"rsp-w-8 rsp-h-8 rsp-text-gray-400"})}),e.jsx("h3",{className:"rsp-text-lg rsp-font-medium rsp-text-gray-900 rsp-mb-2",children:"No buttons added yet"}),e.jsx("p",{className:"rsp-text-gray-500 rsp-text-sm rsp-mb-4",children:"Add interactive buttons to make your message more engaging"}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-400",children:"Choose from Quick Reply, Web URL, Call, or Flow buttons above"})]})]})}const Ja=async(a,r)=>{try{if(!a)throw new Error("No file provided");const s=100*1024*1024;if(a.size>s)throw new Error(`File size too large. Maximum allowed size is ${s/(1024*1024)}MB`);const t=new FormData;t.append("file",a),console.log("Uploading file:",a.name,"Size:",a.size,"Type:",a.type);const n=await fetch(ga(r),{method:"POST",body:t});console.log("Upload response status:",n.status),console.log("Upload response headers:",Object.fromEntries(n.headers.entries()));const l=await n.text();console.log("Raw upload response:",l);let x;try{x=JSON.parse(l)}catch(u){throw console.error("Failed to parse upload response:",u),new Error("Invalid response from upload server")}if(console.log("Parsed upload response:",x),console.log("Upload status:",x.status),console.log("Upload message:",x.message),console.log("Upload data:",x.data),!x.status)throw new Error(x.message||"Upload failed");if(x.data&&Array.isArray(x.data)&&x.data.length>0){const u=x.data[0];if(u.url)return console.log("File uploaded successfully:",{url:u.url,filename:u.filename,originalName:u.originalName,size:u.size}),u.url;throw new Error("No file URL in upload response data")}else throw new Error("No files in upload response data")}catch(s){throw console.error("File upload error:",s),s instanceof Error?s:new Error("Unknown error occurred during file upload")}},Xa=(a,r)=>{const t=a.name.toLowerCase().split(".").pop();switch(r){case"IMAGE":return["jpg","jpeg","png","gif","bmp","tiff","svg"].includes(t||"");case"VIDEO":return["mp4","mov","avi","3gpp"].includes(t||"");case"DOCUMENT":return["pdf","doc","docx","xls","xlsx","ppt","pptx","txt"].includes(t||"");default:return!1}},Ya=a=>{switch(a){case"IMAGE":return 5*1024*1024;case"VIDEO":return 16*1024*1024;case"DOCUMENT":return 100*1024*1024;default:return 10*1024*1024}};function Qa({template:a,setTemplate:r,onFileUpload:s}){var j,A,V,D,F;const[t,n]=k.useState({}),[,l]=k.useState({}),[x,u]=k.useState({open:!1,message:""}),[g,b]=k.useState(!1),[h,M]=k.useState(null),c=k.useRef({}),w=()=>{var y;const o={id:Math.random().toString(36).substr(2,9),headerType:"MEDIA",mediaType:((y=a.carousel)==null?void 0:y.type)==="VIDEO"?"VIDEO":"IMAGE",body:"",buttons:[]};r(S=>{var L,U;return{...S,carousel:{type:((L=a.carousel)==null?void 0:L.type)||"IMAGE",cards:[...((U=a.carousel)==null?void 0:U.cards)||[],o]}}})},T=o=>{r(y=>({...y,carousel:{...y.carousel,cards:y.carousel.cards.filter(S=>S.id!==o)}}))},i=(o,y,S)=>{r(L=>({...L,carousel:{...L.carousel,cards:L.carousel.cards.map(U=>U.id===o?{...U,[y]:S}:U)}}))},d=o=>{r(y=>{const L=((y.carousel||{type:o,cards:[]}).cards||[]).map(U=>({...U,mediaType:o,mediaUrl:""}));return{...y,carousel:{type:o,cards:L}}})},p=(o,y)=>{var J;const S=(J=a.carousel)==null?void 0:J.cards.find(Z=>Z.id===o);if(!S)return;const U=C(o)+1,z=`{{${U}}}`,ne=S[y]+z;r(Z=>{var $;const N=(($=Z.carousel)==null?void 0:$.cards.findIndex(W=>W.id===o))??-1;if(N===-1)return Z;const K=Z.carousel.cards.map((W,P)=>{var ae,re,X;return P!==N?W:{...W,[y]:ne,sampleContent:{headerVariables:((ae=W.sampleContent)==null?void 0:ae.headerVariables)||{},bodyVariables:{...((re=W.sampleContent)==null?void 0:re.bodyVariables)||{},[U.toString()]:`Card Sample ${U}`},buttonVariables:((X=W.sampleContent)==null?void 0:X.buttonVariables)||{}}}});return{...Z,carousel:{...Z.carousel,cards:K}}})},f=o=>{var ne;if(!h)return;const y=c.current[h],S=(ne=a.carousel)==null?void 0:ne.cards.find(J=>J.id===h);if(!S)return;const L=y&&typeof y.selectionStart=="number"?y.selectionStart:S.body.length,U=S.body.substring(0,L),z=S.body.substring(L),O=U+o+z;i(h,"body",O),setTimeout(()=>{const J=c.current[h];if(J){const Z=L+o.length;J.setSelectionRange(Z,Z),J.focus()}},0),b(!1)},C=o=>{var z;const y=(z=a.carousel)==null?void 0:z.cards.find(O=>O.id===o);if(!y)return 0;const L=(y.body||"").match(/\{\{(\d+)\}\}/g);if(!L)return 0;const U=L.map(O=>{const ne=O.match(/{{(\d+)}}/);return ne?parseInt(ne[1],10):0});return U.length>0?Math.max(...U):0},E=(o,y)=>{var U;const S=(U=a.carousel)==null?void 0:U.cards.find(z=>z.id===o);if(!S||S.buttons.length>=2)return;const L={id:Math.random().toString(36).substr(2,9),type:y,text:"",value:"",urlType:"static"};i(o,"buttons",[...S.buttons,L])},I=(o,y,S,L)=>{var J,Z;const U=(J=a.carousel)==null?void 0:J.cards.find(N=>N.id===o);if(!U)return;const z=U.buttons.find(N=>N.id===y);if(!z)return;let O=L;if(S==="value"&&z.type==="URL"&&z.urlType==="dynamic"){if(/\{\{\d+\}\}/.test(O)){const P=O.match(/\{\{(\d+)\}\}/);if(P&&P.index!==void 0){const ae=O.substring(0,P.index),re=P[0],X=O.substring(P.index+re.length);ae&&!ae.endsWith("/")&&!ae.endsWith("{{")&&(O=ae+"/"+re+X)}}const K=Ra(O),$=((Z=U.sampleContent)==null?void 0:Z.buttonVariables)||{},W={...$};K.forEach(P=>{$[P]||(W[P]=`Button Sample ${P}`)}),Object.keys(W).forEach(P=>{K.includes(P)||delete W[P]}),r(P=>{var X;const ae=((X=P.carousel)==null?void 0:X.cards.findIndex(Y=>Y.id===o))??-1;if(ae===-1)return P;const re=P.carousel.cards.map((Y,se)=>{var le,xe;if(se!==ae)return Y;const ie=Y.buttons.map(Q=>Q.id===y?{...Q,[S]:O}:Q);return{...Y,buttons:ie,sampleContent:{headerVariables:((le=Y.sampleContent)==null?void 0:le.headerVariables)||{},bodyVariables:((xe=Y.sampleContent)==null?void 0:xe.bodyVariables)||{},buttonVariables:W}}});return{...P,carousel:{...P.carousel,cards:re}}});return}const ne=U.buttons.map(N=>N.id===y?{...N,[S]:O}:N);i(o,"buttons",ne)},B=(o,y)=>{var U;const S=(U=a.carousel)==null?void 0:U.cards.find(z=>z.id===o);if(!S)return;const L=S.buttons.filter(z=>z.id!==y);i(o,"buttons",L)},v=async(o,y)=>{var S;try{n(O=>({...O,[o]:!0})),l(O=>({...O,[o]:!1}));const L=((S=a.carousel)==null?void 0:S.type)==="VIDEO"?"VIDEO":"IMAGE";if(!Xa(y,L))throw new Error(`Invalid file type. Expected ${L.toLowerCase()} file.`);const U=Ya(L);if(y.size>U){const O=U/1048576;throw new Error(`File size too large. Maximum allowed size is ${O}MB.`)}const z=await s(y);i(o,"mediaUrl",z)}catch(L){console.error("File upload failed:",L),u({open:!0,message:L instanceof Error?L.message:"File upload failed"})}finally{n(L=>({...L,[o]:!1}))}};return e.jsxs("div",{className:"rsp-space-y-6",children:[x.open&&e.jsxs("div",{className:"rsp-fixed rsp-inset-0 rsp-z-50 rsp-flex rsp-items-center rsp-justify-center",children:[e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-40",onClick:()=>u({open:!1,message:""})}),e.jsxs("div",{className:"rsp-relative rsp-z-10 rsp-bg-white rsp-rounded-lg rsp-shadow-lg rsp-w-full rsp-max-w-md rsp-p-5",children:[e.jsx("div",{className:"rsp-mb-3 rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Upload Error"}),e.jsx("div",{className:"rsp-text-sm rsp-text-gray-700 rsp-break-words rsp-whitespace-pre-wrap",children:x.message}),e.jsx("div",{className:"rsp-flex rsp-justify-end rsp-mt-4",children:e.jsx("button",{onClick:()=>u({open:!1,message:""}),className:"rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-white rsp-bg-blue-600 rsp-rounded-md hover:rsp-bg-blue-700",children:"OK"})})]})]}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("h3",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Carousel Cards"}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-4",children:[e.jsxs("span",{className:"rsp-text-sm rsp-text-gray-500",children:["Total Cards: ",((j=a.carousel)==null?void 0:j.cards.length)||0,"/10"]}),e.jsxs("button",{onClick:w,disabled:(((A=a.carousel)==null?void 0:A.cards.length)||0)>=10,className:"rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-rounded-md hover:rsp-bg-blue-700 disabled:rsp-bg-gray-400 disabled:rsp-cursor-not-allowed rsp-text-sm rsp-font-medium",children:[e.jsx(Se,{className:"rsp-w-4 rsp-h-4 rsp-inline rsp-mr-2"}),"Add Card"]})]})]}),e.jsxs("div",{className:"rsp-bg-white rsp-p-4 rsp-rounded-lg rsp-border rsp-border-gray-200",children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-3",children:"Carousel Type"}),e.jsxs("div",{className:"rsp-flex rsp-gap-4",children:[e.jsxs("label",{className:"rsp-flex rsp-items-center",children:[e.jsx("input",{type:"radio",name:"carouselType",value:"IMAGE",checked:((V=a.carousel)==null?void 0:V.type)==="IMAGE",onChange:o=>d(o.target.value),className:"rsp-mr-2"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Image"})]}),e.jsxs("label",{className:"rsp-flex rsp-items-center",children:[e.jsx("input",{type:"radio",name:"carouselType",value:"VIDEO",checked:((D=a.carousel)==null?void 0:D.type)==="VIDEO",onChange:o=>d(o.target.value),className:"rsp-mr-2"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Video"})]})]})]}),e.jsx("div",{className:"rsp-space-y-6",children:(F=a.carousel)==null?void 0:F.cards.map((o,y)=>{var S,L,U,z,O,ne,J,Z;return e.jsxs("div",{className:"rsp-bg-white rsp-rounded-xl rsp-border-2 rsp-border-gray-200 rsp-overflow-hidden rsp-shadow-lg rsp-transition-all hover:rsp-shadow-xl hover:rsp-border-blue-300",children:[e.jsxs("div",{className:"rsp-bg-gradient-to-r rsp-from-blue-50 rsp-to-blue-100 rsp-px-5 rsp-py-3 rsp-flex rsp-items-center rsp-justify-between rsp-border-b rsp-border-gray-200",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-3",children:[e.jsx("div",{className:"rsp-w-8 rsp-h-8 rsp-bg-blue-500 rsp-text-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-font-bold rsp-text-sm rsp-shadow-md",children:y+1}),e.jsxs("h4",{className:"rsp-text-base rsp-font-semibold rsp-text-gray-800",children:["Card ",y+1]})]}),e.jsx("button",{onClick:()=>T(o.id),className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-white hover:rsp-bg-red-500 rsp-rounded-full rsp-transition-colors",title:"Remove Card",children:e.jsx(pe,{className:"rsp-w-4 rsp-h-4"})})]}),e.jsx("div",{className:"rsp-p-6",children:e.jsxs("div",{className:"rsp-grid rsp-grid-cols-1 lg:rsp-grid-cols-2 rsp-gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:((S=a.carousel)==null?void 0:S.type)==="VIDEO"?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),((L=a.carousel)==null?void 0:L.type)==="VIDEO"?"Video":"Image"," Upload"]}),e.jsxs("div",{className:"rsp-border-2 rsp-border-dashed rsp-border-blue-200 rsp-rounded-xl rsp-p-6 rsp-text-center rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-transition-all hover:rsp-border-blue-400 hover:rsp-from-blue-100 rsp-relative",children:[o.mediaUrl?e.jsxs("div",{className:"rsp-relative rsp-group",children:[((U=a.carousel)==null?void 0:U.type)==="IMAGE"?e.jsx("img",{src:o.mediaUrl,alt:`Card ${y+1}`,className:"rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",onLoad:()=>l(N=>({...N,[o.id]:!0})),onError:()=>l(N=>({...N,[o.id]:!1}))}):e.jsx("video",{src:o.mediaUrl,className:"rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",controls:!0,onLoadedData:()=>l(N=>({...N,[o.id]:!0})),onError:()=>l(N=>({...N,[o.id]:!1}))}),e.jsx("button",{onClick:()=>i(o.id,"mediaUrl",""),className:"rsp-absolute rsp-top-2 rsp-right-2 rsp-p-2 rsp-bg-red-500 rsp-text-white rsp-rounded-full hover:rsp-bg-red-600 rsp-shadow-lg rsp-opacity-0 group-hover:rsp-opacity-100 rsp-transition-opacity",title:"Remove media",children:e.jsx(pe,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-2 rsp-left-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-xs rsp-px-2 rsp-py-1 rsp-rounded rsp-backdrop-blur-sm",children:((z=a.carousel)==null?void 0:z.type)==="VIDEO"?"📹 Video":"🖼️ Image"})]}):e.jsxs("div",{children:[e.jsx("div",{className:"rsp-w-20 rsp-h-20 rsp-mx-auto rsp-mb-4 rsp-bg-gradient-to-br rsp-from-blue-100 rsp-to-blue-200 rsp-rounded-xl rsp-flex rsp-items-center rsp-justify-center rsp-shadow-md",children:e.jsx("svg",{className:"rsp-w-10 rsp-h-10 rsp-text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:((O=a.carousel)==null?void 0:O.type)==="VIDEO"?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),e.jsx("input",{type:"file",accept:((ne=a.carousel)==null?void 0:ne.type)==="VIDEO"?"video/*":"image/*",onChange:N=>{var $;const K=($=N.target.files)==null?void 0:$[0];K&&!t[o.id]&&v(o.id,K)},className:"rsp-hidden",id:`file-upload-${o.id}`,disabled:!!t[o.id]}),e.jsxs("label",{htmlFor:`file-upload-${o.id}`,className:`rsp-inline-flex rsp-items-center rsp-gap-2 rsp-px-5 rsp-py-2.5 rsp-border rsp-border-blue-300 rsp-rounded-lg rsp-shadow-sm rsp-text-sm rsp-font-semibold rsp-text-blue-600 rsp-bg-white rsp-transition-colors ${t[o.id]?"rsp-opacity-50 rsp-cursor-not-allowed":"hover:rsp-bg-blue-50 rsp-cursor-pointer"}`,"aria-disabled":!!t[o.id],children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),"Upload ",((J=a.carousel)==null?void 0:J.type)==="VIDEO"?"Video":"Image"]}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-3 rsp-px-2",children:((Z=a.carousel)==null?void 0:Z.type)==="VIDEO"?"📹 MP4, MOV, AVI (Max 16MB)":"🖼️ PNG, JPG, GIF, TIFF, SVG, BMP (Max 5MB)"})]}),t[o.id]&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-30 rsp-flex rsp-items-center rsp-justify-center",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2 rsp-bg-white rsp-px-3 rsp-py-2 rsp-rounded-md rsp-shadow",children:[e.jsxs("svg",{className:"rsp-w-4 rsp-h-4 rsp-animate-spin",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25",strokeWidth:"4"}),e.jsx("path",{d:"M22 12a10 10 0 00-10-10",strokeWidth:"4"})]}),e.jsx("span",{className:"rsp-text-xs rsp-text-gray-700",children:"Uploading..."})]})})]})]}),e.jsxs("div",{className:"rsp-space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})}),"Body Text",e.jsx("span",{className:"rsp-text-xs rsp-text-gray-500 rsp-font-normal",children:"(Max 160 characters)"})]}),e.jsx("div",{className:"rsp-relative",children:e.jsx("textarea",{ref:N=>{c.current[o.id]=N},value:o.body,onChange:N=>{const K=N.target.value,$=K.match(/\{\{(\d+)\}\}/g)||[],W=[...new Set($.map(P=>P.replace(/[{}]/g,"")))];r(P=>{var X;const ae=((X=P.carousel)==null?void 0:X.cards.findIndex(Y=>Y.id===o.id))??-1;if(ae===-1)return P;const re=P.carousel.cards.map((Y,se)=>{var xe,Q,me;if(se!==ae)return Y;const ie=((xe=Y.sampleContent)==null?void 0:xe.bodyVariables)||{},le={...ie};return W.forEach(ce=>{ie[ce]||(le[ce]=`Card Sample ${ce}`)}),Object.keys(le).forEach(ce=>{W.includes(ce)||delete le[ce]}),{...Y,body:K,sampleContent:{headerVariables:((Q=Y.sampleContent)==null?void 0:Q.headerVariables)||{},bodyVariables:le,buttonVariables:((me=Y.sampleContent)==null?void 0:me.buttonVariables)||{}}}});return{...P,carousel:{...P.carousel,cards:re}}})},maxLength:160,rows:4,className:"rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-400 rsp-bg-white rsp-resize-none rsp-shadow-sm rsp-transition-colors",placeholder:"Enter Card Body Message"})}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-2",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-1",children:[e.jsx("button",{onClick:()=>p(o.id,"body"),className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Add Variable",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsx("button",{onClick:()=>{M(o.id),b(!0)},className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Add Emoji",children:e.jsx(Le,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>{const N=c.current[o.id];if(!N)return;const{newText:K,cursorPosition:$}=ue(N,o.body,"bold");i(o.id,"body",K),requestAnimationFrame(()=>{setTimeout(()=>{N&&(N.setSelectionRange($,$),N.focus())},0)})},className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Bold text (*text*)",children:e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"})]})}),e.jsx("button",{onClick:()=>{const N=c.current[o.id];if(!N)return;const{newText:K,cursorPosition:$}=ue(N,o.body,"italic");i(o.id,"body",K),requestAnimationFrame(()=>{setTimeout(()=>{N&&(N.setSelectionRange($,$),N.focus())},0)})},className:"rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",title:"Italic text (_text_)",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 4h4M8 20h4M12 4l-2 16"})})})]}),e.jsxs("span",{className:`rsp-text-xs rsp-font-medium ${o.body.length>140?"rsp-text-orange-500":"rsp-text-gray-500"}`,children:[o.body.length,"/160"]})]})]}),o.buttons.length<2&&e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122"})}),"Add Action Button",e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500 rsp-font-normal",children:["(",o.buttons.length,"/2)"]})]}),e.jsxs("div",{className:"rsp-grid rsp-grid-cols-3 rsp-gap-2",children:[e.jsxs("button",{onClick:()=>E(o.id,"QUICK_REPLY"),className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"})}),e.jsx("span",{className:"rsp-text-xs",children:"Quick Reply"})]}),e.jsxs("button",{onClick:()=>E(o.id,"URL"),className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),e.jsx("span",{className:"rsp-text-xs",children:"Website"})]}),e.jsxs("button",{onClick:()=>E(o.id,"PHONE_NUMBER"),className:"rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-blue-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"})}),e.jsx("span",{className:"rsp-text-xs",children:"Phone"})]})]})]}),o.buttons.length>0&&e.jsxs("div",{className:"rsp-space-y-3",children:[e.jsxs("label",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-green-500",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Configured Buttons"]}),o.buttons.map((N,K)=>e.jsxs("div",{className:"rsp-p-4 rsp-border-2 rsp-border-blue-200 rsp-rounded-lg rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-shadow-sm",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mb-3",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("div",{className:"rsp-w-6 rsp-h-6 rsp-bg-blue-500 rsp-text-white rsp-rounded rsp-flex rsp-items-center rsp-justify-center rsp-text-xs rsp-font-bold",children:K+1}),e.jsx("span",{className:"rsp-text-sm rsp-font-semibold rsp-text-gray-800",children:N.type==="QUICK_REPLY"?"Quick Reply":N.type==="URL"?"Website":"Phone"})]}),e.jsx("button",{onClick:()=>B(o.id,N.id),className:"rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",title:"Remove button",children:e.jsx(pe,{className:"rsp-w-4 rsp-h-4"})})]}),e.jsxs("div",{className:"rsp-space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1",children:"Button Text"}),e.jsx("input",{type:"text",value:N.text,onChange:$=>I(o.id,N.id,"text",$.target.value),placeholder:`Enter Button Text (Max ${N.type==="QUICK_REPLY"?"25":"20"} characters)`,maxLength:N.type==="QUICK_REPLY"?25:20,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"})]}),N.type==="URL"&&e.jsxs("div",{className:"rsp-space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2",children:"URL Type"}),e.jsxs("div",{className:"rsp-flex rsp-gap-4",children:[e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer",children:[e.jsx("input",{type:"radio",checked:N.urlType!=="dynamic",onChange:()=>I(o.id,N.id,"urlType","static"),className:"rsp-mr-2 rsp-text-blue-600"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Static URL"})]}),e.jsxs("label",{className:"rsp-flex rsp-items-center rsp-cursor-pointer",children:[e.jsx("input",{type:"radio",checked:N.urlType==="dynamic",onChange:()=>I(o.id,N.id,"urlType","dynamic"),className:"rsp-mr-2 rsp-text-blue-600"}),e.jsx("span",{className:"rsp-text-sm rsp-text-gray-700",children:"Dynamic URL"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1",children:"Website URL"}),e.jsx("input",{type:"text",value:N.value||"",onChange:$=>I(o.id,N.id,"value",$.target.value),placeholder:N.urlType==="dynamic"?"https://example.com/order/{{1}}":"https://example.com",className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"})]}),N.urlType==="dynamic"&&e.jsxs("div",{className:"rsp-space-y-2",children:[e.jsx("div",{className:"rsp-p-2 rsp-bg-blue-50 rsp-rounded rsp-border rsp-border-blue-200",children:e.jsxs("p",{className:"rsp-text-xs rsp-text-blue-700",children:[e.jsx("strong",{children:"Tip:"})," Use ","{{"," and ","}}}"," to add variables (e.g., https://example.com/","{{","1","}}",")"]})}),e.jsxs("div",{children:[e.jsx("button",{type:"button",onClick:()=>{if(((N.value||"").match(/\{\{(\d+)\}\}/g)||[]).length>=1)return;const P=((N.value||"").match(/\{\{(\d+)\}\}/g)||[]).map(se=>{const ie=se.match(/{{(\d+)}}/);return ie?parseInt(ie[1],10):0}),re=(P.length>0?Math.max(...P):0)+1;let X=N.value||"";X&&!X.endsWith("/")&&!X.endsWith("{{")&&(X=X+"/");const Y=X+`{{${re}}}`;r(se=>{var xe;const ie=((xe=se.carousel)==null?void 0:xe.cards.findIndex(Q=>Q.id===o.id))??-1;if(ie===-1)return se;const le=se.carousel.cards.map((Q,me)=>{var m,R,H;if(me!==ie)return Q;const ce=Q.buttons.map(_=>_.id===N.id?{..._,value:Y}:_),fe=((m=Q.sampleContent)==null?void 0:m.buttonVariables)||{};return{...Q,buttons:ce,sampleContent:{headerVariables:((R=Q.sampleContent)==null?void 0:R.headerVariables)||{},bodyVariables:((H=Q.sampleContent)==null?void 0:H.bodyVariables)||{},buttonVariables:{...fe,[re.toString()]:`Button Sample ${re}`}}}});return{...se,carousel:{...se.carousel,cards:le}}})},disabled:((N.value||"").match(/\{\{(\d+)\}\}/g)||[]).length>=1,className:"rsp-px-3 rsp-py-1.5 rsp-text-xs rsp-bg-blue-500 hover:rsp-bg-blue-600 rsp-text-white rsp-rounded disabled:rsp-bg-gray-300 disabled:rsp-cursor-not-allowed rsp-transition-colors",children:"+ Add Variable"}),((N.value||"").match(/\{\{(\d+)\}\}/g)||[]).length>=1&&e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:"Maximum 1 variable allowed"})]})]})]}),N.type==="PHONE_NUMBER"&&e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1",children:"Phone Number"}),e.jsx("input",{type:"text",value:N.value||"",onChange:$=>I(o.id,N.id,"value",$.target.value),placeholder:"+1234567890",className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"})]})]})]},N.id))]})]})]})})]},o.id)})}),e.jsx("div",{className:"rsp-bg-blue-50 rsp-border-l-4 rsp-border-blue-500 rsp-p-4 rsp-rounded-r-md",children:e.jsxs("div",{className:"rsp-flex",children:[e.jsx("div",{className:"rsp-flex-shrink-0",children:e.jsx("svg",{className:"rsp-h-5 rsp-w-5 rsp-text-blue-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"rsp-ml-3",children:[e.jsx("h3",{className:"rsp-text-sm rsp-font-medium rsp-text-blue-800",children:"Meta WhatsApp HSM Guidelines"}),e.jsx("div",{className:"rsp-mt-2 rsp-text-sm rsp-text-blue-700",children:e.jsxs("ul",{className:"rsp-list-disc rsp-list-inside rsp-space-y-1",children:[e.jsx("li",{children:"Maximum 10 carousel cards per template"}),e.jsx("li",{children:"Maximum 2 buttons per card"}),e.jsx("li",{children:"Card body text limited to 160 characters"}),e.jsx("li",{children:"Button text limited to 20-25 characters depending on type"}),e.jsx("li",{children:"Images: PNG, JPG, GIF, TIFF, SVG, BMP formats supported"}),e.jsx("li",{children:"Videos: MP4, MOV, AVI formats supported"})]})})]})]})}),e.jsx(Ve,{isOpen:g,onClose:()=>b(!1),onSelect:f})]})}const Za=a=>{const s=(a.body||"").match(/\{\{(\d+)\}\}/g);if(!s)return 0;const t=s.map(n=>{const l=n.match(/{{(\d+)}}/);return l?parseInt(l[1],10):0});return t.length>0?Math.max(...t):0};function es({template:a,setTemplate:r}){const[s,t]=k.useState(!1),n=k.useRef(null),{resulMeta:l}=ze(),x=()=>{t(!0),setTimeout(()=>{n.current&&n.current.focus()},0)},u=b=>{const h=n.current,M=a.body,c=h&&typeof h.selectionStart=="number"?h.selectionStart:M.length,w=M.substring(0,c),T=M.substring(c),i=w+b+T;r({...a,body:i}),setTimeout(()=>{if(n.current){const d=c+b.length;n.current.setSelectionRange(d,d),n.current.focus()}},0),t(!1)},g=async b=>{try{console.log(`Starting file upload: ${b.name}`);const h=await Ja(b,l);return console.log(`File uploaded successfully: ${h}`),h}catch(h){throw console.error("Upload failed in parent:",h),h}};return e.jsxs("div",{className:"rsp-space-y-6",children:[a.type!=="CAROUSEL"&&e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsx("h2",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Message Content"}),e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsx(Wa,{template:a,setTemplate:r,onFileUpload:g}),e.jsx(Ga,{template:a,setTemplate:r})]})]}),a.type==="CAROUSEL"&&e.jsxs("div",{className:"rsp-space-y-6",children:[e.jsx("h2",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Message Content"}),e.jsx("div",{className:"rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm",children:e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:["Body ",e.jsx("span",{className:"rsp-text-gray-500",children:"(Global message for carousel)"})]}),e.jsx("div",{className:"rsp-relative",children:e.jsx("textarea",{ref:n,value:a.body,onChange:b=>{var i,d,p;const h=b.target.value,M=h.match(/\{\{(\d+)\}\}/g)||[],c=[...new Set(M.map(f=>f.replace(/[{}]/g,"")))],w=((i=a.sampleContent)==null?void 0:i.bodyVariables)||{},T={...w};c.forEach(f=>{w[f]||(T[f]=`Body Sample ${f}`)}),Object.keys(T).forEach(f=>{c.includes(f)||delete T[f]}),r({...a,body:h,sampleContent:{...a.sampleContent,bodyVariables:T,headerVariables:((d=a.sampleContent)==null?void 0:d.headerVariables)||{},buttonVariables:((p=a.sampleContent)==null?void 0:p.buttonVariables)||{}}})},maxLength:1024,rows:4,className:"rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none",placeholder:"Enter Template Message"})}),!a.body&&e.jsx("p",{className:"rsp-text-xs rsp-text-red-600 rsp-mt-1",children:"Body is required."}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between rsp-mt-1",children:[e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("button",{onClick:()=>{var w,T,i;const h=Za(a)+1,M=`{{${h}}}`,c={...a.sampleContent,bodyVariables:{...(w=a.sampleContent)==null?void 0:w.bodyVariables,[h.toString()]:`Body Sample ${h}`},headerVariables:((T=a.sampleContent)==null?void 0:T.headerVariables)||{},buttonVariables:((i=a.sampleContent)==null?void 0:i.buttonVariables)||{}};r({...a,body:a.body+M,sampleContent:c})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add Variable",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})})}),e.jsx("button",{onClick:x,className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Add emoji",children:e.jsx(Le,{className:"rsp-w-4 rsp-h-4"})}),e.jsx("button",{onClick:()=>{if(!n.current)return;const{newText:b,cursorPosition:h}=ue(n.current,a.body,"bold");r({...a,body:b}),requestAnimationFrame(()=>{setTimeout(()=>{n.current&&(n.current.setSelectionRange(h,h),n.current.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Bold text (*text*)",children:e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 4h8a4 4 0 014 4 4 4 0 01-4 4H6z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 12h9a4 4 0 014 4 4 4 0 01-4 4H6z"})]})}),e.jsx("button",{onClick:()=>{if(!n.current)return;const{newText:b,cursorPosition:h}=ue(n.current,a.body,"italic");r({...a,body:b}),requestAnimationFrame(()=>{setTimeout(()=>{n.current&&(n.current.setSelectionRange(h,h),n.current.focus())},0)})},className:"rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",title:"Italic text (_text_)",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 4h4M8 20h4M12 4l-2 16"})})})]}),e.jsxs("span",{className:"rsp-text-xs rsp-text-gray-500",children:[a.body.length,"/1024"]})]})]})})]}),a.type==="CAROUSEL"&&e.jsx("div",{className:"rsp-space-y-6",children:e.jsx(Qa,{template:a,setTemplate:r,onFileUpload:g})}),a.type!=="CAROUSEL"&&e.jsx("div",{className:"rsp-space-y-6",children:e.jsx(Ka,{template:a,setTemplate:r})}),e.jsx(Ve,{isOpen:s,onClose:()=>t(!1),onSelect:u})]})}function as({type:a}){switch(a){case"QUICK_REPLY":return e.jsx(la,{className:"w-4 h-4"});case"URL":return e.jsx(ta,{className:"w-4 h-4"});case"CALL":return e.jsx(Oe,{className:"w-4 h-4"});case"FLOW":return e.jsx(oa,{className:"w-4 h-4"});default:return null}}function ss({buttons:a,flowButtonText:r,onShowAllOptions:s}){const t=[...a];r&&t.push({id:"flow-button",type:"QUICK_REPLY",text:r});const n=t.slice(0,2);return e.jsxs("div",{className:"rsp-divide-y rsp-divide-gray-200",children:[n.map(l=>e.jsxs("button",{className:"rsp-w-full rsp-py-4 rsp-text-[#128C7E] rsp-text-[15px] rsp-font-medium rsp-bg-white hover:rsp-bg-gray-50 rsp-flex rsp-items-center rsp-gap-3 rsp-px-4 rsp-transition-colors",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[e.jsx("div",{className:"rsp-text-[#128C7E]",children:e.jsx(as,{type:l.type})}),e.jsx("span",{className:"rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap",children:l.text}),l.id==="flow-button"&&e.jsx(aa,{className:"rsp-w-5 rsp-h-5 rsp-text-[#128C7E] rsp-ml-auto"})]},l.id)),t.length>2&&e.jsxs("button",{onClick:s,className:"rsp-w-full rsp-py-4 rsp-text-[#128C7E] rsp-text-[15px] rsp-font-medium rsp-bg-white hover:rsp-bg-gray-50 rsp-flex rsp-items-center rsp-justify-center rsp-transition-colors",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[e.jsx("span",{className:"rsp-text-lg rsp-mr-2",children:"⋯"}),"See all options"]})]})}const rs=a=>{const r=[];let s=0;for(;s<a.length;)if(a[s]==="*"&&s+1<a.length&&a[s+1]==="_"){const t=s+2;let n=t;for(;n<a.length-1;){if(a[n]==="_"&&a[n+1]==="*"){const l=a.substring(t,n);r.push({type:"boldItalic",content:l}),s=n+2;break}n++}n>=a.length-1&&(r.push({type:"text",content:a[s]}),s++)}else if(a[s]==="*"){const t=s+1;let n=t;for(;n<a.length;){if(a[n]==="*"&&(n===t||a[n-1]!=="_")){const l=a.substring(t,n);r.push({type:"bold",content:l}),s=n+1;break}n++}n>=a.length&&(r.push({type:"text",content:a[s]}),s++)}else if(a[s]==="_"){const t=s+1;let n=t;for(;n<a.length;){if(a[n]==="_"&&(n===t||a[n-1]!=="*")){const l=a.substring(t,n);r.push({type:"italic",content:l}),s=n+1;break}n++}n>=a.length&&(r.push({type:"text",content:a[s]}),s++)}else{let t=s;for(;s<a.length&&a[s]!=="*"&&a[s]!=="_";)s++;const n=a.substring(t,s);n&&r.push({type:"text",content:n})}return r},Me=(a,r)=>{if(!a)return"";let s=a;r&&(s=s.replace(/\{\{(\d+)\}\}/g,(x,u)=>r[u]||`[Variable ${u}]`));const t=rs(s),n=[];let l=0;return t.forEach(x=>{switch(x.type){case"text":n.push(e.jsx(k.Fragment,{children:x.content},`text-${l++}`));break;case"bold":n.push(e.jsx("strong",{children:x.content},`format-${l++}`));break;case"italic":n.push(e.jsx("em",{children:x.content},`format-${l++}`));break;case"boldItalic":n.push(e.jsx("strong",{children:e.jsx("em",{children:x.content})},`format-${l++}`));break}}),e.jsx(e.Fragment,{children:n})};function ns({template:a}){var M,c,w,T;const[r,s]=k.useState(!1),[t,n]=k.useState(0),l=(M=a.carousel)!=null&&M.cards?a.carousel.cards.length:0;k.useEffect(()=>{a.type==="CAROUSEL"&&l>0?t>=l&&n(0):n(0)},[l,a.type]);const x=i=>{var d;return i?Me(i,(d=a.sampleContent)==null?void 0:d.headerVariables):""},u=i=>{var d;return i?Me(i,(d=a.sampleContent)==null?void 0:d.bodyVariables):""},g=i=>{var f;const d=(i==null?void 0:i.body)??"";if(!d)return"";const p=((f=i==null?void 0:i.sampleContent)==null?void 0:f.bodyVariables)??{};return Me(d,p)},b=a.headerType!=="NONE"||a.body||a.footer||a.buttons.length>0||a.type==="CAROUSEL"&&((c=a.carousel)==null?void 0:c.cards.length),h=a.headerText||a.body||a.footer;return e.jsxs("div",{className:"rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200",children:[e.jsxs("div",{className:"rsp-p-4 rsp-border-b rsp-border-gray-200",children:[e.jsx("h3",{className:"rsp-text-lg rsp-font-semibold rsp-text-gray-900",children:"Preview"}),e.jsx("p",{className:"rsp-text-sm rsp-text-gray-500",children:"See how your template will look"})]}),e.jsx("div",{className:"rsp-p-6 rsp-flex rsp-justify-center",children:e.jsx("div",{className:"rsp-relative",children:e.jsxs("div",{className:"rsp-w-[280px] rsp-h-[580px] rsp-bg-gradient-to-b rsp-from-[#1a1a1a] rsp-via-[#2d2d2f] rsp-to-[#000000] rsp-rounded-[35px] rsp-p-[2px] rsp-relative rsp-shadow-[0_20px_40px_-10px_rgba(0,0,0,0.7)] rsp-border-[1px] rsp-border-[#404040]",children:[e.jsx("div",{className:"rsp-absolute rsp-right-[-2px] rsp-top-[120px] rsp-w-[2px] rsp-h-[50px] rsp-bg-gradient-to-b rsp-from-[#404040] rsp-to-[#1a1a1a] rsp-rounded-l-[1px] rsp-shadow-md"}),e.jsx("div",{className:"rsp-absolute rsp-left-[-2px] rsp-top-[100px] rsp-w-[2px] rsp-h-[25px] rsp-bg-gradient-to-b rsp-from-[#404040] rsp-to-[#1a1a1a] rsp-rounded-r-[1px] rsp-shadow-sm"}),e.jsx("div",{className:"rsp-absolute rsp-left-[-2px] rsp-top-[135px] rsp-w-[2px] rsp-h-[40px] rsp-bg-gradient-to-b rsp-from-[#404040] rsp-to-[#1a1a1a] rsp-rounded-r-[1px] rsp-shadow-sm"}),e.jsx("div",{className:"rsp-absolute rsp-left-[-2px] rsp-top-[70px] rsp-w-[2px] rsp-h-[20px] rsp-bg-gradient-to-b rsp-from-[#ff8c42] rsp-to-[#ff6b35] rsp-rounded-r-[1px] rsp-shadow-md"}),e.jsxs("div",{className:"rsp-w-full rsp-h-full rsp-bg-black rsp-rounded-[33px] rsp-overflow-hidden rsp-relative rsp-shadow-[inset_0_1px_3px_rgba(0,0,0,0.3)]",children:[e.jsx("div",{className:"rsp-absolute rsp-top-[14px] rsp-left-1/2 rsp-transform -rsp-translate-x-1/2 rsp-w-[70px] rsp-h-[18px] rsp-bg-gradient-to-b rsp-from-[#0a0a0a] rsp-to-[#000000] rsp-rounded-[9px] rsp-z-20 rsp-shadow-[0_1px_4px_rgba(0,0,0,0.6)] rsp-border rsp-border-[#1a1a1a] rsp-flex rsp-items-center rsp-justify-center",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-gap-[8px]",children:[e.jsx("div",{className:"rsp-w-[3px] rsp-h-[3px] rsp-bg-gradient-to-br rsp-from-[#1a1a1a] rsp-to-[#000000] rsp-rounded-full rsp-shadow-inner"}),e.jsx("div",{className:"rsp-w-[2px] rsp-h-[2px] rsp-bg-gradient-to-br rsp-from-[#333] rsp-to-[#000] rsp-rounded-full"})]})}),e.jsxs("div",{className:"rsp-w-full rsp-h-full rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[33px] rsp-relative rsp-overflow-hidden rsp-shadow-[inset_0_1px_2px_rgba(0,0,0,0.1)]",children:[e.jsxs("div",{className:"rsp-absolute rsp-top-0 rsp-left-0 rsp-right-0 rsp-h-[45px] rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-flex rsp-items-center rsp-justify-between rsp-px-[30px] rsp-z-10",children:[e.jsx("div",{className:"rsp-text-[13px] rsp-font-semibold rsp-text-black rsp-tracking-tight",children:"9:41"}),e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-[5px]",children:[e.jsxs("div",{className:"rsp-flex rsp-gap-[2px] rsp-items-end",children:[e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[2px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"}),e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[3px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"}),e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[4px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"}),e.jsx("div",{className:"rsp-w-[1.5px] rsp-h-[5px] rsp-bg-gradient-to-t rsp-from-black rsp-to-[#333] rsp-rounded-[0.5px]"})]}),e.jsx("svg",{className:"rsp-w-[11px] rsp-h-[8px] rsp-text-black rsp-opacity-90",viewBox:"0 0 15 11",fill:"currentColor",children:e.jsx("path",{d:"M1.5 4.5C3.5 2.5 6 1.5 7.5 1.5S11.5 2.5 13.5 4.5M3 6.5C4.5 5 6 4.5 7.5 4.5S10.5 5 12 6.5M5 8.5C6 7.5 6.75 7.25 7.5 7.25S9 7.5 10 8.5M7.5 10.5C7.5 10.5 7.5 10.5 7.5 10.5"})}),e.jsxs("div",{className:"rsp-relative rsp-flex rsp-items-center",children:[e.jsx("div",{className:"rsp-w-[18px] rsp-h-[9px] rsp-border-[1px] rsp-border-black rsp-border-opacity-60 rsp-rounded-[2px] rsp-relative",children:e.jsx("div",{className:"rsp-absolute rsp-inset-[1px] rsp-bg-gradient-to-r rsp-from-[#34d399] rsp-to-[#10b981] rsp-rounded-[1px] rsp-w-[13px] rsp-shadow-inner"})}),e.jsx("div",{className:"rsp-absolute rsp-right-[-2px] rsp-top-[2px] rsp-w-[1px] rsp-h-[5px] rsp-bg-black rsp-bg-opacity-60 rsp-rounded-[0.5px]"})]})]})]}),e.jsxs("div",{className:"rsp-absolute rsp-top-[45px] rsp-left-0 rsp-right-0 rsp-h-[60px] rsp-bg-gradient-to-r rsp-from-[#075E54] rsp-via-[#0a6b5f] rsp-to-[#128C7E] rsp-flex rsp-items-center rsp-px-4 rsp-gap-3 rsp-z-10 rsp-shadow-[0_2px_8px_rgba(0,0,0,0.15)]",children:[e.jsx("svg",{className:"rsp-w-5 rsp-h-5 rsp-text-white rsp-opacity-95 rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.42-1.41L7.83 13H20v-2z"})}),e.jsx("div",{className:"rsp-w-[36px] rsp-h-[36px] rsp-bg-gradient-to-br rsp-from-[#25D366] rsp-via-[#20c55e] rsp-to-[#128C7E] rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-[0_2px_6px_rgba(0,0,0,0.2)] rsp-border-[2px] rsp-border-white rsp-border-opacity-30",children:e.jsx("span",{className:"rsp-text-white rsp-text-[14px] rsp-font-bold rsp-drop-shadow-sm",children:"B"})}),e.jsxs("div",{className:"rsp-flex-1",children:[e.jsx("div",{className:"rsp-text-white rsp-text-[14px] rsp-font-semibold rsp-drop-shadow-sm rsp-tracking-tight",children:"Business"}),e.jsx("div",{className:"rsp-text-[#B8E6D1] rsp-text-[11px] rsp-opacity-85 rsp-font-medium",children:"WhatsApp Business"})]}),e.jsxs("div",{className:"rsp-flex rsp-gap-4",children:[e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-white rsp-opacity-90 rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"})}),e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-white rsp-opacity-90 rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})})]})]}),e.jsxs("div",{className:"rsp-absolute rsp-top-[105px] rsp-left-0 rsp-right-0 rsp-bottom-[60px] rsp-bg-gradient-to-b rsp-from-[#E8E2DB] rsp-via-[#E5DDD5] rsp-to-[#DDD5CC] rsp-overflow-y-auto",children:[e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-opacity-[0.03]",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.08'%3E%3Cpath d='M40 40c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm0-32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm32 32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`}}),e.jsx("div",{className:"rsp-relative rsp-px-4 rsp-py-4",children:b?e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-items-start",children:[(h||a.headerType==="MEDIA"||a.buttons.length>0)&&e.jsx("div",{className:"rsp-flex rsp-justify-start rsp-mb-1.5",children:e.jsxs("div",{className:"rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-max-w-[220px] rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-relative rsp-border rsp-border-gray-100 rsp-animate-slide-up rsp-overflow-hidden",children:[a.headerType==="MEDIA"&&a.mediaUrl&&e.jsxs("div",{className:"rsp-w-full rsp-overflow-hidden",children:[a.mediaType==="IMAGE"&&e.jsx("img",{src:a.mediaUrl,alt:"Header media",className:"rsp-w-full rsp-max-h-[150px] rsp-object-cover rsp-block",onError:i=>{i.currentTarget.style.display="none"}}),a.mediaType==="VIDEO"&&e.jsxs("div",{className:"rsp-relative rsp-min-w-[150px] rsp-w-full rsp-h-[150px] rsp-bg-gradient-to-br rsp-from-gray-800 rsp-to-gray-900 rsp-flex rsp-items-center rsp-justify-center",children:[e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-black rsp-bg-opacity-70 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-lg rsp-border rsp-border-white rsp-border-opacity-20",children:e.jsx("div",{className:"rsp-w-0 rsp-h-0 rsp-border-l-[8px] rsp-border-l-white rsp-border-t-[6px] rsp-border-t-transparent rsp-border-b-[6px] rsp-border-b-transparent rsp-ml-1"})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-2 rsp-right-2 rsp-bg-black rsp-bg-opacity-75 rsp-text-white rsp-text-[10px] rsp-px-2 rsp-py-1 rsp-rounded-full rsp-shadow-md rsp-backdrop-blur-sm",children:"📹 Video"})]}),a.mediaType==="DOCUMENT"&&e.jsx("div",{className:"rsp-p-3 rsp-bg-gradient-to-r rsp-from-gray-50 rsp-to-gray-100",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-gap-2",children:[e.jsx("div",{className:"rsp-w-10 rsp-h-10 rsp-bg-gradient-to-br rsp-from-red-500 rsp-to-red-600 rsp-rounded-lg rsp-flex rsp-items-center rsp-justify-center rsp-shadow-md",children:e.jsx("span",{className:"rsp-text-white rsp-text-[9px] rsp-font-bold",children:"PDF"})}),e.jsxs("div",{children:[e.jsx("div",{className:"rsp-text-[12px] rsp-font-semibold rsp-text-gray-800",children:"Document"}),e.jsx("div",{className:"rsp-text-[10px] rsp-text-gray-600",children:"PDF • 1.2 MB"})]})]})})]}),a.headerType==="TEXT"&&a.headerText&&e.jsx("div",{className:"rsp-px-4 rsp-pt-3 rsp-pb-2",children:e.jsx("div",{className:"rsp-text-[15px] rsp-font-semibold rsp-text-[#111b21] rsp-leading-[1.3] rsp-tracking-normal rsp-break-words",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:x(a.headerText)})}),a.body&&e.jsx("div",{className:`rsp-px-4 ${a.headerType==="MEDIA"?"rsp-pt-2":"rsp-pt-3"} ${a.footer||a.buttons.length>0,"rsp-pb-2"}`,children:e.jsx("div",{className:"rsp-text-[14px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-whitespace-pre-wrap rsp-tracking-normal rsp-break-words",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:u(a.body)})}),a.footer&&e.jsx("div",{className:`rsp-px-4 ${a.buttons.length>0,"rsp-pb-2"}`,children:e.jsx("div",{className:"rsp-text-[12px] rsp-text-[#667781] rsp-pt-2 rsp-border-t rsp-border-gray-100 rsp-break-words rsp-break-all rsp-whitespace-pre-wrap",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:a.footer})}),a.buttons.length>0&&e.jsx("div",{className:"rsp-border-t rsp-border-gray-100",children:e.jsx(ss,{buttons:a.buttons,onShowAllOptions:()=>s(!0)})}),a.buttons.length===0&&e.jsx("div",{className:"rsp-px-4 rsp-pb-2 rsp-text-right",children:e.jsxs("div",{className:"rsp-text-[11px] rsp-text-[#667781] rsp-flex rsp-items-center rsp-justify-end rsp-gap-1 rsp-opacity-80",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:["9:41 AM",e.jsx("svg",{className:"rsp-w-3 rsp-h-3 rsp-text-[#53bdeb]",viewBox:"0 0 16 15",fill:"currentColor",children:e.jsx("path",{d:"M15.01 3.316l-.478-.372a.365.365 0 0 0-.51.063L8.666 9.879a.32.32 0 0 1-.484.033l-.358-.325a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l1.32 1.266c.143.14.361.125.484-.033l6.272-8.048a.366.366 0 0 0-.064-.512zm-4.1 0l-.478-.372a.365.365 0 0 0-.51.063L4.566 9.879a.32.32 0 0 1-.484.033L1.891 7.769a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l3.61 3.463c.143.14.361.125.484-.033l6.272-8.048a.365.365 0 0 0-.064-.512z"})})]})})]})}),a.type==="CAROUSEL"&&(((T=(w=a.carousel)==null?void 0:w.cards)==null?void 0:T.length)||0)>0&&e.jsx("div",{className:"rsp-flex rsp-justify-start rsp-mb-1.5",children:e.jsx("div",{className:"rsp-w-[220px] rsp-animate-slide-up",children:e.jsx("div",{className:"rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-overflow-hidden rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-border rsp-border-gray-100 rsp-relative rsp-min-h-[280px] rsp-flex rsp-flex-col",children:e.jsxs("div",{className:"rsp-relative rsp-flex-1 rsp-flex rsp-flex-col",children:[(()=>{var d,p;const i=a.carousel&&a.carousel.cards.length>0?a.carousel.cards[t]||a.carousel.cards[0]:void 0;return e.jsxs("div",{className:"rsp-flex rsp-flex-col rsp-h-full",children:[e.jsx("div",{className:"rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0",children:i&&i.mediaUrl?e.jsxs(e.Fragment,{children:[((d=a.carousel)==null?void 0:d.type)==="IMAGE"?e.jsx("img",{src:i.mediaUrl,alt:"Carousel card",className:"rsp-w-full rsp-h-full rsp-object-cover",onError:f=>{f.currentTarget.style.display="none"}}):e.jsx("div",{className:"rsp-relative rsp-w-full rsp-h-full rsp-bg-gradient-to-br rsp-from-gray-800 rsp-to-gray-900 rsp-flex rsp-items-center rsp-justify-center",children:e.jsx("div",{className:"rsp-w-10 rsp-h-10 rsp-bg-black rsp-bg-opacity-70 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-lg",children:e.jsx("div",{className:"rsp-w-0 rsp-h-0 rsp-border-l-[6px] rsp-border-l-white rsp-border-t-[5px] rsp-border-t-transparent rsp-border-b-[5px] rsp-border-b-transparent rsp-ml-1"})})}),a.carousel&&a.carousel.cards.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>n(f=>f>0?f-1:a.carousel.cards.length-1),className:"rsp-absolute rsp-left-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}),e.jsx("button",{onClick:()=>n(f=>f<a.carousel.cards.length-1?f+1:0),className:"rsp-absolute rsp-right-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})})]}),e.jsxs("div",{className:"rsp-absolute rsp-top-2 rsp-right-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-[10px] rsp-px-2 rsp-py-0.5 rsp-rounded-full rsp-backdrop-blur-sm",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:[t+1,"/",a.carousel?a.carousel.cards.length:0]})]}):e.jsx("div",{className:"rsp-w-full rsp-h-full rsp-flex rsp-items-center rsp-justify-center",children:e.jsxs("div",{className:"rsp-text-center",children:[e.jsx("svg",{className:"rsp-w-12 rsp-h-12 rsp-mx-auto rsp-text-gray-400 rsp-mb-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:((p=a.carousel)==null?void 0:p.type)==="VIDEO"?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:"No media"})]})})}),e.jsx("div",{className:"rsp-px-4 rsp-py-3 rsp-flex-1 rsp-flex rsp-items-start",children:e.jsx("p",{className:"rsp-text-[13px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-line-clamp-3",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:i?g(i):"Card body text..."})}),e.jsx("div",{className:"rsp-border-t rsp-border-gray-100 rsp-mt-auto",children:i&&i.buttons.length>0?e.jsx(e.Fragment,{children:i.buttons.map((f,C)=>e.jsx("div",{className:`rsp-px-4 rsp-py-3 rsp-text-center rsp-text-[14px] rsp-text-[#128C7E] rsp-font-medium rsp-break-words rsp-whitespace-pre-wrap ${C<i.buttons.length-1?"rsp-border-b rsp-border-gray-100":""}`,style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-gap-2",children:[f.type==="URL"&&e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),(f.type==="CALL"||f.type==="PHONE_NUMBER")&&e.jsx("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z"})}),e.jsx("span",{className:"rsp-inline-block rsp-max-w-[180px] rsp-break-words rsp-break-all rsp-whitespace-pre-wrap rsp-text-center",children:f.text})]})},f.id))}):e.jsx("div",{className:"rsp-px-4 rsp-py-3 rsp-text-center rsp-text-xs rsp-text-gray-400",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:"No buttons"})})]})})(),a.carousel&&a.carousel.cards.length>1&&e.jsx("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-gap-1.5 rsp-py-3 rsp-bg-white rsp-border-t rsp-border-gray-100",children:a.carousel&&a.carousel.cards.map((i,d)=>e.jsx("button",{onClick:()=>n(d),className:`rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${d===t?"rsp-bg-[#128C7E] rsp-w-6":"rsp-bg-gray-300 hover:rsp-bg-gray-400"}`},d))})]})})})})]}):e.jsx("div",{className:"rsp-flex rsp-items-center rsp-justify-center rsp-h-[300px]",children:e.jsxs("div",{className:"rsp-text-center rsp-text-gray-500 rsp-animate-fade-in",children:[e.jsx("div",{className:"rsp-w-12 rsp-h-12 rsp-bg-gradient-to-br rsp-from-gray-50 rsp-to-gray-100 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-2 rsp-shadow-md rsp-border rsp-border-gray-200",children:e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-gray-400",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h4l4 4 4-4h4c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-2 12H6v-2h12v2zm0-3H6V9h12v2zm0-3H6V6h12v2z"})})}),e.jsx("p",{className:"rsp-text-xs rsp-font-medium rsp-text-gray-600",children:"Start building your template"}),e.jsx("p",{className:"rsp-text-xs rsp-mt-1 rsp-text-gray-500",children:"Add content to see a live preview"})]})})})]}),e.jsxs("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-right-0 rsp-h-[60px] rsp-bg-gradient-to-r rsp-from-[#F0F2F5] rsp-via-[#EBEDF0] rsp-to-[#E8EAED] rsp-flex rsp-items-center rsp-px-4 rsp-gap-2 rsp-border-t rsp-border-gray-200 rsp-shadow-[0_-1px_4px_rgba(0,0,0,0.05)]",children:[e.jsx("svg",{className:"rsp-w-6 rsp-h-6 rsp-text-[#54656F] rsp-opacity-60",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"})}),e.jsx("div",{className:"rsp-flex-1 rsp-bg-gradient-to-r rsp-from-white rsp-to-[#fafafa] rsp-rounded-[24px] rsp-px-4 rsp-py-2 rsp-flex rsp-items-center rsp-min-h-[36px] rsp-shadow-[0_1px_2px_rgba(0,0,0,0.1)] rsp-border rsp-border-gray-200",children:e.jsx("span",{className:"rsp-text-[13px] rsp-text-[#667781] rsp-opacity-70 rsp-font-normal",children:"Type a message"})}),e.jsx("div",{className:"rsp-w-9 rsp-h-9 rsp-bg-gradient-to-br rsp-from-[#25D366] rsp-via-[#20c55e] rsp-to-[#00A884] rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-[0_2px_6px_rgba(37,211,102,0.3)] rsp-border rsp-border-[#20c55e] rsp-border-opacity-30",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-white rsp-drop-shadow-sm",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"})})})]}),r&&e.jsx("div",{className:"rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-40 rsp-z-30 rsp-flex rsp-items-end rsp-animate-fade-in",children:e.jsxs("div",{className:"rsp-w-full rsp-bg-[#F0F2F5] rsp-rounded-t-2xl rsp-shadow-lg rsp-animate-slide-up",children:[e.jsx("div",{className:"rsp-p-4 rsp-border-b rsp-border-gray-300",children:e.jsx("h4",{className:"rsp-font-bold rsp-text-center rsp-text-gray-800 rsp-text-md",children:a.body||"Options"})}),e.jsx("div",{className:"rsp-max-h-[250px] rsp-overflow-y-auto",children:a.buttons.map((i,d)=>e.jsx("div",{className:`rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${d<a.buttons.length-1?"rsp-border-b rsp-border-gray-300":""}`,style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:i.text},i.id))}),e.jsx("div",{onClick:()=>s(!1),className:"rsp-mt-2 rsp-p-4 rsp-text-center rsp-font-bold rsp-text-[#128C7E] rsp-bg-white rsp-cursor-pointer rsp-shadow-inner",style:{fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif'},children:"Close"})]})})]})]})]})})})]})}const _e={name:"",category:"MARKETING",type:"BASIC",language:"en",enableClickTracking:!1,headerType:"NONE",headerText:"",body:"",footer:"",buttons:[]};function ts({editId:a,onCancel:r}){var d,p,f;const[s,t]=k.useState(_e),[n,l]=k.useState(!0),[x,u]=k.useState(!1),[g,b]=k.useState(!1),[h,M]=k.useState(null),[c,w]=k.useState({isOpen:!1});k.useState({isOpen:!1}),k.useEffect(()=>{if(h){const C=setTimeout(()=>{M(null)},5e3);return()=>clearTimeout(C)}},[h]);const T=async()=>{var C,E,I;try{if(b(!0),M(null),!s.name||!s.body)throw new Error("Template name and body are required");const B=localStorage.getItem("account"),v=B?JSON.parse(B):{apiKey:""};if(!v.apiKey)throw new Error("Please set your API key in the dashboard first");let j;if(a){const A=await Ba(v,a,s);if(!A.success)throw new Error(A.message||"Update failed");j={status:"success",message:"Template updated successfully",data:{details:[{template_name:s.name,template_id:a}]}}}else if(j=await Va(v,s),j.status==="error")throw new Error(j.message);if(j.status==="error")throw new Error(j.message);w({isOpen:!0,templateName:(C=j.data)==null?void 0:C.details[0].template_name,templateId:(E=j.data)==null?void 0:E.details[0].template_id,template:(I=j.data)==null?void 0:I.template}),t(_e)}catch(B){M(B instanceof Error?B.message:"An error occurred while creating the template")}finally{b(!1)}};k.useEffect(()=>{if(!a)return;(async()=>{try{const E=localStorage.getItem("account"),I=E?JSON.parse(E):{apiKey:""};if(!I.apiKey)throw new Error("Please set your API key in the dashboard first");const B=await Da(I.apiKey,a);t(v=>({...v,...B}))}catch(E){console.error("Failed to load template for edit",E),M(E instanceof Error?E.message:"Failed to load template")}})()},[a]);const i=()=>{w({isOpen:!1}),r&&r()};return e.jsxs("div",{className:"rsp-min-h-screen rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm",children:[e.jsxs("div",{className:"rsp-max-w-[1200px] rsp-mx-auto rsp-px-6 rsp-h-full",children:[e.jsx("div",{className:"rsp-py-6 rsp-border-b rsp-border-gray-200",children:e.jsxs("div",{className:"rsp-flex rsp-items-center rsp-justify-between",children:[e.jsx("h1",{className:"rsp-text-2xl rsp-font-semibold rsp-text-[#0043ff]",children:a?"Edit Template":"Add Template"}),e.jsx("div",{className:"rsp-flex rsp-items-center rsp-gap-3",children:e.jsxs("button",{onClick:()=>l(!n),className:`rsp-flex rsp-items-center rsp-gap-2 rsp-px-4 rsp-py-2 rsp-rounded-md rsp-text-sm rsp-font-medium rsp-transition-colors
|
|
103
|
+
${n?"rsp-bg-blue-100 rsp-text-blue-700 rsp-border rsp-border-blue-200":"rsp-bg-gray-100 rsp-text-gray-700 rsp-border rsp-border-gray-200"}`,children:[e.jsxs("svg",{className:"rsp-w-4 rsp-h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})]}),n?"Hide Preview":"Show Preview"]})})]})}),e.jsxs("div",{className:`rsp-py-8 ${n?"rsp-grid xl:rsp-grid-cols-[1fr,400px] rsp-gap-8":""}`,children:[e.jsxs("div",{className:`rsp-space-y-8 ${n?"":"rsp-max-w-4xl rsp-mx-auto"}`,children:[e.jsxs("div",{className:"rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-space-y-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:["Template Name ",e.jsx("span",{className:"rsp-text-red-500",children:"*"})]}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("input",{type:"text",value:s.name,onChange:C=>t({...s,name:C.target.value.replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"").replace(/_+/g,"_")}),onBlur:()=>u(!0),className:"rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",placeholder:"Template name cannot Have capital letters and space"}),e.jsx("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500"})]}),!s.name&&x&&e.jsx("p",{className:"rsp-text-xs rsp-text-red-600 rsp-mt-1",children:"Template name is required."}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:"Template name cannot Have capital letters and space"})]}),e.jsxs("div",{className:"rsp-grid rsp-grid-cols-2 rsp-gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Category"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsxs("select",{value:s.category,onChange:C=>t({...s,category:C.target.value}),className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:[e.jsx("option",{value:"MARKETING",children:"Marketing"}),e.jsx("option",{value:"UTILITY",children:"Utility"})]}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500"})]}),e.jsx("p",{className:"rsp-text-xs rsp-text-gray-500 rsp-mt-1",children:"Choose Marketing for promotional communication and Utility for informational messages."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Language"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsx("select",{value:s.language,onChange:C=>t({...s,language:C.target.value}),className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:_a.map(C=>e.jsx("option",{value:C.value,children:C.label},C.value))}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-8 rsp-h-0.5 rsp-bg-red-500"})]})]})]}),e.jsxs("div",{className:"rsp-grid rsp-grid-cols-2 rsp-gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Template Type"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsxs("select",{value:s.type,onChange:C=>{const E=C.target.value,I=s.type;E!==I&&t(E==="CAROUSEL"?{name:s.name,category:s.category,type:E,language:s.language,enableClickTracking:s.enableClickTracking,headerType:"NONE",headerText:"",body:"",footer:"",buttons:[],carousel:{type:"IMAGE",cards:[{id:Math.random().toString(36).substr(2,9),headerType:"MEDIA",mediaType:"IMAGE",mediaUrl:"",body:"",buttons:[]}]}}:{name:s.name,category:s.category,type:E,language:s.language,enableClickTracking:s.enableClickTracking,headerType:"NONE",headerText:"",body:"",footer:"",buttons:[]})},className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:[e.jsx("option",{value:"BASIC",children:"Basic"}),e.jsx("option",{value:"CAROUSEL",children:"Carousel"})]}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}),e.jsx("div",{className:"rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2",children:"Enable click tracking"}),e.jsxs("div",{className:"rsp-relative",children:[e.jsxs("select",{value:s.enableClickTracking.toString(),onChange:C=>t({...s,enableClickTracking:C.target.value==="true"}),className:"rsp-w-full rsp-px-0 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm rsp-bg-transparent rsp-appearance-none rsp-h-10 rsp-leading-10 focus:rsp-outline-none focus:rsp-border-blue-500",children:[e.jsx("option",{value:"false",children:"False"}),e.jsx("option",{value:"true",children:"True"})]}),e.jsx("div",{className:"rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none",children:e.jsx("svg",{className:"rsp-w-4 rsp-h-4 rsp-text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})})]})]})]})]}),e.jsx("div",{className:"rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm",children:e.jsx(es,{template:s,setTemplate:t})}),e.jsxs("div",{className:"rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-pt-6 rsp-border-t rsp-border-gray-200",children:[h&&e.jsxs("div",{className:"rsp-mb-4 rsp-flex rsp-items-start rsp-gap-3 rsp-p-4 rsp-rounded-lg rsp-bg-red-50 rsp-border-l-4 rsp-border-l-red-500 rsp-relative rsp-animate-fade-in",children:[e.jsx(ge,{className:"rsp-w-5 rsp-h-5 rsp-text-red-500 rsp-flex-shrink-0 rsp-mt-0.5"}),e.jsxs("div",{children:[e.jsx("h3",{className:"rsp-text-sm rsp-font-medium rsp-text-red-800",children:"Error"}),e.jsx("p",{className:"rsp-mt-1 rsp-text-sm rsp-text-red-700",children:h})]}),e.jsx("button",{onClick:()=>M(null),className:"rsp-absolute rsp-top-2 rsp-right-2 rsp-p-1 hover:rsp-bg-red-100 rsp-rounded-full",children:e.jsx(pe,{className:"rsp-w-4 rsp-h-4 rsp-text-red-500"})})]}),e.jsxs("div",{className:"rsp-flex rsp-gap-4",children:[e.jsx("button",{onClick:()=>r==null?void 0:r(),className:"rsp-flex-1 rsp-py-3 rsp-px-6 rsp-rounded-md rsp-transition-colors rsp-text-gray-700 rsp-font-medium rsp-text-sm rsp-bg-white rsp-border rsp-border-gray-300 hover:rsp-bg-gray-50",children:"Cancel"}),e.jsx("button",{onClick:T,disabled:g,className:`rsp-flex-1 rsp-py-3 rsp-px-6 rsp-rounded-md rsp-transition-colors rsp-text-white rsp-font-medium rsp-text-sm
|
|
104
|
+
${g?"rsp-bg-blue-600 rsp-cursor-not-allowed":"rsp-bg-blue-600 hover:rsp-bg-blue-700 active:rsp-bg-blue-800"}`,children:g?a?"Resubmitting for Approval...":"Submitting for Approval...":a?"Resubmit for Approval":"Submit for Approval"})]})]})]}),n&&e.jsx("div",{children:e.jsx("div",{className:"rsp-sticky rsp-top-4",children:e.jsx(ns,{template:s})})})]})]}),e.jsx(ye,{isOpen:c.isOpen,onClose:i,title:"Success",children:e.jsxs("div",{className:"rsp-space-y-4",children:[e.jsx("div",{className:"rsp-text-center",children:e.jsx("p",{className:"rsp-text-green-600 rsp-font-medium rsp-mb-4",children:"Template created successfully!"})}),c.templateId&&e.jsxs("div",{className:"rsp-bg-gray-50 rsp-p-4 rsp-rounded-lg rsp-space-y-2",children:[e.jsxs("div",{className:"rsp-flex rsp-justify-between",children:[e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:"Template Name:"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium",children:c.templateName})]}),e.jsxs("div",{className:"rsp-flex rsp-justify-between",children:[e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:"Template ID:"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium rsp-font-mono",children:c.templateId})]}),((d=c.template)==null?void 0:d.meta_tid)&&e.jsxs("div",{className:"rsp-flex rsp-justify-between",children:[e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:"Meta TID:"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium rsp-font-mono",children:c.template.meta_tid})]}),((p=c.template)==null?void 0:p.status)&&e.jsxs("div",{className:"rsp-flex rsp-justify-between",children:[e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:"Status:"}),e.jsx("span",{className:`rsp-text-sm rsp-font-medium rsp-capitalize ${c.template.status==="pending"?"rsp-text-yellow-600":c.template.status==="approved"?"rsp-text-green-600":"rsp-text-red-600"}`,children:c.template.status})]}),((f=c.template)==null?void 0:f.quality)&&e.jsxs("div",{className:"rsp-flex rsp-justify-between",children:[e.jsx("span",{className:"rsp-text-sm rsp-text-gray-600",children:"Quality:"}),e.jsx("span",{className:"rsp-text-sm rsp-font-medium rsp-capitalize",children:c.template.quality})]})]})]})})]})}exports.CreateTemplate=ts;exports.Dashboard=Sa;exports.TrustSignalProvider=da;
|