PageSourceSearch

https://www.strangeadv.com/assets/BlogEditor-DqImGOju.js

js strangeadv.com collected 2026-10-09 23:31:45 UTC 28,032 bytes, 63 lines download raw bytes

1import{j as e}from"./radix-D5qHxdhA.js";import{r as n,h as q,u as J}from"./react-vendor-CVZ_YpZg.js";import{b as C,a as m,F as K,U as l,V as P,aa as z,w as p,x as Q,f as X}from"./index-BLRe0tvd.js";import{S as $}from"./select-native-DepdU5an.js";import{F as Y}from"./ArrowLeftIcon-D27NDkQg.js";import{F as Z}from"./EyeIcon-CTepPQWA.js";import{F as ee}from"./StarIcon-DZRDk0IB.js";import{F as te}from"./ViewColumnsIcon-DcEnsuAs.js";import{F as re}from"./RectangleGroupIcon-LtwDKYUJ.js";import"./data-BGl8MEun.js";import"./tiptap-ClXTdT6A.js";import"./select-DAmR4lR_.js";function ae({title:d,titleId:u,...x},o){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":u},x),d?n.createElement("title",{id:u},d):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 3v1.5M3 21v-6m0 0 2.77-.693a9 9 0 0 1 6.208.682l.108.054a9 9 0 0 0 6.086.71l3.114-.732a48.524 48.524 0 0 1-.005-10.499l-3.11.732a9 9 0 0 1-6.085-.711l-.108-.054a9 9 0 0 0-6.208-.682L3 4.5M3 15V4.5"}))}const se=n.forwardRef(ae),le={title:"",slug:"",excerpt:"",content:"",contentBlocks:[],coverImageUrl:"",status:"draft",metaTitle:"",metaDescription:""},j={hero:{label:"Hero Image",icon:P,description:"Full-width banner image"},intro:{label:"Intro Section",icon:z,description:"Styled intro text box"},feature:{label:"Feature Card",icon:re,description:"Image + title + description"},sidebyside:{label:"Side by Side",icon:te,description:"Image and text side by side"},section:{label:"Section Header",icon:ee,description:"Section title with accent"},closing:{label:"Closing",icon:se,description:"Closing section with image"},text:{label:"Text Block",icon:z,description:"Simple text paragraph"},image:{label:"Image",icon:P,description:"Standalone image"}};function fe(){const{id:d}=q(),u=J(),x=!d||d==="new",[o,c]=n.useState(le),[h,b]=n.useState([]),[L,U]=n.useState(0),[W,E]=n.useState(!x),[N,B]=n.useState(!1),[y,I]=n.useState("content"),[f,w]=n.useState(null),[S,F]=n.useState(!1);n.useEffect(()=>{x||A()},[d]);const A=async()=>{try{const s=(await C.get(`/blog/${d}`)).data;if(c({id:s.id,title:s.title,slug:s.slug,excerpt:s.excerpt||"",content:s.content||"",contentBlocks:s.contentBlocks||[],coverImageUrl:s.coverImageUrl||"",status:s.status,metaTitle:s.metaTitle||"",metaDescription:s.metaDescription||""}),s.contentBlocks&&s.contentBlocks.length>0){b(s.contentBlocks);const r=Math.max(...s.contentBlocks.map(a=>a.id),0);U(r+1)}}catch(t){console.error("Failed to fetch post:",t),u("/admin/blog")}finally{E(!1)}},T=t=>t.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").trim(),O=t=>{c(s=>({...s,title:t,slug:s.slug||T(t)}))},M=t=>{const s={marginTop:40,marginBottom:40,borderRadius:8};t==="sidebyside"&&(s.imagePosition="left"),t==="section"&&(s.accentColor="#f39c12"),t==="text"&&(s.fontSize=17,s.fontWeight="400",s.textAlign="left",s.textColor="#555555");const r={id:L,type:t,...s};b(a=>[...a,r]),U(a=>a+1),F(!1)},k=t=>{b(s=>s.filter(r=>r.id!==t))},i=(t,s,r)=>{b(a=>a.map(g=>g.id===t?{...g,[s]:r}:g))},v=(t,s)=>{const r=s.target.files?.[0];if(r){const a=new FileReader;a.onload=g=>{i(t,"imageUrl",g.target?.result)},a.readAsDataURL(r)}},R=n.useCallback(()=>{const t=`
2<style>
3  .blog-container { max-width: 1200px; margin: 0 auto; padding: 20px; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; line-height: 1.6; color: #333; }
4  .hero-image { width: 100%; margin-bottom: 40px; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.2); }
5  .hero-image img { width: 100%; height: auto; display: block; }
6  .intro-section { background-color: #fff; padding: 30px; margin-bottom: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
7  .intro-section h2 { font-size: 2rem; color: #2c3e50; margin-bottom: 15px;
7 border-bottom: 3px solid #f39c12; padding-bottom: 10px; }
8  .intro-section p { font-size: 1.1rem; line-height: 1.8; color: #555; }
9  .feature-card { background-color: #fff; margin-bottom: 40px; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
10  .feature-card img { width: 100%; height: auto; display: block; object-fit: cover; }
11  .feature-card-content { padding: 30px; }
12  .feature-card h2 { font-size: 2rem; color: #2c3e50; margin-bottom: 15px; border-bottom: 3px solid #f39c12; padding-bottom: 10px; }
13  .feature-card p { font-size: 1.1rem; line-height: 1.8; color: #555; }
14  .section-header { background-color: #fff; padding: 30px; margin-bottom: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
15  .section-header h2 { font-size: 2rem; margin-bottom: 30px; }
16  .sidebyside { display: flex; align-items: center; gap: 30px; margin-bottom: 40px; padding-bottom: 40px; border-bottom: 2px solid #e0e0e0; }
17  .sidebyside.image-right { flex-direction: row-reverse; }
18  .sidebyside-image { flex: 0 0 300px; max-width: 300px; }
19  .sidebyside-image img { width: 100%; height: auto; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
20  .sidebyside-content { flex: 1; }
21  .sidebyside-content h3 { font-size: 1.5rem; color: #2c3e50; margin-bottom: 10px; }
22  .sidebyside-content p { font-size: 1.1rem; line-height: 1.8; color: #555; }
23  .closing-section { background-color: #1a1a1a; color: #fff; padding: 40px; text-align: center; border-radius: 8px; margin-top: 40px; }
24  .closing-section img { margin: 20px auto; max-width: 100%; border-radius: 8px; }
25  .text-block { margin-bottom: 30px; }
26  .standalone-image { margin-bottom: 30px; text-align: center; }
27  .standalone-image img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
28  @media (max-width: 768px) {
29    .sidebyside { flex-direction: column !important; }
30    .sidebyside-image { flex: 1; max-width: 100%; }
31  }
32</style>`,s=h.map(r=>{switch(r.type){case"hero":return r.imageUrl?`<div class="hero-image" style="margin-top: ${r.marginTop||0}px; margin-bottom: ${r.marginBottom||40}px; border-radius: ${r.borderRadius||8}px;"><img src="${r.imageUrl}" alt="${r.content||""}" /></div>`:"";case"intro":return`<article class="intro-section" style="margin-top: ${r.marginTop||0}px; margin-bottom: ${r.marginBottom||30}px;">
33  ${r.title?`<h2>${r.title}</h2>`:""}
34  ${r.content?`<p>${r.content.replace(/\n/g,"<br>")}</p>`:""}
35</article>`;case"feature":return`<section class="feature-card" style="margin-top: ${r.marginTop||0}px; margin-bottom: ${r.marginBottom||40}px;">
36  ${r.imageUrl?`<img src="${r.imageUrl}" alt="${r.title||""}" />`:""}
37  <div class="feature-card-content">
38    ${r.title?`<h2>${r.title}</h2>`:""}
39    ${r.description?`<p>${r.description.replace(/\n/g,"<br>")}</p>`:""}
40  </div>
41</section>`;case"sidebyside":return`<div class="sidebyside ${r.imagePosition==="right"?"image-right":""}" style="margin-top: ${r.marginTop||0}px; margin-bottom: ${r.marginBottom||40}px;">
42  <div class="sidebyside-image">
43    ${r.imageUrl?`<img src="${r.imageUrl}" alt="${r.title||""}" />`:""}
44  </div>
45  <div class="sidebyside-content">
46    ${r.title?`<h3>${r.title}</h3>`:""}
47    ${r.description?`<p>${r.description.replace(/\n/g,"<br>")}</p>`:""}
48  </div>
49</div>`;case"section":return`<section class="section-header" style="margin-top: ${r.marginTop||0}px; margin-bottom: ${r.marginBottom||40}px;">
50  <h2 style="color: ${r.accentColor||"#f39c12"};">${r.title||"Section Title"}</h2>
51</section>`;case"closing":return`<section class="closing-section" style="margin-top: ${r.marginTop||40}px; margin-bottom: ${r.marginBottom||0}px;">
52  ${r.imageUrl?`<img src="${r.imageUrl}" alt="${r.content||""}" />`:""}
53  ${r.content?`<p>${r.content}</p>`:""}
54</section>`;case"text":return r.content?`<div class="text-block" style="margin-top: ${r.marginTop||0}px; margin-bottom: ${r.marginBottom||30}px;">
55  <p style="font-size: ${r.fontSize||17}px; font-weight: ${r.fontWeight||"400"}; text-align: ${r.textAlign||"left"}; color: ${r.textColor||"#555"}; line-height: 1.8;">${r.content.replace(/\n/g,"<br>")}</p>
56</div>`:"";case"image":return r.imageUrl?`<div class="standalone-image" style="margin-top: ${r.marginTop||0}px; margin-bottom: ${r.marginBottom||30}px; max-width: ${r.maxWidth||100}%; margin-left: auto; margin-right: auto;">
57  <img src="${r.imageUrl}" alt="${r.content||""}" style="border-radius: ${r.borderRadius||8}px;" />
58</div>`:"";default:return""}}).filter(r=>r).join(`
59
60`);return t+`
61<div class="blog-container">
62`+s+`
63</div>`},[h]),D=async(t=!1)=>
63{if(!o.title.trim()){alert("Please enter a title");return}try{B(!0);const s=R(),r={title:o.title,slug:o.slug||T(o.title),excerpt:o.excerpt,content:s,contentBlocks:h,coverImageUrl:o.coverImageUrl||null,status:t?"published":o.status,metaTitle:o.metaTitle||null,metaDescription:o.metaDescription||null};if(x){const a=await C.post("/blog",r);u(`/admin/blog/${a.data.id}/edit`)}else await C.put(`/blog/${d}`,r);t&&alert("Post published!")}catch(s){console.error("Failed to save post:",s),alert("Failed to save post")}finally{B(!1)}},H=t=>{w(t)},V=(t,s)=>{if(t.preventDefault(),f===null||f===s)return;const r=[...h],a=r[f];r.splice(f,1),r.splice(s,0,a),b(r),w(s)},_=()=>{w(null)},G=(t,s)=>{const r=j[t.type].icon;return e.jsxs("div",{draggable:!0,onDragStart:()=>H(s),onDragOver:a=>V(a,s),onDragEnd:_,className:`bg-surface-2 bg-surface border border-border rounded-lg p-4 transition-all ${f===s?"opacity-50 scale-95":""}`,children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"cursor-grab text-text-muted hover:text-text-muted",children:e.jsx(Q,{className:"w-5 h-5"})}),e.jsxs("span",{className:"flex items-center gap-2 font-medium text-text",children:[e.jsx(r,{className:"w-4 h-4"}),j[t.type].label]})]}),e.jsx(m,{onClick:()=>k(t.id),className:"p-1 text-danger hover:text-danger",children:e.jsx(X,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"space-y-3",children:[t.type==="hero"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Image URL"}),e.jsx(l,{type:"url",value:t.imageUrl?.startsWith("data:")?"":t.imageUrl||"",onChange:a=>i(t.id,"imageUrl",a.target.value),placeholder:"https://...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Or upload image"}),e.jsx(l,{type:"file",accept:"image/*",onChange:a=>v(t.id,a),className:"w-full text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Alt text"}),e.jsx(l,{type:"text",value:t.content||"",onChange:a=>i(t.id,"content",a.target.value),className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),t.imageUrl&&e.jsx("img",{src:t.imageUrl,alt:"",className:"max-w-full h-auto rounded-lg max-h-32 object-contain"})]}),t.type==="intro"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Heading"}),e.jsx(l,{type:"text",value:t.title||"",onChange:a=>i(t.id,"title",a.target.value),placeholder:"Section heading...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Content"}),e.jsx(p,{value:t.content||"",onChange:a=>i(t.id,"content",a.target.value),rows:4,placeholder:"Introduction text...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm resize-none"})]})]}),t.type==="feature"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Image URL"}),e.jsx(l,{type:"url",value:t.imageUrl?.startsWith("data:")?"":t.imageUrl||"",onChange:a=>i(t.id,"imageUrl",a.target.value),placeholder:"https://...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Or upload image"}),e.jsx(l,{type:"file",accept:"image/*",onChange:a=>v(t.id,a),className:"w-full text-sm"})]}),t.imageUrl&&e.jsx("img",{src:t.imageUrl,alt:"",className:"max-w-full h-auto rounded-lg max-h-32 object-contain"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Title"}),e.jsx(l,{type:"text",value:t.title||"",onChange:a=>i(t.id,"title",a.target.value),placeholder:"Feature title...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Description"}),e.jsx(p,{value:t.description||"",onChange:a=>
63i(t.id,"description",a.target.value),rows:4,placeholder:"Feature description...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm resize-none"})]})]}),t.type==="sidebyside"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-2 gap-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Image Position"}),e.jsxs($,{value:t.imagePosition||"left",onChange:a=>i(t.id,"imagePosition",a.target.value),className:"w-full px-3 py-2 border border-border rounded-lg text-sm",children:[e.jsx("option",{value:"left",children:"Image Left"}),e.jsx("option",{value:"right",children:"Image Right"})]})]})}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Image URL"}),e.jsx(l,{type:"url",value:t.imageUrl?.startsWith("data:")?"":t.imageUrl||"",onChange:a=>i(t.id,"imageUrl",a.target.value),placeholder:"https://...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Or upload image"}),e.jsx(l,{type:"file",accept:"image/*",onChange:a=>v(t.id,a),className:"w-full text-sm"})]}),t.imageUrl&&e.jsx("img",{src:t.imageUrl,alt:"",className:"max-w-full h-auto rounded-lg max-h-24 object-contain"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Title"}),e.jsx(l,{type:"text",value:t.title||"",onChange:a=>i(t.id,"title",a.target.value),placeholder:"Item title...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Description"}),e.jsx(p,{value:t.description||"",onChange:a=>i(t.id,"description",a.target.value),rows:3,placeholder:"Item description...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm resize-none"})]})]}),t.type==="section"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Section Title"}),e.jsx(l,{type:"text",value:t.title||"",onChange:a=>i(t.id,"title",a.target.value),placeholder:"Section title...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Accent Color"}),e.jsx(l,{type:"color",value:t.accentColor||"#f39c12",onChange:a=>i(t.id,"accentColor",a.target.value),className:"w-20 h-8 rounded cursor-pointer"})]})]}),t.type==="closing"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Image URL"}),e.jsx(l,{type:"url",value:t.imageUrl?.startsWith("data:")?"":t.imageUrl||"",onChange:a=>i(t.id,"imageUrl",a.target.value),placeholder:"https://...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Or upload image"}),e.jsx(l,{type:"file",accept:"image/*",onChange:a=>v(t.id,a),className:"w-full text-sm"})]}),t.imageUrl&&e.jsx("img",{src:t.imageUrl,alt:"",className:"max-w-full h-auto rounded-lg max-h-24 object-contain"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Closing text"}),e.jsx(p,{value:t.content||"",onChange:a=>i(t.id,"content",a.target.value),rows:2,placeholder:"Optional closing message...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm resize-none"})]})]}),t.type==="text"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsx(p,{value:t.content||"",onChange:a=>i(t.id,"content",a.target.value),rows:4,placeholder:"Enter text...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm resize-none"})}),e.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs text-text-subtle mb-1",children:["Size: ",t.fontSize||17,"px"]}),e.jsx(l,{type:"range",min:"12",max:"32",value:t.fontSize||17,onChange:a=>
63i(t.id,"fontSize",parseInt(a.target.value)),className:"w-full"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-subtle mb-1",children:"Weight"}),e.jsxs($,{value:t.fontWeight||"400",onChange:a=>i(t.id,"fontWeight",a.target.value),className:"w-full px-2 py-1 border border-border rounded text-xs",children:[e.jsx("option",{value:"400",children:"Normal"}),e.jsx("option",{value:"600",children:"Semi-Bold"}),e.jsx("option",{value:"700",children:"Bold"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-subtle mb-1",children:"Align"}),e.jsxs($,{value:t.textAlign||"left",onChange:a=>i(t.id,"textAlign",a.target.value),className:"w-full px-2 py-1 border border-border rounded text-xs",children:[e.jsx("option",{value:"left",children:"Left"}),e.jsx("option",{value:"center",children:"Center"}),e.jsx("option",{value:"right",children:"Right"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-text-subtle mb-1",children:"Color"}),e.jsx(l,{type:"color",value:t.textColor||"#555555",onChange:a=>i(t.id,"textColor",a.target.value),className:"w-full h-6 rounded cursor-pointer"})]})]})]}),t.type==="image"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Image URL"}),e.jsx(l,{type:"url",value:t.imageUrl?.startsWith("data:")?"":t.imageUrl||"",onChange:a=>i(t.id,"imageUrl",a.target.value),placeholder:"https://...",className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Or upload image"}),e.jsx(l,{type:"file",accept:"image/*",onChange:a=>v(t.id,a),className:"w-full text-sm"})]}),t.imageUrl&&e.jsx("img",{src:t.imageUrl,alt:"",className:"max-w-full h-auto rounded-lg max-h-32 object-contain"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Alt text"}),e.jsx(l,{type:"text",value:t.content||"",onChange:a=>i(t.id,"content",a.target.value),className:"w-full px-3 py-2 border border-border rounded-lg text-sm"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs text-text-subtle mb-1",children:["Max Width: ",t.maxWidth||100,"%"]}),e.jsx(l,{type:"range",min:"20",max:"100",value:t.maxWidth||100,onChange:a=>i(t.id,"maxWidth",parseInt(a.target.value)),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs text-text-subtle mb-1",children:["Border Radius: ",t.borderRadius||8,"px"]}),e.jsx(l,{type:"range",min:"0",max:"30",value:t.borderRadius||8,onChange:a=>i(t.id,"borderRadius",parseInt(a.target.value)),className:"w-full"})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-3 border-t border-border",children:[e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs text-text-subtle mb-1",children:["Top: ",t.marginTop||0,"px"]}),e.jsx(l,{type:"range",min:"0",max:"80",value:t.marginTop||0,onChange:a=>i(t.id,"marginTop",parseInt(a.target.value)),className:"w-full"})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"block text-xs text-text-subtle mb-1",children:["Bottom: ",t.marginBottom||40,"px"]}),e.jsx(l,{type:"range",min:"0",max:"80",value:t.marginBottom||40,onChange:a=>i(t.id,"marginBottom",parseInt(a.target.value)),className:"w-full"})]})]})]})]},t.id)};return W?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):e.jsxs("div",{className:"min-h-screen bg-surface-2 bg-surface",children:[e.jsx("div",{className:"bg-surface border-b border-border px-6 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(m,{onClick:()=>u("/admin/blog"),className:"p-2 hover:bg-surface-2 rounded-lg text-text-muted",children:e.jsx(Y,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-text",children:x?"New Blog Post":"Edit Blog Post"}),o.status==="published"&&e.jsx("span",{className:"text-xs text-primary",children:"Published"})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[!x&&e.jsxs("a",{href:`/blog/${o.slug}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2 border border-border rounded-lg hover:bg-surface-2 text-text",children:[e.jsx(Z,{className:"w-4 h-4"}),"Preview"]}),e.jsx(m,{onClick:()=>D(!1),disabled:N,className:"px-4 py-2 border border-border rounded-lg hover:bg-surface-2 text-text disabled:opacity-50",children:N?"Saving...":"Save Draft"}),e.jsxs(m,{onClick:()=>D(!0),disabled:N,className:"flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary disabled:opacity-50",children:[e.jsx(K,{className:"w-4 h-4"}
63),o.status==="published"?"Update":"Publish"]})]})]})}),e.jsx("div",{className:"bg-surface border-b border-border px-6",children:e.jsxs("div",{className:"flex gap-6",children:[e.jsx(m,{onClick:()=>I("content"),className:`py-3 border-b-2 font-medium text-sm ${y==="content"?"border-primary text-primary":"border-transparent text-text-subtle text-text-muted hover:text-text"}`,children:"Content"}),e.jsx(m,{onClick:()=>I("settings"),className:`py-3 border-b-2 font-medium text-sm ${y==="settings"?"border-primary text-primary":"border-transparent text-text-subtle text-text-muted hover:text-text"}`,children:"Settings"})]})}),e.jsx("div",{className:"p-6 h-[calc(100vh-140px)]",children:y==="content"?e.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[e.jsxs("div",{className:"flex flex-col gap-6 h-full overflow-hidden",children:[e.jsxs("div",{className:"bg-surface rounded-lg p-6 shadow-sm flex-shrink-0",children:[e.jsx("label",{className:"block text-sm font-medium text-text mb-2",children:"Post Title"}),e.jsx(l,{type:"text",value:o.title,onChange:t=>O(t.target.value),placeholder:"Enter post title...",className:"w-full px-4 py-3 text-xl font-semibold border border-border bg-surface text-text rounded-lg focus:ring-ring focus:border-primary"})]}),e.jsxs("div",{className:"bg-surface rounded-lg p-6 shadow-sm flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 flex-shrink-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-text",children:"Content Blocks"}),e.jsxs("span",{className:"text-sm text-text-subtle text-text-muted",children:[h.length," blocks"]})]}),e.jsx("div",{className:"space-y-4 overflow-y-auto pr-2 flex-1",children:h.map((t,s)=>G(t,s))}),e.jsxs("div",{className:"mt-4 flex-shrink-0",children:[e.jsx(m,{onClick:()=>F(!S),className:"!h-auto w-full flex items-center justify-center gap-2 px-4 py-3 border-2 border-dashed border-border rounded-lg text-text-muted hover:border-primary hover:text-primary transition-colors",children:"+ Add Block"}),S&&e.jsx("div",{className:"mt-3 grid grid-cols-2 gap-2 p-4 bg-surface-2 bg-surface rounded-lg border border-border",children:Object.keys(j).map(t=>{const{label:s,icon:r,description:a}=j[t];return e.jsxs(m,{onClick:()=>M(t),className:"!h-auto min-h-[88px] flex items-start gap-3 p-3 bg-surface rounded-lg border border-border hover:border-primary hover:bg-primary-soft transition-colors text-left",children:[e.jsx(r,{className:"w-5 h-5 text-text-subtle text-text-muted mt-0.5"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-text text-sm",children:s}),e.jsx("div",{className:"text-xs text-text-subtle text-text-muted",children:a})]})]},t)})})]})]})]}),e.jsxs("div",{className:"bg-surface rounded-lg shadow-sm overflow-hidden flex flex-col h-full",children:[e.jsx("div",{className:"bg-surface-2 bg-surface px-4 py-3 border-b border-border flex-shrink-0",children:e.jsx("h3",{className:"font-semibold text-text",children:"Preview"})}),e.jsx("div",{className:"overflow-y-auto bg-surface-2 bg-surface flex-1",children:e.jsxs("div",{className:"p-4",children:[o.title&&e.jsx("div",{className:"bg-surface-3 text-primary-foreground text-center py-8 px-4 mb-4 rounded-lg",children:e.jsx("h1",{className:"text-2xl font-bold",children:o.title})}),e.jsx("div",{className:"prose max-w-none",dangerouslySetInnerHTML:{__html:R()}})]})})]})]}):e.jsx("div",{className:"max-w-2xl",children:e.jsxs("div",{className:"bg-surface rounded-lg p-6 shadow-sm space-y-6",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text mb-2",children:"Slug (URL)"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"text-text-subtle text-text-muted mr-1",children:"/blog/"}),e.jsx(l,{type:"text",value:o.slug,onChange:t=>c(s=>({...s,slug:t.target.value})),className:"flex-1 px-3 py-2 border border-border bg-surface text-text rounded-lg focus:ring-ring focus:border-primary"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text mb-2",children:"Excerpt"}),e.jsx(p,{value:o.excerpt,onChange:t=>c(s=>({...s,excerpt:t.target.value})),rows:3,placeholder:"Brief summary shown in blog listing...",className:"w-full px-3 py-2 border border-border bg-surface text-text rounded-lg focus:ring-ring focus:border-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text mb-2",children:"Cover Image URL"}),e.jsx(l,{type:"url",value:o.coverImageUrl?.startsWith("data:")?"":o.coverImageUrl,onChange:t=>c(s=>({...s,coverImageUrl:t.target.value})),placeholder:"https://...",className:"w-full px-3 py-2 border border-border bg-surface text-text rounded-lg focus:ring-ring focus:border-primary"}),e.jsxs("div",{className:"mt-2",children:[e.jsx("label",{className:"block text-sm text-text-muted mb-1",children:"Or upload image"}),e.jsx(l,{type:"file",accept:"image/*",onChange:t=>{const s=t.target.files?.[0];if(s){const r=new FileReader;r.onload=a=>{c(g=>({...g,coverImageUrl:a.target?.result}))}
63,r.readAsDataURL(s)}},className:"w-full text-sm"})]}),o.coverImageUrl&&e.jsx("img",{src:o.coverImageUrl,alt:"",className:"mt-2 max-h-40 rounded-lg"})]}),e.jsxs("div",{className:"pt-4 border-t border-border",children:[e.jsx("h4",{className:"font-medium text-text mb-4",children:"SEO Settings"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text mb-2",children:"Meta Title"}),e.jsx(l,{type:"text",value:o.metaTitle,onChange:t=>c(s=>({...s,metaTitle:t.target.value})),placeholder:o.title||"Page title for search engines",className:"w-full px-3 py-2 border border-border bg-surface text-text rounded-lg focus:ring-ring focus:border-primary"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-text mb-2",children:"Meta Description"}),e.jsx(p,{value:o.metaDescription,onChange:t=>c(s=>({...s,metaDescription:t.target.value})),rows:2,placeholder:"Description for search engine results...",className:"w-full px-3 py-2 border border-border bg-surface text-text rounded-lg focus:ring-ring focus:border-primary"})]})]})]})]})})})]})}export{fe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.