1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},r=(new e.Error).stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="cbb9ff7f-6144-43d1-9aac-a113a0710023",e._sentryDebugIdIdentifier="sentry-dbid-cbb9ff7f-6144-43d1-9aac-a113a0710023")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6719],{15552:(e,r,t)=>{t.d(r,{default:()=>J});var s=t(95155),a=t(56266),l=t(47582),o=t(4509),n=t(33789),i=t(67001),c=t(97003),d=t(67909),g=t(83209),h=t(84916),u=t(12115),m=t(61229),x=t(65229),p=t(35299),j=t(20063),f=t(91727),y=t(75035),b=t(78957),w=t(5891),v=t(51539),N=t(24842),C=t(75234),S=t(77084),k=t(20698),R=t(57862),I=t(17787),D=t(49027),A=t(27587),M=t(49476),T=t(39347),z=t(46805),E=t(14585),U=t(61640);let B=(0,d.default)(()=>Promise.all([t.e(6975),t.e(4228),t.e(3848),t.e(8061),t.e(2807),t.e(1198),t.e(1159),t.e(2470),t.e(23),t.e(6529),t.e(5593),t.e(4180),t.e(5277),t.e(3976),t.e(3847),t.e(4969),t.e(2074),t.e(871),t.e(6719),t.e(1494),t.e(3511),t.e(4629),t.e(6024),t.e(8386),t.e(9629),t.e(6241),t.e(521),t.e(9466)]).then(t.bind(t,61483)),{loadableGenerated:{webpack:()=>[61483]},ssr:!1,loading:()=>(0,s.jsx)("div",{className:"w-full h-96 bg-gray-100 dark:bg-gray-800 animate-pulse rounded border flex items-center justify-center",children:(0,s.jsx)("span",{className:"text-gray-500",children:"Loading editor..."})})}),F=()=>(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"(Optional)"});function L(e){let{item:r,categoryName:t,onRemove:a,uniqueId:l}=e,{attributes:o,listeners:n,setNodeRef:i,transform:d,transition:g,isDragging:h}=(0,D.gl)({id:l}),u={transform:A.Ks.Transform.toString(d),transition:g,opacity:h?.5:1};return(0,s.jsxs)("div",{ref:i,style:u,className:"flex items-center gap-2 bg-secondary border border-border-primary px-3 py-2 rounded-md",children:[(0,s.jsx)("button",{type:"button",className:"cursor-grab active:cursor-grabbing text-muted-foreground hover:text-foreground",...o,...n,children:(0,s.jsx)(M.A,{className:"h-4 w-4"})}),"bestCategory"===r.type&&(0,s.jsx)(T.A,{className:"h-3.5 w-3.5 fill-amber-400 text-amber-500"}),(0,s.jsx)("span",{className:"text-sm flex-1 text-secondary-foreground",children:t}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground px-2 py-0.5 bg-background border border-border-primary rounded",children:"category"===r.type?"Category":"Best Category"}),(0,s.jsx)(c.$,{type:"button",variant:"ghost",size:"sm",onClick:()=>a(r.id),className:"h-auto p-0 text-muted-foreground hover:text-destructive",children:(0,s.jsx)(x.A,{className:"h-3 w-3"})})]})}function J(e){let{place:r,categoryId:t,onSubmit:d}=e;(0,U.b)();let[x,A]=(0,u.useState)(!1),M=(0,j.useRouter)(),J=(0,l.jE)(),[O,P]=(0,u.useState)([]),[q,V]=(0,u.useState)([]),[$,K]=(0,u.useState)([]),[H,W]=(0,u.useState)([]),[_,G]=(0,u.useState)([]),[Q,Z]=(0,u.useState)("category"),[Y,X]=(0,u.useState)(""),[ee,er]=(0,u.useState)({dataUrl:"",httpUrl:""}),[et,es]=(0,u.useState)(null),[ea,el]=(0,u.useState)(!1),[eo,en]=(0,u.useState)(!1),[ei,ec]=(0,u.useState)("add-category"===r),ed=(0,u.useRef)("add-category"===r),eg=(0,a.mN)({defaultValues:{name:"",slug:"",shortDescription:"",description:"",tldr:"",freeShortDesc:"",freeDescription:"",faqs:[],seoTitle:"",seoDescription:"",seoKeywords:"",canonicalUrl:"",freeSeoTitle:"",freeSeoDescription:"",isFeatured:!1,isPopular:!1,allowFreePage:!1,tag:""}});(0,u.useEffect)(()=>{(async()=>{try{let[e,r]=await Promise.all([(0,N.Q)({skipCache:!0}),(0,C.c)(1e3)]),s=e.filter(e=>e.id!==t).map(e=>({id:e.id,name:e.name}));W(s);let a=(Array.isArray(r)?r:[]).map(e=>({id:e.id,name:e.name}));G(a)}catch(e){console.error("Error fetching categories:",e),m.oR.error("Error loading categories")}})()},[t]),(0,u.useEffect)(()=>{(async()=>{if(t&&"edit-category"===r&&!ed.current){ed.current=!0;try{let e=await (0,S.$)(t);if(e){let r={name:e.name,slug:e.slug||"",shortDescription:e.shortDescription||"",description:e.description||"",tldr:e.tldr||"",freeShortDesc:e.freeShortDesc||"",freeDescription:e.freeDescription||"",faqs:e.faqs||[],seoTitle:e.seoTitle||"",seoDescription:e.seoDescription||"",seoKeywords:e.seoKeywords||"",canonicalUrl:e.canonicalUrl||"",freeSeoTitle:e.freeSeoTitle||"",freeSeoDescription:e.freeSeoDescription||"",isFeatured:e.isFeatured||!1,isPopular:e.isPopular||!1,allowFreePage:e.allowFreePage||!1,tag:e.tag||""};if(eg.reset(r),ec(!0),setTimeout(()=>{en(!1)},500),e.icon&&er({dataUrl:"",httpUrl:e.icon}),P(e.faqs||[]),V(e.faqs||[]),e.relatedCategories)try{let r=(Array.isArray(e.relatedCategories)?e.relatedCategories:JSON.parse(e.relatedCategories)).map((e,r)=>{if("object"==typeof e&&null!==e&&e.id&&e.type){var t;return{...e,order:null!=(t=e.order)?t:r}}if("string"==typeof e){let[t,s]=e.split(":");if(t&&s&&("category"===t||"bestCategory"===t))return{id:s,type:t,order:r}}return null}).filter(e=>null!==e);K(r)}catch(e){console.error("Error parsing related categories:",e),K([])}}}catch(e){m.oR.error("Error fetching category"),console.error("Error fetching category:",e)}}})()},[t,r,ei]);let eh=e=>{K($.filter(r=>r.id!==e).map((e,r)=>({...e,order:r})))},eu=(0,I.FR)((0,I.MS)(I.AN),(0,I.MS)(I.uN,{coordinateGetter:D.JR})),em=JSON.stringify(O)!==JSON.stringify(q),ex=(eg.formState.isDirty||ea||eo||em||$.length>0)&&!x;async function ep(e){A(!0),e.faqs=O,e.relatedCategories=$;let s=null;if(""===ee.httpUrl&&et){if(null==(s=await (0,b.Ru)({file:et,imageType:"category",itemSlug:void 0,title:e.name}))?void 0:s.success)e.icon=s.success;else if(null==s?void 0:s.error){m.oR.error("Icon upload error: ".concat(s.error)),A(!1);return}}else ee.httpUrl&&(e.icon=ee.httpUrl);try{let s;"add-category"===r?s=await (0,k.z)(e):"edit-category"===r&&t&&(s=await (0,R.s)(t,e)),(null==s?void 0:s.success)?(m.oR.success(s.success),J.invali
1dateQueries({queryKey:["categories","light"]}),J.invalidateQueries({queryKey:["categories"]}),d?d():M.push("/admin/categories")):(null==s?void 0:s.error)&&m.oR.error(s.error)}catch(e){m.oR.error("Something went wrong"),console.error("Error submitting form:",e)}finally{A(!1)}}return(0,s.jsxs)("div",{className:"",children:[(0,s.jsxs)("div",{className:"my-2 flex items-center justify-center space-x-2 mb-6",children:["add-category"===r?(0,s.jsx)(w.F.plus,{className:"w-6 h-6 mr-2"}):(0,s.jsx)(w.F.pencil,{className:"w-6 h-6 mr-2"}),(0,s.jsx)("h2",{className:"text-2xl font-bold text-center",children:"add-category"===r?"Add a new category":"Edit category"})]}),(0,s.jsx)(g.Zp,{className:"w-full mx-auto p-4 mb-6 rounded-2xl",children:(0,s.jsx)(o.lV,{...eg,children:(0,s.jsxs)("form",{onSubmit:eg.handleSubmit(ep),className:"rounded-md xl:max-w-[1200px] w-full mx-auto sm:px-10 px-4 pb-10 space-y-6",children:[(0,s.jsx)(f.A,{children:"Basic Information"}),(0,s.jsx)(o.zB,{control:eg.control,name:"name",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Name"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"Category name",...r,required:!0,className:"dark:bg-slate-900 bg-white",onChange:e=>{r.onChange(e);let t=eg.getValues("slug");if(!t||""===t.trim()){let r=e.target.value.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim();eg.setValue("slug",r)}}})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"slug",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Custom Slug ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"category-url-slug (auto-generated from name if empty)",...r,className:"dark:bg-slate-900 bg-white",onChange:e=>{let t=e.target.value.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-");r.onChange(t)}})}),(0,s.jsx)(o.Rr,{children:"URL-friendly version of the category name. Leave empty to auto-generate from name."}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"shortDescription",render:e=>{let{field:a}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Short Description"}),(0,s.jsx)(o.MJ,{children:"add-category"===r||"edit-category"===r&&ei?(0,s.jsx)(B,{value:a.value||"",onChange:e=>{e.replace(/<[^>]*>/g,"").trim().length<=400&&(eg.setValue("shortDescription",e,{shouldDirty:!0,shouldTouch:!0}),en(!0))},height:"200px",placeholder:"Brief category description. Supports HTML and Markdown formatting (max 400 characters)."},"short-desc-".concat(t||"new","-").concat(ei)):(0,s.jsx)("div",{className:"w-full h-48 bg-gray-100 dark:bg-gray-800 animate-pulse rounded border flex items-center justify-center",children:(0,s.jsx)("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading editor..."})})}),(0,s.jsx)(o.C5,{}),(0,s.jsxs)("p",{className:"text-sm text-muted-foreground mt-1",children:[a.value?"".concat(a.value.replace(/<[^>]*>/g,"").trim().length,"/400"):"0/400"," characters (HTML content)"]})]})}}),(0,s.jsx)(f.A,{children:"Category Settings"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,s.jsx)(o.zB,{control:eg.control,name:"isFeatured",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"flex flex-row items-start space-x-3 space-y-0",children:[(0,s.jsx)(o.MJ,{children:(0,s.jsx)(h.S,{checked:r.value,onCheckedChange:r.onChange})}),(0,s.jsxs)("div",{className:"space-y-1 leading-none",children:[(0,s.jsx)(o.lR,{children:"Featured Category"}),(0,s.jsx)(o.Rr,{children:"Mark this category as featured to highlight it"})]})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"isPopular",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"flex flex-row items-start space-x-3 space-y-0",children:[(0,s.jsx)(o.MJ,{children:(0,s.jsx)(h.S,{checked:r.value,onCheckedChange:r.onChange})}),(0,s.jsxs)("div",{className:"space-y-1 leading-none",children:[(0,s.jsx)(o.lR,{children:"Popular Category"}),(0,s.jsx)(o.Rr,{children:"Mark this category as popular"})]})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"allowFreePage",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"flex flex-row items-start space-x-3 space-y-0",children:[(0,s.jsx)(o.MJ,{children:(0,s.jsx)(h.S,{checked:r.value,onCheckedChange:r.onChange})}),(0,s.jsxs)("div",{className:"space-y-1 leading-none",children:[(0,s.jsx)(o.lR,{children:"Allow Free Page"}),(0,s.jsxs)(o.Rr,{children:["Enable free tools page at /ai-categories/","{slug}","/free"]})]})]})}})]}),(0,s.jsx)(f.A,{children:"Category Description"}),(0,s.jsx)(o.zB,{control:eg.control,name:"description",render:e=>{let{field:a}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Category Description"}),(0,s.jsx)(o.Rr,{children:"Write detailed category description using the rich text editor. Supports both HTML and Markdown formats with full formatting capabilities."}),(0,s.jsx)(o.MJ,{children:"add-category"===r||"edit-category"===r&&ei?(0,s.jsx)(B,{value:a.value||"",onChange:e=>{eg.setValue("description",e,{shouldDirty:!0,shouldTouch:!0}),en(!0)},height:"500px",placeholder:"Write your category description here. Supports HTML and Markdown formatting."},"desc-".concat(t||"new","-").concat(ei)):(0,s.jsx)("div",{className:"w-full h-96 bg-gray-100 dark:bg-gray-800 animate-pulse rounded border flex items-center justify-center",children:(0,s.jsx)("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading editor..."})})}),(0,s.jsx)(o.C5,{}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Rich text description with full HTML and Markdown formatting support. Use the mode switch to toggle between WYSIWYG and Markdown editing."})]})}}),(0,s.jsx)(f.A,{children:"Curated Items Content"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"This field is shown at the top of the curated items listicle section. Only dis
1played when the category has curated items."}),(0,s.jsx)(o.zB,{control:eg.control,name:"tldr",render:e=>{let{field:a}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["TL;DR Summary ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.Rr,{children:"Quick summary shown at the top of the curated items section. Good for SEO and user engagement."}),(0,s.jsx)(o.MJ,{children:"add-category"===r||"edit-category"===r&&ei?(0,s.jsx)(B,{value:a.value||"",onChange:e=>{eg.setValue("tldr",e,{shouldDirty:!0,shouldTouch:!0}),en(!0)},height:"200px",placeholder:"Write a quick TL;DR summary for this category's curated tools. E.g., 'Looking for the best AI coding agents? Our top picks include Cursor for IDE integration, GitHub Copilot for inline suggestions, and...'"},"tldr-".concat(t||"new","-").concat(ei)):(0,s.jsx)("div",{className:"w-full h-48 bg-gray-100 dark:bg-gray-800 animate-pulse rounded border flex items-center justify-center",children:(0,s.jsx)("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading editor..."})})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(f.A,{children:"Free Page Content"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:'These fields are used for the /free page when "Allow Free Page" is enabled. If left empty, the main description fields will be used.'}),(0,s.jsx)(o.zB,{control:eg.control,name:"freeShortDesc",render:e=>{let{field:a}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Free Page Short Description ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:"add-category"===r||"edit-category"===r&&ei?(0,s.jsx)(B,{value:a.value||"",onChange:e=>{eg.setValue("freeShortDesc",e,{shouldDirty:!0,shouldTouch:!0}),en(!0)},height:"200px",placeholder:"Short description for free tools page. Supports HTML and Markdown formatting."},"free-short-desc-".concat(t||"new","-").concat(ei)):(0,s.jsx)("div",{className:"w-full h-48 bg-gray-100 dark:bg-gray-800 animate-pulse rounded border flex items-center justify-center",children:(0,s.jsx)("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading editor..."})})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"freeDescription",render:e=>{let{field:a}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Free Page Full Description ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.Rr,{children:"Detailed description for the free tools page. Supports both HTML and Markdown formats with full formatting capabilities."}),(0,s.jsx)(o.MJ,{children:"add-category"===r||"edit-category"===r&&ei?(0,s.jsx)(B,{value:a.value||"",onChange:e=>{eg.setValue("freeDescription",e,{shouldDirty:!0,shouldTouch:!0}),en(!0)},height:"400px",placeholder:"Write your free page description here. Supports HTML and Markdown formatting."},"free-desc-".concat(t||"new","-").concat(ei)):(0,s.jsx)("div",{className:"w-full h-96 bg-gray-100 dark:bg-gray-800 animate-pulse rounded border flex items-center justify-center",children:(0,s.jsx)("div",{className:"text-gray-500 dark:text-gray-400",children:"Loading editor..."})})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(f.A,{children:"Media"}),(0,s.jsx)(y.ImageUpload,{title:"Category Icon",setImageStateIsUpdated:el,imageUrl:ee,handleImageUrl:e=>{let{url:r,type:t}=e;er(e=>({...e,[t]:r}))},handleImageData:e=>{es(e)},imageData:et,maxSize:5e5}),(0,s.jsx)(f.A,{children:"FAQs"}),(0,s.jsx)(E.A,{value:O,onChange:P,disabled:x}),(0,s.jsx)(f.A,{children:"Related Categories"}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:'Add related categories (regular + best categories) that will appear above items with enhanced visibility. Regular categories with "Allow Free Page" enabled will show free chips. Drag to reorder.'}),$.length>0&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Selected Categories (drag to reorder):"}),(0,s.jsx)(I.Mp,{sensors:eu,collisionDetection:I.fp,onDragEnd:e=>{let{active:r,over:t}=e;t&&r.id!==t.id&&K(e=>{let s=e.findIndex(e=>"".concat(e.type,":").concat(e.id)===r.id),a=e.findIndex(e=>"".concat(e.type,":").concat(e.id)===t.id);return(0,D.be)(e,s,a).map((e,r)=>({...e,order:r}))})},children:(0,s.jsx)(D.gB,{items:$.map(e=>"".concat(e.type,":").concat(e.id)),strategy:D._G,children:(0,s.jsx)("div",{className:"space-y-2",children:$.map(e=>{let r="category"===e.type?H.find(r=>r.id===e.id):_.find(r=>r.id===e.id),t="".concat(e.type,":").concat(e.id);return(0,s.jsx)(L,{item:e,categoryName:(null==r?void 0:r.name)||e.id,onRemove:eh,uniqueId:t},t)})})})})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Add Related Category:"}),(0,s.jsxs)("div",{className:"flex gap-2 border-b",children:[(0,s.jsx)("button",{type:"button",onClick:()=>Z("category"),className:"px-4 py-2 text-sm font-medium transition-colors border-b-2 ".concat("category"===Q?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Regular Categories"}),(0,s.jsxs)("button",{type:"button",onClick:()=>Z("bestCategory"),className:"px-4 py-2 text-sm font-medium transition-colors border-b-2 flex items-center gap-1 ".concat("bestCategory"===Q?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[(0,s.jsx)(T.A,{className:"h-3.5 w-3.5"}),"Best Categories"]})]}),(0,s.jsx)("div",{className:"space-y-2",children:"category"===Q?(0,s.jsx)(z.Z,{options:H.filter(e=>!$.some(r=>
1r.id===e.id)),value:[Y].filter(Boolean),onValueChange:e=>{let r=e[e.length-1];if(r&&r!==Y){X(r);let e={id:r,type:"category",order:$.length};K([...$,e]),X("")}},placeholder:"Search and select regular categories...",emptyMessage:"No categories available."}):(0,s.jsx)(z.Z,{options:_.filter(e=>!$.some(r=>r.id===e.id)),value:[Y].filter(Boolean),onValueChange:e=>{let r=e[e.length-1];if(r&&r!==Y){X(r);let e={id:r,type:"bestCategory",order:$.length};K([...$,e]),X("")}},placeholder:"Search and select best categories...",emptyMessage:"No best categories available."})})]})]}),(0,s.jsx)(o.zB,{control:eg.control,name:"tag",render:e=>{var r;let{field:t}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Tag ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"Category tag or label",...t,value:null!=(r=t.value)?r:"",className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.Rr,{children:"Optional tag or label for this category"}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(v.nD,{type:"single",collapsible:!0,children:(0,s.jsxs)(v.As,{value:"seo",children:[(0,s.jsx)(v.$m,{children:"SEO Settings"}),(0,s.jsxs)(v.ub,{className:"space-y-4",children:[(0,s.jsx)(o.zB,{control:eg.control,name:"seoTitle",render:e=>{var r;let{field:t}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["SEO Title ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"SEO optimized title",...t,value:null!=(r=t.value)?r:"",className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"seoDescription",render:e=>{var r;let{field:t}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["SEO Description ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(i.T,{placeholder:"SEO optimized description",...t,value:null!=(r=t.value)?r:"",className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"seoKeywords",render:e=>{var r;let{field:t}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["SEO Keywords ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"keyword1, keyword2, keyword3",...t,value:null!=(r=t.value)?r:"",className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"canonicalUrl",render:e=>{var r;let{field:t}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Canonical URL ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"https://example.com/canonical-path",...t,value:null!=(r=t.value)?r:"",className:"dark:bg-slate-900 bg-white",pattern:"^https:\\/\\/.*",title:"URL must start with https://"})}),(0,s.jsx)(o.C5,{})]})}})]})]})}),eg.watch("allowFreePage")&&(0,s.jsx)(v.nD,{type:"single",collapsible:!0,children:(0,s.jsxs)(v.As,{value:"free-seo",children:[(0,s.jsx)(v.$m,{children:"Free Page SEO Settings (Optional)"}),(0,s.jsxs)(v.ub,{className:"space-y-4",children:[(0,s.jsx)("p",{className:"text-sm text-muted-foreground mb-4",children:"Customize SEO metadata for the free tools page. Leave empty to use auto-generated templates with tool count and current year."}),(0,s.jsx)(o.zB,{control:eg.control,name:"freeSeoTitle",render:e=>{var r;let{field:t}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Free Page SEO Title ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:'e.g., "45+ Free Writing AI Tools 2025 - No Credit Card"',...t,value:null!=(r=t.value)?r:"",className:"dark:bg-slate-900 bg-white"})}),(0,s.jsxs)(o.Rr,{children:['Custom SEO title for /free page. Auto-generated format: "',"{count}","+ Free ","{category}"," AI Tools ","{year}",' - No Credit Card"']}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:eg.control,name:"freeSeoDescription",render:e=>{var r;let{field:t}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Free Page SEO Description ",(0,s.jsx)(F,{})]}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(i.T,{placeholder:'e.g., "Discover 45+ free writing AI tools. Explore forever-free AI solutions with
1no credit card required."',...t,value:null!=(r=t.value)?r:"",className:"dark:bg-slate-900 bg-white",rows:3})}),(0,s.jsx)(o.Rr,{children:'Custom SEO description for /free page. Auto-generated format includes tool count and emphasizes "free" and "no credit card required"'}),(0,s.jsx)(o.C5,{})]})}})]})]})}),(0,s.jsxs)(c.$,{disabled:!ex,type:"submit",className:"flex ml-auto text-white",children:["add-category"===r?"Add":"Update"," Category",x&&(0,s.jsx)(p.A,{className:"w-4 h-4 animate-spin ml-2"})]})]})})})]})}},23045:(e,r,t)=>{t.d(r,{BlogCategoryForm:()=>j});var s=t(95155),a=t(12115),l=t(56266),o=t(503),n=t(33246),i=t(97003),c=t(33789),d=t(90235),g=t(5891),h=t(61229),u=t(48745),m=t(20325),x=t(15836);let p=n.Ik({name:n.Yj().min(1,"Name is required").max(100,"Name must be 100 characters or less"),slug:n.Yj().min(1,"Slug is required").max(100,"Slug must be 100 characters or less").regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/,"Slug must be lowercase letters, numbers, and hyphens only")});function j(e){let{mode:r,categoryId:t,onSuccess:n}=e,[j,f]=(0,a.useTransition)(),[y,b]=(0,a.useState)("edit"===r),[w,v]=(0,a.useState)("create"===r),{register:N,handleSubmit:C,setValue:S,watch:k,reset:R,formState:{errors:I}}=(0,l.mN)({resolver:(0,o.u)(p),defaultValues:{name:"",slug:""}}),D=k("name");return((0,a.useEffect)(()=>{w&&"create"===r&&D&&S("slug",D.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),{shouldValidate:!0})},[D,w,r,S]),(0,a.useEffect)(()=>{"edit"===r&&t&&(b(!0),(0,u.B)(t).then(e=>{e?R({name:e.name,slug:e.slug}):h.oR.error("Blog category not found")}).catch(()=>{h.oR.error("Failed to load blog category")}).finally(()=>{b(!1)}))},[r,t,R]),y)?(0,s.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,s.jsx)(g.F.spinner,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(0,s.jsxs)("form",{onSubmit:C(e=>{f(async()=>{if("create"===r){let r=await (0,m.n)(e.name,e.slug);if(r.error)return void h.oR.error(r.error);h.oR.success("Blog category created successfully"),R({name:"",slug:""}),null==n||n()}else if("edit"===r&&t){let r=await (0,x.S)(t,{name:e.name,slug:e.slug});if(r.error)return void h.oR.error(r.error);h.oR.success("Blog category updated successfully"),null==n||n()}})}),className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(d.J,{htmlFor:"name",children:"Name"}),(0,s.jsx)(c.p,{id:"name",placeholder:"e.g. Artificial Intelligence",...N("name")}
1),I.name&&(0,s.jsx)("p",{className:"text-sm text-destructive",children:I.name.message})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(d.J,{htmlFor:"slug",children:"Slug"}),(0,s.jsx)(c.p,{id:"slug",placeholder:"e.g. artificial-intelligence",...N("slug",{onChange:()=>{"create"===r&&v(!1)}})}),I.slug&&(0,s.jsx)("p",{className:"text-sm text-destructive",children:I.slug.message})]}),(0,s.jsx)("div",{className:"flex justify-end gap-2 pt-2",children:(0,s.jsxs)(i.$,{type:"submit",disabled:j,children:[j&&(0,s.jsx)(g.F.spinner,{className:"h-4 w-4 animate-spin mr-2"}),"create"===r?"Create Category":"Update Category"]})})]})}},77271:(e,r,t)=>{t.d(r,{default:()=>z});var s=t(95155),a=t(56266),l=t(15239),o=t(4509),n=t(33789),i=t(67001),c=t(97003),d=t(83209),g=t(12115),h=t(61229),u=t(65229),m=t(6191),x=t(35299),p=t(20063),j=t(91727),f=t(75035),y=t(78957),b=t(5891),w=t(32158),v=t(20325),N=t(37608),C=t(69392),S=t(55398),k=t(67909);t(46438),t(40857);var R=t(47507),I=t(54679),D=t(14585),A=t(61640);let M=(0,k.default)(()=>Promise.all([t.e(6975),t.e(4228),t.e(3848),t.e(8061),t.e(2807),t.e(1198),t.e(1159),t.e(2470),t.e(23),t.e(6529),t.e(5593),t.e(4180),t.e(5277),t.e(3976),t.e(3847),t.e(4969),t.e(2074),t.e(871),t.e(6719),t.e(1494),t.e(3511),t.e(4629),t.e(6024),t.e(8386),t.e(9629),t.e(6241),t.e(521),t.e(9466)]).then(t.bind(t,61483)),{loadableGenerated:{webpack:()=>[61483]},ssr:!1,loading:()=>(0,s.jsx)("div",{className:"w-full h-96 bg-gray-100 dark:bg-gray-800 animate-pulse rounded border flex items-center justify-center",children:(0,s.jsx)("span",{className:"text-gray-500",children:"Loading editor..."})})}),T=()=>(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"(Optional)"});function z(e){let{place:r,blogId:t,onSubmit:k}=e;(0,A.b)();let[z,E]=(0,g.useState)(!1),[U,B]=(0,g.useState)([]),[F,L]=(0,g.useState)(""),[J,O]=(0,g.useState)(!1),P=(0,p.useRouter)();(0,g.useEffect)(()=>{(async()=>{B(await (0,w.s)())})()},[]);let q=async()=>{if(F.trim()){O(!0);try{let e=await (0,v.n)(F);(null==e?void 0:e.success)?(h.oR.success(e.success),B([...U,e.category]),L("")):(null==e?void 0:e.error)&&h.oR.error(e.error)}catch(e){h.oR.error("Failed to create category")}finally{O(!1)}}},[V,$]=(0,g.useState)({dataUrl:"",httpUrl:""}),[K,H]=(0,g.useState)(null),[W,_]=(0,g.useState)(!1),[G,Q]=(0,g.useState)([]),[Z,Y]=(0,g.useState)({dataUrl:"",httpUrl:""}),[X,ee]=(0,g.useState)(null),[er,et]=(0,g.useState)(!1),[es,ea]=(0,g.useState)(""),[el,eo]=(0,g.useState)(""),[en,ei]=(0,g.useState)([]),[ec,ed]=(0,g.useState)([]),[eg,eh]=(0,g.useState)(""),[eu,em]=(0,g.useState)([]),[ex,ep]=(0,g.useState)(""),ej=()=>{if(""!==eg.trim()&&!ec.includes(eg.trim())){let e=[...ec,eg.trim()];ed(e),ey.setValue("tags",e),eh("")}},ef=()=>{if(""!==ex.trim()&&!eu.includes(ex.trim())){let e=[...eu,ex.trim()];em(e),ey.setValue("tldr",e),ep("")}};(0,g.useEffect)(()=>{(async()=>{if(t&&"edit-blog"===r)try{let r=await (0,N.d)(t);if(r){var e,s;let t=new Date(r.date).toISOString().split("T")[0];ei(r.faqs||[]);let a=r.tags||[];ed(a);let l=r.tldr||[];em(l),ey.reset({title:r.title,slug:r.slug||"",excerpt:r.excerpt||"",date:t,published:r.published,image:r.image||void 0,images:r.images||[],faqs:r.faqs||[],tldr:l,seoTitle:r.seoTitle||"",seoDescription:r.seoDescription||"",seoKeywords:r.seoKeywords||"",canonicalUrl:r.canonicalUrl||"",tags:a,allowComments:null==(e=r.allowComments)||e,featured:null!=(s=r.featured)&&s}),r.image&&$({dataUrl:"",httpUrl:r.image});let o=r.longDescription||"";ea(o),eo(o),Q(r.images||[])}}catch(e){h.oR.error("Error fetching blog"),console.error("Error fetching blog:",e)}})()},[t,r]);let ey=(0,a.mN)({defaultValues:{title:"",slug:"",excerpt:"",date:new Date().toISOString().split("T")[0],published:!0,image:"",images:[],faqs:[],tldr:[],seoTitle:"",seoDescription:"",seoKeywords:"",canonicalUrl:"",tags:[],allowComments:!0,featured:!1}}),eb=async()=>{if(X){E(!0);try{let e=await (0,y.Ru)({file:X,imageType:"blog-content",itemSlug:"edit-blog"===r?t:void 0,title:ey.getValues("title"),index:G.length});(null==e?void 0:e.success)?(Q([...G,e.success]),Y({dataUrl:"",httpUrl:""}),ee(null),et(!0)):(null==e?void 0:e.error)&&h.oR.error("Image upload error: ".concat(e.error))}catch(e){h.oR.error("Error uploading image"),console.error("Error uploading image:",e)}finally{E(!1)}}},ew=es!==el,ev=(ey.formState.isDirty||W||er||ew)&&!z;async function eN(e){if(E(!0),e.date){let r=new Date("".concat(e.date,"T00:00:00.000Z"));e.date=r.toISOString()}let s=null;if(""===V.httpUrl&&K){if(null==(s=await (0,y.Ru)({file:K,imageType:"blog-hero",itemSlug:"edit-blog"===r?t:void 0,title:e.title}))?void 0:s.success)e.image=s.success;else if(null==s?void 0:s.error){h.oR.error("Main image upload error: ".concat(s.error)),E(!1);return}}else V.httpUrl&&(e.image=V.httpUrl);e.images=G;let a=es;if(!a||""===a.trim()){let e=window.blogEditorRef;if(e)try{let r=e.getInstance(),t=r.getHTML(),s=r.getMarkdown();(a=t.trim()||s.trim())&&ea(a)}catch(e){console.warn("Could not retrieve content from editor:",e)}}e.longDescription=a,e.tags=ec,e.tldr=eu;try{let s;e.faqs=en,"add-blog"===r?s=await (0,C.$)(e):"edit-blog"===r&&t&&(s=await (0,S.c)(t,e)),(null==s?void 0:s.success)?(h.oR.success(s.success),k?k():P.push("/admin/blogs")):(null==s?void 0:s.error)?h.oR.error(s.error):h.oR.error("Unexpected response from server")}catch(e){console.error("Error saving blog:",e),h.oR.error("Something went wrong while saving the blog")}finally{E(!1)}}return(0,s.jsxs)("div",{className:"",children:[(0,s.jsxs)("div",{className:"my-2 flex items-center justify-center space-x-2 mb-6",children:["add-blog"===r?(0,s.jsx)(b.F.plus,{className:"w-6 h-6 mr-2"}):(0,s.jsx)(b.F.pencil,{className:"w-6 h-6 mr-2"}),(0,s.jsx)("h2",{className:"text-2xl font-bold text-center",children:"add-blog"===r?"Create a new blog post":"Edit blog post"})]}),(0,s.jsx)(d.Zp,{className:"w-full mx-auto p-4 mb-6 rounded-2xl",children:(0,s.jsx)(o.lV,{...ey,children:(0,s.jsxs)("form",{onSubmit:ey.handleSubmit(eN),className:"rounded-md xl:max-w-[1200px] w-full mx-auto
1sm:px-10 px-4 pb-10 space-y-6",children:[(0,s.jsx)(j.A,{children:"Basic Information"}),(0,s.jsx)(o.zB,{control:ey.control,name:"title",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Title"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"Blog title",...r,onChange:e=>{r.onChange(e);var t=e.target.value;ey.setValue("title",t);let s=ey.getValues("slug");if(!s||""===s.trim()){let e=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,"");ey.setValue("slug",e)}},required:!0,className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:ey.control,name:"slug",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Slug (URL)"}),(0,s.jsx)(o.Rr,{children:"Custom URL slug for SEO. Auto-generated from title if left empty."}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"custom-blog-slug",...r,className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:ey.control,name:"excerpt",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Excerpt"}),(0,s.jsx)(o.Rr,{children:"Brief summary displayed in blog cards and listings"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(i.T,{placeholder:"Enter a brief excerpt for your blog post",...r,className:"dark:bg-slate-900 bg-white min-h-[100px]"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)(o.lR,{children:["Key Takeaways (TLDR) ",(0,s.jsx)(T,{})]}),(0,s.jsx)(o.Rr,{children:"Add bullet points summarizing the main points of your blog post. These appear in a highlighted box above the content."}),(0,s.jsx)("div",{className:"space-y-2",children:eu.map((e,r)=>(0,s.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-purple-50 dark:bg-purple-950/30 border-l-4 border-purple-500 rounded-r-md",children:[(0,s.jsx)("span",{className:"text-sm flex-1",children:e}),(0,s.jsx)(c.$,{type:"button",variant:"ghost",size:"sm",className:"h-6 w-6 p-0 hover:bg-purple-100 dark:hover:bg-purple-900/50",onClick:()=>(e=>{let r=[...eu];r.splice(e,1),em(r),ey.setValue("tldr",r)})(r),children:(0,s.jsx)(u.A,{className:"h-4 w-4"})})]},r))}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.p,{placeholder:"Add a key takeaway point",value:ex,onChange:e=>ep(e.target.value),onKeyPress:e=>"Enter"===e.key&&(e.preventDefault(),ef()),className:"dark:bg-slate-900 bg-white flex-1"}),(0,s.jsx)(c.$,{type:"button",onClick:ef,size:"icon",disabled:!ex.trim(),children:(0,s.jsx)(m.A,{className:"h-4 w-4"})})]})]}),(0,s.jsx)(o.zB,{control:ey.control,name:"date",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Publication Date"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{type:"date",...r,required:!0,className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,s.jsx)(o.zB,{control:ey.control,name:"published",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"flex flex-row items-start space-x-3 space-y-0 p-4 border rounded-md",children:[(0,s.jsx)(o.MJ,{children:(0,s.jsx)("input",{type:"checkbox",checked:r.value,onChange:r.onChange,className:"h-5 w-5 mt-1"})}),(0,s.jsxs)("div",{className:"space-y-1 leading-none",children:[(0,s.jsx)(o.lR,{children:"Published"}),(0,s.jsx)(o.Rr,{children:"Make the blog publicly visible"})]})]})}}),(0,s.jsx)(o.zB,{control:ey.control,name:"featured",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"flex flex-row items-start space-x-3 space-y-0 p-4 border rounded-md",children:[(0,s.jsx)(o.MJ,{children:(0,s.jsx)("input",{type:"checkbox",checked:r.value,onChange:r.onChange,className:"h-5 w-5 mt-1"})}),(0,s.jsxs)("div",{className:"space-y-1 leading-none",children:[(0,s.jsx)(o.lR,{children:"Featured"}),(0,s.jsx)(o.Rr,{children:"Show in featured blog sections"})]})]})}}),(0,s.jsx)(o.zB,{control:ey.control,name:"allowComments",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"flex flex-row items-start space-x-3 space-y-0 p-4 border rounded-md",children:[(0,s.jsx)(o.MJ,{children:(0,s.jsx)("input",{type:"checkbox",checked:r.value,onChange:r.onChange,className:"h-5 w-5 mt-1"})}),(0,s.jsxs)("div",{className:"space-y-1 leading-none",children:[(0,s.jsx)(o.lR,{children:"Allow Comments"}),(0,s.jsx)(o.Rr,{children:"Enable comments on this post"})]})]})}})]}),(0,s.jsx)(j.A,{children:"Blog Content"}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(o.lR,{children:"Blog Content"}),(0,s.jsx)(o.Rr,{children:"Write your blog post content using the rich text editor. Supports both markdown and HTML formats with image uploads to Cloudflare R2."}),(0,s.jsx)(M,{value:es||"",height:"500px",useCommandShortcut:!0,onChange:e=>{ea(e)},imageNamePrefix:"blog-content",toolbarItems:[["heading","bold","italic","strike"],["hr","quote"],["ul","ol","task","indent","outdent"],["table","image","link"],["code","codeblock"],["scrollSync"]],placeholder:"Write your blog post content here. Supports HTML and Markdown formatting with image uploads.",previewStyle:"tab",hideModeSwitch:!1})]}),(0,s.jsx)(j.A,{children:"Tags"}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mb-4",children:ec.map((e,r)=>(0,s.jsxs)("div",{className:"flex items-center gap-1 bg-info-bg dark:bg-info-bg px-3 py-1 rounded-full",children:[(0,s.jsx)("span",{className:"text-sm",children:e}),(0,s.jsx)(c.$,{type:"button",variant:"ghost",size:"sm",className:"h-4 w-4 p-0 hover:bg-transparent",onClick:()=>(e=>{let r=[...ec];r.splice(e,1),ed(r),ey.setValue("tags",r)})(r),children:(0,s.jsx)(u.A,{className:"h-3 w-3"})})]},r))}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.p,{placeholder:"Add a tag",value:eg,onChange:e=>eh(e.target.value),onKeyPress:e=>"Enter"===e.key&&(e.preventDefault(),ej()),className:"dark:bg-slate-900 bg-white flex-1"}),(0,s.jsx)(c.$,{type:"button",onClick:ej,size:"icon",children:(0,s.jsx)(m.A,{className:"h-4 w-4"})})]})]}),(0,s.jsx)(j.A,{children:"SEO Settings"}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsx)(o.zB,{control:ey.control,name:"seoTitle",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["SEO Title ",(0,s.jsx)(T,{})]}),(0,s.jsx)(o.Rr,{children:"Custom title for search engines (leave empty to use main title)"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"Custom SEO title",...r,className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:ey.control,name:"canonicalUrl",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["Canonical URL ",(0,s.jsx)(T,{})]}),(0,s.jsx)(o.Rr,{children:"Custom canonical URL (leave empty for auto-generation)"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"https://example.com/custom-url",...r,className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}})]}),(0,s.jsx)(o.zB,{control:ey.control,name:"seoDescription",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["SEO Meta Description ",(0,s.jsx)(T,{})]}),(0,s.jsx)(o.Rr,{children:"Custom meta description for search engines (leave empty to use short description)"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(i.T,{placeholder:"Custom meta description for search engines",...r,className:"dark:bg-slate-900 bg-white min-h-[80px]"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(o.zB,{control:ey.control,name:"seoKeywords",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsxs)(o.lR,{children:["SEO Keywords ",(0,s.jsx)(T,{})]}),(0,s.jsx)(o.Rr,{children:"Comma-separated keywords for search engines"}),(0,s.jsx)(o.MJ,{children:(0,s.jsx)(n.p,{placeholder:"keyword1, keyword2, keyword3",...r,className:"dark:bg-slate-900 bg-white"})}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsx)(j.A,{children:"FAQs"}),(0,s.jsx)(D.A,{value:en,onChange:ei,disabled:z}),(0,s.jsx)(j.A,{children:"Featured Image"}),(0,s.jsx)(f.ImageUpload,{title:"Main Blog Image",setImageStateIsUpdated:_,imageUrl:V,handleImageUrl:e=>{let{url:r,type:t}=e;$(e=>({...e,[t]:r}))},handleImageData:e=>{H(e)},imageData:K,maxSize:2e6}),(0,s.jsx)(j.A,{children:"Additional Images"}),(0,s.jsxs)("div",{className:"space-y-4",children:[G.map((e,r)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"h-16 w-16 rounded-md overflow-hidden relative",children:(0,s.jsx)(l.default,{src:e||"/placeholder.svg",alt:"Additional image ".concat(r+1),fill:!0,className:"object-cover",sizes:"64px"})}),(0,s.jsx)(n.p,{value:e,readOnly:!0,className:"dark:bg-slate-900 bg-white flex-1"}),(0,s.jsx)(c.$,{type:"button",variant:"destructive",size:"icon",onClick:()=>(e=>{let r=[...G];r.splice(e,1),Q(r),et(!0)})(r),children:(0,s.jsx)(u.A,{className:"h-4 w-4"})})]},r)),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(f.ImageUpload,{title:"Add Additional Image",setImageStateIsUpdated:()=>{},imageUrl:Z,handleImageUrl:e=>{let{url:r,type:t}=e;Y(e=>({...e,[t]:r}))},handleImageData:e=>{ee(e)},imageData:X,maxSize:2e6}),X&&(0,s.jsxs)(c.$,{type:"button",onClick:eb,disabled:z,className:"flex items-center",children:[(0,s.jsx)(m.A,{className:"h-4 w-4 mr-2"}),"Add Image",z&&(0,s.jsx)(x.A,{className:"w-4 h-4 animate-spin ml-2"})]})]})]}),(0,s.jsx)(j.A,{children:"Category & Organization"}),(0,s.jsx)(o.zB,{control:ey.control,name:"categoryId",render:e=>{let{field:r}=e;return(0,s.jsxs)(o.eI,{className:"text-left",children:[(0,s.jsx)(o.lR,{children:"Category"}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(R.l6,{onValueChange:r.onChange,value:r.value,children:[(0,s.jsx)(o.MJ,{children:(0,s.jsx)(R.bq,{className:"dark:bg-slate-900 bg-white",children:(0,s.jsx)(R.yv,{placeholder:"Select a category"})})}),(0,s.jsx)(R.gC,{children:U.map(e=>(0,s.jsx)(R.eb,{value:e.id,children:e.name},e.id))})]}),(0,s.jsxs)(I.lG,{children:[(0,s.jsx)(I.zM,{asChild:!0,children:(0,s.jsx)(c.$,{type:"button",variant:"outline",children:"+ New"})}),(0,s.jsxs)(I.Cf,{children:[(0,s.jsx)(I.c7,{children:(0,s.jsx)(I.L3,{children:"Create New Category"})}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)(n.p,{placeholder:"Category name",value:F,onChange:e=>L(e.target.value)}),(0,s.jsxs)(c.$,{type:"button",onClick:q,disabled:J||!F.trim(),children:[J?(0,s.jsx)(x.A,{className:"w-4 h-4 animate-spin mr-2"}):null,"Create Category"]})]})]})]})]}),(0,s.jsx)(o.C5,{})]})}}),(0,s.jsxs)(c.$,{disabled:!ev,type:"submit",className:"flex ml-auto text-white",children:["add-blog"===r?"Create":"Update"," Blog"]})]})})})]})}}}]);
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.