PageSourceSearch

https://atzuma.co.il/assets/AdminTemplateManagement-BJsvDEe_.js

js atzuma.co.il collected 2026-10-02 07:46:50 UTC 104,762 bytes, 18 lines download raw bytes

1import{j as e}from"./index-C_Fqshtm.js";import{r as h,u as xe}from"./router-BXL9ASSk.js";import{u as be,a as fe,d as ye,t as je,b as _e}from"./api-Drf1Dne2.js";import{H as ve}from"./HeroMessagesManagement-C0Vhdcjd.js";import"./vendor-BNcAc9ko.js";import"./httpClient-D4HtC_NG.js";import"./index-BqDtoUCL.js";import"./search-DQVJjOoe.js";import"./createLucideIcon-0jETPTlQ.js";import"./x-DzBoDhQk.js";import"./chevron-down-Co5aPzv0.js";import"./eye-E_fm2zZc.js";import"./copy-DcpDJEZe.js";import"./trash-2-9Se24Ovq.js";(function(){try{var b=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};b.SENTRY_RELEASE={id:"[email protected]"}}catch{}})();try{(function(){var b=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},N=new b.Error().stack;N&&(b._sentryDebugIds=b._sentryDebugIds||{},b._sentryDebugIds[N]="ea51df5d-a9a9-410b-98bc-6d3504f3f696",b._sentryDebugIdIdentifier="sentry-dbid-ea51df5d-a9a9-410b-98bc-6d3504f3f696")})()}catch{}const Ne=({isOpen:b,onClose:N,onSuccess:P,language:j="en"})=>{const[R,w]=h.useState(1),[D,g]=h.useState(!1),[_,C]=h.useState({}),[I,T]=h.useState([]),[i,M]=h.useState({template_name:"",description:"",template_type:"manual_assignment",signature_range_min:100,signature_range_max:1e4,hero_message_style_id:null,currency:"ILS",hide_reach:!1,tier_count:4,tiers:[{amount:5,base_reach:50,actual_reach:75,bonus_percentage:50,is_featured:!1,badge:""},{amount:15,base_reach:150,actual_reach:200,bonus_percentage:33,is_featured:!1,badge:""},{amount:25,base_reach:300,actual_reach:400,bonus_percentage:33,is_featured:!0,badge:"Popular"},{amount:50,base_reach:600,actual_reach:900,bonus_percentage:50,is_featured:!1,badge:"Best value"}]}),c=h.useCallback(t=>({createTemplate:{en:"Create New Pricing Template",he:"יצירת תבנית תמחור חדשה"},step:{en:"Step",he:"שלב"},of:{en:"of",he:"מתוך"},next:{en:"Next",he:"הבא"},back:{en:"Back",he:"חזור"},cancel:{en:"Cancel",he:"ביטול"},create:{en:"Create Template",he:"צור תבנית"},preview:{en:"Preview",he:"תצוגה מקדימה"},basicInfo:{en:"Basic Information",he:"מידע בסיסי"},templateName:{en:"Template Name",he:"שם התבנית"},templateNamePlaceholder:{en:"Enter template name...",he:"הזן שם תבנית..."},description:{en:"Description",he:"תיאור"},descriptionPlaceholder:{en:"Describe this template...",he:"תאר את התבנית..."},templateType:{en:"Template Type",he:"סוג התבנית"},primaryDefault:{en:"Primary Default",he:"ברירת מחדל ראשית"},rangeDefault:{en:"Range Default",he:"ברירת מחדל טווח"},manualAssignment:{en:"Manual Assignment",he:"הקצאה ידנית"},primaryDefaultDesc:{en:"Universal template for all petitions (0-∞ signatures)",he:"תבנית אוניברסלית לכל העצומות (0-∞ חתימות)"},rangeDefaultDesc:{en:"Template for specific signature range",he:"תבנית לטווח חתימות ספציפי"},manualAssignmentDesc:{en:"Template for manual assignment to specific petitions only",he:"תבנית להקצאה ידנית לעצומות ספציפיות בלבד"},heroMessageStyle:{en:"Hero Message Style",he:"סגנון הודעת גיבור"},selectHeroMessage:{en:"Select a message style",he:"בחר סגנון הודעה"},noHeroMessage:{en:"None (use default)",he:"ללא (השתמש בברירת מחדל)"},signatureRange:{en:"Signature Range",he:"טווח חתימות"},minSignatures:{en:"Minimum Signatures",he:"מינימום חתימות"},maxSignatures:{en:"Maximum Signatures",he:"מקסימום חתימות"},rangeHelp:{en:"Define when this template will be shown to users",he:"הגדר מתי התבנית תוצג למשתמשים"},primaryRangeNote:{en:"Primary template covers all signature ranges automatically",he:"תבנית ראשית מכסה את כל טווחי החתימות אוטומטית"},tiersCurrency:{en:"Tiers & Currency",he:"רמות ומטבע"},tierCount:{en:"Number of Tiers",he:"מספר רמות"},currency:{en:"Currency",he:"מטבע"},tierCountHelp:{en:"Choose between 2-4 pricing tiers",he:"בחר בין 2-4 רמות תמחור"},tiersConfig:{en:"Tiers Configuration",he:"הגדרת רמות"},amount:{en:"Amount",he:"סכום"},baseReach:{en:"Base Reach (Guaranteed)",he:"הגעה מובטחת"},actualReach:{en:"Actual Reach (Delivered)",he:"הגעה בפועל"},bonusPercentage:{en:"Bonus %",he:"אחוז בונוס"},isFeatured:{en:"Featured Tier",he:"רמה מומלצת"},badge:{en:"Badge Text",he:"טקסט תג"},tiersHelp:{en:"Configure pricing tiers with reach numbers and bonuses",he:"הגדר רמות תמחור עם מספרי הגעה ובונוסים"},baseReachHelp:{en:"Minimum guaranteed reach",he:"הגעה מינימלית מובטחת"},actualReachHelp:{en:"Actual reach delivered",he:"הגעה בפועל שתימסר"},badgeHelp:{en:'Optional badge text (e.g., "Popular", "Best value")',he:'טקסט תג אופציונלי (למשל "פופולרי", "הכי כדאי")'},reviewCreate:{en:"Review & Create",he:"סקירה ויצירה"},templatePreview:{en:"Template Preview",he:"תצוגה מקדימה של התבנית"},reviewHelp:{en:"Review your template configuration before creating",he:"סקור את הגדרות התבנית לפני היצירה"},required:{en:"Required",he:"נדרש"},optional:{en:"Optional",he:"אופציונלי"}
1,creating:{en:"Creating...",he:"יוצר..."},USD:{en:"US Dollar ($)",he:"דולר אמריקני ($)"},EUR:{en:"Euro (€)",he:"יורו (€)"},ILS:{en:"Israeli Shekel (₪)",he:"שקל ישראלי (₪)"},nameRequired:{en:"Template name is required",he:"שם התבנית נדרש"},rangeInvalid:{en:"Maximum must be greater than minimum",he:"המקסימום חייב להיות גדול מהמינימום"},amountInvalid:{en:"Amount must be greater than 0",he:"הסכום חייב להיות גדול מ-0"},tierCountInvalid:{en:"Please select between 2-6 tiers",he:"אנא בחר בין 2-6 רמות"}})[t]?.[j]||t,[j]);h.useEffect(()=>{b&&(async()=>{try{const r=localStorage.getItem("auth_token"),d=await fetch("/api/v1/admin/hero-messages",{headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json"}});if(d.ok){const x=await d.json();if(console.log("Hero message styles loaded:",x),x.success&&x.data){const s=x.data.filter(l=>l.is_active);console.log("Active hero message styles:",s),T(s)}}else console.error("Failed to load hero message styles:",d.status)}catch(r){console.error("Error loading hero message styles:",r)}})()},[b,j]);const n=t=>{if(t<2||t>6)return;const r=[...i.tiers];if(t>r.length)for(;r.length<t;){const x=r[r.length-1].amount+10;r.push({amount:x,base_reach:x*10,actual_reach:x*15,bonus_percentage:50,is_featured:!1,badge:""})}else t<r.length&&r.splice(t);M(d=>({...d,tier_count:t,tiers:r}))},k=t=>{switch(t){case"primary_default":M(r=>({...r,template_type:"primary_default",signature_range_min:0,signature_range_max:999999}));break;case"manual_assignment":M(r=>({...r,template_type:"manual_assignment",signature_range_min:0,signature_range_max:999999}));break}},B=t=>{const r={};switch(t){case 1:i.template_name.trim()||(r.template_name=c("nameRequired"));break;case 2:i.template_type==="range_default"&&i.signature_range_max<=i.signature_range_min&&(r.signature_range=c("rangeInvalid"));break;case 3:(i.tier_count<2||i.tier_count>6)&&(r.tier_count=c("tierCountInvalid"));break;case 4:i.tiers.forEach((d,x)=>{d.amount<=0&&(r[`tier_${x}_amount`]=c("amountInvalid")),d.base_reach<=0&&(r[`tier_${x}_base_reach`]="Base reach must be greater than 0"),d.actual_reach<d.base_reach&&(r[`tier_${x}_actual_reach`]="Actual reach must be >= base reach")});break}return C(r),Object.keys(r).length===0},E=()=>{B(R)&&w(t=>Math.min(t+1,5))},$=()=>{w(t=>Math.max(t-1,1))},m=(t,r)=>{M(d=>({...d,[t]:r})),_[t]&&C(d=>({...d,[t]:""}))},U=(t,r,d)=>{M(x=>({...x,tiers:x.tiers.map((s,l)=>{if(l===t){const u={...s,[r]:d};if(r==="base_reach"||r==="actual_reach"){const S=r==="base_reach"?d:s.base_reach,v=r==="actual_reach"?d:s.actual_reach;S>0&&(u.bonus_percentage=Math.round((v/S-1)*100))}return u}return s})}))},W=async()=>{if(B(4)){g(!0);try{const t=localStorage.getItem("auth_token"),r={template_name:i.template_name,description:i.description,template_type:i.template_type,signature_range_min:i.signature_range_min,signature_range_max:i.signature_range_max,hero_message_style_id:i.hero_message_style_id,currency:i.currency,hide_reach:i.hide_reach?1:0,tiers:i.tiers.slice(0,i.tier_count)};console.log("📡 Sending template data:",r);const d=await fetch("/api/v1/admin/pricing/templates",{method:"POST",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(r)});if(d.ok){const x=await d.json();P(x.data),N(),w(1),M({template_name:"",description:"",template_type:"manual_assignment",signature_range_min:100,signature_range_max:1e4,hero_message_style_id:null,currency:"ILS",tier_count:4,tiers:[{amount:5,base_reach:50,actual_reach:75,bonus_percentage:50,is_featured:!1,badge:""},{amount:15,base_reach:150,actual_reach:200,bonus_percentage:33,is_featured:!1,badge:""},{amount:25,base_reach:300,actual_reach:400,bonus_percentage:33,is_featured:!0,badge:"Popular"},{amount:50,base_reach:600,actual_reach:900,bonus_percentage:50,is_featured:!1,badge:"Best value"}]})}else{const x=await d.json();C({general:x.message||"Failed to create template"})}}catch(t){console.error("Create template error:",t),C({general:"Network error occurred"})}finally{g(!1)}}},A=t=>({USD:"$",EUR:"€",ILS:"₪"})[t]||"₪",f=["📄","🎯","⚙️","💰","👁️"];return b?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-4xl flex flex-col",style:{direction:j==="he"?"rtl":"ltr",maxHeight:"90vh"},children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-t-xl flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-white bg-opacity-20 rounded-lg text-2xl",children:"📄"}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold",children:c("createTemplate")}),e.jsxs("p",{className:"text-blue-100 text-sm",children:[c("step")," ",R," ",c("of")," 5"]})]})]}),e.jsx("button",{onClick:N,className:"p-2 hover:bg-white hover:bg-opacity-20 rounded-lg transition-colors text-xl",children:"✕"})]}),e.jsx("div",{className:"px-6 py-4 bg-gray-50 flex-shrink-0",children:e.jsx("div",{className:"flex items-center justify-between mb-2",children:[1,2,3,4,5].map((t,r)=>{const d=t===R,x=t<R;return e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`
2                    flex items-center justify-center w-10 h-10 rounded-full border-2 transition-colors
3                    ${d?"bg-blue-500 border-blue-500 text-white":""}
4                    ${x?"bg-green-500 border-green-500 text-white":""}
5                    ${!d&&!x?"bg-gray-200 border-gray-300 text-gray-500":""}
6                  `,children:x?"✓":f[r]}),r<4&&e.jsx("div",{className:`
7                      w-16 h-0.5 mx-2 transition-colors
8                      ${t<R?"bg-green-500":"bg-gray-300"}
9                    `})]},t)})})}),e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[e.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[R===1&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:c("basicInfo")}),e.jsx("p",{className:"text-gray-600",children:"Start by providing basic information and template type"})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[c("templateName")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{type:"text",value:i.template_name,onChange:t=>m("template_name",t.target.value),placeholder:c("templateNamePlaceholder"),className:`w-full px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors ${_.template_name?"border-red-500":"border-gray-300"}`}),_.template_name&&e.jsxs("p",{className:"mt-1 text-sm text-red-600 flex items-center gap-1",children:[e.jsx("span",{className:"text-lg",children:"⚠️"}),_.template_name]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[c("description")," ",e.jsxs("span",{className:"text-gray-400",children:["(",c("optional"),")"]})]}),e.jsx("textarea",{value:i.description,onChange:t=>m("description",t.target.value),placeholder:c("descriptionPlaceholder"),rows:3,className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors resize-none"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:[c("templateType")," ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{className:`p-4 border-2 rounded-lg cursor-pointer transition-colors ${i.template_type==="primary_default"?"border-blue-500 bg-blue-50":"border-gray-300 bg-white hover:border-blue-300"}`,onClick:()=>k("primary_default"),children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("input",{type:"radio",checked:i.template_type==="primary_default",onChange:()=>k("primary_default"),className:"mr-3"}),e.jsx("h4",{className:"font-semibold text-gray-900",children:c("primaryDefault")})]}),e.jsx("p",{className:"text-sm text-gray-600",children:c("primaryDefaultDesc")}),i.template_type==="primary_default"&&e.jsx("div",{className:"mt-2 p-2 bg-yellow-50 border border-yellow-200 rounded text-xs text-yellow-800",children:"⚠️ Only one primary template allowed"})]}),e.jsxs("div",{className:`p-4 border-2 rounded-lg cursor-pointer transition-colors ${i.template_type==="manual_assignment"?"border-blue-500 bg-blue-50":"border-gray-300 bg-white hover:border-blue-300"}`,onClick:()=>k("manual_assignment"),children:[e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsx("input",{type:"radio",checked:i.template_type==="manual_assignment",onChange:()=>k("manual_assignment"),className:"mr-3"}),e.jsx("h4",{className:"font-semibold text-gray-900",children:c("manualAssignment")})]}),e.jsx("p",{className:"text-sm text-gray-600",children:c("manualAssignmentDesc")}),i.template_type==="manual_assignment"&&e.jsx("div",{className:"mt-2 p-2 bg-blue-50 border border-blue-200 rounded text-xs text-blue-800",children:"ℹ️ Won't be used automatically"})]})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[c("heroMessageStyle")," ",e.jsxs("span",{className:"text-gray-400",children:["(",c("optional"),")"]})]}),e.jsxs("select",{value:i.hero_message_style_id||"",onChange:t=>m("hero_message_style_id",t.target.value?parseInt(t.target.value):null),className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",children:[e.jsx("option",{value:"",children:c("noHeroMessage")}),I.map(t=>e.jsxs("option",{value:t.id,children:[t.style_name," - ",t.style_description]},t.id))]})]}),e.jsx("div",{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:i.hide_reach,onChange:t=>m("hide_reach",t.target.checked)}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Hide reach estimates in tiers (site support)"})]})})]})]}),R===2&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:c("signatureRange")}),e.jsx("p",{className:"text-gray-600",children:i.template_type==="primary_default"?c("primaryRangeNote"):i.template_type==="manual_assignment"?"Manual templates don't use automatic ranges":c("rangeHelp")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:c("minSignatures")}),e.jsx("input",{type:"number",value:i.signature_range_min,onChange:t=>m("signature_range_min",parseInt(t.target.value)||0),min:"0",disabled:i.template_type!=="range_default",className:`w-full px-4 py-3 border rounded-lg transition-colors ${i.template_type!=="range_default"?"bg-gray-100 border-gray-300 text-gray-500 cursor-not-allowed":"border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}`})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:c("maxSignatures")}),e.jsx("input",{type:"number",value:i.signature_range_max,onChange:t=>m("signature_range_max",parseInt(t.target.value)||0),min:"1",disabled:i.template_type!=="range_default",className:`w-full px-4 py-3 border rounded-lg transition-colors ${i.template_type!=="range_default"?"bg-gray-100 border-gray-300 text-gray-500 cursor-not-allowed":"border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}`})]}),_.signature_range&&e.jsx("div",{className:"md:col-span-2",children:e.jsxs("p",{className:"text-sm text-red-600 flex items-center gap-1",children:[e.jsx("span",{className:"text-lg",children:"⚠️"}),_.signature_range]})}),e.jsx("div",{className:"md:col-span-2 p-4 bg-blue-50 rounded-lg",children:e.jsxs("p",{className:"text-sm text-blue-800",children:[e.jsx("strong",{children:"Range:"}),i.template_type==="primary_default"?" All signatures (Universal coverage)":i.template_type==="manual_assignment"?" Not applicable (Manual assignment only)":` ${i.signature_range_min.toLocaleStr
9ing()} - ${i.signature_range_max.toLocaleString()} signatures`]})})]})]}),R===3&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:c("tiersCurrency")}),e.jsx("p",{className:"text-gray-600",children:c("tierCountHelp")})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:c("tierCount")}),e.jsxs("select",{value:i.tier_count,onChange:t=>n(parseInt(t.target.value)),className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",children:[e.jsx("option",{value:2,children:"2 Tiers"}),e.jsx("option",{value:3,children:"3 Tiers"}),e.jsx("option",{value:4,children:"4 Tiers"}),e.jsx("option",{value:5,children:"5 Tiers"}),e.jsx("option",{value:6,children:"6 Tiers"})]}),_.tier_count&&e.jsx("p",{className:"mt-1 text-sm text-red-600",children:_.tier_count})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:c("currency")}),e.jsxs("select",{value:i.currency,onChange:t=>m("currency",t.target.value),className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors",children:[e.jsx("option",{value:"USD",children:c("USD")}),e.jsx("option",{value:"EUR",children:c("EUR")}),e.jsx("option",{value:"ILS",children:c("ILS")})]})]}),e.jsx("div",{className:"md:col-span-2 p-4 bg-green-50 rounded-lg",children:e.jsxs("p",{className:"text-sm text-green-800",children:[e.jsx("strong",{children:"Configuration:"})," ",i.tier_count," pricing tiers in ",i.currency]})})]})]}),R===4&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:c("tiersConfig")}),e.jsxs("p",{className:"text-gray-600",children:["Configure your ",i.tier_count," pricing tiers"]})]}),e.jsx("div",{className:"space-y-4",children:i.tiers.slice(0,i.tier_count).map((t,r)=>e.jsxs("div",{className:"p-4 border border-gray-200 rounded-lg bg-gray-50",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h4",{className:"text-lg font-semibold text-gray-800",children:["Tier ",r+1," ",t.is_featured&&e.jsx("span",{className:"text-blue-600",children:"⭐"})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:t.is_featured,onChange:d=>U(r,"is_featured",d.target.checked),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),c("isFeatured")]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[c("amount")," (",A(i.currency),")"]}),e.jsx("input",{type:"number",value:t.amount,onChange:d=>U(r,"amount",parseFloat(d.target.value)||0),min:"0.01",step:"0.01",className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors ${_[`tier_${r}_amount`]?"border-red-500":"border-gray-300"}`}),_[`tier_${r}_amount`]&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:_[`tier_${r}_amount`]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:c("baseReach")}),e.jsx("input",{type:"number",value:t.base_reach,onChange:d=>U(r,"base_reach",parseInt(d.target.value)||0),min:"1",className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors ${_[`tier_${r}_base_reach`]?"border-red-500":"border-gray-300"}`}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:c("baseReachHelp")}),_[`tier_${r}_base_reach`]&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:_[`tier_${r}_base_reach`]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:c("actualReach")}),e.jsx("input",{type:"number",value:t.actual_reach,onChange:d=>U(r,"actual_reach",parseInt(d.target.value)||0),min:"1",className:`w-full px-3 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors ${_[`tier_${r}_actual_reach`]?"border-red-500":"border-gray-300"}`}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:c("actualReachHelp")}),_[`tier_${r}_actual_reach`]&&e.jsx("p",{className:"mt-1 text-xs text-red-600",children:_[`tier_${r}_actual_reach`]})]}),e.jsxs("div",{className:"md:col-span-2 lg:col-span-1",children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[c("bonusPercentage")," (Auto)"]}),e.jsxs("div",{className:"px-3 py-2 bg-gray-100 border border-gray-300 rounded-lg text-gray-700",children:["+",t.bonus_percentage,"%"]}),e.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["Calculated: (",t.actual_reach," - ",t.base_reach,") / ",t.base_reach," × 100"]})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[c("badge")," ",e.jsxs("span",{className:"text-gray-400",children:["(",c("optional"),")"]})]}),e.jsx("input",{type:"text",value:t.badge,onChange:d=>U(r,"badge",d.target.value),placeholder:"e.g., Popular, Best value, Most chosen",className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 transition-colors"}),e.jsx("p",{className:"mt-1 text-xs text-gray-500",children:c("badgeHelp")})]})]}),e.jsxs("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[e.jsx("p",{className:"text-sm font-medium text-blue-800",children:"Preview:"}),e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[e.jsxs("span",{className:"text-lg font-bold text-blue-600",children:[A(i.currency),t.amount]}),e.jsxs("span",{className:"text-sm text-gray-600",children:["👥 ",t.base_reach," people"]}),t.bonus_percentage>0&&e.jsxs("span",{className:"text-sm text-green-600 font-medium",children:["🎁 Actually ",t.actual_reach,"! (+",t.bonus_percentage,"%)"]}),t.is_featured&&e.jsx("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded-full",children:"⭐ Featured"}),t.badge&&e.jsx("span",{className:"text-xs bg-yellow-100 text-yellow-800 px-2 py-1 rounded-full",children:t.badge})]})]})]},r))})]}),R===5&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-2xl font-bold text-gray-900 mb-2",children:c("reviewCreate")}),e.jsx("p",{className:"text-gray-600",children:c("reviewHelp")})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-6",children:[e.jsx("h4",{className:"text-lg font-semibold mb-4",children:c("templatePreview")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[c("templateName"),":"]}),e.jsx("p",{className:"font-medium",children:i.template_name})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm text-gray-600",children:"Template Type:"}),e.jsx("p",{className:"font-medium",children:i.template_type==="primary_default"?c("primaryDefault"):i.template_type==="manual_assignment"?c("manualAssignment"):c("rangeDefault")})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[c("signatureRange"),":"]}),e.jsx("p",{className:"font-medium",children:i.template_type==="primary_default"?"All signatures (0-∞)":i.template_type==="manual_assignment"?"Manual assignment only":`${i.signature_range_min.toLocaleStr
9ing()} - ${i.signature_range_max.toLocaleString()}`})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[c("currency"),":"]}),e.jsx("p",{className:"font-medium",children:i.currency})]})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-sm text-gray-600",children:[c("description"),":"]}),e.jsx("p",{className:"font-medium",children:i.description||"No description"})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-sm text-gray-600",children:["Pricing Tiers (",i.tier_count,"):"]}),e.jsx("div",{className:`grid gap-3 mt-2 ${i.tier_count===2?"grid-cols-2":i.tier_count===3?"grid-cols-3":i.tier_count===4?"grid-cols-2 md:grid-cols-4":"grid-cols-3"}`,children:i.tiers.slice(0,i.tier_count).map((t,r)=>e.jsxs("div",{className:"bg-white p-3 rounded border",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("p",{className:"text-lg font-bold text-blue-600",children:[A(i.currency),t.amount]}),t.is_featured&&e.jsx("span",{className:"text-yellow-500",children:"⭐"})]}),e.jsxs("p",{className:"text-xs text-gray-600",children:["👥 ",t.base_reach," → ",t.actual_reach]}),t.bonus_percentage>0&&e.jsxs("p",{className:"text-xs text-green-600 font-medium",children:["+",t.bonus_percentage,"% bonus"]}),t.badge&&e.jsx("p",{className:"text-xs text-yellow-600 font-medium",children:t.badge})]},r))})]})]})]}),_.general&&e.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:e.jsxs("p",{className:"text-red-600 flex items-center gap-2",children:[e.jsx("span",{className:"text-xl",children:"⚠️"}),_.general]})})]})]}),e.jsx("div",{className:"border-t border-gray-200 bg-gray-50 p-6 flex-shrink-0 rounded-b-xl",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-3",children:R>1&&e.jsxs("button",{onClick:$,className:"flex items-center gap-2 px-4 py-2 text-gray-600 border border-gray-300 rounded-lg hover:bg-gray-100 transition-colors",children:[e.jsx("span",{className:"text-lg",children:"←"}),c("back")]})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("button",{onClick:N,className:"px-4 py-2 text-gray-600 border border-gray-300 rounded-lg hover:bg-gray-100 transition-colors",children:c("cancel")}),R<5?e.jsxs("button",{onClick:E,disabled:D,className:"flex items-center gap-2 px-6 py-2 bg-blue-500 text-white rounded-lg hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[c("next"),e.jsx("span",{className:"text-lg",children:"→"})]}):e.jsx("button",{onClick:W,disabled:D,className:"flex items-center gap-2 px-6 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:D?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),c("creating")]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-lg",children:"✓"}),c("create")]})})]})]})})]})]})}):null},se=b=>{if(typeof b=="string")try{return JSON.parse(b)}catch(N){return console.error("JSON parse error:",N),null}return b},Te=({isOpen:b,onClose:N,templateId:P,language:j,onEdit:R,onDuplicate:w,onToggleStatus:D})=>{const[g,_]=h.useState(null),[C,I]=h.useState(null),[T,i]=h.useState(!0),[M,c]=h.useState(null),[n,k]=h.useState("details"),B=j==="he",E=t=>{if(typeof t=="number"&&!isNaN(t))return t;if(typeof t=="string"){const r=parseFloat(t);return isNaN(r)?0:r}return 0},$=(t,r="ILS")=>{const d=E(t);return`${r==="USD"?"$":r==="EUR"?"€":"₪"}${d.toFixed(2)}`},m=t=>E(t).toLocaleString(j==="he"?"he-IL":"en-US"),U=t=>{if(!t)return"N/A";try{return new Date(t).toLocaleDateString(j==="he"?"he-IL":"en-US")}catch{return"Invalid Date"}},W=t=>{if(t.is_primary)return j==="he"?"ברירת מחדל ראשית":"Primary Default";switch(t.template_type){case"primary_default":return j==="he"?"ברירת מחדל ראשית":"Primary Default";case"range_default":return j==="he"?"ברירת מחדל טווח":"Range Default";case"manual":return j==="he"?"ידני בלבד":"Manual Only";default:return j==="he"?"ידני":"Manual"}},A=t=>{if(t.is_primary)return j==="he"?"הכל (0-∞)":"All (0-∞)";const r=t.signature_range_min||0,d=t.signature_range_max||999999;return d>
9=999999?`${r.toLocaleString()}+`:`${r.toLocaleString()}-${d.toLocaleString()}`},f=h.useCallback(t=>({viewTemplate:{en:"View Template Details",he:"צפייה בפרטי התבנית"},close:{en:"Close",he:"סגור"},edit:{en:"Edit Template",he:"ערוך תבנית"},duplicate:{en:"Duplicate",he:"שכפל"},toggleStatus:{en:"Toggle Status",he:"שנה סטטוס"},loading:{en:"Loading template details...",he:"טוען פרטי תבנית..."},error:{en:"Error loading template",he:"שגיאה בטעינת התבנית"},details:{en:"Details",he:"פרטים"},tiers:{en:"Pricing Tiers",he:"רמות תמחור"},petitions:{en:"Active Petitions",he:"עצומות פעילות"},analytics:{en:"Analytics",he:"אנליטיקה"},templateName:{en:"Template Name",he:"שם התבנית"},description:{en:"Description",he:"תיאור"},templateType:{en:"Template Type",he:"סוג התבנית"},signatureRange:{en:"Signature Range",he:"טווח חתימות"},tierCount:{en:"Number of Tiers",he:"מספר רמות"},currency:{en:"Currency",he:"מטבע"},status:{en:"Status",he:"סטטוס"},active:{en:"Active",he:"פעיל"},inactive:{en:"Inactive",he:"לא פעיל"},createdBy:{en:"Created By",he:"נוצר על ידי"},lastUpdated:{en:"Last Updated",he:"עודכן לאחרונה"},amount:{en:"Amount",he:"סכום"},baseReach:{en:"Base Reach",he:"הגעה בסיסית"},actualReach:{en:"Actual Reach",he:"הגעה בפועל"},bonus:{en:"Bonus",he:"בונוס"},featured:{en:"Featured",he:"מומלץ"},badge:{en:"Badge",he:"תג"},petitionTitle:{en:"Petition Title",he:"כותרת העצומה"},signatures:{en:"Signatures",he:"חתימות"},impressions:{en:"Impressions",he:"הצגות"},conversions:{en:"Conversions",he:"המרות"},revenue:{en:"Revenue",he:"הכנסות"},activatedAt:{en:"Activated",he:"הופעל"},noPetitions:{en:"No active petitions found",he:"לא נמצאו עצומות פעילות"},totalImpressions:{en:"Total Impressions",he:'סה"כ הצגות'},totalConversions:{en:"Total Conversions",he:'סה"כ המרות'}
9,conversionRate:{en:"Conversion Rate",he:"שיעור המרה"},totalRevenue:{en:"Total Revenue",he:'סה"כ הכנסות'},avgPayment:{en:"Average Payment",he:"תשלום ממוצע"}})[t]?.[j]||t,[j]);return h.useEffect(()=>{if(!b||!P)return;(async()=>{i(!0),c(null);try{const r=localStorage.getItem("auth_token"),[d,x]=await Promise.all([fetch(`/api/v1/admin/pricing/templates/${P}`,{headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json"}}),fetch(`/api/v1/admin/pricing/templates/${P}/analytics`,{headers:{Authorization:`Bearer ${r}`,"Content-Type":"application/json",Accept:"application/json"}}).catch(()=>null)]);if(!d.ok)throw new Error(`Template API error: ${d.status}`);const s=await d.json();if(console.log("✅ Template data:",s),s.success){const l=s.data;l.tier_config&&typeof l.tier_config=="string"&&(l.tier_config=se(l.tier_config)),_(l)}else throw new Error("Template not found");if(x&&x.ok){const l=await x.json();l.success&&I(l.data)}}catch(r){console.error("❌ ViewTemplateModal error:",r),c(r instanceof Error?r.message:"Failed to load template")}finally{i(!1)}})()},[b,P]),h.useEffect(()=>{b||(_(null),I(null),k("details"),c(null))},[b]),b?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[90vh] overflow-hidden ${B?"text-right":"text-left"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:f("viewTemplate")}),g&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${g.is_active?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:g.is_active?f("active"):f("inactive")}),g.is_primary&&e.jsx("span",{className:"px-3 py-1 rounded-full text-sm font-medium bg-blue-100 text-blue-800",children:"🎯 PRIMARY"})]})]}),e.jsx("button",{onClick:N,className:"text-gray-400 hover:text-gray-600 text-2xl font-bold",children:"✕"})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:T?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:f("loading")})]})}):M?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsxs("p",{className:"text-red-600 mb-4",children:[f("error"),": ",M]}),e.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:"Retry"})]})}):g?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-b border-gray-200",children:e.jsx("nav",{className:"flex space-x-8 px-6","aria-label":"Tabs",children:[{id:"details",label:f("details"),icon:"📋"},{id:"tiers",label:f("tiers"),icon:"💰"},{id:"petitions",label:f("petitions"),icon:"📝"},{id:"analytics",label:f("analytics"),icon:"📊"}].map(t=>e.jsx("button",{onClick:()=>k(t.id),className:`py-3 px-1 border-b-2 font-medium text-sm ${n===t.id?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"}`,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("span",{children:t.icon}),t.label]})},t.id))})}),e.jsxs("div",{className:"p-6 overflow-y-auto max-h-96",children:[n==="details"&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("templateName")}),e.jsx("p",{className:"text-gray-900 font-medium",children:g.template_name||"N/A"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"XR Parameter (Unique Number)"}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded text-sm font-mono",children:g.unique_number||"N/A"}),g.unique_number&&e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(g.unique_number||"")},className:"text-blue-600 hover:text-blue-800 text-sm",title:"Copy to clipboard",children:"📋 Copy"})]}),e.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Use: ?XR=",g.unique_number||"[unique_number]"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("templateType")}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${g.is_primary?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:W(g)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("signatureRange")}),e.jsx("p",{className:"text-gray-900 font-medium",children:A(g)}
9)]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("tierCount")}),e.jsxs("p",{className:"text-gray-900 font-medium",children:[g.tier_count||0," ",j==="he"?"רמות":"tiers"]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("currency")}),e.jsx("p",{className:"text-gray-900 font-medium",children:g.base_currency||"ILS"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("createdBy")}),e.jsx("p",{className:"text-gray-900",children:g.created_by?.full_name||"Unknown"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("lastUpdated")}),e.jsxs("p",{className:"text-gray-900",children:[U(g.updated_at),g.last_updated_by&&e.jsxs("span",{className:"text-gray-600 text-sm ml-2",children:["by ",g.last_updated_by.full_name]})]})]})]}),g.description&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:f("description")}),e.jsx("p",{className:"text-gray-900 bg-gray-50 p-3 rounded",children:g.description})]}),g.is_primary&&e.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg border border-blue-200",children:[e.jsx("h4",{className:"font-medium text-blue-800 mb-2",children:"🎯 Primary Template"}),e.jsx("p",{className:"text-sm text-blue-700",children:j==="he"?"תבנית זו משמשת כברירת מחדל עבור כל העצומות שלא הוגדרה להן תבנית ספציפית.":"This template serves as the default for all petitions that don't have a specific template assigned."})]})]}),n==="tiers"&&e.jsx("div",{className:"space-y-4",children:(()=>{const t=g?.tier_config,r=se(t),d=r?.tiers;return console.log("🔍 TIERS DEBUG:"),console.log("Template tier_count:",g?.tier_count),console.log("Original tier_config:",t),console.log("Parsed tier_config:",r),console.log("Tiers array:",d),d&&Array.isArray(d)&&d.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h4",{className:"font-medium text-lg",children:"💰 Pricing Tiers"}),e.jsxs("span",{className:"px-3 py-1 bg-gray-100 text-gray-700 rounded-full text-sm",children:[d.length," ",j==="he"?"רמות":"tiers"]})]}),d.map((x,s)=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 mb-3 bg-white shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"font-semibold text-lg text-green-600",children:$(x.amount,g.base_currency)}),e.jsxs("div",{className:"flex items-center gap-2",children:[x.is_featured&&e.jsxs("span",{className:"px-2 py-1 bg-yellow-100 text-yellow-800 text-xs font-medium rounded",children:["⭐ ",f("featured")]}),x.badge&&e.jsxs("span",{className:"px-2 py-1 bg-purple-100 text-purple-800 text-xs font-medium rounded",children:["🏷️ ",x.badge]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 text-sm",children:[e.jsxs("div",{className:"bg-gray-50 p-3 rounded",children:[e.jsxs("span",{className:"text-gray-600",children:[f("baseReach"),":"]}),e.jsxs("div",{className:"font-medium text-lg",children:["👥 ",m(x.base_reach||0)]})]}),e.jsxs("div",{className:"bg-gray-50 p-3 rounded",children:[e.jsxs("span",{className:"text-gray-600",children:[f("actualReach"),":"]}),e.jsxs("div",{className:"font-medium text-lg",children:["🎯 ",m(x.actual_reach||0)]})]}),e.jsxs("div",{className:"bg-gray-50 p-3 rounded",children:[e.jsxs("span",{className:"text-gray-600",children:[f("bonus"),":"]}),e.jsxs("div",{className:"font-medium text-lg text-green-600",children:["🎁 +",E(x.bonus_percentage),"%"]})]})]})]},s))]}):e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"💰"}),e.jsx("h3",{className:"text-lg font-medium text-gray-900 mb-2",children:"No Pricing Tiers"}),e.jsx("p",{className:"text-gray-600",children:j==="he"?"לא נמצאו רמות תמחור עבור תבנית זו":"No pricing tiers found for this template"}),e.jsxs("div",{className:"mt-4 text-xs text-gray-400 bg-gray-50 p-3 rounded",children:[e.jsxs("p",{children:[e.jsx("strong",{children:"Template tier_count:"})," ",g?.tier_count||0]}),e.jsxs("p",{children:[e.jsx("strong",{children:"tier_config type:"})," ",typeof t]}),e.jsxs("p",{children:[e.jsx("strong",{children:"Parsed successfully:"})," ",r?"Yes":"No"]})]})]})})()}),n==="petitions"&&e.jsx("div",{className:"space-y-4",children:g.active_assignments&&g.active_assignments.length>0?g.active_assignments.map(t=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsx("h3",{className:"font-medium text-lg text-blue-600 hover:text-blue-800",children:t.title||"Untitled Petition"}),e.jsxs("span",{className:"text-sm text-gray-600",children:["ID: ",t.petition_id||t.id]})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[f("signatures"),":"]}
9),e.jsxs("div",{className:"font-medium",children:["✍️ ",m((t.current_signatures_count||0)+(t.boost_signatures||0))]})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[f("impressions"),":"]}),e.jsxs("div",{className:"font-medium",children:["👁️ ",m(t.total_impressions||0)]})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[f("conversions"),":"]}),e.jsxs("div",{className:"font-medium",children:["💰 ",m(t.total_conversions||0)]})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-gray-600",children:[f("revenue"),":"]}),e.jsx("div",{className:"font-medium text-green-600",children:$(t.total_revenue||0,g.base_currency)})]})]}),t.activated_at&&e.jsxs("div",{className:"mt-3 text-xs text-gray-500",children:[f("activatedAt"),": ",U(t.activated_at),t.assignment_reason&&e.jsxs("span",{className:"ml-2",children:["• ",t.assignment_reason]})]})]},t.assignment_id||t.id)):e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"📝"}),e.jsx("p",{children:f("noPetitions")})]})}),n==="analytics"&&e.jsx("div",{className:"space-y-6",children:C?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-blue-600",children:m(C.overview?.total_impressions||0)}),e.jsx("div",{className:"text-sm text-blue-800",children:f("totalImpressions")})]}),e.jsxs("div",{className:"bg-green-50 p-4 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-green-600",children:m(C.overview?.total_conversions||0)}),e.jsx("div",{className:"text-sm text-green-800",children:f("totalConversions")})]}),e.jsxs("div",{className:"bg-purple-50 p-4 rounded-lg",children:[e.jsxs("div",{className:"text-2xl font-bold text-purple-600",children:[E(C.overview?.conversion_rate||0).toFixed(2),"%"]}),e.jsx("div",{className:"text-sm text-purple-800",children:f("conversionRate")})]}),e.jsxs("div",{className:"bg-yellow-50 p-4 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-yellow-600",children:$(C.overview?.total_revenue||0,g.base_currency)}),e.jsx("div",{className:"text-sm text-yellow-800",children:f("totalRevenue")})]}),e.jsxs("div",{className:"bg-indigo-50 p-4 rounded-lg",children:[e.jsx("div",{className:"text-2xl font-bold text-indigo-600",children:$(C.overview?.avg_payment||0,g.base_currency)}),e.jsx("div",{className:"text-sm text-indigo-800",children:f("avgPayment")})]})]}),C.recommendations&&C.recommendations.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-lg mb-3",children:"💡 Recommendations"}),e.jsx("div",{className:"space-y-2",children:C.recommendations.map((t,r)=>e.jsx("div",{className:`p-3 rounded border-l-4 ${t.priority==="high"?"border-red-400 bg-red-50":t.priority==="medium"?"border-yellow-400 bg-yellow-50":"border-blue-400 bg-blue-50"}`,children:e.jsx("p",{className:"text-sm",children:t.message})},r))})]})]}):e.jsxs("div",{className:"text-center py-8 text-gray-500",children:[e.jsx("div",{className:"text-gray-400 text-6xl mb-4",children:"📊"}),e.jsx("p",{children:"Analytics data not available"})]})})]})]}):null}),e.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200 bg-gray-50",children:[e.jsx("div",{className:"flex items-center gap-3",children:g&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:()=>R?.(P),className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",children:["✏️ ",f("edit")]}),e.jsxs("button",{onClick:()=>w?.(P),className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 transition-colors",children:["📋 ",f("duplicate")]}),e.jsx("button",{onClick:()=>D?.(P),className:`px-4 py-2 rounded transition-colors ${g.is_active?"bg-red-600 text-white hover:bg-red-700":"bg-green-600 text-white hover:bg-green-700"}`,children:g.is_active?"⏸️ Deactivate":"▶️ Activate"})]})}),e.jsx("button",{onClick:N,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50 transition-colors",children:f("close")})]})]})}):null},we=({isOpen:b,onClose:N,templateId:P,language:j,onSuccess:R})=>{const[w,D]=h.useState(1),[g,_]=h.useState(!0),[C,I]=h.useState(!1),[T,i]=h.useState({}),[M,c]=h.useState([]),[n,k]=h.useState({template_name:"",description:"",is_primary:!1,template_type:"manual_assignment",signature_range_min:1e3,signature_range_max:1e4,tier_count:3,hero_message_style_id:null,currency:"ILS",hide_reach:!1,tiers:[{amount:5,base_reach:50,actual_reach:75,bonus_percentage:50,is_featured:!1,badge:""}]}),[B,E]=h.useState(null),$=j==="he",m=h.useCallback(s=>({editTemplate:{en:"Edit Pricing Template",he:"עריכת תבנית תמחור"},loading:{en:"Loading template data...",he:"טוען נתוני התבנית..."},step:{en:"Step",he:"שלב"},of:{en:"of",he:"מתוך"},next:{en:"Next",he:"הבא"},previous:{en:"Previous",he:"הקודם"},save:{en:"Save Changes",he:"שמור שינויים"},saving:{en:"Saving...",he:"שומר..."},cancel:{en:"Cancel",he:"ביטול"},templateType:{en:"Template Type & Basic Info",he:"סוג התבנית ומידע בסיסי"},templateName:{en:"Template Name",he:"שם התבנית"},templateNamePlaceholder:{en:"Enter template name...",he:"הכנס שם התבנית..."},description:{en:"Description (Optional)",he:"תיאור (אופציונלי)"},descriptionPlaceholder:{en:"Describe this template...",he:"תאר את התבנית..."},selectTemplateType:{en:"Template Type",he:"סוג התבנית"},primaryDefault:{en:"Primary Default",he:"ברירת מחדל ראשית"},rangeDefault:{en:"Range Default",he:"ברירת מחדל טווח"},manual:{en:"Manual Only",he:"ידני בלבד"},primaryInfo:{en:"Universal template for all petitions without specific assignment",he:"תבנית אוניברסלית לכל העצומות ללא השמה ספציפית"},rangeInfo:{en:"Template for petitions within specific signature range",he:"תבנית לעצומות בטווח חתימות ספציפי"},manualInfo:{en:"Template for manual assignment only",he:"תבנית להשמה ידנית בלבד"},signatureRange:{en:"Signature Range",he:"טווח חתימות"},minSignatures:{en:"Minimum Signatures",he:"מינימום חתימות"},maxSignatures:{en:"Maximum Signatures",he:"מקסימום חתימות"},automaticRange:{en:"Automatic Range (All Petitions)",he:"טווח אוטומטי (כל העצומות)"},tierConfiguration:{en:"Tier Configuration",he:"הגדרת רמות"},tierCount:{en:"Number of Tiers",he:"מספר רמות"},currency:{en:"Currency",he:"מטבע"},tiersSetup:{en:"Pricing Tiers Setup",he:"הגדרת רמות תמחור"},addTier:{en:"Add Tier",he:"הוסף רמה"},removeTier:{en:"Remove",he:"הסר"},amount:{en:"Amount",he:"סכום"},baseReach:{en:"Base Reach",he:"הגעה בסיסית"},actualReach:{en:"Actual Reach",he:"הגעה בפועל"},bonus:{en:"Bonus",he:"בונוס"},featured:{en:"Featured",he:"מומלץ"},badge:{en:"Badge (Optional)",he:"תג (אופציונלי)"},reviewUpdate:{en:"Review & Update",he:"סקירה ועדכון"},preview:{en:"Preview",he:"תצוגה מקדימה"}})[s]?.[j]||s,[j]);h.useEffect(()=>{if(!b)return;(async()=>{const l=localStorage.getItem("auth_token");try{const u=await fetch("/api/v1/admin/hero-messages",{headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"}});if(u.ok){const S=await u.json();if(console.log("Hero Message Styles loaded on open:",S),S.success&&S.data){const v=S.data.map(H=>({id:H.id,name:H.style_name||H.name||`Style ${H.id}`}));c(v),console.log("Hero message styles set:",v)}}}catch(u){console.error("Error loading hero message styles:",u)}})()},[b]),h.useEffect(()=>{if(!b||!P)return;(async()=>{_(!0);try{const l=localStorage.getItem("auth_token"),u=await fetch(`/api/v1/admin/pricing/templates/${P}`,{headers:{Authorization:`Bearer ${l}`,"Content-Type":"application/json"}});if(u.ok){const S=await u.json();if(S.success&&S.data){const v=S.data;E(v),k({template_name:v.template_name||"",description:v.description||"",is_primary:v.is_primary||!1,template_type:v.template_type||"manual_assignment",signature_range_min:v.signature_range_min||1e3,signature_range_max:v.signature_range_max||1e4,tier_count:v.tier_count||3,hero_message_style_id:v.hero_message_style_id||null,currency:v.base_currency||"ILS",hide_reach:!!v.hide_reach,tiers:v.tier_config?.tiers||[]}),console.log("✅ Template loaded for editing:",v.template_name)}}}catch(l){console.error("❌ Error loading template for edit:",l)}finally{_(!1)}})()},[b,P]),h.useEffect(()=>{b||(D(1),i({}),_(!0))},[b]);const U=s=>{k(l=>({...l,template_type:s,is_primary:s==="primary_default",signature_range_min:s==="primary_default"?0:l.signature_range_min,signature_range_max:s==="primary_default"?999999:l.signature_range_max}))},W=s=>{const l=[...n.tiers];if(s>l.length)for(let u=l.length;u<s;u++){const S=l[u-1];l.push({amount:S?S.amount+10:5+u*10,base_reach:S?S.base_reach+100:50+u*100,actual_reach:S?S.actual_reach+130:75+u*130,bonus_percentage:30,is_featured:!1,badge:""})}else s<l.length&&l.splice(s);k(u=>({...u,tier_count:s,tiers:l}))},A=(s,l,u)=>{const S=[...n.tiers],v={...S[s]};if(l==="amount"?v.amount=u:l==="base_reach"?v.base_reach=u:l==="actual_reach"?v.actual_reach=u:l==="bonus_percentage"?v.bonus_percentage=u:l==="is_featured"?v.is_featured=u:l==="badge"&&(v.badge=u),l==="base_reach"||l==="actual_reach"){const H=l==="base_reach"?u:v.base_reach,X=l==="actual_reach"?u:v.actual_reach;H>0&&(v.bonus_percentage=Math.round((X/H-1)*100))}S[s]=v,k({...n,tiers:S})},f=s=>{const l={};switch(s){case 1:n.template_name.trim()||(l.template_name="Template name is required");break;case 2:n.is_primary||(n.signature_range_min<0&&(l.signature_range_min="Minimum signatures cannot be negative"),n.signature_range_max<=n.signature_range_min&&(l.signature_range_max="Maximum must be greater than minimum"));break;case 3:(n.tier_count<2||n.tier_count>6)&&(l.tier_count="Tier count must be between 2 and 6");break;
9case 4:n.tiers.forEach((u,S)=>{u.amount<=0&&(l[`tier_${S}_amount`]="Amount must be greater than 0"),u.base_reach<=0&&(l[`tier_${S}_base_reach`]="Base reach must be greater than 0"),u.actual_reach<u.base_reach&&(l[`tier_${S}_actual_reach`]="Actual reach must be >= base reach")});break}return i(l),Object.keys(l).length===0},t=()=>{f(w)&&(w===1&&n.is_primary?D(3):D(w+1))},r=()=>{w===3&&n.is_primary?D(1):D(w-1),i({})},d=async()=>{if(f(5)){I(!0);try{const s={template_name:n.template_name,description:n.description||void 0,is_primary:n.is_primary,template_type:n.template_type,signature_range_min:n.signature_range_min,signature_range_max:n.signature_range_max,tier_count:n.tier_count,hero_message_style_id:n.hero_message_style_id||void 0,currency:n.currency,hide_reach:n.hide_reach?1:0,tiers:n.tiers},l=await be(P,s);R(l),N()}catch(s){console.error("Error updating template:",s),i({general:s instanceof Error?s.message:"Failed to update template"})}finally{I(!1)}}},x=s=>{switch(s){case"USD":return"$";case"EUR":return"€";case"ILS":return"₪";default:return"₪"}};return b?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white rounded-lg shadow-xl max-w-2xl w-full max-h-[90vh] overflow-hidden ${$?"text-right":"text-left"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-gray-200",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:m("editTemplate")}),e.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[m("step")," ",w," ",m("of")," 5"]}),B&&e.jsxs("p",{className:"text-xs text-blue-600 mt-1",children:["Editing: ",B.template_name,B.is_primary&&e.jsx("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs",children:"PRIMARY"})]})]}),e.jsx("button",{onClick:N,className:"text-gray-400 hover:text-gray-600 text-2xl font-bold",children:"✕"})]}),g?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:m("loading")})]})}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:e.jsx("div",{className:"flex items-center space-x-4",children:[1,2,3,4,5].map(s=>e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium ${s<=w?"bg-blue-600 text-white":s===2&&n.is_primary?"bg-gray-100 text-gray-400":"bg-gray-200 text-gray-600"}`,children:s<=w?"✓":s===2&&n.is_primary?"⏭️":s}),s<5&&e.jsx("div",{className:`w-12 h-1 ${s<w||s===2&&n.is_primary&&w>=3?"bg-blue-600":"bg-gray-200"}`})]},s))})}),e.jsxs("div",{className:"p-6 overflow-y-auto max-h-96",children:[w===1&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h3",{className:"text-lg font-medium",children:m("templateType")}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[m("templateName")," *"]}),e.jsx("input",{type:"text",value:n.template_name,onChange:s=>k({...n,template_name:s.target.value}),placeholder:m("templateNamePlaceholder"),className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${T.template_name?"border-red-500":"border-gray-300"}`}),T.template_name&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.template_name})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:m("description")}),e.jsx("textarea",{value:n.description,onChange:s=>k({...n,description:s.target.value}),placeholder:m("descriptionPlaceholder"),rows:3,className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-3",children:[m("selectTemplateType")," *"]}),e.jsx("div",{className:"grid grid-cols-3 gap-3",children:[{value:"primary_default",label:"Primary",icon:"🎯"},{value:"manual_assignment",label:"Manual",icon:"✋"}].map(s=>e.jsxs("div",{className:`border rounded-lg p-3 cursor-pointer transition-all text-center ${n.template_type===s.value?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,onClick:()=>
9U(s.value),children:[e.jsx("div",{className:"text-2xl mb-1",children:s.icon}),e.jsx("div",{className:"font-medium text-sm",children:s.label})]},s.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Hero Message Style"}),e.jsxs("select",{value:n.hero_message_style_id||"",onChange:s=>k({...n,hero_message_style_id:s.target.value?Number(s.target.value):null}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"",children:"None (Use Default)"}),M.map(s=>e.jsx("option",{value:s.id,children:s.name},s.id))]})]}),e.jsx("div",{children:e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:n.hide_reach,onChange:s=>k({...n,hide_reach:s.target.checked})}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:"Hide reach estimates in tiers (site support)"})]})})]}),w===2&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h3",{className:"text-lg font-medium",children:m("signatureRange")}),n.is_primary?e.jsxs("div",{className:"bg-blue-50 p-4 rounded-lg border border-blue-200",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-blue-600 text-lg",children:"🎯"}),e.jsx("span",{className:"font-medium text-blue-800",children:m("automaticRange")})]}),e.jsx("p",{className:"text-blue-700 text-sm",children:"Primary templates automatically cover all signature ranges (0 - ∞)"}),e.jsx("div",{className:"mt-3 text-sm font-mono bg-white p-2 rounded border",children:"Range: 0 - 999,999 (All petitions)"})]}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[m("minSignatures")," *"]}),e.jsx("input",{type:"number",value:n.signature_range_min,onChange:s=>k({...n,signature_range_min:parseInt(s.target.value)||0}),min:"0",className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${T.signature_range_min?"border-red-500":"border-gray-300"}`}),T.signature_range_min&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.signature_range_min})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[m("maxSignatures")," *"]}),e.jsx("input",{type:"number",value:n.signature_range_max,onChange:s=>k({...n,signature_range_max:parseInt(s.target.value)||0}),min:"1",className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${T.signature_range_max?"border-red-500":"border-gray-300"}`}),T.signature_range_max&&e.jsx("p",{className:"text-red-500 text-sm mt-1",children:T.signature_range_max})]})]})]}),w===3&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h3",{className:"text-lg font-medium",children:m("tierConfiguration")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[m("tierCount")," *"]}),e.jsxs("select",{value:n.tier_count,onChange:s=>W(parseInt(s.target.value)),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsxs("option",{value:2,children:["2 ",j==="he"?"רמות":"Tiers"]}),e.jsxs("option",{value:3,children:["3 ",j==="he"?"רמות":"Tiers"]}),e.jsxs("option",{value:4,children:["4 ",j==="he"?"רמות":"Tiers"]}),e.jsxs("option",{value:5,children:["5 ",j==="he"?"רמות":"Tiers"]}),e.jsxs("option",{value:6,children:["6 ",j==="he"?"רמות":"Tiers"]})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:[m("currency")," *"]}),e.jsxs("select",{value:n.currency,onChange:s=>k({...n,currency:s.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",children:[e.jsx("option",{value:"USD",children:"🇺🇸 USD ($)"}),e.jsx("option",{value:"EUR",children:"🇪🇺 EUR (€)"}),e.jsx("option",{value:"ILS",children:"🇮🇱 ILS (₪)"})]})]})]}),e.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[e.jsx("h4",{className:"font-medium mb-2",children:"Current Configuration:"}),e.jsxs("div",{className:"text-sm text-gray-600",children:[e.jsxs("p",{children:["Template Type: ",e.jsx("span",{className:"font-medium",children:n.is_primary?"Primary Default":n.template_type})]}),e.jsxs("p",{children:["Tiers: ",e.jsx("span",{className:"font-medium",children:n.tier_count})]}),e.jsxs("p",{children:["Currency: ",e.jsx("span",{className:"font-medium",children:n.currency})]}),!n.is_primary&&e.jsxs("p",{children:["Range: ",e.jsxs("span",{className:"font-medium",children:[n.signature_range_min.toLocaleStr
9ing()," - ",n.signature_range_max.toLocaleString()]})]})]})]})]}),w===4&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-medium",children:m("tiersSetup")}),e.jsxs("span",{className:"px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm",children:[n.tiers.length," / ",n.tier_count," tiers"]})]}),e.jsx("div",{className:"space-y-4",children:n.tiers.slice(0,n.tier_count).map((s,l)=>e.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("h4",{className:"font-medium",children:["Tier ",l+1]})}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[m("amount")," *"]}),e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute left-3 top-2 text-gray-500",children:x(n.currency)}),e.jsx("input",{type:"number",value:s.amount,onChange:u=>A(l,"amount",parseFloat(u.target.value)||0),min:"0.01",step:"0.01",className:`w-full pl-8 pr-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${T[`tier_${l}_amount`]?"border-red-500":"border-gray-300"}`})]}),T[`tier_${l}_amount`]&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:T[`tier_${l}_amount`]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[m("baseReach")," *"]}),e.jsx("input",{type:"number",value:s.base_reach,onChange:u=>A(l,"base_reach",parseInt(u.target.value)||0),min:"1",className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${T[`tier_${l}_base_reach`]?"border-red-500":"border-gray-300"}`}),T[`tier_${l}_base_reach`]&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:T[`tier_${l}_base_reach`]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[m("actualReach")," *"]}),e.jsx("input",{type:"number",value:s.actual_reach,onChange:u=>A(l,"actual_reach",parseInt(u.target.value)||0),min:"1",className:`w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 ${T[`tier_${l}_actual_reach`]?"border-red-500":"border-gray-300"}`}),T[`tier_${l}_actual_reach`]&&e.jsx("p",{className:"text-red-500 text-xs mt-1",children:T[`tier_${l}_actual_reach`]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:[m("bonus")," (%)"]}),e.jsx("input",{type:"number",value:s.bonus_percentage,readOnly:!0,className:"w-full px-3 py-2 border border-gray-300 rounded-md bg-gray-50"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:m("badge")}),e.jsx("input",{type:"text",value:s.badge,onChange:u=>A(l,"badge",u.target.value),placeholder:"Popular, Best value...",className:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:"checkbox",checked:s.is_featured,onChange:u=>A(l,"is_featured",u.target.checked),className:"h-4 w-4 text-blue-600 rounded border-gray-300 focus:ring-blue-500"}),e.jsx("label",{className:"ml-2 text-sm text-gray-700",children:m("featured")})]})]}),e.jsxs("div",{className:"mt-4 p-3 bg-blue-50 border border-blue-200 rounded-lg",children:[e.jsxs("p",{className:"text-sm font-medium text-blue-800",children:[m("preview"),":"]}),e.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[e.jsxs("span",{className:"text-lg font-bold text-blue-600",children:[x(n.currency),s.amount]}),e.jsxs("span",{className:"text-sm text-gray-600",children:["👥 ",s.base_reach," people"]}),s.bonus_percentage>0&&e.jsxs("span",{className:"text-sm text-green-600 font-medium",children:["🎁 Actually ",s.actual_reach,"! (+",s.bonus_percentage,"%)"]}),s.is_featured&&e.jsxs("span",{className:"text-xs bg-blue-100 text-blue-800 px-2 py-1 rounded",children:["⭐ ",m("featured")]}),s.badge&&e.jsxs("span",{className:"text-xs bg-gray-100 text-gray-800 px-2 py-1 rounded",children:["🏷️ ",s.badge]})]})]})]},l))})]}),w===5&&e.jsxs("div",{className:"space-y-6",children:[e.jsx("h3",{className:"text-lg font-medium",children:m("reviewUpdate")}),e.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Template Name:"}),e.jsx("div",{children:n.template_name})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Template Type:"}),e.jsx("div",{className:"flex items-center gap-2",children:n.is_primary?e.jsx("span",{className:"px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs",children:"🎯 PRIMARY DEFAULT"}):e.jsxs("span",{className:"px-2 py-1 bg-gray-100 text-gray-800 rounded text-xs",children:["📊 ",n.template_type.toUpperCase()]})})]}),!n.is_primary&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Signature Range:"}
9),e.jsxs("div",{children:[n.signature_range_min.toLocaleString()," - ",n.signature_range_max.toLocaleString()]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Currency & Tiers:"}),e.jsxs("div",{children:[n.currency," (",n.tier_count," tiers)"]})]}),n.hero_message_style_id&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Hero Message Style:"}),e.jsx("div",{children:M.find(s=>s.id===n.hero_message_style_id)?.name||`Style #${n.hero_message_style_id}`})]})]}),e.jsxs("div",{children:[e.jsxs("span",{className:"font-medium",children:["Pricing Tiers (",n.tiers.length,"):"]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 mt-2",children:n.tiers.slice(0,n.tier_count).map((s,l)=>e.jsxs("div",{className:"text-sm bg-white p-2 rounded border",children:[x(n.currency),s.amount," → ",s.base_reach," people",s.bonus_percentage>0&&e.jsxs("span",{className:"text-green-600",children:[" (+",s.bonus_percentage,"%)"]}),s.is_featured&&e.jsx("span",{className:"text-blue-600",children:" ⭐"})]},l))})]}),n.description&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Description:"}),e.jsx("div",{className:"text-sm mt-1",children:n.description})]})]}),T.general&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded-md p-4",children:e.jsx("p",{className:"text-red-600 text-sm",children:T.general})})]})]}),e.jsxs("div",{className:"flex items-center justify-between p-6 border-t border-gray-200 bg-gray-50",children:[e.jsx("div",{children:w>1&&e.jsxs("button",{onClick:r,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:["← ",m("previous")]})}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:N,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:m("cancel")}),w<5?e.jsxs("button",{onClick:t,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700",children:[m("next")," →"]}):e.jsx("button",{onClick:d,disabled:C,className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 disabled:bg-gray-400 disabled:cursor-not-allowed",children:m(C?"saving":"save")})]})]})]})]})}):null},Se=({isOpen:b,onClose:N,title:P,message:j,confirmText:R,confirmButtonClass:w="bg-red-600 hover:bg-red-700",onConfirm:D,loading:g=!1,language:_="en"})=>{const C=_==="he",I=T=>({cancel:{en:"Cancel",he:"ביטול"},loading:{en:"Processing...",he:"מעבד..."}})[T]?.[_]||T;return b?e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:e.jsxs("div",{className:`bg-white rounded-lg shadow-xl max-w-md w-full ${C?"text-right":"text-left"}`,children:[e.jsx("div",{className:"p-6 border-b border-gray-200",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:P}),e.jsx("button",{onClick:N,disabled:g,className:"text-gray-400 hover:text-gray-600 text-xl font-bold disabled:cursor-not-allowed",children:"✕"})]})}),e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("div",{className:"w-12 h-12 rounded-full bg-yellow-100 flex items-center justify-center",children:e.jsx("span",{className:"text-2xl",children:"⚠️"})})}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-gray-600 text-sm leading-relaxed",children:j})})]})}),e.jsxs("div",{className:"flex items-center justify-end gap-3 p-6 border-t border-gray-200 bg-gray-50",children:[e.jsx("button",{onClick:N,disabled:g,className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50 transition-colors disabled:cursor-not-allowed disabled:opacity-50",children:I("cancel")}),e.jsx("button",{onClick:D,disabled:g,className:`px-4 py-2 text-white rounded transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${w}`,children:g?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),I("loading")]}):R})]})]})}):null},We=({language:b="en"})=>{const[N,P]=h.useState([]),[j,R]=h.useState(!0),[w,D]=h.useState(null),[g,_]=h.useState(!1),[C,I]=h.useState(!1),[T,i]=h.useState(!1),[M,c]=h.useState(!1),[n,k]=h.useState(!1),[B,E]=h.useState(null),[$,m]=h.useState(null),[U,W]=h.useState(!1),[A,f]=h.useState({search:"",template_type:"",is_active:"",performance_filter:"all",sort_by:"created_at",sort_direction:"desc"}),[t,r]=h.useState({current_page:1,per_page:20,total:0,last_page:1}),[d,x]=h.useState({total_templates:0,active_templates:0,high_performing_templates:0,performance_rate:0}
9),[s,l]=h.useState([]),[u,S]=h.useState(""),v=xe(),H=b==="he",X={en:{title:"Pricing Template Management",subtitle:"Manage pricing templates, A/B tests, and performance analytics",backToDashboard:"Back to Admin Dashboard",createTemplate:"Create New Template",searchPlaceholder:"Search templates...",filters:{allTemplateTypes:"All Template Types",primaryDefault:"Primary Default",rangeDefault:"Range Default",manual:"Manual Only",allStatuses:"All Statuses",active:"Active",inactive:"Inactive",performanceFilter:"Performance Filter",allPerformance:"All Performance",highPerforming:"High Performing (15%+)",mediumPerforming:"Medium Performing (3-15%)",lowPerforming:"Low Performing (<3%)",sortBy:"Sort By",name:"Name",createdAt:"Created Date",successRate:"Success Rate",totalRevenue:"Total Revenue",avgPayment:"Average Payment"},table:{templateName:"Template Name",templateType:"Template Type",signatureRange:"Signature Range",tiers:"Tiers",currency:"Currency",performance:"Performance",conversions:"Conv. Rate",revenue:"Revenue",assignments:"Assignments",status:"Status",actions:"Actions",createdAt:"Created"},actions:{view:"View Details",edit:"Edit Template",duplicate:"Duplicate",createABTest:"Create A/B Test",viewPerformance:"View Performance",activate:"Activate",deactivate:"Deactivate",delete:"Delete"},status:{active:"Active",inactive:"Inactive",highPerforming:"High Performing",mediumPerforming:"Medium",lowPerforming:"Needs Attention"},templateTypes:{primary_default:"Primary Default",range_default:"Range Default",manual:"Manual Only"},summary:{totalTemplates:"Total Templates",activeTemplates:"Active Templates",highPerforming:"High Performing",performanceRate:"Performance Rate",primaryTemplate:"Primary Template",rangeTemplates:"Range Templates"},modals:{createTemplate:"Create New Pricing Template",editTemplate:"Edit Pricing Template",templatePerformance:"Template Performance Analytics",createABTest:"Create A/B Test",compareTemplates:"Compare Templates"},messages:{noTemplates:"No templates found",createFirstTemplate:"Create your first pricing template to get started",loadingTemplates:"Loading templates...",errorLoading:"Error loading templates",templateCreated:"Template created successfully",templateUpdated:"Template updated successfully",templateDeleted:"Template deleted successfully",templateDuplicated:"Template duplicated successfully",templateStatusChanged:"Template status updated successfully"},confirmations:{deleteTitle:"Delete Template",deleteMessage:"Are you sure you want to delete this template? This action cannot be undone.",deleteConfirm:"Delete Template",activateTitle:"Activate Template",activateMessage:"Are you sure you want to activate this template?",activateConfirm:"Activate",deactivateTitle:"Deactivate Template",deactivateMessage:"Are you sure you want to deactivate this template? All active assignments will be paused.",deactivateConfirm:"Deactivate",duplicateTitle:"Duplicate Template",duplicateMessage:"This will create a copy of the template. Continue?",duplicateConfirm:"Duplicate"}},he:{title:"ניהול תבניות תמחור",subtitle:"ניהול תבניות תמחור, מבחני A/B ואנליטיקת ביצועים",backToDashboard:"חזרה לדשבורד האדמין",createTemplate:"יצירת תבנית חדשה",searchPlaceholder:"חיפוש תבניות...",filters:{allTemplateTypes:"כל סוגי התבניות",primaryDefault:"ברירת מחדל ראשית",rangeDefault:"ברירת מחדל טווח",manual:"ידני בלבד",allStatuses:"כל הסטטוסים",active:"פעיל",inactive:"לא פעיל",performanceFilter:"סינון ביצועים",allPerformance:"כל הביצועים",highPerforming:"ביצועים גבוהים (15%+)",mediumPerforming:"ביצועים בינוניים (3-15%)",lowPerforming:"ביצועים נמוכים (<3%)",sortBy:"מיין לפי",name:"שם",createdAt:"תאריך יצירה",successRate:"שיעור הצלחה",totalRevenue:"הכנסות כולל",avgPayment:"תשלום ממוצע"},table:{templateName:"שם התבנית",templateType:"סוג התבנית",signatureRange:"טווח חתימות",tiers:"רמות",currency:"מטבע",performance:"ביצועים",conversions:"שיעור המרה",revenue:"הכנסות",assignments:"השמות",status:"סטטוס",actions:"פעולות",createdAt:"נוצר"},actions:{view:"צפייה בפרטים",edit:"עריכת תבנית",duplicate:"שכפול",createABTest:"יצירת מבחן A/B",viewPerformance:"צפייה בביצועים",activate:"הפעלה",deactivate:"השבתה",delete:"מחיקה"},status:{active:"פעיל",inactive:"לא פעיל",highPerforming:"ביצועים גבוהים",mediumPerforming:"בינוני",lowPerforming:"דורש טיפול"},templateTypes:{primary_default:"ברירת מחדל ראשית",range_default:"ברירת מחדל טווח",manual:"ידני בלבד"},summary:{totalTemplates:"תבניות כולל",activeTemplates:"תבניות פעילות",highPerforming:"ביצועים גבוהים",performanceRate:"שיעור ביצועים",primaryTemplate:"תבנית ראשית",rangeTemplates:"תבניות טווח"},modals:{createTemplate:"יצירת תבנית תמחור חדשה",editTemplate:"עריכת תבנית תמחור",templatePerformance:"אנליטיקת ביצועי תבנית",createABTest:"יצירת מבחן A/B",compareTemplates:"השוואת תבניות"},messages:{noTemplates:"לא נמצאו תבניות",createFirstTemplate:"צור את התבנית הראשונה שלך כדי להתחיל",loadingTemplates:"טוען תבניות...",errorLoading:"שגיאה בטעינת תבניות",templateCreated:"התבנית נוצרה בהצלחה",templateUpdated:"התבנית עודכנה בהצלחה",templateDeleted:"התבנית נמחקה בהצלחה",templateDuplicated:"התבנית שוכפלה בהצלחה",templateStatusChanged:"סטטוס התבנית עודכן בהצלחה"},confirmations:{deleteTitle:"מחיקת תבנית",deleteMessage:"האם אתה בטוח שברצונך למחוק תבנית זו? פעולה זו לא ניתנת לביטול.",deleteConfirm:"מחק תבנית",activateTitle:"הפעלת תבנית",activateMessage:"האם אתה בטוח שברצונך להפעיל תבנית זו?",activateConfirm:"הפעל",deactivateTitle:"השבתת תבנית",deactivateMessage:"האם אתה בטוח שברצונך להשבית תבנית זו? כל ההשמות הפעילות יושעו.",deactivateConfirm:"השבת",duplicateTitle:"שכפול תבנית",duplicateMessage:"פעולה זו תיצור עותק של התבנית. להמשיך?",duplicateConfirm:"שכפל"}}},o=h.useCallback(a=>{const y=a.split(".");let p=X[b];for(const z of y)p=p?.[z];return p||a},[b]),F=h.useCallback(async()=>{try{R(!0),D(null);const a=new URLSearchParams;Object.entries(A).forEach(([L,q])=>{q&&q!=="all"&&q!==""&&a.append(L,q.toString())}),a.append("page",t.current_page.toString()),a.append("per_page",t.per_page.toString());const y=localStorage.getItem("auth_token");if(!y){console.error("❌ No auth token found for fetchTemplates"),D("Authentication required. Please login again.");return}const p=await fetch(`/api/v1/admin/pricing/templates?${a}`,{method:"GET",headers:{Authorization:`Bearer ${y}`,"Content-Type":"application/json",Accept:"application/json"}});if(console.log("📡 Templates API response status:",p.status),!p.ok){if(p.status===401){console.error("❌ Authentication failed in fetchTemplates"),D("Authentication failed. Please login again.");return}throw new Error(`HTTP error! status: ${p.status}`)}const z=await p.json();if(console.log("📦 Templates API response:",z),z.success){const L=z.data?.data||[];if(P(L),z.data){const q={current_page:z.data.current_page||1,per_page:z.data.per_page||20,total:z.data.total||0,last_page:z.data.last_page||1};r(q)}if(z.data?.summary)x(z.data.summary);else{const q=L.filter(Y=>Y.is_active).length,Ce=L.find(Y=>Y.is_primary),ae=L.filter(Y=>
9Y.performance?.success_rate>=15).length;x({total_templates:L.length,active_templates:q,high_performing_templates:ae,performance_rate:L.length>0?ae/L.length*100:0})}console.log("✅ Templates loaded successfully:",L.length)}else throw new Error("Failed to fetch templates")}catch(a){console.error("❌ Error fetching templates:",a),D(a instanceof Error?a.message:"Unknown error occurred")}finally{R(!1)}},[A,t.current_page,t.per_page]),re=a=>{if(a.is_primary)return o("templateTypes.primary_default");switch(a.template_type){case"primary_default":return o("templateTypes.primary_default");case"range_default":return o("templateTypes.range_default");case"manual":return o("templateTypes.manual");default:return a.signature_range_min>0||a.signature_range_max<999999?o("templateTypes.range_default"):o("templateTypes.manual")}},ne=a=>{if(a.is_primary)return b==="he"?"הכל (0-∞)":"All (0-∞)";const y=a.signature_range_min||0,p=a.signature_range_max||999999;return p>=999999?`${y.toLocaleString()}+`:`${y.toLocaleString()}-${p.toLocaleString()}`},Q=a=>{E(a),I(!0)},le=a=>{E(a),i(!0)},ee=a=>{m({type:"duplicate",templateId:a.id,templateName:a.template_name}),c(!0)},te=a=>{m({type:"toggle_status",templateId:a.id,templateName:a.template_name,currentStatus:a.is_active}),c(!0)},ie=a=>{m({type:"delete",templateId:a.id,templateName:a.template_name}),c(!0)},oe=async a=>{if(!a.is_primary&&confirm(`Set "${a.template_name}" as the default template for all petitions?`))try{await fe(a.id),alert("Template set as default successfully"),await F()}catch(y){alert(`Error: ${y instanceof Error?y.message:"Unknown error"}`)}},ce=async()=>{if($){W(!0);try{switch($.type){case"duplicate":await _e($.templateId),alert(o("messages.templateDuplicated"));break;case"toggle_status":await je($.templateId),alert(o("messages.templateStatusChanged"));break;case"delete":await ye($.templateId),alert(o("messages.templateDeleted"));break}await F()}catch(a){console.error("❌ Action failed:",a),alert(`Error: ${a instanceof Error?a.message:"Unknown error"}`)}finally{W(!1),c(!1),m(null)}}},O=(a,y)=>{f(p=>({...p,[a]:y})),r(p=>({...p,current_page:1}))},Z=a=>{r(y=>({...y,current_page:a}))},de=a=>{l(y=>y.includes(a)?y.filter(p=>p!==a):[...y,a])},me=async()=>{if(!(!u||s.length===0))try{console.log("Bulk action:",u,"Templates:",s),l([]),S(""),await F()}catch(a){console.error("Error performing bulk action:",a)}},J=a=>{switch(a){case"create":_(!1);break;case"view":I(!1),E(null);break;case"edit":i(!1),E(null);break;case"confirm":c(!1),m(null);break}},ue=a=>{F(),alert(o("messages.templateCreated")),console.log("Template created:",a)},ge=a=>{F(),alert(o("messages.templateUpdated")),console.log("Template updated:",a)};h.useEffect(()=>{F()},[F]);const pe=()=>{if(!$)return{title:"",message:"",confirmText:"",buttonClass:""};const{type:a,templateName:y,currentStatus:p}=$;switch(a){case"delete":return{title:o("confirmations.deleteTitle"),message:`${o("confirmations.deleteMessage")}
10
11Template: "${y}"`,confirmText:o("confirmations.deleteConfirm"),buttonClass:"bg-red-600 hover:bg-red-700"};case"toggle_status":return p?{title:o("confirmations.deactivateTitle"),message:`${o("confirmations.deactivateMessage")}
12
13Template: "${y}"`,confirmText:o("confirmations.deactivateConfirm"),buttonClass:"bg-orange-600 hover:bg-orange-700"}:{title:o("confirmations.activateTitle"),message:`${o("confirmations.activateMessage")}
14
15Template: "${y}"`,confirmText:o("confirmations.activateConfirm"),buttonClass:"bg-green-600 hover:bg-green-700"};case"duplicate":return{title:o("confirmations.duplicateTitle"),message:`${o("confirmations.duplicateMessage")}
16
17Template: "${y}"`,confirmText:o("confirmations.duplicateConfirm"),buttonClass:"bg-blue-600 hover:bg-blue-700"};default:return{title:"",message:"",confirmText:"",buttonClass:""}}},he=({performance:a,currency:y})=>{const z=(L=>L>=15?{level:"high",color:"bg-green-500",textColor:"text-green-700"}:L>=3?{level:"medium",color:"bg-yellow-500",textColor:"text-yellow-700"}:{level:"low",color:"bg-red-500",textColor:"text-red-700"})(a.success_rate);return e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-3 h-3 rounded-full ${z.color}`}),e.jsxs("div",{className:"text-sm",children:[e.jsxs("div",{className:`font-medium ${z.textColor}`,children:[a.success_rate.toFixed(1),"%"]}),e.jsxs("div",{className:"text-gray-500 text-xs",children:[K(y),a.total_revenue.toFixed(0)]})]})]})},K=a=>{switch(a){case"USD":return"$";case"EUR":return"€";case"ILS":return"₪";default:return"₪"}},V=N.some(a=>a.is_primary),G=pe();return e.jsxs("div",{style:{minHeight:"100vh",background:"linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 50%, #f0f9ff 100%)",direction:H?"rtl":"ltr"},children:[e.jsx("div",{style:{background:"white",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",borderBottom:"3px solid #059669"},children:e.jsxs("div",{style:{maxWidth:"1400px",margin:"0 auto",padding:"1.5rem 1rem",display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:"1rem"},children:[e.jsxs("div",{children:[e.jsxs("h1",{style:{fontSize:"2rem",fontWeight:"bold",color:"#111827",marginBottom:"0.5rem",textAlign:H?"right":"left"},children:["📊 ",o("title")]}),e.jsx("p",{style:{fontSize:"1rem",color:"#6b7280",textAlign:H?"right":"left"},children:o("subtitle")})]}),e.jsxs("div",{style:{display:"flex",gap:"1rem",alignItems:"center"},children:[e.jsxs("button",{onClick:()=>v("/admin/main"),style:{padding:"0.75rem 1.5rem",background:"transparent",border:"2px s
17olid #6b7280",borderRadius:"0.5rem",color:"#6b7280",fontWeight:"600",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("span",{children:"📊"}),o("backToDashboard")]}),e.jsxs("button",{onClick:()=>_(!0),style:{padding:"0.75rem 1.5rem",background:"linear-gradient(135deg, #059669 0%, #047857 100%)",border:"none",borderRadius:"0.5rem",color:"white",fontWeight:"600",cursor:"pointer",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"0.5rem"},children:[e.jsx("span",{children:"➕"}),o("createTemplate")]})]})]})}),e.jsxs("div",{style:{maxWidth:"1400px",margin:"0 auto",padding:"2rem 1rem 1rem"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(250px, 1fr))",gap:"1.5rem",marginBottom:"2rem"},children:[e.jsxs("div",{style:{background:"white",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",border:"2px solid #e5e7eb"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem"},children:[e.jsx("span",{style:{fontSize:"2rem"},children:"📝"}),e.jsx("span",{style:{background:"#f3f4f6",color:"#374151",padding:"0.25rem 0.75rem",borderRadius:"1rem",fontSize:"0.875rem",fontWeight:"600"},children:o("summary.totalTemplates")}
17)]}),e.jsx("div",{style:{fontSize:"2rem",fontWeight:"bold",color:"#111827",marginBottom:"0.25rem"},children:d.total_templates}),e.jsxs("div",{style:{fontSize:"0.875rem",color:"#6b7280"},children:[d.active_templates," ",o("summary.activeTemplates").toLowerCase()]})]}),e.jsxs("div",{style:{background:"white",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",border:"2px solid #e5e7eb"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem"},children:[e.jsx("span",{style:{fontSize:"2rem"},children:"🎯"}),e.jsx("span",{style:{background:V?"#dbeafe":"#fee2e2",color:V?"#1d4ed8":"#dc2626",padding:"0.25rem 0.75rem",borderRadius:"1rem",fontSize:"0.875rem",fontWeight:"600"},children:o("summary.primaryTemplate")})]}),e.jsx("div",{style:{fontSize:"2rem",fontWeight:"bold",color:V?"#1d4ed8":"#dc2626",marginBottom:"0.25rem"},children:V?"✓":"✗"}),e.jsx("div",{style:{fontSize:"0.875rem",color:"#6b7280"},children:V?"Primary template active":"No primary template"})]}),e.jsxs("div",{style:{background:"white",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",border:"2px solid #e5e7eb"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem"},children:[e.jsx("span",{style:{fontSize:"2rem"},children:"🚀"}),e.jsx("span",{style:{background:"#dcfce7",color:"#166534",padding:"0.25rem 0.75rem",borderRadius:"1rem",fontSize:"0.875rem",fontWeight:"600"},children:o("summary.highPerforming")})]}),e.jsx("div",{style:{fontSize:"2rem",fontWeight:"bold",color:"#059669",marginBottom:"0.25rem"},children:d.high_performing_templates}),e.jsxs("div",{style:{fontSize:"0.875rem",color:"#6b7280"},children:[d.performance_rate.toFixed(1),"% ",o("summary.performanceRate").toLowerCase()]})]}),e.jsxs("div",{style:{background:"white",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",border:"2px solid #e5e7eb"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem"},children:[e.jsx("span",{style:{fontSize:"2rem"},children:"📈"}),e.jsx("span",{style:{background:"#fef3c7",color:"#92400e",padding:"0.25rem 0.75rem",borderRadius:"1rem",fontSize:"0.875rem",fontWeight:"600"},children:"Revenue"})]}),e.jsxs("div",{style:{fontSize:"2rem",fontWeight:"bold",color:"#d97706",marginBottom:"0.25rem"},children:["₪",N.reduce((a,y)=>a+(y.performance?.total_revenue||0),0).toFixed(0)]}),e.jsx("div",{style:{fontSize:"0.875rem",color:"#6b7280"},children:"Total template revenue"})]}),e.jsxs("div",{style:{background:"linear-gradient(135deg, #f59e0b 0%, #d97706 100%)",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",border:"2px solid #fed7aa",cursor:"pointer",transition:"transform 0.2s",position:"relative"},onClick:()=>k(!0),onMouseEnter:a=>a.currentTarget.style.transform="scale(1.02)",onMouseLeave:a=>a.currentTarget.style.transform="scale(1)",children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.5rem"},children:[e.jsx("span",{style:{fontSize:"2rem"},children:"💬"}),e.jsx("span",{style:{background:"rgba(255, 255, 255, 0.9)",color:"#92400e",padding:"0.25rem 0.75rem",borderRadius:"1rem",fontSize:"0.875rem",fontWeight:"600"},children:"Hero Messages"})]}),e.jsx("div",{style:{fontSize:"2rem",fontWeight:"bold",color:"white",marginBottom:"0.25rem"},children:"Manage Texts"}),e.jsx("div",{style:{fontSize:"0.875rem",color:"rgba(255, 255, 255, 0.9)"},children:"Payment page messages"})]})]}),e.jsxs("div",{style:{background:"white",borderRadius:"1rem",padding:"1.5rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",marginBottom:"2rem"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, 1fr))",gap:"1rem",alignItems:"end"},children:[e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem"},children:"Search"}),e.jsx("input",{type:"text",placeholder:o("searchPlaceholder"),value:A.search,onChange:a=>O("search",a.target.value),style:{width:"100%",padding:"0.75rem",border:"2px s
17olid #e5e7eb",borderRadius:"0.5rem",fontSize:"0.875rem",outline:"none",transition:"border-color 0.2s ease"}})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem"},children:"Template Type"}),e.jsxs("select",{value:A.template_type,onChange:a=>O("template_type",a.target.value),style:{width:"100%",padding:"0.75rem",border:"2px solid #e5e7eb",borderRadius:"0.5rem",fontSize:"0.875rem",outline:"none",background:"white"},children:[e.jsx("option",{value:"",children:o("filters.allTemplateTypes")}),e.jsx("option",{value:"primary_default",children:o("filters.primaryDefault")}),e.jsx("option",{value:"range_default",children:o("filters.rangeDefault")}),e.jsx("option",{value:"manual",children:o("filters.manual")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem"},children:"Status"}),e.jsxs("select",{value:A.is_active,onChange:a=>O("is_active",a.target.value),style:{width:"100%",padding:"0.75rem",border:"2px solid #e5e7eb",borderRadius:"0.5rem",fontSize:"0.875rem",outline:"none",background:"white"},children:[e.jsx("option",{value:"",children:o("filters.allStatuses")}),e.jsx("option",{value:"true",children:o("filters.active")}),e.jsx("option",{value:"false",children:o("filters.inactive")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem"},children:o("filters.performanceFilter")}),e.jsxs("select",{value:A.performance_filter,onChange:a=>O("performance_filter",a.target.value),style:{width:"100%",padding:"0.75rem",border:"2px solid #e5e7eb",borderRadius:"0.5rem",fontSize:"0.875rem",outline:"none",background:"white"},children:[e.jsx("option",{value:"all",children:o("filters.allPerformance")}),e.jsx("option",{value:"high",children:o("filters.highPerforming")}),e.jsx("option",{value:"medium",children:o("filters.mediumPerforming")}),e.jsx("option",{value:"low",children:o("filters.lowPerforming")})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:{display:"block",fontSize:"0.875rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem"},children:o("filters.sortBy")}),e.jsxs("select",{value:`${A.sort_by}_${A.sort_direction}`,onChange:a=>{const[y,p]=a.target.value.split("_");O("sort_by",y),O("sort_direction",p)},style:{width:"100%",padding:"0.75rem",border:"2px solid #e5e7eb",borderRadius:"0.5rem",fontSize:"0.875rem",outline:"none",background:"white"},children:[e.jsxs("option",{value:"created_at_desc",children:[o("filters.createdAt")," (Newest)"]}),e.jsxs("option",{value:"created_at_asc",children:[o("filters.createdAt")," (Oldest)"]}),e.jsxs("option",{value:"template_name_asc",children:[o("filters.name")," (A-Z)"]}),e.jsxs("option",{value:"template_name_desc",children:[o("filters.name")," (Z-A)"]})]})]})]}),s.length>0&&e.jsx("div",{style:{marginTop:"1.5rem",padding:"1rem",background:"#f9fafb",borderRadius:"0.5rem",border:"1px solid #e5e7eb"},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"1rem",flexWrap:"wrap"},children:[e.jsxs("span",{style:{fontSize:"0.875rem",fontWeight:"600",color:"#374151"},children:[s.length," templates selected"]}),e.jsxs("select",{value:u,onChange:a=>S(a.target.value),style:{padding:"0.5rem 0.75rem",border:"1px solid #d1d5db",borderRadius:"0.375rem",fontSize:"0.875rem",background:"white"},children:[e.jsx("option",{value:"",children:"Select Action"}),e.jsx("option",{value:"activate",children:"Activate Selected"}),e.jsx("option",{value:"deactivate",children:"Deactivate Selected"}),e.jsx("option",{value:"compare",children:"Compare Selected"})]}),e.jsx("button",{onClick:me,disabled:!u,style:{padding:"0.5rem 1rem",background:u?"#059669":"#d1d5db",color:"white",border:"none",borderRadius:"0.375rem",fontSize:"0.875rem",fontWeight:"600",cursor:u?"pointer":"not-allowed",transition:"all 0.2s ease"},children:"Apply Action"}),e.jsx("button",{onClick:()=>l([]),style:{padding:"0.5rem 1rem",background:"transparent",color:"#6b7280",border:"1px solid #d1d5db",borderRadius:"0.375rem",fontSize:"0.875rem",cursor:"pointer"},children:"Clear Selection"})]})})]}),e.jsxs("div",{style:{background:"white",borderRadius:"1rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",overflow:"hidden"},children:[j?e.jsxs("div",{style:{padding:"3rem",textAlign:"center",color:"#6b7280"},children:[e.jsx("div",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"⏳"}),e.jsx("div",{children:o("messages.loadingTemplates")}
17)]}):w?e.jsxs("div",{style:{padding:"3rem",textAlign:"center",color:"#dc2626"},children:[e.jsx("div",{style:{fontSize:"2rem",marginBottom:"1rem"},children:"❌"}),e.jsx("div",{children:w}),e.jsx("button",{onClick:()=>F(),style:{marginTop:"1rem",padding:"0.75rem 1.5rem",background:"#059669",color:"white",border:"none",borderRadius:"0.5rem",cursor:"pointer"},children:"Retry"})]}):N.length===0?e.jsxs("div",{style:{padding:"3rem",textAlign:"center",color:"#6b7280"},children:[e.jsx("div",{style:{fontSize:"3rem",marginBottom:"1rem"},children:"📝"}),e.jsx("h3",{style:{fontSize:"1.25rem",fontWeight:"600",color:"#374151",marginBottom:"0.5rem"},children:o("messages.noTemplates")}),e.jsx("p",{style:{marginBottom:"1.5rem"},children:o("messages.createFirstTemplate")}),e.jsx("button",{onClick:()=>_(!0),style:{padding:"0.75rem 1.5rem",background:"#059669",color:"white",border:"none",borderRadius:"0.5rem",fontWeight:"600",cursor:"pointer",transition:"all 0.2s ease"},children:o("createTemplate")})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{background:"#f9fafb",borderBottom:"1px solid #e5e7eb",padding:"0.75rem 1rem",display:"grid",gridTemplateColumns:"auto 1fr 120px 120px 80px 80px 120px 100px 100px 80px 160px",gap:"1rem",alignItems:"center",fontSize:"0.875rem",fontWeight:"600",color:"#374151"},children:[e.jsx("input",{type:"checkbox",checked:s.length===N.length,onChange:a=>{a.target.checked?l(N.map(y=>y.id)):l([])},style:{margin:0}}),e.jsx("div",{children:o("table.templateName")}),e.jsx("div",{children:o("table.templateType")}),e.jsx("div",{children:o("table.signatureRange")}),e.jsx("div",{children:o("table.tiers")}),e.jsx("div",{children:o("table.currency")}),e.jsx("div",{children:o("table.performance")}),e.jsx("div",{children:o("table.revenue")}),e.jsx("div",{children:o("table.assignments")}),e.jsx("div",{children:o("table.status")}),e.jsx("div",{children:o("table.actions")})]}),e.jsx("div",{style:{maxHeight:"600px",overflowY:"auto"},children:N.map((a,y)=>e.jsxs("div",{style:{borderBottom:y<N.length-1?"1px solid #f3f4f6":"none",padding:"1rem",display:"grid",gridTemplateColumns:"auto 1fr 120px 120px 80px 80px 120px 100px 100px 80px 160px",gap:"1rem",alignItems:"center",fontSize:"0.875rem",transition:"background-color 0.2s ease",cursor:"pointer"},onMouseEnter:p=>{p.currentTarget.style.background="#f9fafb"},onMouseLeave:p=>{p.currentTarget.style.background="transparent"},onClick:()=>Q(a.id),children:[e.jsx("input",{type:"checkbox",checked:s.includes(a.id),onChange:()=>de(a.id),style:{margin:0},onClick:p=>p.stopPropagation()}),e.jsxs("div",{children:[e.jsxs("div",{style:{fontWeight:"600",color:"#111827",marginBottom:"0.25rem"},children:[a.template_name,a.is_primary&&e.jsx("span",{style:{marginLeft:"0.5rem",padding:"0.125rem 0.375rem",background:"#dbeafe",color:"#1d4ed8",fontSize:"0.75rem",borderRadius:"0.25rem",fontWeight:"600"},children:"PRIMARY"})]}),a.description&&e.jsx("div",{style:{color:"#6b7280",fontSize:"0.75rem",lineHeight:"1.2"},children:a.description.length>50?a.description.substring(0,50)+"...":a.description})]}),e.jsx("div",{style:{fontSize:"0.875rem",fontWeight:"600"},children:e.jsx("span",{style:{padding:"0.25rem 0.75rem",borderRadius:"1rem",fontSize:"0.75rem",fontWeight:"600",background:a.is_primary?"#dbeafe":"#f3f4f6",color:a.is_primary?"#1d4ed8":"#374151"},children:re(a)})}),e.jsx("div",{style:{fontSize:"0.875rem",color:"#6b7280",fontWeight:"500"},children:ne(a)}),e.jsx("div",{style:{textAlign:"center",fontWeight:"600",color:"#059669"},children:a.tier_count||0}),e.jsx("div",{style:{textAlign:"center",fontWeight:"600"},children:K(a.base_currency)}),e.jsx("div",{children:a.performance&&e.jsx(he,{performance:a.performance,currency:a.base_currency})}),e.jsxs("div",{style:{textAlign:"center",fontWeight:"600",color:"#111827"},children:[K(a.base_currency),a.performance?.total_revenue?.toFixed(0)||"0"]}),e.jsxs("div",{style:{textAlign:"center"},children:[e.jsx("div",{style:{fontWeight:"600",color:"#111827"},children:a.assignments_count||0}),e.jsxs("div",{style:{fontSize:"0.75rem",color:"#6b7280"},children:[a.performance?.active_assignments||0," active"]})]}),e.jsx("div",{style:{textAlign:"center"},children:e.jsx("span",{style:{padding:"0.25rem 0.75rem",borderRadius:"1rem",fontSize:"0.75rem",fontWeight:"600",background:a.is_active?"#dcfce7":"#fee2e2",color:a.is_active?"#166534":"#dc2626"},children:a.is_active?o("status.active"):o("status.inactive")})}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"center",flexWrap:"wrap"},children:[e.jsx("button",{onClick:p=>{p.stopPropagation(),Q(a.id)},style:{padding:"0.375rem",background:"#e0e7ff",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},title:o("actions.view"),children:"👁️"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),le(a.id)},style:{padding:"0.375rem",background:"#fef3c7",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},title:o("actions.edit"),children:"✏️"}),!a.is_primary&&e.jsx("button",{onClick:p=>{p.stopPropagation(),oe(a)},style:{padding:"0.375rem",background:"#d1fae5",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},title:"Set as Default",children:"👑"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),ee(a)},style:{padding:"0.375rem",background:"#e0f2fe",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},title:o("actions.duplicate"),children:"📋"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),te(a)},style:{padding:"0.375rem",background:a.is_active?"#fee2e2":"#dcfce7",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},title:a.is_active?o("actions.deactivate"):o("actions.activate"),children:a.is_active?"⏸️":"▶️"}),e.jsx("button",{onClick:p=>{p.stopPropagation(),ie(a)},style:{padding:"0.375rem",background:"#fecaca",border:"none",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem"},title:o("actions.delete"),children:"🗑️"})]})]},a.id))})]}),!j&&!w&&N.length>0&&t.last_page>1&&e.jsxs("div",{style:{padding:"1rem",borderTop:"1px solid #e5e7eb",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{fontSize:"0.875rem",color:"#6b7280"},children:["Showing ",(t.current_page-1)*t.per_page+1," to"," ",Math.min(t.current_page*t.per_page,t.total)," of"," ",t.total," templates"]}),e.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[e.jsx("button",{onClick:()=>Z(t.current_page-1),disabled:t.current_page<=1,style:{padding:"0.5rem 0.75rem",background:t.current_page<=1?"#f3f4f6":"#ffffff",border:"1px solid #d1d5db",borderRadius:"0.375rem",cursor:t.current_page<=1?"not-allowed":"pointer",fontSize:"0.875rem"},children:"Previous"}),Array.from({length:Math.min(5,t.last_page)}
17,(a,y)=>{const p=y+1;return e.jsx("button",{onClick:()=>Z(p),style:{padding:"0.5rem 0.75rem",background:t.current_page===p?"#059669":"#ffffff",color:t.current_page===p?"white":"#374151",border:"1px solid #d1d5db",borderRadius:"0.375rem",cursor:"pointer",fontSize:"0.875rem",fontWeight:t.current_page===p?"600":"400"},children:p},p)}),e.jsx("button",{onClick:()=>Z(t.current_page+1),disabled:t.current_page>=t.last_page,style:{padding:"0.5rem 0.75rem",background:t.current_page>=t.last_page?"#f3f4f6":"#ffffff",border:"1px solid #d1d5db",borderRadius:"0.375rem",cursor:t.current_page>=t.last_page?"not-allowed":"pointer",fontSize:"0.875rem"},children:"Next"})]})]})]})]}),g&&e.jsx(Ne,{isOpen:g,onClose:()=>J("create"),onSuccess:ue,language:b}),C&&B&&e.jsx(Te,{isOpen:C,onClose:()=>J("view"),templateId:B,language:b,onEdit:()=>{I(!1),i(!0)},onDuplicate:()=>{const a=N.find(y=>y.id===B);a&&(I(!1),ee(a))},onToggleStatus:()=>{const a=N.find(y=>y.id===B);a&&(I(!1),te(a))}}),T&&B&&e.jsx(we,{isOpen:T,onClose:()=>J("edit"),templateId:B,language:b,onSuccess:ge}),M&&$&&e.jsx(Se,{isOpen:M,onClose:()=>J("confirm"),title:G.title,message:G.message,confirmText:G.confirmText,confirmButtonClass:G.buttonClass,onConfirm:ce,loading:U,language:b}),n&&e.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,background:"rgba(0, 0, 0, 0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{background:"white",borderRadius:"1rem",width:"95%",maxWidth:"1200px",maxHeight:"90vh",overflow:"hidden",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{padding:"1.5rem",borderBottom:"1px solid #e5e7eb",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsx("h2",{style:{fontSize:"1.5rem",fontWeight:"bold",color:"#111827"},children:"Hero Messages Management"}),e.jsx("button",{onClick:()=>k(!1),style:{padding:"0.5rem",background:"transparent",border:"none",cursor:"pointer",fontSize:"1.5rem",color:"#6b7280"},children:"✕"})]}),e.jsx("div",{style:{flex:1,overflow:"auto"},children:e.jsx(ve,{language:b})})]})})]})};export{We as default};
18//# sourceMappingURL=AdminTemplateManagement-BJsvDEe_.js.map

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.