1import{_ as fe}from"./Ckx1e21f.js";import{g as Z,h as ae,i as J,e as xe,u as ve,j as p,k as ke,c as u,l as k,m as i,a as t,f as we,b as H,w as O,d as T,t as m,n as B,q as E,v as I,F as te,r as se,s as Ce,o as g,x as _e,y as X}from"./Cl-Y4suh.js";const Te=()=>{const P=Z("auth_status",()=>"loading"),v=Z("auth_user",()=>null),D=Z("auth_configured",()=>!0),N=async()=>{var w;try{const A=await $fetch("/api/auth/session");A.authenticated?(P.value="authenticated",v.value=A.user):(P.value="unauthenticated",v.value=null)}catch(A){console.error("Error fetching session:",A),P.value="unauthenticated",v.value=null,(w=A==null?void 0:A.message)!=null&&w.includes("OAuth not configured")&&(D.value=!1)}},V=()=>{window.location.href="/api/auth/login"},G=async()=>{try{await $fetch("/api/auth/logout",{method:"POST"}),P.value="unauthenticated",v.value=null,window.location.href="/"}catch(w){console.error("Error signing out:",w)}};return ae(()=>{N()}),{status:J(P),user:J(v),isConfigured:J(D),signIn:V,signOut:G,refresh:N}},Ae={class:"min-h-screen bg-gray-50 dark:bg-[#08090a]"},$e={key:0,class:"flex items-center justify-center min-h-screen px-4"},Ee={class:"max-w-2xl w-full"},Ue={class:"bg-yellow-50 dark:bg-yellow-900/20 border-2 border-yellow-400 dark:border-yellow-600 rounded-lg shadow-lg p-8"},Ie={class:"mt-6 text-center"},Se={key:1,class:"flex items-center justify-center min-h-screen"},Pe={key:2,class:"flex items-center justify-center min-h-screen"},Le={class:"max-w-md w-full mx-4"},Me={class:"bg-white dark:bg-[#0f1113] rounded-lg shadow-xl p-8"},De=["disabled"],Fe={key:0,class:"w-6 h-6",fill:"currentColor",viewBox:"0 0 24 24"},Re={key:1,class:"animate-spin rounded-full h-6 w-6 border-b-2 border-white"},Be={key:3,class:"container mx-auto px-4 py-8"},Ne={class:"max-w-6xl mx-auto"},je={class:"mb-8 flex justify-between items-center"},ze={class:"text-gray-600 dark:text-gray-400"},He={class:"font-semibold"},Oe={class:"flex gap-3"},Ve={class:"mb-6 flex gap-4"},Ge={class:"bg-white dark:bg-[#0f1113] rounded-lg shadow-xl max-w-4xl w-full my-8"},qe={class:"p-6"},We={class:"flex justify-between items-center mb-6"},Ye={class:"text-2xl font-bold text-gray-900 dark:text-white"},Ke={class:"grid grid-cols-2 gap-4"},Ze={class:"grid grid-cols-2 gap-4"},Je={class:"space-y-2"},Xe=["disabled"],Qe=["disabled"],et={key:0,class:"text-sm text-gray-600 dark:text-gray-400 truncate"},tt={key:1,class:"text-sm text-red-600 dark:text-red-400"},st={key:0,class:"mt-4"},at={class:"relative w-full max-w-md"},ot=["src","alt"],lt={class:"mt-6"},rt={class:"flex items-center justify-between mb-4"},it=["disabled"],nt={key:0,class:"space-y-4 mt-4"},dt={class:"flex flex-col lg:flex-row gap-4"},ut={class:"flex-1 min-w-0"},gt=["onChange","disabled"],ct=["onClick","disabled"],mt={key:0,class:"text-sm text-gray-600 dark:text-gray-400 truncate mt-2 break-all"},pt={key:1,class:"text-sm text-red-600 dark:text-red-400 mt-1"},bt={key:2,class:"mt-3"},yt={class:"relative w-full max-w-md"},ht=["src","alt"],ft={class:"flex-1 min-w-0 lg:max-w-xs"},xt=["onUpdate:modelValue","onInput"],vt={class:"text-sm text-gray-500 dark:text-gray-400 mt-2"},kt={class:"bg-gray-200 dark:bg-[#0f1113] px-1.5 py-0.5 rounded text-xs font-mono"},wt={class:"flex items-start lg:items-center"},Ct=["onClick"],_t={key:1,class:"text-center py-8 border border-gray-300 dark:border-white/15 rounded-lg bg-gray-50 dark:bg-white/5/50"},Tt={class:"grid grid-cols-2 gap-4"},At={class:"flex items-center pt-8"},$t={class:"flex items-center cursor-pointer"},Et={class:"flex gap-4 pt-4"},Ut={type:"submit",class:"px-6 py-3 bg-emerald-600 hover:bg-emerald-700 text-white font-semibold rounded-lg transition-colors"},It={class:"bg-white dark:bg-[#0f1113] rounded-lg shadow-lg overflow-hidden"},St={class:"p-6"},Pt={key:0,class:"text-center py-8"},Lt={key:1,class:"text-center py-8"},Mt={key:2,class:"space-y-4"},Dt={class:"flex justify-between items-start"},Ft={class:"flex-1"},Rt={class:"flex items-center gap-2 mb-2"},Bt={class:"text-lg font-semibold text-gray-900 dark:text-white"},Nt={key:0,class:"px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},jt={key:1,class:"px-2 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"},zt={key:2,class:"px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"},Ht={class:"text-gray-600 dark:text-gray-400 text-sm mb-2"},Ot={class:"flex gap-4 text-sm text-gray-500 dark:text-gray-400"},Vt={class:"flex gap-2 ml-4"},Gt=["onClick"],qt=["onClick","disabled"],Wt=["onClick","disabled"],Zt=xe({__name:"admin",setup(P){ve({title:"Content Manager - Respond Capture",meta:[{name:"robots",content:"noindex, nofollow"}]});const{status:v,user:D,isConfigured:N,signIn:V,signOut:G}=Te(),w=p(!1);async function A(){try{w.value=!0,console.log("Starting GitHub OAuth sign in..."),V()}catch(a){console.error("Sign in error:",a),alert("Failed to sign in. Please try again.")}finally{w.value=!1}}const q=p(!1),C=p(null),W=p(!0),j=p([]),L=p(!1),$=p(""),F=p(!1),Y=p(null),z=p(!1),K=p(!1),Q=p({}),f=p({}),y=p({}),r=p({title:"",description:"",category:"Recruitment & Retention",author:"Respond Capture Team",date:"",image:"",images:[],tags:"",featured:!1,body:""}),S=async()=>{W.value=!0;try{const a=await $fetch("/api/insights/all",{method:"GET",headers:{"Cache-Control":"no-cache"},query:{_t:Date.now()}});if(a.success)j.value=a.data,console.log("[Admin] Loaded posts:",j.value.length);else{console.error("Error loading posts:",a.error,a.details);const e=a.details?`${a.error}: ${a.details}`:a.error||"Unknown error";alert(`Error loading posts: ${e} 2 3Please check: 41. AWS credentials are configured 52. DynamoDB table exists 63. Network connection is stable`)}}catch(a){console.error("Error loading posts:",a);const e=a.message||a.toString()||"Network error";alert(`Error loading posts: ${e} 7 8Please refresh the page or check your connection.`)}finally{W.value=!1}},R=a=>{if(!a.meta.date)return!1;const e=new Date(a.meta.date);if(isNaN(e.getTime()))return!1;const n=new Date,l=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate(),23,59,59,999));return e>l},oe=a=>{if(!a)return"Date not available";const e=new Date(a);if(isNaN(e.getTime()))return"Invalid date";const n=e.getUTCFullYear(),l=e.getUTCMonth(),o=e.getUTCDate();return new Date(Date.UTC(n,l,o)).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"})},le=a=>{C.value=a;let e="";if(a.meta.date){const n=new Date(a.meta.date);if(!isNaN(n.getTime())){const l=n.getUTCFullYear(),o=String(n.getUTCMonth()+1).padStart(2,"0"),s=String(n.getUTCDate()).padStart(2,"0");e=`${l}-${o}
8-${s}`}}r.value={title:a.title,description:a.description,category:a.meta.category,author:a.meta.author,date:e,image:a.meta.image||"",images:a.meta.images||[],tags:a.meta.tags?a.meta.tags.join(", "):"",featured:a.meta.featured||!1,body:a.body},f.value={},y.value={}},M=()=>{q.value=!1,C.value=null,$.value="",F.value=!1,f.value={},y.value={},r.value={title:"",description:"",category:"Recruitment & Retention",author:"Respond Capture Team",date:"",image:"",images:[],tags:"",featured:!1,body:""}},re=async a=>{var o;const e=a.target,n=(o=e.files)==null?void 0:o[0];if(!n)return;if(!n.type.startsWith("image/")){$.value="Please select an image file";return}const l=5*1024*1024;if(n.size>l){$.value="Image size must be less than 5MB";return}$.value="",L.value=!0;try{console.log("[Admin] Uploading file:",n.name,"size:",n.size,"type:",n.type),console.log("[Admin] Getting presigned URL...");const s=await $fetch("/api/upload/presigned",{method:"GET",query:{filename:n.name,contentType:n.type||"image/jpeg"}}).catch(h=>{throw console.error("[Admin] Error getting presigned URL:",h),new Error(`Failed to get upload URL: ${h.message||"Network error"}`)});if(!s.success)throw new Error(s.error||"Failed to get upload URL");const{uploadUrl:d,publicUrl:c}=s.data;console.log("[Admin] Got presigned URL, uploading directly to S3...");const b=await fetch(d,{method:"PUT",body:n,headers:{"Content-Type":n.type||"image/jpeg"}});if(!b.ok){const h=await b.text();throw new Error(`S3 upload failed: ${b.status} ${b.statusText} - ${h}`)}console.log("[Admin] Upload successful! Public URL:",c),r.value.image=c,F.value=!1,$.value=""}catch(s){console.error("Upload error:",s);const d=s.message||"Failed to upload image. Please try again.";$.value=d,alert(`Image upload failed: ${d} 9 10Check browser console for details.`)}finally{L.value=!1,e&&(e.value="")}},ie=()=>{r.value.image="",F.value=!1,$.value=""},ne=async()=>{console.log("[Admin] addImageUpload called, current images:",r.value.images),(!r.value.images||!Array.isArray(r.value.images))&&(r.value.images=[]);const e=`image${r.value.images.length+1}`,n={tag:e,url:""};r.value.images=[...r.value.images,n];const l=r.value.images.length-1;console.log("[Admin] Added image, new images array:",r.value.images),console.log("[Admin] Images length:",r.value.images.length),console.log("[Admin] New image tag:",e),console.log("[Admin] New image index:",l),await X(),setTimeout(()=>{ee(l)},100)},de=a=>{r.value.images.splice(a,1),delete f.value[a],delete y.value[a];const e={},n={};Object.keys(f.value).forEach(l=>{const o=parseInt(l);o>a?(e[o-1]=f.value[o],n[o-1]=y.value[o]||""):o<a&&(e[o]=f.value[o],n[o]=y.value[o]||"")}),f.value=e,y.value=n},ue=async(a,e)=>{var s;const n=a.target,l=(s=n.files)==null?void 0:s[0];if(!l)return;if(!l.type.startsWith("image/")){y.value[e]="Please select an image file";return}const o=5*1024*1024;if(l.size>o){y.value[e]="Image size must be less than 5MB";return}y.value[e]="",f.value[e]=!0;try{console.log("[Admin] Uploading additional image:",l.name,"size:",l.size,"type:",l.type);const d=await $fetch("/api/upload/presigned",{method:"GET",query:{filename:l.name,contentType:l.type||"image/jpeg"}}
10).catch(U=>{throw console.error("[Admin] Error getting presigned URL:",U),new Error(`Failed to get upload URL: ${U.message||"Network error"}`)});if(!d.success)throw new Error(d.error||"Failed to get upload URL");const{uploadUrl:c,publicUrl:b}=d.data;console.log("[Admin] Got presigned URL, uploading directly to S3...");const h=await fetch(c,{method:"PUT",body:l,headers:{"Content-Type":l.type||"image/jpeg"}});if(!h.ok){const U=await h.text();throw new Error(`S3 upload failed: ${h.status} ${h.statusText} - ${U}`)}console.log("[Admin] Upload successful! Public URL:",b),r.value.images[e]&&(r.value.images[e].url=b),y.value[e]=""}catch(d){console.error("Upload error:",d);const c=d.message||"Failed to upload image. Please try again.";y.value[e]=c,alert(`Image upload failed: ${c} 11 12Check browser console for details.`)}finally{f.value[e]=!1,n&&(n.value="")}},ge=(a,e)=>{a&&a instanceof HTMLInputElement&&(Q.value[e]=a,console.log("[Admin] Set file input ref for index",e))},ee=a=>{console.log("[Admin] triggerImageFileInput called for index:",a),X(()=>{var n;const e=Q.value[a];if(console.log("[Admin] Input from refs:",e),e&&e instanceof HTMLInputElement&&!e.disabled){console.log("[Admin] Clicking input from refs"),e.click();return}{const l=document.querySelectorAll('input[type="file"][accept="image/*"]');console.log("[Admin] Found",l.length,"file inputs");const o=(n=document.querySelector('[class*="Additional Images"]'))==null?void 0:n.closest(".mt-6");if(o){const s=o.querySelectorAll('input[type="file"][accept="image/*"]');if(console.log("[Admin] Found",s.length,"inputs in additional images section"),s[a]&&s[a]instanceof HTMLInputElement){const d=s[a];if(!d.disabled){console.log("[Admin] Clicking input from section at index",a),d.click();return}}}if(l.length>a+1){const s=l[a+1];if(s&&!s.disabled){console.log("[Admin] Clicking input by offset from hero image"),s.click();return}}console.warn("[Admin] Could not find file input for index",a)}})},ce=a=>{const e=r.value.images[a];e&&e.tag&&(e.tag=e.tag.replace(/[^a-zA-Z0-9_]/g,"").toLowerCase(),e.tag&&!/^[a-zA-Z0-9]/.test(e.tag)&&(e.tag=`image${a+1}`))},me=a=>{a&&(a.preventDefault(),a.stopPropagation()),X(()=>{if(console.log("[Admin] triggerFileInput called"),Y.value){console.log("[Admin] Using ref to click file input");const e=Y.value;if(e&&!e.disabled){e.click();return}}{const e=document.querySelector('input[type="file"][accept="image/*"]');e&&!e.disabled?(console.log("[Admin] Found file input via DOM query, clicking..."),e.click()):console.error("[Admin] File input not found or disabled!",{inputExists:!!e,disabled:e==null?void 0:e.disabled})}})},pe=async a=>{if(confirm(`Are you sure you want to publish "${a.title}"? 13 14This will make the post visible on the production website (www.respondcapture.com). 15 16Draft posts are already visible on localhost and dev environments for review.`)){z.value=!0;try{const e=await $fetch(`/api/insights/${a.slug}/publish`,{method:"POST"});e.success?(alert(`â ${e.data.message} 17 18The post is now live on production!`),await S()):alert(`â Failed to publish: ${e.error} 19 20${e.details||""}`)}catch(e){console.error("Error publishing post:",e),alert("â Failed to publish post. Please check the console for details.")}finally{z.value=!1}}},be=async()=>{var a,e,n,l;try{let o;const s=r.value.tags?r.value.tags.split(",").map(x=>x.trim()).filter(x=>x):[],d=((a=r.value.images)==null?void 0:a.filter(x=>x.url&&x.tag))||[],c={title:r.value.title,description:r.value.description,category:r.value.category,author:r.value.author,date:r.value.date||void 0,image:r.value.image||void 0,images:d.length>0?d:void 0,tags:s,featured:r.value.featured,body:r.value.body},b=JSON.stringify(c).length,h=(b/1024).toFixed(2),U=(b/(1024*1024)).toFixed(2);console.log("[Admin] Attempting to save post:",{isEdit:!!C.value,slug:(e=C.value)==null?void 0:e.slug,bodySize:`${b} bytes (${h} KB, ${U} MB)`,exceedsCloudFrontLimit:b>1048576,cookies:document.cookie,hasCookie:document.cookie.includes("auth_session"),userAgent:navigator.userAgent,cookieEnabled:navigator.cookieEnabled}),C.value?o=await $fetch(`/api/insights/${C.value.slug}`,{method:"POST",body:c,credentials:"include"}):o=await $fetch("/api/insights",{method:"POST",body:c,credentials:"include"}),o.success?(alert(o.data.message),M(),await new Promise(x=>setTimeout(x,100)),await S()):alert(`Error: ${o.error}`)}catch(o){console.error("Error saving post:",o),console.error("Error details:",{message:o==null?void 0:o.message,status:(o==null?void 0:o.statusCode)||(o==null?void 0:o.status),statusText:o==null?void 0:o.statusText,data:o==null?void 0:o.data,cause:o==null?void 0:o.cause,response:o==null?void 0:o.response});let s="Error saving post. Please try again.";const d=(o==null?void 0:o.statusCode)||(o==null?void 0:o.status)||((n=o==null?void 0:o.response)==null?void 0:n.status);d===401||d===403?(s=`Authentication error (${d}). Your session may have expired. Please sign out and sign in again.`,console.error("Auth error - session may be invalid. Cookie
20:",document.cookie.includes("auth_session"))):(l=o==null?void 0:o.data)!=null&&l.error?(s=`Error: ${o.data.error}`,o.data.details&&(s+=` 21 22Details: ${o.data.details}`)):o!=null&&o.message&&(s=`Error: ${o.message}`),alert(s)}},ye=async()=>{var a,e,n;try{let l;const o=r.value.tags?r.value.tags.split(",").map(_=>_.trim()).filter(_=>_):[],s=((a=r.value.images)==null?void 0:a.filter(_=>_.url&&_.tag))||[],d={title:r.value.title,description:r.value.description,category:r.value.category,author:r.value.author,date:r.value.date||void 0,image:r.value.image||void 0,images:s.length>0?s:void 0,tags:o,featured:r.value.featured,body:r.value.body},c=JSON.stringify(d).length,b=(c/1024).toFixed(2),h=(c/(1024*1024)).toFixed(2);if(console.log("[Admin] Attempting to save and publish post:",{bodySize:`${c} bytes (${b} KB, ${h} MB)`,exceedsCloudFrontLimit:c>1048576,cookies:document.cookie,hasCookie:document.cookie.includes("auth_session"),userAgent:navigator.userAgent,cookieEnabled:navigator.cookieEnabled}),l=await $fetch("/api/insights",{method:"POST",body:d,credentials:"include"}),!l.success){alert(`Error creating post: ${l.error}`);return}const U=l.data.slug;await new Promise(_=>setTimeout(_,100));const x=await $fetch(`/api/insights/${U}/publish`,{method:"POST",credentials:"include"});x.success?(alert(`â Blog post published successfully! 23 24The post is now live on production!`),M(),await new Promise(_=>setTimeout(_,100)),await S()):(alert(`â Post was created as draft but failed to publish: ${x.error} 25 26${x.details||""} 27 28You can publish it manually from the post list.`),M(),await S())}catch(l){console.error("Error saving and publishing post:",l),console.error("Error details:",{message:l==null?void 0:l.message,status:(l==null?void 0:l.statusCode)||(l==null?void 0:l.status),statusText:l==null?void 0:l.statusText,data:l==null?void 0:l.data,cause:l==null?void 0:l.cause,response:l==null?void 0:l.response});let o="Error saving and publishing post. Please try again.";const s=(l==null?void 0:l.statusCode)||(l==null?void 0:l.status)||((e
28=l==null?void 0:l.response)==null?void 0:e.status);s===401||s===403?(o=`Authentication error (${s}). Your session may have expired. Please sign out and sign in again.`,console.error("Auth error - session may be invalid. Cookie:",document.cookie.includes("auth_session"))):(n=l==null?void 0:l.data)!=null&&n.error?(o=`Error: ${l.data.error}`,l.data.details&&(o+=` 29 30Details: ${l.data.details}`)):l!=null&&l.message&&(o=`Error: ${l.message}`),alert(o)}};ae(async()=>{v.value==="authenticated"&&await S()}),ke(v,async a=>{a==="authenticated"&&await S()});const he=async a=>{if(confirm(`Are you sure you want to delete "${a.title}"? 31 32This will permanently remove the blog post file from the content directory.`+(a.meta.published?` 33 34WARNING: This post is published!`:""))){K.value=!0;try{const n=await $fetch(`/api/insights/${a.slug}`,{method:"DELETE"});n.success?(alert(n.message),await S()):alert(`Error: ${n.error||"Failed to delete post"}`)}catch(n){console.error("Error deleting post:",n),alert(`Error deleting post: ${n.message||"Please try again"}`)}finally{K.value=!1}}};return(a,e)=>{var l,o;const n=fe;return g(),u("div",Ae,[i(N)?i(v)==="loading"?(g(),u("div",Se,e[13]||(e[13]=[t("div",{class:"text-center"},[t("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-emerald-600 mx-auto mb-4"}),t("p",{class:"text-gray-600 dark:text-gray-400"},"Loading...")],-1)]))):i(v)==="unauthenticated"?(g(),u("div",Pe,[t("div",Le,[t("div",Me,[e[15]||(e[15]=t("div",{class:"text-center mb-8"},[t("h1",{class:"text-3xl font-bold text-gray-900 dark:text-white mb-2"},"Respond Capture Admin"),t("p",{class:"text-gray-600 dark:text-gray-400"},"Sign in with your GitHub account to manage blog posts")],-1)),t("button",{onClick:A,disabled:i(w),class:"w-full flex items-center justify-center gap-3 px-6 py-3 bg-gray-900 hover:bg-gray-800 dark:bg-white/5 dark:hover:bg-gray-600 text-white font-semibold rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed"},[i(w)?(g(),u("div",Re)):(g(),u("svg",Fe,e[14]||(e[14]=[t("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"},null,-1)]))),T(" "+m(i(w)?"Signing in...":"Sign in with GitHub"),1)],8,De),e[16]||(e[16]=t("div",{class:"mt-6 text-sm text-gray-600 dark:text-gray-400 text-center"},[t("p",null,"Only repository collaborators can access this admin panel.")],-1))])])])):i(v)==="authenticated"?(g(),u("div",Be,[t("div",Ne,[t("div",je,[t("div",null,[e[18]||(e[18]=t("h1",{class:"text-3xl font-bold text-gray-900 dark:text-white mb-2"},"Content Manager",-1)),t("p",ze,[e[17]||(e[17]=T(" Signed in as ")),t("span",He,m(((l=i(D))==null?void 0:l.username)||((o=i(D))==null?void 0:o.name)),1)])]),t("div",Oe,[H(n,{to:"/",class:"px-4 py-2 bg-gray-200 dark:bg-white/5 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-900 dark:text-white rounded-lg transition-colors"},{default:O(()=>e[19]||(e[19]=[T(" â Back to Home ")])),_:1,__:[19]}),t("button",{onClick:e[0]||(e[0]=s=>i(G)()),class:"px-4 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors"}," Sign Out ")])]),t("div",Ve,[t("button",{onClick:e[1]||(e[1]=s=>q.value=!0),class:"px-6 py-3 bg-emerald-600 hover:bg-emerald-700 text-white font-semibold rounded-lg transition-colors"}," + Create New Blog Post "),H(n,{to:"/insights",class:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white font-semibold rounded-lg transition-colors"},{default:O(()=>e[20]||(e[20]=[T(" View Published Posts ")])),_:1,__:[20]})]),i(q)||i(C)?(g(),u("div",{key:0,class:"fixed inset-0 bg-black/50 flex items-start justify-center z-50 p-4 overflow-y-auto",onClick:B(M,["self"])},[t("div",Ge,[t("div",qe,[t("div",We,[t("h2",Ye,m(i(C)?"Edit Blog Post":"Create New Blog Post"),1),t("button",{onClick:M,class:"text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200"},e[21]||(e[21]=[t("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),t("form",{onSubmit:B(be,["prevent"]),class:"space-y-4"},[t("div",null,[e[22]||(e[22]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Title *",-1)),E(t("input",{"onUpdate:modelValue":e[2]||(e[2]=s=>i(r).title=s),type:"text",required:"",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white",placeholder:"Enter blog post title"},null,512),[[I,i(r).title]])]),t("div",null,[e[23]||(e[23]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Description *",-1)),E(t("textarea",{"onUpdate:modelValue":e[3]||(e[3]=s=>i(r).description=s),required:"",rows:"3",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white",placeholder:"Brief description for SEO and previews"},null,512),[[I,i(r).description]])]),t("div",Ke,[t("div",null,[e[24]||(e[24]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Category *",-1)),E(t("input",{"onUpdate:modelValue":e[4]||(e[4]=s=>i(r).category=s),type:"text",required:"",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white",placeholder:"e.g., Recruitment & Retention"},null,512),[[I,i(r).category]])]),t("div",null,[e[25]||(e[25]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Author",-1)),E(t("input",{"onUpdate:modelValue":e[5]||(e[5]=s=>i(r).author=s),type:"text",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white",placeholder:"Respond Capture Team"},null,512),[[I,i(r).author]])])]),t("div",Ze,[t("div",null,[e[26]||(e[26]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Publish Date",-1)),E(t("input",{"onUpdate:modelValue":e[6]||(e[6]=s=>i(r).date=s),type:"date",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white"}
34,null,512),[[I,i(r).date]]),e[27]||(e[27]=t("p",{class:"text-sm text-gray-500 dark:text-gray-400 mt-1"}," Leave empty for today's date ",-1))]),t("div",null,[e[29]||(e[29]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Hero Image",-1)),t("div",Je,[t("input",{ref_key:"fileInput",ref:Y,type:"file",accept:"image/*",onChange:re,class:"hidden",disabled:i(L)},null,40,Xe),t("button",{type:"button",onClick:B(me,["stop","prevent"]),class:"w-full px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-white font-semibold rounded-lg transition-colors flex items-center justify-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",disabled:i(L)},[e[28]||(e[28]=t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)),T(" "+m(i(L)?"Uploading...":i(r).image?"Change Hero Image":"Add Hero Image"),1)],8,Qe),i(r).image?(g(),u("p",et,m(i(r).image),1)):k("",!0),i($)?(g(),u("p",tt,m(i($)),1)):k("",!0)])])]),i(r).image?(g(),u("div",st,[e[31]||(e[31]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Hero Image Preview",-1)),t("div",at,[t("img",{src:i(r).image,alt:i(r).title||"Preview",class:"w-full h-auto rounded-lg border border-gray-300 dark:border-white/15",onError:e[7]||(e[7]=s=>F.value=!0)},null,40,ot),i(F)?k("",!0):(g(),u("button",{key:0,type:"button",onClick:ie,class:"absolute top-2 right-2 p-2 bg-red-600 hover:bg-red-700 text-white rounded-full transition-colors",title:"Remove image"},e[30]||(e[30]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])))])])):k("",!0),t("div",lt,[t("div",rt,[e[33]||(e[33]=t("div",null,[t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1"},"Additional Images"),t("p",{class:"text-sm text-gray-500 dark:text-gray-400"}," Upload images and assign tags to reference them in markdown using [tag] ")],-1)),t("button",{type:"button",onClick:B(ne,["stop","prevent"]),class:"px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white text-sm font-semibold rounded-lg transition-colors flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap",disabled:i(L)},e[32]||(e[32]=[t("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),T(" Add Addl' Images ")]),8,it)]),i(r).images&&i(r).images.length>0?(g(),u("div",nt,[(g(!0),u(te,null,se(i(r).images,(s,d)=>(g(),u("div",{key:d,class:"border border-gray-300 dark:border-white/15 rounded-lg p-4 bg-gray-50 dark:bg-white/5/50"},[t("div",dt,[t("div",ut,[e[34]||(e[34]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Image",-1)),t("input",{ref_for:!0,ref:c=>ge(c,d),type:"file",accept:"image/*",onChange:c=>ue(c,d),class:"hidden",disabled:i(f)[d]},null,40,gt),t("button",{type:"button",onClick:B(c=>ee(d),["stop","prevent"]),class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white hover:bg-gray-50 dark:hover:bg-gray-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",disabled:i(f)[d]},m(i(f)[d]?"Uploading...":s.url?"Change Image":"Choose Image"),9,ct),s.url?(g(),u("p",mt,m(s.url),1)):k("",!0),i(y)[d]?(g(),u("p",pt,m(i(y)[d]),1)):k("",!0),s.url?(g(),u("div",bt,[t("div",yt,[t("img",{src:s.url,alt:`Image ${d+1}`,class:"w-full h-auto rounded-lg border border-gray-300 dark:border-white/15 max-h-48 object-contain"},null,8,ht)])])):k("",!0)]),t("div",ft,[e[37]||(e[37]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Tag Name",-1)),E(t("input",{"onUpdate:modelValue":c=>s.tag=c,type:"text",placeholder:"image1",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white",onInput:c=>ce(d)},null,40,xt),[[I,s.tag]]),t("p",vt,[e[35]||(e[35]=T(" Use ")),t("code",kt,"["+m(s.tag||"image1")+"]",1),e[36]||(e[36]=T(" in your markdown to embed this image "))])]),t("div",wt,[t("button",{type:"button",onClick:c=>de(d),class:"px-3 py-2 bg-red-600 hover:bg-red-700 text-white rounded-lg transition-colors flex-shrink-0",title:"Remove image"},e[38]||(e[38]=[t("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]),8,Ct)])])]))),128))])):(g(),u("div",_t,e[39]||(e[39]=[t("svg",{class:"w-12 h-12 mx-auto text-gray-400 dark:text-gray-500 mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1),t("p",{class:"text-gray-500 dark:text-gray-400 mb-2"},"No additional images added yet.",-1),t("p",{class:"text-sm text-gray-400 dark:text-gray-500"},`Click "Add Addl' Images" to upload images with tags for embedding in your markdown.`,-1)])))]),t("div",Tt,[t("div",null,[e[40]||(e[40]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Tags (comma-separated)",-1)),E(t("input",{"onUpdate:modelValue":e[8]||(e[8]=s=>i(r).tags=s),type:"text",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white",placeholder:"recruitment, hiring, law enforcement"},null,512),[[I,i(r).tags]])]),t("div",At,[t("label",$t,[E(t("input",{"onUpdate:modelValue":e[9]||(e[9]=s=>i(r).featured=s),type:"checkbox",class:"w-5 h-5 text-emerald-600 border-gray-300 rounded focus:ring-emerald-500"},null,512),[[Ce,i(r).featured]]),e[41]||(e[41]=t("span",{class:"ml-2 text-sm font-medium text-gray-700 dark:text-gray-300"}," Featured Post ",-1))])])]),t("div",null,[e[42]||(e[42]=t("label",{class:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Content (Markdown) *",-1)),E(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=s=>i(r).body=s),required:"",rows:"15",class:"w-full px-4 py-2 border border-gray-300 dark:border-white/15 rounded-lg bg-white dark:bg-white/5 text-gray-900 dark:text-white font-mono text-sm",placeholder:"Write your blog post content in Markdown format..."},null,512),[[I,i(r).body]]),e[43]||(e[43]=t("p",{class:"text-sm text-gray-500 dark:text-gray-400 mt-1"}," Use Markdown syntax: **bold**, *italic*, # Heading, - List, etc. ",-1))]),t("div",Et,[t("button",Ut,m(i(C)?"Update Post":"Save as Draft"),1),i(C)?k("",!0):(g(),u("button",{key:0,t
34ype:"button",onClick:ye,class:"px-6 py-3 bg-purple-600 hover:bg-purple-700 text-white font-semibold rounded-lg transition-colors"}," Publish ")),t("button",{type:"button",onClick:M,class:"px-6 py-3 bg-gray-200 dark:bg-white/5 hover:bg-gray-300 dark:hover:bg-gray-600 text-gray-900 dark:text-white font-semibold rounded-lg transition-colors"}," Cancel ")])],32)])])])):k("",!0),t("div",It,[t("div",St,[e[48]||(e[48]=t("h2",{class:"text-xl font-semibold text-gray-900 dark:text-white mb-4"},"All Blog Posts",-1)),i(W)?(g(),u("div",Pt,e[44]||(e[44]=[t("p",{class:"text-gray-600 dark:text-gray-400"},"Loading posts...",-1)]))):i(j).length===0?(g(),u("div",Lt,e[45]||(e[45]=[t("p",{class:"text-gray-600 dark:text-gray-400"},"No posts found. Create your first blog post!",-1)]))):(g(),u("div",Mt,[(g(!0),u(te,null,se(i(j),s=>(g(),u("div",{key:s.slug,class:"border border-gray-200 dark:border-white/10 rounded-lg p-4 hover:border-emerald-500 dark:hover:border-emerald-500 transition-colors"},[t("div",Dt,[t("div",Ft,[t("div",Rt,[t("h3",Bt,m(s.title),1),s.meta.published&&!R(s)?(g(),u("span",Nt," Published ")):s.meta.published&&R(s)?(g(),u("span",jt," Scheduled ")):(g(),u("span",zt," Draft "))]),t("p",Ht,m(s.description),1),t("div",Ot,[t("span",null,m(s.meta.category),1),e[46]||(e[46]=t("span",null,"â¢",-1)),t("span",null,m(oe(s.meta.date)),1),e[47]||(e[47]=t("span",null,"â¢",-1)),t("span",null,m(s.meta.author),1)])]),t("div",Vt,[H(n,{to:s.meta.published&&!R(s)?`/insights/${s.slug}`:`/insights/${s.slug}?preview=true`,target:"_blank",class:_e(["px-3 py-2 rounded transition-colors text-sm",s.meta.published&&!R(s)?"bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300 hover:bg-blue-200 dark:hover:bg-blue-800":"bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300 hover:bg-indigo-200 dark:hover:bg-indigo-800"])},{default:O(()=>[T(m(s.meta.published&&!R(s)?"View":"Preview"),1)]),_:2},1032,["to","class"]),t("button",{onClick:d=>le(s),class:"px-3 py-2 bg-emerald-100 dark:bg-emerald-900 text-emerald-700 dark:text-emerald-300 rounded hover:bg-emerald-200 dark:hover:bg-emerald-800 transition-colors text-sm"}," Edit ",8,Gt),s.meta.published?k("",!0):(g(),u("button",{key:0,onClick:d=>pe(s),disabled:i(z),class:"px-3 py-2 bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300 rounded hover:bg-purple-200 dark:hover:bg-purple-800 transition-colors text-sm font-semibold disabled:opacity-50 disabled:cursor-not-allowed"},m(i(z)?"Publishing...":"Publish"),9,qt)),t("button",{onClick:d=>he(s),disabled:i(K),class:"px-3 py-2 bg-red-100 dark:bg-red-900 text-red-700 dark:text-red-300 rounded hover:bg-red-200 dark:hover:bg-red-800 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Delete ",8,Wt)])])]))),128))]))])])])])):k("",!0):(g(),u("div",$e,[t("div",Ee,[t("div",Ue,[e[12]||(e[12]=we('<div class="text-center mb-6"><div class="inline-flex items-center justify-center w-16 h-16 bg-yellow-400 dark:bg-yellow-600 rounded-full mb-4"><svg class="w-8 h-8 text-yellow-900 dark:text-yellow-100" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg></div><h1 class="text-3xl font-bold text-gray-900 dark:text-white mb-2">OAuth Not Configured</h1><p class="text-gray-700 dark:text-gray-300">GitHub OAuth authentication is not set up for this environment.</p></div><div class="bg-white dark:bg-[#0f1113] rounded-lg p-6 mb-6"><h2 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Required Environment Variables:</h2><ul class="space-y-2 text-sm font-mono text-gray-700 dark:text-gray-300"><li class="flex items-center gap-2"><span class="text-red-500">â</span> GITHUB_CLIENT_ID</li><li class="flex items-center gap-2"><span class="text-red-500">â</span> GITHUB_CLIENT_SECRET</li><li class="flex items-center gap-2"><span class="text-red-500">â</span> NEXTAUTH_SECRET</li><li class="flex items-center gap-2"><span class="text-gray-400">â</span> GITHUB_REPO</li><li class="flex items-center gap-2"><span class="text-gray-400">â</span> NEXTAUTH_URL</li></ul></div><div class="text-sm text-gray-700 dark:text-gray-300 space-y-3"><p class="font-semibold">To enable admin access:</p><ol class="list-decimal list-inside space-y-2 ml-4"><li>Create a GitHub OAuth app at <a href="https://github.com/settings/developers" target="_blank" class="text-blue-600 dar
34k:text-blue-400 underline">github.com/settings/developers</a></li><li>Add the environment variables to AWS Amplify</li><li>Redeploy the application</li></ol><p class="mt-4 text-xs text-gray-600 dark:text-gray-400"> See <code class="bg-gray-200 dark:bg-white/5 px-2 py-1 rounded">memory-bank/github-oauth-admin-cms.md</code> for detailed instructions. </p></div>',3)),t("div",Ie,[H(n,{to:"/",class:"inline-block px-6 py-3 bg-gray-900 dark:bg-white/5 hover:bg-gray-800 dark:hover:bg-gray-600 text-white font-semibold rounded-lg transition-colors"},{default:O(()=>e[11]||(e[11]=[T(" â Back to Home ")])),_:1,__:[11]})])])])]))])}}});export{Zt 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.