1import{r as c,d as k,z as y,j as e,aa as Se,M as be,F as Ie,aj as Te,ar as R,x as Ee,b as T,T as B,P as le,aN as fe,aF as $e,aD as Le,aR as Me,J as Fe,aS as U,I as Ae,af as Be,aV as ge,au as ae,Z as re}from"./index-BH8Hq4fF.js";import{L as De}from"./LoadError-DtFBUis7.js";import{b as me}from"./notificationCatalog-BP5L2CAl.js";import{I as V}from"./image-DgoP-ctX.js";import{B as Oe}from"./bell-ring-Db0rTCDW.js";import{C as Pe}from"./chevron-left-DaNP-hnR.js";import{U as z}from"./upload-DtbdHLAK.js";import{D as Re,a as xe,b as Ue}from"./defaultMessageTemplates-O7fWkcUA.js";import{B as Ke}from"./baseline-CoO2TSdU.js";import{Y}from"./youtube-CpfQxPon.js";import{P as ze}from"./play-BtMz3qTH.js";import{C as Ve}from"./chevron-up-Nk0mcmku.js";import{S as q}from"./sparkles-DYMjDKmN.js";import{L as je}from"./lightbulb-B7_-PNqe.js";import{E as Ge}from"./eye-off-B4MzD2pP.js";import"./refresh-cw-kjmzcQOe.js";const X=[{key:"whatsapp",label:"××××ס×פ",hint:"ת××× ×ª ××תרת (media) ××××עת ×××××ס×פ",Icon:Se,color:"#059669",chip:"bg-emerald-50 text-emerald-700"},{key:"email",label:"××××´×",hint:"××× ×¨ ×ר×ש ×××עת ×××××´×",Icon:be,color:"#2563eb",chip:"bg-blue-50 text-blue-700"},{key:"push",label:"×תר×ת Push",hint:"ת××× × ××תר×ת ×פ×ש (×ער××¥ ×פ×ת××)",Icon:Oe,color:"#64748b",chip:"bg-slate-100 text-slate-600"}],ue=Object.keys(me).map(t=>{const r=Te(t)||{};return{key:t,label:r.label||t,Icon:r.icon||R,situations:(me[t]||[]).length}}).sort((t,r)=>t.label.localeCompare(r.label,"he"));function He(){const[t,r]=c.useState([]),[o,p]=c.useState(!0),[i,g]=c.useState(null),m=c.useCallback(async()=>{p(!0);try{const l=await k.entities.NotificationImage.list();r(l||[])}catch(l){console.error(l),y.error("ש×××× ×××¢×× ×ª ×ת××× ×ת")}finally{p(!1)}},[]);c.useEffect(()=>{m()},[m]);const N=(l,a)=>t.find(u=>u.module_key===l&&u.channel===a),x=(l,a)=>{var u;return((u=N(l,a))==null?void 0:u.image_url)||""},b=l=>X.reduce((a,u)=>a+(x(l,u.key)?1:0),0),h=async(l,a,u)=>{const _=N(l,a);if(u){if(_){r(v=>v.map(C=>C.id===_.id?{...C,image_url:u}:C));try{await k.entities.NotificationImage.update(_.id,{image_url:u})}catch(v){console.error(v),y.error("ש×××× ×ש××ר×"),m()}}else try{const v=await k.entities.NotificationImage.create({module_key:l,channel:a,image_url:u});r(C=>[...C,v])}catch(v){console.error(v),y.error("ש×××× ×ש××ר×"),m()}y.success("×ת××× × × ×©×ר×")}else if(_){r(v=>v.filter(C=>C.id!==_.id));try{await k.entities.NotificationImage.delete(_.id),y.success("×ת××× × ××סר×")}catch(v){console.error(v),y.error("ש×××× ×××××§×"),m()}}};if(o)return e.jsx("div",{className:"flex items-center justify-center h-48",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})});const n=i?ue.find(l=>l.key===i):null;return e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:e.jsx(V,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-[0.9375rem] font-bold text-slate-800",children:"ת××× ×ת ××תר××ת"}),e.jsx("p",{className:"text-xs text-slate-400",children:"×§××¢× ×ª××× × ××××××ת ××× ××××× ×××× ×¢×¨××¥. ×× ××תר××ת ש×××ª× ××××× ×©××× (××× ×ס×××ס××) ××ש××× ×¢× ×ת××× × ×©×××××¨× â ××× ×¨ ×××××´×, ××תרת ×××××ס×פ ×ת××× × ×פ×ש."})]})]}),!n&&e.jsx(Qe,{}),n?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[e.jsxs("button",{onClick:()=>g(null),className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-full border border-slate-200 text-sm font-bold text-slate-600 hover:bg-slate-50",children:[e.jsx(Ie,{className:"w-4 h-4"})," ××× ××××××××"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:n.Icon&&e.jsx(n.Icon,{className:"w-5 h-5"})}),e.jsx("h3",{className:"text-[1rem] font-extrabold text-slate-800",children:n.label})]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:X.map(l=>e.jsx(Ye,{channel:l,value:x(i,l.key),fallback:l.key!=="email"?x(i,"email"):"",onSave:a=>h(i,l.key,a)},l.key))})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:ue.map(l=>{const a=l.Icon,u=b(l.key);return e.jsx("button",{onClick:()=>g(l.key),className:"text-right rounded-2xl border border-slate-200 bg-white p-4 transition-all hover:shadow-md hover:-translate-y-0.5 hover:border-fuchsia-200",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"w-11 h-11 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:a&&e.jsx(a,{className:"w-[22px] h-[22px]"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h4",{className:"text-[0.9375rem] font-extrabold text-slate-800 truncate",children:l.label}),e.jsxs("p",{className:"text-[0.75rem] text-slate-400 mt-0.5",children:[l.situations," ס××× ×תר××ת"]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1",children:X.map(_=>{const v=!!x(l.key,_.key),C=_.Icon;return e.jsx("span",{title:`${_.label}: ${v?"ת××× × ××××רת":"××× ×ª××× ×"}`,className:`w-6 h-6 rounded-lg grid place-items-center ${v?_.chip:"bg-slate-50 text-slate-300"}`,children:e.jsx(C,{className:"w-3.5 h-3.5"})},_.key)})}),e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-bold ms-auto ${u>0?"text-fuchsia-600":"text-slate-400"}`,children:[u>0?`${u}/3 ××××ר×ת`:"×××ר ת××× ×ת"," ",e.jsx(Pe,{className:"w-3.5 h-3.5"})]})]})]})]})},l.key)})})]})}function Qe(){const[t,r]=c.useState(null),[o,p]=c.useState({name:"",phone:"",email:""}),[i,g]=c.useState(!1),m=c.useCallback(async()=>{try{r(await k.entities.NotificationTestRecipient.list("-created_date",200)||[])}catch(n){console.error(n),r([])}},[]);c.useEffect(()=>{m()},[m]);const N=async()=>{const n=o.name.trim(),l=o.phone.trim(),a=o.email.trim();if(!n||!l&&!a){y.error("× ×רש ×©× + ××פ×× ×× ××××´×");return}g(!0);try{const u=await k.entities.NotificationTestRecipient.create({name:n,phone:l,email:a});r(_=>[u,..._||[]]),p({name:"",phone:"",email:""}),y.success("× ×סף ×רש××ת ×××××§×ת")}catch(u){console.error(u),y.error("ש×××× ×××ספ×")}finally{g(!1)}},x=async(n,l)=>{r(a=>a.map(u=>u.id===n?{...u,...l}:u));try{await k.entities.NotificationTestRecipient.update(n,l)}catch(a){console.error(a),y.error("ש×××× ×ש××ר×"),m()}},b=async n=>{if(confirm("××ס×ר × ××¢× ××××§×?")){r(l=>l.filter(a=>a.id!==n));try{await k.entities.NotificationTestRecipient.delete(n),y.success("××סר")}catch(l){console.error(l),y.error("ש×××× ××סר×"),m()}}},h="h-9 rounded-lg border border-slate-200 bg-white px-2.5 text-sm focus:outline-none focus:border-fuchsia-300 focus:ring-2 focus:ring-fuchsia-50";return e.jsxs("div",{className:"rounded-2xl border border-fuchsia-100 bg-fuchsia-50/40 p-4 mb-4",children:[e.jsxs("div",{className:"flex items-start gap-2.5 mb-3",children:[e.jsx("span",{className:"w-8 h-8 rounded-lg grid place-items-center flex-none bg-fuchsia-100 text-fuchsia-700",children:e.jsx(Ee,{className:"w-4 h-4"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[0.875rem] font-extrabold text-slate-800",children:"× ××¢× × ××××§×"}),e.jsx("p",{className:"text-[0.75rem] text-slate-500",children:"רש××ת ×× ×©× ×§×©×¨ ×ש×××ת ××××§×ת. ××× ×ª×× ×ת, ×פת×ר «ש×× ×××××§×» (×ס×פר-××××× ××××) פ××ª× ×ת ×רש××× ××× â ×××ר×× ××× ×ש××× ××××××¢× × ×©××ת ××× ×ער×צ×× ×פע××××."})]})]}),t===null?e.jsx("div",{className:"flex justify-center py-4 text-slate-400",children:e.jsx(T,{className:"w-5 h-5 animate-spin"})}):e.jsxs("div",{className:"space-y-2",children:[t.map(n=>e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_1fr_1.4fr_auto] gap-2 items-center bg-white rounded-xl border border-slate-200 p-2",children:[e.jsx("input",{className:h,defaultValue:n.name||"",placeholder:"×©× ×××",onBlur:l=>{const a=l.target.value.trim();a!==(n.name||"")&&x(n.id,{name:a})}}),e.jsx("input",{className:h,dir:"ltr",defaultValue:n.phone||"",placeholder:"××פ××",onBlur:l=>{const a=l.target.value.trim();a!==(n.phone||"")&&x(n.id,{phone:a})}}),e.jsx("input",{className:h,dir:"ltr",defaultValue:n.email||"",placeholder:"××××´×",onBlur:l=>{const a=l.target.value.trim();a!==(n.email||"")&&x(n.id,{email:a})}}),e.jsx("button",{onClick:()=>b(n.id),className:"w-9 h-9 rounded-lg text-red-500 hover:bg-red-50 grid place-items-center justify-self-start","aria-label":"×סר",children:e.jsx(B,{className:"w-4 h-4"})})]},n.id)),t.length===0&&e.jsx("p",{className:"text-sm text-slate-400 text-center py-2",children:"××× × ××¢× × ××××§× ×¢××××."}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-[1fr_1fr_1.4fr_auto] gap-2 items-center pt-1",children:[e.jsx("input",{className:h,value:o.name,placeholder:"×©× ×××",onChange:n=>p(l=>({...l,name:n.target.value}))}),e.jsx("input",{className:h,dir:"ltr",value:o.phone,placeholder:"××פ××",onChange:n=>p(l=>({...l,phone:n.target.value}))}),e.jsx("input",{className:h,dir:"ltr",value:o.email,placeholder:"××××´×",onChange:n=>p(l=>({...l,email:n.target.value})),onKeyDown:n=>{n.key==="Enter"&&N()}}),e.jsxs("button",{onClick:N,disabled:i,className:"inline-flex items-center justify-center gap-1.5 h-9 px-3 rounded-lg text-white text-sm font-bold disabled:opacity-60 justify-self-start",style:{backgroundColor:"#c026d3"},children:[i?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(le,{className:"w-4 h-4"})," ××סף"]})]})]})]})}function Ye({channel:t,value:r,fallback:o,onSave:p}){const[i,g]=c.useState(!1),{Icon:m}=t,N=!r&&!!o,x=async b=>{var n;const h=(n=b.target.files)==null?void 0:n[0];if(b.target.value="",!!h){g(!0);try{const{file_url:l}=await k.integrations.Core.UploadFile({file:h});await p(l)}catch(l){console.error(l),y.error("ש×××× ×××¢××ת ×ת××× ×")}finally{g(!1)}}};return e.jsxs("div",{className:"rounded-2xl border border-slate-200 overflow-hidden bg-white flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-slate-100",children:[e.jsx("span",{className:"w-7 h-7 rounded-lg grid place-items-center flex-none",style:{backgroundColor:`${t.color}15`,color:t.color},children:e.jsx(m,{className:"w-4 h-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-bold text-slate-800",children:t.label}),e.jsx("div",{className:"text-[0.6875rem] text-slate-400 truncate",children:t.hint})]})]}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col gap-2",children:[e.jsx("div",{className:"aspect-[16/9] rounded-xl bg-slate-100 overflow-hidden grid place-items-center relative",children:r?e.jsx("img",{src:r,alt:"",className:"w-full h-full object-cover"}):N?e.jsxs(e.Fragment,{children:[e.jsx("img",{src:o,alt:"",className:"w-full h-full object-cover opacity-45"}),e.jsx("span",{className:"absolute inset-0 grid place-items-center",children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-[0.625rem] font-bold text-slate-700 bg-white/85 rounded-full px-2 py-0.5",children:[e.jsx(be,{className:"w-3 h-3 text-blue-600"})," ×ר×רת ×××× ××××××´×"]})})]}):e.jsx(V,{className:"w-8 h-8 text-slate-300"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex-1 inline-flex items-center justify-center gap-1.5 h-9 px-3 rounded-lg border border-slate-200 text-xs font-bold text-slate-600 hover:bg-slate-50 cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:x,disabled:i}),i?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5"})," ",i?"××¢××...":r?"××××£ ת××× ×":"××¢×× ×ª××× ×"]}),r&&e.jsxs("button",{onClick:()=>p(""),disabled:i,className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg text-xs font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," ×סר"]})]})]})]})}const he={marketing:{chip:"bg-purple-50 text-purple-700",dot:"#7c3aed"},service:{chip:"bg-cyan-50 text-cyan-700",dot:"#0891b2"},emergency:{chip:"bg-red-50 text-red-700",dot:"#dc2626"}};function qe(){const[t,r]=c.useState([]),[o,p]=c.useState(!0),i=c.useCallback(async()=>{p(!0);try{r(await k.entities.MessageTemplateDefaultImage.list()||[])}catch(h){console.error(h),y.error("ש×××× ×××¢×× ×ª ×ת××× ×ת")}finally{p(!1)}},[]);c.useEffect(()=>{i()},[i]);const g=h=>t.find(n=>n.template_key===h),m=h=>{var n;return((n=g(h))==null?void 0:n.image_url)||""},N=async(h,n)=>{const l=g(h);if(n){if(l){r(a=>a.map(u=>u.id===l.id?{...u,image_url:n}:u));try{await k.entities.MessageTemplateDefaultImage.update(l.id,{image_url:n})}catch(a){console.error(a),y.error("ש×××× ×ש××ר×"),i()}}else try{const a=await k.entities.MessageTemplateDefaultImage.create({template_key:h,image_url:n});r(u=>[...u,a])}catch(a){console.error(a),y.error("ש×××× ×ש××ר×"),i()}y.success("×ת××× × × ×©×ר×")}else if(l){r(a=>a.filter(u=>u.id!==l.id));try{await k.entities.MessageTemplateDefaultImage.delete(l.id),y.success("×ת××× × ××סר×")}catch(a){console.error(a),y.error("ש×××× ×××××§×"),i()}}},x=c.useMemo(()=>Re.map(h=>({...h,templates:xe.filter(n=>n.cat===h.key)})),[]),b=t.filter(h=>h.image_url).length;return o?e.jsx("div",{className:"flex items-center justify-center h-48",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none bg-fuchsia-50 text-fuchsia-600",children:e.jsx(fe,{className:"w-5 h-5"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h2",{className:"text-[0.9375rem] font-bold text-slate-800",children:"ת××× ×ת ×ת×× ××ת ×§××××"}),e.jsx("p",{className:"text-xs text-slate-400",children:"××¢×× ×ª××× × ××ת ××× ×ª×× ×ת ×ר×רת ×××× (×ש×שת ××× ×ער×צ×× â ××××´×, ××××ס×פ, פ×ש ××תר). ×ת××× × ×ª××××£ ×ת ×××× ×¨ ×××××××× ×שק×××× ×ª××¢× ×ת ת×× ××ת ×ר×רת ×××××."})]}),e.jsxs("span",{className:`ms-auto flex-none text-xs font-bold px-2.5 py-1 rounded-full ${b>0?"bg-fuchsia-50 text-fuchsia-600":"bg-slate-100 text-slate-400"}`,children:[b,"/",xe.length," ××××ר×ת"]})]}),e.jsx("div",{className:"space-y-6",children:x.map(h=>{const n=he[h.key]||he.marketing;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx("span",{className:"w-2.5 h-2.5 rounded-full flex-none",style:{backgroundColor:n.dot}}),e.jsx("h3",{className:"text-sm font-extrabold text-slate-700",children:h.title}),e.jsxs("span",{className:"text-[0.6875rem] text-slate-400",children:[h.templates.length," ת×× ××ת"]})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:h.templates.map(l
1=>e.jsx(Je,{tpl:l,tint:n,value:m(l.key),onSave:a=>N(l.key,a)},l.key))})]},h.key)})})]})}function Je({tpl:t,tint:r,value:o,onSave:p}){const[i,g]=c.useState(!1),m=c.useMemo(()=>Ue(t,{}),[t]),N=async x=>{var h;const b=(h=x.target.files)==null?void 0:h[0];if(x.target.value="",!!b){g(!0);try{const{file_url:n}=await k.integrations.Core.UploadFile({file:b});await p(n)}catch(n){console.error(n),y.error("ש×××× ×××¢××ת ×ת××× ×")}finally{g(!1)}}};return e.jsxs("div",{className:"rounded-2xl border border-slate-200 overflow-hidden bg-white flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-slate-100",children:[e.jsx("span",{className:"text-lg flex-none leading-none",children:t.emoji||"â¨"}),e.jsx("div",{className:"min-w-0 flex-1",children:e.jsx("div",{className:"text-[0.8125rem] font-bold text-slate-800 truncate",children:t.title})}),e.jsx("span",{className:`flex-none text-[0.625rem] font-bold px-1.5 py-0.5 rounded-full ${o?r.chip:"bg-slate-100 text-slate-400"}`,children:o?"ת××× ×":"×ר×רת ××××"})]}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col gap-2",children:[e.jsx("div",{className:"aspect-[16/9] rounded-xl bg-slate-100 overflow-hidden grid place-items-center relative",children:o?e.jsx("img",{src:o,alt:"",className:"w-full h-full object-cover"}):e.jsxs(e.Fragment,{children:[e.jsx("img",{src:m,alt:"",className:"w-full h-full object-cover opacity-90"}),e.jsx("span",{className:"absolute bottom-1 inset-x-0 grid place-items-center",children:e.jsxs("span",{className:"inline-flex items-center gap-1 text-[0.625rem] font-bold text-slate-700 bg-white/85 rounded-full px-2 py-0.5",children:[e.jsx(V,{className:"w-3 h-3"})," ××× ×¨ ×ר×רת ××××"]})})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("label",{className:"flex-1 inline-flex items-center justify-center gap-1.5 h-9 px-3 rounded-lg border border-slate-200 text-xs font-bold text-slate-600 hover:bg-slate-50 cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:N,disabled:i}),i?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5"})," ",i?"××¢××...":o?"××××£ ת××× ×":"××¢×× ×ª××× ×"]}),o&&e.jsxs("button",{onClick:()=>p(""),disabled:i,className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg text-xs font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," ×סר"]})]})]})]})}const We=[{key:"templates",update_type:"info_center",title:"××ש: ת×× ××ת ××××¢× ×××× ×ת ××××צ×",body:"××¢×ש×× ×פשר ×××¢×× ×××××¦× 25 ת×× ××ת ××××¢× ×××× ×ת â ש××××§, ש×ר×ת ×××ר×× â ××× ××××× ×©× ×××¢ ×ת××©× (××× ×קס עסק××, ××ר××¢××, ×××××, ×צ××¢×ת ××¢××). ×× ×ª×× ×ת ××××¢× ×¢× ×ª××× ×× ××¡× ×××× ×¨ ×××ת×, ×× ××ª× ×ª ×ער××× ××××. ×××× ×¡× ×××××× Â«×ª×× ××ת ×××××¢×ת» â «××¢× ×ª×× ××ת ×ר×רת ××××».",module_key:"message_templates",category:"general"},{key:"youtube",update_type:"info_center",title:"××ש: ××ספת סר××× ×××××× ×××××¢×ת",body:"×ש×××ת ××××¢× ×פשר ×¢×ש×× ×צרף סר××× ×××××× â ××× ×××¦× ××××עת ×××צ×פ ××××××´× ×¢× ×ª××× × ××××ערת ××§×ש×ר ×צפ×××. ×××¦× ×¢× Â«×¡×¨×××» ×עת ××××ר ×××××¢× ××××××§× ×§×ש×ר.",module_key:"send_message",category:"general"},{key:"vote_alerts",update_type:"info_center",title:"××ש: ×תר××ת ××××××××ת ××צ××¢×ת ××××××××ת",body:"××צ××¢×ת ×××××××××ת ש××××ת ×עת ×תר××ת ×××××××ת: ×××× × ×¢× ×¤×ª××ת ××צ××¢×, ××©×ª× ×ª×××ר×ת â ×××צע תק×פת ××צ××¢× ××©×¢× ××¤× × ×ס××× â ×××××ס×פ, ××××´× ×פ×ש, ××¤× ×ער×צ×× ×©××רת×. ×× ×ס××× × ×©×פ×× ×ת×× ××ת ××תר××ת ×©× ××ער×ת.",module_key:"digital_votes",category:"general"},{key:"unsubscribe",update_type:"info_center",title:"××ש: ××¡×¨× ×רש××ת ×תפ××¦× â ×¢×××× ××××§",body:"×× ××××´× ×©× ×©×× ×××× ×עת ×§×ש×ר «××¡×¨× ×רש××ת ×תפ×צ×» ×פ××ר, ×× ×רש ××××§. ת×ש××× ×©×ס××¨× ×ת עצ×× ×× ××§××× ×¢×× ××××´×, ×ת×××× ×ר××ת ×××ª× ××××× ×ת ××ס××× ×ª×ת «××¤×¨× ××××¢×ת» â פע×××ת × ×ספ×ת â «××× ××¡×¨× ××××××ר».",module_key:"message_reports",category:"general"},{key:"message_report",update_type:"info_center",title:"ש×פ×ר: ××× ××××¢×ת ×תצ××× ××ש×",body:"××× ×××××¢×ת ×¢××¦× ×××ש â רש××ת ×××××¢×ת ××¦× ×××, ×××¤×¨× ××× ×××¦× ××©× × ×¢× ×ª×¦××× ××¤× ×¢×¨××¥ (× ××¢× ××, ××××ס×פ, ××××´×, פ×ש) ×ס×××ס ש×××× ××× × ××¢×. × ××¡×¤× ×× ×פשר×ת ×××קת ××××¢×.",module_key:"message_reports",category:"general"},{key:"personal_links",update_type:"info_center",title:"ש×פ×ר: ×× ××¡× ×××§× ××××ר ×××ש×",body:"×§×ש×ר×× ××××ר ××××©× ××תר××ת ××××××× ×עת ×ש×ר×ת: ת××©× ××××ר × ×× ×¡ ×××, ×ת××©× ×©××× × ××××ר ××××¢ ×××¡× ××ת××ר×ת ××××ר ×××××××ת ×××¢× ×××§×ר×. פ××ת ××××× â ××תר ש×××ש ×ש×ר×ת××.",module_key:"resident_app",category:"general"},{key:"alert_images",update_type:"info_center",title:"ש×פ×ר: ת××× ×ª ××××´× ××ר×רת ×××× ××תר××ת",body:"××××רת ת××× ×ת ××תר××ת, ×ת××× × ×©××××רת ×××××´× ×ש×שת ××ר×רת ×××× ×× ×××××ס×פ ××פ×ש â ×× ×©×× ×××¢××ת ת××× × ××ת ××× ×××ª× ×ת ××תר××ת ××× ×ער×צ××.",module_key:"",category:"general"}];function Xe(t){const r=String(t||"").match(/(?:youtu\.be\/|v=|embed\/|shorts\/)([\w-]{11})/);return r?`https://img.youtube.com/vi/${r[1]}/hqdefault.jpg`:null}const ne=Object.entries(ge||{}).filter(([,t])=>t&&t.path).map(([t,r])=>({value:t,label:r.label||t})).sort((t,r)=>t.label.localeCompare(r.label,"he")),P="w-full h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50 transition-all",ye=[{key:"residents",label:"ת×ש×××"},{key:"community",label:"×§××××"},{key:"info",label:"××××¢"},{key:"office",label:"×שר×"},{key:"messages",label:"××××¢×ת"},{key:"emergency",label:"××ר××"},{key:"general",label:"××××"}],Ne={banner:{label:"××× ×¨×× ×ת××פ××",icon:V,color:"#2563eb",desc:"××צ××× ×××צע ××× ××× ×× ×××§×× ××רפ×× ××ת××פ×× ×××××××ת."},video:{label:"סר××× × ××××××",icon:Y,color:"#dc2626",desc:"×פשר ×××ס××£ ××× ×¡×¨××× ××. סר××× ××× ×××¦× ×××צע ××× ××× ××; ×©× ××× ×× ××תר ××צ××× ×רצ×עת ×ר××ס×× × ×¢× ×©× ×¤×ª×ת ××××צ×."},ticker:{label:"×¢×××× × ×ער×ת",icon:Ke,color:"#7c3aed",desc:'×ר×××¡× "×¢×××× ×× ××ש××" ×"×ר×× ××××¢" ×××× ××× ×× ×©× ×× ××§××××ת. ×××¨× ××× ×¤×¨×× ×¡××: ×¢×××× ×§×¦×¨ (××תרת + ת×××ר) ×× ×ת×ת ×ר×× ××××¢ (××תרת + ת×××ר ××× + ת××× ×).'}};function Ns(){const[t,r]=c.useState([]),[o,p]=c.useState(!0),[i,g]=c.useState(!1),[m,N]=c.useState(!1),[x,b]=c.useState("banner"),[h,n]=c.useState(""),[l,a]=c.useState("message"),[u,_]=c.useState(!1),[v,C]=c.useState(!1),[I,$]=c.useState("all"),[F,D]=c.useState([]),[L,G]=c.useState(null),[J,ie]=c.useState(!1),O=c.useCallback(async()=>{p(!0),g(!1);try{const s=await k.entities.AdminPublication.list("display_order",200);r(s||[])}catch(s){console.error(s),g(!0)}finally{p(!1)}},[]);c.useEffect(()=>{O()},[O]);const A=s=>t.filter(d=>d.kind===s).sort((d,f)=>(d.display_order||0)-(f.display_order||0)),K=s=>A(s).reduce((d,f)=>
1Math.max(d,f.display_order||0),0)+1,H=async s=>{try{const d=await k.entities.AdminPublication.create({is_active:!0,...s});return r(f=>[...f,d]),d}catch(d){return console.error(d),y.error("ש×××× ×××ספ×"),null}},we=async()=>{if(!J&&confirm("×××¢×× ×ר×××¡× ×ר×× ××××¢ ×¢× ××××××ת ×××ש×ת? ××ר××ס×× ×××××¦×¨× ××¢×××× ×× × ××ª× ×× ×ער×××.")){ie(!0);try{const s=new Set(t.filter(j=>j.kind==="ticker").map(j=>j.title));let d=K("ticker"),f=0;for(const j of We)s.has(j.title)||(await k.entities.AdminPublication.create({kind:"ticker",update_type:j.update_type||"info_center",title:j.title,body:j.body,module_key:j.module_key||"",category:j.category||"general",image_url:"",is_active:!0,display_order:d++}),f++);y.success(f?`× ××¦×¨× ${f} ×ר×××¡× ×ר×× ××××¢`:"××ר××ס×× ××ר ×§×××××"),await O()}catch(s){console.error(s),y.error("ש×××× ×××¢×× ×ª ×ר×××¡× ×××××¢")}finally{ie(!1)}}},E=async(s,d)=>{r(f=>f.map(j=>j.id===s?{...j,...d}:j));try{await k.entities.AdminPublication.update(s,d)}catch(f){console.error(f),y.error("ש×××× ×ש××ר×"),O()}},W=async s=>{if(!confirm("×××××§ ×ת ×פרס××?"))return!1;r(d=>d.filter(f=>f.id!==s));try{return await k.entities.AdminPublication.delete(s),y.success("× ×××§"),!0}catch(d){return console.error(d),y.error("ש×××× ×××××§×"),O(),!1}},oe=async(s,d)=>{const f=A("video"),j=f.findIndex(M=>M.id===s.id),S=j+d;if(S<0||S>=f.length)return;const w=[...f];[w[j],w[S]]=[w[S],w[j]];for(let M=0;M<w.length;M+=1)(w[M].display_order||0)!==M+1&&await E(w[M].id,{display_order:M+1})},ce=async()=>{const s=h.trim();if(s.length<2){y.error("×ת×× × ×ש×");return}_(!0);try{const d=await k.functions.invoke("composeSystemUpdate",{action:"compose",topic:s,mode:l}),f=(d==null?void 0:d.data)||{},j=[];if(f.message&&j.push({kind:"new_update",title:f.message.title||"",body:f.message.body||"",module_key:f.message.module_key||""}),f.info&&j.push({kind:"info_center",title:f.info.title||"",body:f.info.body||"",category:"general",image_url:"",module_key:f.info.module_key||""}),!j.length){y.error("×× ××פק ת×××, × ×¡× ×©××");return}D(j),n("")}catch(d){console.error(d),y.error("ש×××× ×× ×ס××")}finally{_(!1)}},ke=async(s,d)=>{const f={kind:"ticker",update_type:s.kind,title:s.title,body:s.body,module_key:s.module_key||"",is_active:d,display_order:K("ticker")};s.kind==="info_center"&&(f.category=s.category||"general",f.image_url=s.image_url||"");const j=await H(f);return j&&y.success(d?"פ×רס×":"× ×©×ר ××××××"),j},_e=s=>{C(!1),D([{kind:s.kind,title:s.title,body:s.body,category:"general",image_url:"",module_key:s.module_key||""}])},Ce=async s=>{var f;const d=(f=s.target.files)==null?void 0:f[0];if(s.target.value="",!!d){N(!0);try{const{file_url:j}=await k.integrations.Core.UploadFile({file:d});await H({kind:"banner",image_url:j,display_order:K("banner")}),y.success("×××× ×¨ × ×סף")}catch(j){console.error(j),y.error("ש×××× ×××¢××ת ×××× ×¨")}finally{N(!1)}}},de=t.filter(s=>s.is_active&&(s.kind==="banner"||s.kind==="video")).length;return o?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):i?e.jsx("div",{dir:"rtl",children:e.jsx(De,{onRetry:O})}):e.jsxs("div",{dir:"rtl",className:"space-y-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"w-11 h-11 rounded-xl bg-purple-50 grid place-items-center flex-none",children:e.jsx($e,{className:"w-6 h-6 text-purple-600"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-extrabold text-slate-900",children:"פרס××××"}),e.jsx("p",{className:"text-sm text-slate-500 mt-0.5",children:"פרס×× ××× ×¨, סר××× ×× ×¡×ר×פ ×¢×××× ×× ×©××צ×× ×××× ××× ×× ×©× ×× ××§××××ת. ×פרס×× ××פ××¢ רק ×ש××× ×¤×¢××."})]})]}),x!=="notif_images"&&x!=="template_images"&&de>1&&e.jsxs("div",{className:"rounded-xl bg-amber-50 border border-amber-200 text-amber-800 text-xs font-medium px-3 py-2",children:["ש××× ××: ××××ר×× ",de," פרס×××× ×¤×¢×××× ×××צע ×××× â ×× ×ת×××¤× ×× ××ר ××."]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(Ne).map(([s,d])=>{const f=d.icon,j=x===s,S=A(s).length;return e.jsxs("button",{onClick:()=>
1b(s),className:`inline-flex items-center gap-2 h-11 px-4 rounded-xl text-sm font-bold border-2 transition-all ${j?"text-white shadow-md":"bg-white text-slate-600 border-slate-200 hover:border-slate-300 hover:shadow-sm"}`,style:j?{backgroundColor:d.color,borderColor:d.color}:void 0,children:[e.jsx("span",{className:`w-6 h-6 rounded-lg grid place-items-center flex-none ${j?"bg-white/20 text-white":""}`,style:j?void 0:{backgroundColor:`${d.color}15`,color:d.color},children:e.jsx(f,{className:"w-4 h-4"})}),d.label,e.jsx("span",{className:`text-xs tabular-nums rounded-full px-1.5 py-0.5 ${j?"bg-white/25 text-white":"bg-slate-100 text-slate-500"}`,children:S})]},s)}),e.jsxs("button",{onClick:()=>b("notif_images"),className:`inline-flex items-center gap-2 h-11 px-4 rounded-xl text-sm font-bold border-2 transition-all ${x==="notif_images"?"text-white shadow-md":"bg-white text-slate-600 border-slate-200 hover:border-slate-300 hover:shadow-sm"}`,style:x==="notif_images"?{backgroundColor:"#c026d3",borderColor:"#c026d3"}:void 0,children:[e.jsx("span",{className:`w-6 h-6 rounded-lg grid place-items-center flex-none ${x==="notif_images"?"bg-white/20 text-white":""}`,style:x!=="notif_images"?{backgroundColor:"#c026d315",color:"#c026d3"}:void 0,children:e.jsx(V,{className:"w-4 h-4"})}),"ת××× ×ת ××תר××ת"]}),e.jsxs("button",{onClick:()=>b("template_images"),className:`inline-flex items-center gap-2 h-11 px-4 rounded-xl text-sm font-bold border-2 transition-all ${x==="template_images"?"text-white shadow-md":"bg-white text-slate-600 border-slate-200 hover:border-slate-300 hover:shadow-sm"}`,style:x==="template_images"?{backgroundColor:"#0891b2",borderColor:"#0891b2"}:void 0,children:[e.jsx("span",{className:`w-6 h-6 rounded-lg grid place-items-center flex-none ${x==="template_images"?"bg-white/20 text-white":""}`,style:x!=="template_images"?{backgroundColor:"#0891b215",color:"#0891b2"}:void 0,children:e.jsx(fe,{className:"w-4 h-4"})}),"ת××× ×ת ×ת×× ××ת ×§××××"]})]}),x==="banner"&&e.jsx(Z,{kind:"banner",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:[A("banner").map(s=>e.jsxs("div",{className:`rounded-2xl border overflow-hidden bg-white ${s.is_active?"border-slate-200":"border-slate-100 opacity-60"}`,children:[e.jsx("div",{className:"aspect-[16/9] bg-slate-100",children:s.image_url&&e.jsx("img",{src:s.image_url,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsx(as,{moduleKey:s.module_key,linkUrl:s.link_url,onChange:d=>E(s.id,d)}),(s.module_key||s.link_url)&&e.jsx(se,{label:"××§×¡× ××פת×ר ×¢× ×ת××× ×",value:s.button_label,onSave:d=>E(s.id,{button_label:d}),placeholder:"×פר××× × ×ספ××"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(te,{active:s.is_active,onToggle:()=>E(s.id,{is_active:!s.is_active})}),e.jsx("button",{onClick:()=>W(s.id),className:"w-8 h-8 rounded-lg text-red-500 hover:bg-red-50 grid place-items-center","aria-label":"×××§",children:e.jsx(B,{className:"w-4 h-4"})})]})]})]},s.id)),e.jsxs("label",{className:"rounded-2xl border-2 border-dashed border-slate-200 hover:border-blue-300 hover:bg-blue-50/40 transition-colors grid place-items-center cursor-pointer min-h-[180px]",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Ce,disabled:m}),e.jsxs("span",{className:"flex flex-col items-center gap-2 text-slate-400",children:[m?e.jsx(T,{className:"w-7 h-7 animate-spin"}):e.jsx(z,{className:"w-7 h-7"}),e.jsx("span",{className:"text-sm font-semibold",children:m?"××¢××...":"××סף ××× ×¨"})]})]})]})}),x==="video"&&e.jsx(Z,{kind:"video",onAdd:()=>H({kind:"video",display_order:K("video")}),addLabel:"××סף סר×××",children:A("video").length===0?e.jsx(Q,{text:"××× ×¡×¨××× ×× ××××ר××. ××ס××¤× ×¡×¨××× ×××××× (×× ×××) ש××צ×× ×××× ××× ××."}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-3",children:A("video").map((s,d,f)=>{const j=Xe(s.video_url);return e.jsxs("div",{className:`rounded-2xl border overflow-hidden bg-white flex flex-col ${s.is_active?"border-slate-200":"border-slate-100 opacity-60"}`,children:[e.jsxs("div",{className:"relative aspect-video bg-slate-900",children:[j?e.jsx("img",{src:j,alt:"",className:"absolute inset-0 w-full h-full object-cover"}):e.jsx("div",{className:"absolute inset-0 grid place-items-center",children:e.jsx(Y,{className:"w-9 h-9 text-slate-500"})}),e.jsx("span",{className:"absolute inset-0 grid place-items-center bg-black/10",children:e.jsx("span",{className:"w-11 h-11 rounded-full bg-red-600/95 grid place-items-center shadow-lg",children:e.jsx(ze,{className:"w-5 h-5 text-white translate-x-[1px]",fill:"currentColor"})})}),e.jsxs("div",{className:"absolute top-1.5 right-1.5 flex items-center gap-1 rounded-full bg-black/45 backdrop-blur px-1 py-0.5",children:[e.jsx("button",{onClick:()=>oe(s,-1),disabled:d===0,className:"w-6 h-6 rounded-full grid place-items-center text-white/90 hover:bg-white/20 disabled:opacity-30","aria-label":"××× ××¢××",children:e.jsx(Ve,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-[0.6875rem] font-bold text-white tabular-nums px-0.5",children:d+1}),e.jsx("button",{onClick:()=>
1oe(s,1),disabled:d===f.length-1,className:"w-6 h-6 rounded-full grid place-items-center text-white/90 hover:bg-white/20 disabled:opacity-30","aria-label":"××× ×××",children:e.jsx(Le,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"p-3 flex flex-col gap-2 flex-1",children:[e.jsx(se,{label:"××תרת (××פצ××× ××)",value:s.title,onSave:S=>E(s.id,{title:S}),placeholder:"××תרת ×סר×××"}),e.jsx(se,{label:"×§×ש×ר ××××××",value:s.video_url,onSave:S=>E(s.id,{video_url:S}),placeholder:"https://www.youtube.com/watch?v=...",dir:"ltr",icon:Y}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"××××× ××§×שר (×××× × ××©× ×סר××× ××××)"}),e.jsxs("select",{value:s.module_key||"",onChange:S=>E(s.id,{module_key:S.target.value}),className:P,children:[e.jsx("option",{value:"",children:"××× ×××××"}),ne.map(S=>e.jsx("option",{value:S.value,children:S.label},S.value))]})]}),e.jsxs("div",{className:"flex items-center flex-wrap gap-1.5 mt-auto pt-1",children:[e.jsx(te,{active:s.is_active,onToggle:()=>E(s.id,{is_active:!s.is_active})}),e.jsx(ee,{on:s.show_on_board!==!1,icon:Me,onLabel:"×××¦× ×× ××××",offLabel:"××¦× ×× ××××",title:s.show_on_board!==!1?"×××¦× ×××× ××× ×× â ×××¦× ××× ××סת×ר":"×× ×××¦× ×××× ××× ×× â ×××¦× ××× ××צ××",tone:"emerald",onClick:()=>E(s.id,{show_on_board:s.show_on_board===!1})}),e.jsx(ee,{on:!!s.show_on_site,icon:Fe,onLabel:"×××¦× ××תר",offLabel:"××¦× ××תר",title:s.show_on_site?"×××¦× ××תר ×ש××××§× â ×××¦× ××× ××סת×ר":"×× ×××¦× ××תר â ×××¦× ××× ××צ××",tone:"blue",onClick:()=>E(s.id,{show_on_site:!s.show_on_site})}),e.jsx(ee,{on:!!s.show_in_gallery,icon:Y,onLabel:"×××ר××",offLabel:"××¦× ×××ר××",title:s.show_in_gallery?"×××¦× ×××ר××ת סר××× × ×××ר×× â ×××¦× ××× ××סת×ר":"×× ×××¦× ×××ר×× â ×××¦× ××× ××צ××",tone:"purple",onClick:()=>E(s.id,{show_in_gallery:!s.show_in_gallery})}),e.jsx("button",{onClick:()=>W(s.id),className:"w-8 h-8 rounded-lg text-red-500 hover:bg-red-50 grid place-items-center ms-auto","aria-label":"×××§",children:e.jsx(B,{className:"w-4 h-4"})})]})]})]},s.id)})})}),x==="ticker"&&e.jsxs(Z,{kind:"ticker",onAdd:()=>H({kind:"ticker",title:"",update_type:"new_update",display_order:K("ticker")}),addLabel:"××סף ×¢××××",children:[e.jsxs("div",{className:"rounded-2xl border border-purple-100 bg-purple-50/50 p-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 text-purple-800 font-bold text-sm",children:[e.jsx(q,{className:"w-4 h-4"})," × ×ס×× ×¢× AI"]}),e.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center gap-2",children:[e.jsx("input",{value:h,onChange:s=>n(s.target.value),onKeyDown:s=>{s.key==="Enter"&&ce()},placeholder:"×ת×× × ××©× â ××××××: ××××× ×צ××¢×ת ××××××××ת ××ש",className:"flex-1 h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"}),e.jsx("div",{className:"inline-flex rounded-full bg-white border border-slate-200 p-1 flex-none",children:[{k:"message",l:"× ×¡× ××××¢×"},{k:"info",l:"× ×¡× ××××¢"},{k:"both",l:"×× ×××"}].map(s=>e.jsx("button",{onClick:()=>a(s.k),className:`px-3 h-8 rounded-full text-xs font-bold transition-all ${l===s.k?"bg-purple-600 text-white shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:s.l},s.k))}),e.jsxs("button",{onClick:ce,disabled:u,className:"inline-flex items-center justify-center gap-1.5 h-10 px-4 rounded-xl text-white text-sm font-bold shadow-sm hover:brightness-110 transition-all disabled:opacity-60 flex-none",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[u?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(q,{className:"w-4 h-4"})," × ×¡×"]}),e.jsxs("button",{onClick:()=>C(!0),className:"inline-flex items-center justify-center gap-1.5 h-10 px-4 roun
1ded-xl border-2 border-purple-200 text-purple-700 text-sm font-bold hover:bg-purple-50 transition-all flex-none",children:[e.jsx(je,{className:"w-4 h-4"})," ×צע×ת ××¢×××× ×× ×××××¢"]}),e.jsxs("button",{onClick:we,disabled:J,className:"inline-flex items-center justify-center gap-1.5 h-10 px-4 rounded-xl bg-white border-2 border-emerald-200 text-emerald-700 text-sm font-bold hover:bg-emerald-50 transition-all disabled:opacity-60 flex-none",children:[J?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(U,{className:"w-4 h-4"})," ××¢× ×ר×××¡× ×ר×× ××××¢"]})]})]}),(()=>{const s=A("ticker");if(s.length===0)return e.jsx(Q,{text:"××× ×¢×××× ×× ××××ר××. × ×¡×× ×¢× AI, ××§×©× ×צע×ת, ×× ××ס××¤× ×¢××××/×ת×× ××× ×ת."});const d=s.filter(w=>(w.update_type||"new_update")!=="info_center"),f=s.filter(w=>w.update_type==="info_center"),j=I!=="info_center",S=I!=="new_update";return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:[{k:"all",l:`××× (${s.length})`},{k:"new_update",l:`×¢×××× ×× (${d.length})`},{k:"info_center",l:`×ר×× ××××¢ (${f.length})`}].map(w=>e.jsx("button",{onClick:()=>$(w.k),className:`h-9 px-4 rounded-full text-sm font-bold border-2 transition-all ${I===w.k?"bg-purple-600 border-purple-600 text-white shadow-sm":"bg-white border-slate-200 text-slate-600 hover:border-purple-300 hover:bg-purple-50"}`,children:w.l},w.k))}),j&&(d.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5 text-indigo-700 font-bold text-sm",children:[e.jsx(R,{className:"w-4 h-4"})," ×¢×××× ×× ××ש×× ",e.jsxs("span",{className:"text-xs font-semibold text-slate-400",children:["(",d.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-4 gap-3",children:d.map(w=>e.jsx(pe,{row:w,onEdit:()=>G(w)},w.id))})]}):I==="new_update"&&e.jsx(Q,{text:"××× ×¢×××× ×× ××ש××."})),S&&(f.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5 text-blue-700 font-bold text-sm",children:[e.jsx(U,{className:"w-4 h-4"})," ×ר×× ××××¢ ",e.jsxs("span",{className:"text-xs font-semibold text-slate-400",children:["(",f.length,")"]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-4 gap-3",children:f.map(w=>e.jsx(pe,{row:w,onEdit:()=>G(w)},w.id))})]}):I==="info_center"&&e.jsx(Q,{text:"××× ×ת××ת ×ר×× ××××¢."}))]})})()]}),x==="notif_images"&&e.jsx(He,{}),x==="template_images"&&e.jsx(qe,{}),L&&e.jsx(Ze,{row:L,onSave:async s=>{await E(L.id,s)},onDelete:async()=>{await W(L.id)&&G(null)},onClose:()=>G(null)}),v&&e.jsx(ss,{onClose:()=>C(!1),onCreate:_e}),F.length>0&&e.jsx(es,{draft:F[0],remaining:F.length,onSave:async(s,d)=>{await ke(s,d),D(f=>f.slice(1))},onDiscard:()=>D(s=>s.slice(1))})]})}function pe({row:t,onEdit:r}){var g,m;const o=t.update_type==="info_center",p=o?((g=ye.find(N=>N.key===(t.category||"general")))==null?void 0:g.label)||"××××":null,i=t.module_key&&((m=ge[t.module_key])==null?void 0:m.label)||"";return e.jsxs("button",{onClick:r,className:`group text-right bg-white rounded-2xl border overflow-hidden flex flex-col shadow-sm hover:shadow-md hover:-translate-y-0.5 transition-all ${t.is_active?"border-slate-200":"border-slate-100 opacity-60"}`,children:[e.jsxs("div",{className:`relative aspect-[16/9] overflow-hidden ${o?"bg-slate-100":""}`,style:o?void 0:{backgroundImage:"linear-gradient(135deg,#6366f1,#2563eb)"},children:[o?t.image_url?e.jsx("img",{src:t.image_url,alt:"",className:"w-full h-full object-cover group-hover:scale-[1.03] transition-transform duration-500"}):e.jsx("div",{className:"w-full h-full grid place-items-center",children:e.jsx(U,{className:"w-8 h-8 text-slate-300"})}):e.jsx("div",{className:"w-full h-full grid place-items-center",children:e.jsx(R,{className:"w-9 h-9 text-white/90"})}),e.jsxs("span",{className:`absolute top-2 right-2 inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[0.625rem] font-bold ${o?"bg-white/90 text-blue-700":"bg-white/20 text-white backdrop-blur-sm"}`,children:[o?e.jsx(U,{className:"w-3 h-3"}):e.jsx(R,{className:"w-3 h-3"})," ",o?"×ר×× ××××¢":"×¢××××"]}),!t.is_active&&e.jsx("span",{className:"absolute top-2 left-2 px-2 py-0.5 rounded-full text-[0.625rem] font-bold bg-amber-100 text-amber-700",children:"××ש××"})]}),e.jsxs("div",{className:"p-3 flex-1 flex flex-col",children:[p&&e.jsx("span",{className:"inline-block self-start mb-1.5 px-2 py-0.5 rounded-full text-[0.625rem] font-bold bg-blue-50 text-blue-700",children:p}),e.jsx("h3",{className:"text-sm font-bold text-slate-800 leading-snug line-clamp-2",children:t.title||"××× ××תרת"}),e.jsxs("div",{className:"mt-auto pt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-bold text-purple-600 flex-none",children:"ער××× â"}),i&&e.jsx("span",{className:"text-[0.625rem] text-slate-400 truncate",children:i})]})]})]})}function Ze({row:t,onSave:r,onDelete:o,onClose:p}){const[i,g]=c.useState(t.update_type||"new_update"),[m,N]=c.useState(t.title||""),[x,b]=c.useState(t.body||""),[h,n]=c.useState(t.category||"general"),[l,a]=c.useState(t.image_url||""),[u,_]=c.useState(t.module_key||""),[v,C]=c.useState(t.is_active!==!1),[I,$]=c.useState(!1),F=i==="info_center",D=async()=>
1{if(!m.trim()){y.error("× ×רשת ××תרת");return}$(!0);try{await r({update_type:i,title:m.trim(),body:x.trim(),module_key:u||"",is_active:v,category:h||"general",image_url:F?l:t.image_url||""}),p()}finally{$(!1)}};return ae.createPortal(e.jsxs("div",{dir:"rtl",className:"fixed inset-0 z-[100] flex items-center justify-center p-3 sm:p-6",onClick:p,children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] overflow-hidden bg-white rounded-3xl shadow-2xl flex flex-col",onClick:L=>L.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-800 font-extrabold",children:[F?e.jsx(U,{className:"w-5 h-5"}):e.jsx(R,{className:"w-5 h-5"})," ער××ת ",F?"×ת×ת ××××¢":"×¢××××"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{active:v,onToggle:()=>C(L=>!L)}),e.jsx("button",{"aria-label":"ס××ר×",onClick:p,className:"w-9 h-9 rounded-full bg-slate-100 hover:bg-slate-200 grid place-items-center text-slate-600",children:e.jsx(re,{className:"w-5 h-5"})})]})]}),e.jsx("div",{className:"p-5 overflow-y-auto space-y-3.5",children:e.jsx(ve,{kind:i,setKind:g,title:m,setTitle:N,body:x,setBody:b,category:h,setCategory:n,image:l,setImage:a,moduleKey:u,setModuleKey:_})}),e.jsxs("div",{className:"flex items-center justify-between gap-2 px-5 py-4 border-t border-slate-100",children:[e.jsxs("button",{onClick:o,disabled:I,className:"inline-flex items-center gap-1.5 h-10 px-4 rounded-full text-sm font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-4 h-4"})," ×××§"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:p,disabled:I,className:"h-10 px-4 rounded-full text-sm font-bold text-slate-500 hover:bg-slate-100",children:"×××"}),e.jsxs("button",{onClick:D,disabled:I,className:"inline-flex items-center gap-1.5 h-10 px-5 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 disabled:opacity-60",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[I?e.jsx(T,{className:"w-4 h-4 animate-spin"}):null," ש××ר"]})]})]})]})]}),document.body)}function ve({kind:t,setKind:r,title:o,setTitle:p,body:i,setBody:g,category:m,setCategory:N,image:x,setImage:b,moduleKey:h,setModuleKey:n}){const l=t==="info_center";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"inline-flex rounded-full bg-slate-100 p-1",children:[{k:"new_update",l:"×¢×××× ××ש"},{k:"info_center",l:"×ר×× ××××¢"}].map(a=>e.jsx("button",{onClick:()=>r(a.k),className:`px-3.5 h-8 rounded-full text-xs font-bold transition-all ${t===a.k?"bg-white text-purple-700 shadow-sm":"text-slate-500 hover:text-slate-700"}`,children:a.l},a.k))}),l&&e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"×§×××ר××"}),e.jsx("select",{value:m,onChange:a=>N(a.target.value),className:P,children:ye.map(a=>e.jsx("option",{value:a.key,children:a.label},a.key))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"××תרת"}),e.jsx("input",{value:o,onChange:a=>p(a.target.value),placeholder:"××תרת",className:"w-full h-10 rounded-xl border border-slate-200 bg-white px-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:l?"ת×××ר ×××":"ת×××ר"}),e.jsx("textarea",{value:i,onChange:a=>g(a.target.value),rows:l?7:4,placeholder:"ת×××",className:"w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm leading-relaxed resize-y focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"})]}),l&&e.jsx(ls,{value:x,onSave:b}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:'××××× ××§×שר (×פת×ר "××¢×ר ×× ××××" + ××ת×ר סר××× ×× ×ש×)'}),e.jsxs("select",{value:h,onChange:a=>n(a.target.value),className:P,children:[e.jsx("option",{value:"",children:"××× ×××××"}),ne.map(a=>e.jsx("option",{value:a.value,children:a.label},a.value))]})]})]})}function es({draft:t,remaining:r,onSave:o,onDiscard:p}){const[i,g]=c.useState(t.kind||"new_update"),[m,N]=c.useState(t.title||""),[x,b]=c.useState(t.body||""),[h,n]=c.useState(t.category||"general"),[l,a]=c.useState(t.image_url||""),[u,_]=c.useState(t.module_key||""),[v,C]=c.useState(!1),I=async $=>{if(!m.trim()){y.error("× ×רשת ××תרת");return}C(!0);try{await o({kind:i,title:m.trim(),body:x.trim(),category:h,image_url:l,module_key:u},$)}finally{C(!1)}};return ae.createPortal(e.jsxs("div",{dir:"rtl",className:"fixed inset-0 z-[100] flex items-center justify-center p-3 sm:p-6",onClick:p,children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] overflow-hidden bg-white rounded-3xl shadow-2xl flex flex-col",onClick:$=>$.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-800 font-extrabold",children:[e.jsx(q,{className:"w-5 h-5"})," ××××× ×ער××× ×××ש×ר",r>1?` (× ××ª×¨× ${r})`:""]}),e.jsx("button",{onClick:p,className:"w-9 h-9 rounded-full bg-slate-100 hover:bg-slate-200 grid place-items-center text-slate-600",children:e.jsx(re,{className:"w-5 h-5"})})]}),e.jsx("div",{className:"p-5 overflow-y-auto space-y-3.5",children:e.jsx(ve,{
1kind:i,setKind:g,title:m,setTitle:N,body:x,setBody:b,category:h,setCategory:n,image:l,setImage:a,moduleKey:u,setModuleKey:_})}),e.jsxs("div",{className:"flex items-center justify-end gap-2 px-5 py-4 border-t border-slate-100",children:[e.jsx("button",{onClick:p,disabled:v,className:"h-10 px-4 rounded-full text-sm font-bold text-slate-500 hover:bg-slate-100",children:"×××"}),e.jsx("button",{onClick:()=>I(!1),disabled:v,className:"h-10 px-4 rounded-full text-sm font-bold border-2 border-slate-200 text-slate-700 hover:bg-slate-50",children:"ש××ר ××××××"}),e.jsxs("button",{onClick:()=>I(!0),disabled:v,className:"inline-flex items-center gap-1.5 h-10 px-5 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 disabled:opacity-60",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[v?e.jsx(T,{className:"w-4 h-4 animate-spin"}):null," ש××ר ×פרס×"]})]})]})]}),document.body)}function ss({onClose:t,onCreate:r}){const[o,p]=c.useState(""),[i,g]=c.useState(!1),[m,N]=c.useState(null),[x,b]=c.useState({}),h=async()=>{var l;g(!0);try{const a=await k.functions.invoke("composeSystemUpdate",{action:"suggest",recent:o.trim()});N(((l=a==null?void 0:a.data)==null?void 0:l.suggestions)||[])}catch(a){console.error(a),y.error("ש×××× ××פקת ×צע×ת"),N([])}finally{g(!1)}},n=async(l,a)=>{await r(l),b(u=>({...u,[a]:!0}))};return ae.createPortal(e.jsxs("div",{dir:"rtl",className:"fixed inset-0 z-[100] flex items-center justify-center p-3 sm:p-6",onClick:t,children:[e.jsx("div",{className:"absolute inset-0 bg-slate-900/50 backdrop-blur-sm"}),e.jsxs("div",{className:"relative w-full max-w-3xl max-h-[88vh] overflow-hidden bg-white rounded-3xl shadow-2xl flex flex-col",onClick:l=>l.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 px-5 py-4 border-b border-slate-100",children:[e.jsxs("div",{className:"flex items-center gap-2 text-purple-800 font-extrabold",children:[e.jsx(je,{className:"w-5 h-5"})," ×צע×ת ××¢×××× ×× ×××××¢"]}),e.jsx("button",{"aria-label":"ס××ר×",onClick:t,className:"w-9 h-9 rounded-full bg-slate-100 hover:bg-slate-200 grid place-items-center text-slate-600",children:e.jsx(re,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"p-5 overflow-y-auto space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-slate-500 mb-2",children:"×פשר ××××××§ ×ת ×× ×©×©××ר×/× ×סף ××ער×ת ×××ר×× × (××¤× ×××××) â ×× ××ש××ר ר××§ ××× ××§×× ×צע×ת ת××× ×¢× ×××××ת ××ער×ת."}),e.jsx("textarea",{value:o,onChange:l=>p(l.target.value),rows:3,placeholder:"××××××: ××××× ×צ××¢×ת ××××××××ת â × ××¡×¤× ×©×××ת ת×××ר×ת; ××××× ×ª×ש××× â ס×× ×× ×תק×× ××ש...",className:"w-full rounded-xl border border-slate-200 bg-white px-3 py-2 text-sm resize-y focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50"}),e.jsxs("button",{onClick:h,disabled:i,className:"mt-2 inline-flex items-center gap-1.5 h-10 px-5 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 disabled:opacity-60",style:{backgroundImage:"linear-gradient(90deg,#7c3aed,#2563eb)"},children:[i?e.jsx(T,{className:"w-4 h-4 animate-spin"}):e.jsx(q,{className:"w-4 h-4"})," ",m?"×¨×¢× × ×צע×ת":"×פק ×צע×ת"]})]}),i&&e.jsxs("div",{className:"flex items-center gap-2 text-slate-500 text-sm justify-center py-6",children:[e.jsx(T,{className:"w-4 h-4 animate-spin"})," ×××× ×צע×תâ¦"]}),m&&!i&&(m.length===0?e.jsx("p",{className:"text-sm text-slate-400 text-center py-6",children:"×× × ××¦×¨× ×צע×ת, × ×¡× ×©××."}):e.jsx("div",{className:"space-y-3",children:m.map((l,a)=>{const u=l.kind==="info_center";return e.jsxs("div",{className:"rounded-2xl border border-slate-200 p-3.5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[0.6875rem] font-bold ${u?"bg-blue-50 text-blue-700":"bg-indigo-50 text-indigo-700"}`,children:[u?e.jsx(U,{className:"w-3 h-3"}):e.jsx(R,{className:"w-3 h-3"})," ",u?"×ר×× ××××¢":"×¢×××× ××ש"]}),e.jsx("h4",{className:"text-sm font-bold text-slate-800 flex-1",children:l.title})]}),e.jsx("p",{className:"text-sm text-slate-600 leading-relaxed whitespace-pre-wrap line-clamp-4",children:l.body}),e.jsx("div",{className:"mt-2 flex justify-end",children:x[a]?e.jsx("span",{className:"text-xs font-bold text-emerald-600",children:"× ×סף â"}):e.jsxs("button",{onClick:()=>n(l,a),className:"inline-flex items-center gap-1.5 h-9 px-4 roun
1ded-full bg-purple-600 text-white text-xs font-bold hover:brightness-110",children:[e.jsx(le,{className:"w-3.5 h-3.5"})," צ×ר ",u?"×ת××":"×¢××××"]})})]},a)})}))]})]})]}),document.body)}function Z({kind:t,children:r,onAdd:o,addLabel:p}){const i=Ne[t],g=i.icon;return e.jsxs("div",{className:"bg-white rounded-2xl border border-slate-100 shadow-sm p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("span",{className:"w-9 h-9 rounded-xl grid place-items-center flex-none",style:{backgroundColor:`${i.color}15`,color:i.color},children:e.jsx(g,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-[0.9375rem] font-bold text-slate-800",children:i.label}),e.jsx("p",{className:"text-xs text-slate-400",children:i.desc})]})]}),o&&e.jsxs("button",{onClick:o,className:"inline-flex items-center gap-1.5 h-9 px-4 rounded-full text-white text-sm font-bold shadow-sm hover:brightness-110 transition-all flex-none",style:{backgroundColor:i.color},children:[e.jsx(le,{className:"w-4 h-4"})," ",p]})]}),r]})}function Q({text:t}){return e.jsx("p",{className:"text-sm text-slate-400 text-center py-6",children:t})}function te({active:t,onToggle:r,compact:o}){return e.jsxs("button",{onClick:r,title:t?"פע×× â ×××¦× ×××× ××× ××. ×××¦× ××× ××ש××ת":"××ש×× â ש××ר ×× ××× × ××צ×. ×××¦× ××× ××פע××",className:`inline-flex items-center gap-1.5 rounded-full text-xs font-bold transition-colors ${o?"px-2 py-1":"px-3 py-1.5"} ${t?"bg-emerald-50 text-emerald-700":"bg-amber-50 text-amber-700"}`,children:[t?e.jsx(Be,{className:"w-3.5 h-3.5"}):e.jsx(Ge,{className:"w-3.5 h-3.5"}),o?"":t?"פע××":"××ש××"]})}const ts={emerald:"bg-emerald-50 text-emerald-700 ring-1 ring-emerald-200",blue:"bg-blue-50 text-blue-700 ring-1 ring-blue-200"};function ee({on:t,icon:r,onLabel:o,offLabel:p,title:i,tone:g="emerald",onClick:m}){return e.jsxs("button",{onClick:m,title:i,className:`inline-flex items-center gap-1.5 rounded-full text-xs font-bold px-3 py-1.5 transition-colors ${t?ts[g]:"bg-slate-100 text-slate-400"}`,children:[r&&e.jsx(r,{className:"w-3.5 h-3.5"}),t?o:p]})}function se({label:t,value:r,onSave:o,placeholder:p,dir:i,icon:g}){const[m,N]=c.useState(r||"");c.useEffect(()=>{N(r||"")},[r]);const x=()=>{(m||"")!==(r||"")&&o(m.trim())};return e.jsxs("label",{className:"block",children:[t&&e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:t}),e.jsxs("div",{className:"relative",children:[g&&e.jsx(g,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{value:m,onChange:b=>N(b.target.value),onBlur:x,onKeyDown:b=>{b.key==="Enter"&&b.currentTarget.blur()},placeholder:p,dir:i,className:`w-full h-10 rounded-xl border border-slate-200 bg-white ${g?"pr-9":"px-3"} pl-3 text-sm focus:outline-none focus:border-purple-300 focus:ring-2 focus:ring-purple-50 transition-all`})]})]})}function ls({value:t,onSave:r}){const[o,p]=c.useState(!1),i=async g=>{var N;const m=(N=g.target.files)==null?void 0:N[0];if(g.target.value="",!!m){p(!0);try{const{file_url:x}=await k.integrations.Core.UploadFile({file:m});r(x)}catch(x){console.error(x),y.error("ש×××× ×××¢××ת ×ת××× ×")}finally{p(!1)}}};return e.jsxs("div",{children:[e.jsx("span",{className:"text-[0.6875rem] font-bold text-slate-400 mb-1 block",children:"ת××× ×ª ××ת××"}),t?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-24 h-16 rounded-lg overflow-hidden bg-slate-100 flex-none",children:e.jsx("img",{src:t,alt:"",className:"w-full h-full object-cover"})}),e.jsxs("label",{className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg border border-slate-200 text-xs font-bold text-slate-600 hover:bg-slate-50 cursor-pointer",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:i,disabled:o}),o?e.jsx(T,{className:"w-3.5 h-3.5 animate-spin"}):e.jsx(z,{className:"w-3.5 h-3.5"})," ××××£"]}),e.jsxs("button",{onClick:()=>r(""),className:"inline-flex items-center gap-1.5 h-9 px-3 rounded-lg text-xs font-bold text-red-500 hover:bg-red-50",children:[e.jsx(B,{className:"w-3.5 h-3.5"})," ×סר"]})]}):e.jsxs("label",{className:"flex items-center justify-center gap-2 h-16 rounded-lg border-2 border-dashed border-slate-200 hover:border-blue-300 hover:bg-blue-50/40 transition-colors cursor-pointer text-slate-400 text-sm font-semibold",children:[e.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:i,disabled:o}),o?e.jsx(T,{className:"w-5 h-5 animate-spin"}):e.jsx(z,{className:"w-5 h-5"})," ",o?"××¢××...":"××¢×× ×ª××× ×"]})]})}function as({moduleKey:t,linkUrl:r,onChange:o}){const p=t?"module":r?"link":"none",[i,g]=c.useState(p),[m,N]=c.useState(r||"");c.useEffect(()=>{g(t?"module":r?"link":"none"),N(r||"")},[t,r]);const x=b=>{g(b),b==="none"?o({module_key:"",link_url:""}):b==="link"&&o({module_key:"",link_url:m.trim()})};return e.jsxs("div",{className:"space-y-2",children:[e.jsxs("select",{value:i,onChange:b=>x(b.target.value),className:P,children:[e.jsx("option",{value:"none",children:"××× ××¢× ××××צ×"}),e.jsx("option",{value:"module",children:"××¢×ר ×××××× ××ער×ת"}),e.jsx("option",{value:"link",children:"×§×ש×ר ××צ×× ×"})]}),i==="module"&&e.jsxs("select",{value:t||"",onChange:b=>o({module_key:b.target.value,link_url:""}),className:P,children:[e.jsx("option",{value:"",children:"××ר ×××××â¦"}),ne.map(b=>e.jsx("option",{value:b.value,children:b.label},b.value))]}),i==="link"&&e.jsxs("div",{className:"relative",children:[e.jsx(Ae,{className:"absolute right-2.5 top-1/2 -translate-y-1/2 w-4 h-4 text-slate-400"}),e.jsx("input",{value:m,onChange:b=>N(b.target.value),onBlur:()=>o({module_key:"",link_url:m.trim()}),onKeyDown:b=>{b.key==="Enter"&&b.currentTarget.blur()},placeholder:"https://...",dir:"ltr",className:`${P} pr-9`})]})]})}export{ye as INFO_CATEGORIES,Ns as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.