1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[56674],{29502:(e,t,a)=>{a.d(t,{A:()=>l});let l=(0,a(71847).A)("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]])},56674:(e,t,a)=>{a.r(t),a.d(t,{default:()=>x});var l=a(95155),s=a(12115),r=a(18720),n=a(29502),o=a(65229),i=a(35299);let d=[{key:"facebook",label:"Facebook"},{key:"twitter",label:"X"},{key:"threads",label:"Threads"},{key:"linkedin",label:"LinkedIn"},{key:"bluesky",label:"Bluesky"},{key:"telegram",label:"Telegram"},{key:"pinterest",label:"Pinterest"}];function c(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let a=e=>String(e).padStart(2,"0");return"".concat(t.getFullYear(),"-").concat(a(t.getMonth()+1),"-").concat(a(t.getDate()),"T").concat(a(t.getHours()),":").concat(a(t.getMinutes()))}function x(e){let{blogPostId:t,scheduledAt:a,platforms:x,title:u,link:f,bodies:h,onClose:p,onSaved:m}=e,b=new Set(x),k="".concat((u||"New post").trim()).concat(f?"\n\n".concat(f):""),[g,y]=(0,s.useState)(c(a)),[v,j]=(0,s.useState)(new Set(x)),[w,N]=(0,s.useState)(()=>({...h||{}})),[C,S]=(0,s.useState)(!1);async function A(){let e=g?new Date(g).toISOString():null;if(g&&isNaN(new Date(g).getTime()))return void r.oR.error("Pick a valid date and time");if(e&&new Date(e).getTime()<=Date.now()+6e4)return void r.oR.error("Pick a time at least a minute from now");let l=[...v].filter(e=>!b.has(e)),s=[...b].filter(e=>!v.has(e)),n=e&&c(a)!==g,o={},i=!1;for(let e of v){var d,x;let t=(null!=(d=w[e])?d:"").trim();t&&(o[e]=t),t===(null!=(x=null==h?void 0:h[e])?x:"").trim()||l.includes(e)||(i=!0)}if(!n&&0===l.length&&0===s.length&&!i)return void r.oR.message("Nothing changed");S(!0);try{let a=await fetch("/api/blog/schedule-edit",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({blogPostId:t,...n?{scheduledFor:e}:{},addPlatforms:l,removePlatforms:s,bodies:o})}),i=await a.json();if(!a.ok)throw Error(i.error||"Could not update the schedule");if(Array.isArray(i.skipped)&&i.skipped.length&&r.oR.message("Skipped: ".concat(i.skipped.join(", "))),"string"==typeof i.wpWarning&&i.wpWarning){r.oR.error(i.wpWarning,{duration:12e3}),S(!1);return}r.oR.success("Schedule updated"),m(),p()}catch(e){r.oR.error(e instanceof Error?e.message:"Could not update the schedule")}finally{S(!1)}}return(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-start sm:items-center justify-center p-4 bg-black/50 overflow-y-auto",onClick:p,children:(0,l.jsxs)("div",{className:"card w-full max-w-md bg-white dark:bg-[#18181b] max-h-[90vh] flex flex-col overflow-hidden my-auto",onClick:e=>e.stopPropagation(),children:[(0,l.jsxs)("div",{className:"flex items-start justify-between px-5 pt-5 pb-3 flex-shrink-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(n.A,{size:18,className:"text-[#7C3AED]"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("h3",{className:"text-base font-semibold text-[#1d1d1f] dark:text-[#f5f5f7]",children:"Edit schedule"}),u&&(0,l.jsx)("p",{className:"text-xs text-[#6e6e73] dark:text-[#ebebf0] mt-0.5 truncate max-w-[300px]",children:u})]})]}),(0,l.jsx)("button",{onClick:p,className:"text-[#86868b] hover:text-[#1d1d1f] dark:hover:text-white p-1",title:"Close",children:(0,l.jsx)(o.A,{size:18})})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-4 px-5 overflow-y-auto overscroll-contain flex-1 min-h-0",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-semibold text-[#1d1d1f] dark:text-[#f5f5f7] mb-1",children:"Publish date & time"}),(0,l.jsx)("input",{type:"datetime-local",value:g,onChange:e=>y(e.target.value),className:"w-full px-3 py-2 rounded-lg border border-[var(--border-2,#e5e5e7)] bg-white dark:bg-[#1a1a1d] text-sm focus:outline-none focus:border-[#7C3AED]"}),(0,l.jsx)("p",{className:"text-[10px] text-[#86868b] mt-1",children:"Social posts shift with it, keeping their spacing."})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)("label",{className:"block text-xs font-semibold text-[#1d1d1f] dark:text-[#f5f5f7] mb-1.5",children:"Post to socials"}),(0,l.jsx)("div",{className:"flex flex-col gap-2",children:d.map(e=>{var t;let a=v.has(e.key);return(0,l.jsxs)("div",{className:"rounded-lg border",style:{borderColor:a?"#7C3AED":"var(--border-2,#e5e5e7)",background:a?"rgba(124,58,237,0.06)":"transparent"},children:[(0,l.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.key,void j(e=>{let a=new Set(e);return a.has(t)?a.delete(t):(a.add(t),N(e=>e[t]&&e[t].trim()?e:{...e,[t]:k})),a})},className:"flex w-full items-center justify-between px-3 py-2 text-sm",style:{color:"var(--text,#1d1d1f)"},children:[(0,l.jsx)("span",{className:"font-medium",children:e.label}),(0,l.jsx)("span",{className:"text-[10px] font-bold",style:{color:a?"#7C3AED":"#c7c7cc"},children:a?"ON":"OFF"})]}),a&&(0,l.jsxs)("div",{className:"px-3 pb-2.5",children:[(0,l.jsx)("textarea",{value:null!=(t=w[e.key])?t:"",onChange:t=>N(a=>({...a,[e.key]:t.target.value})),rows:2,placeholder:"Caption for ".concat(e.label,"â¦"),className:"w-full px-2.5 py-2 rounded-md border text-[13px] leading-snug resize-y focus:outline-none focus:border-[#7C3AED]",style:{borderColor:"var(--border-2,#e5e5e7)",background:"var(--surface,#fff)",color:"var(--text,#1d1d1f)"}}),(0,l.jsx)("button",{type:"button",onClick:()=>N(t=>({...t,[e.key]:k})),className:"text-[10px] text-[#86868b] hover:text-[#7C3AED] mt-1",children:"Reset to default"})]})]},e.key)})}),(0,l.jsx)("p",{className:"text-[10px] text-[#86868b] mt-1.5",children:"Edit each channelâs caption above. Only connected channels on your plan will queue; the rest are skipped."})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border-2,#e5e5e7)] px-5 py-3 flex-shrink-0",children:[(0,l.jsx)("button",{onClick:p,className:"px-3 py-2 rounded-lg text-xs font-medium text-[#6e6e73] dar
1k:text-[#ebebf0] hover:bg-[var(--surface-hover,#f5f5f7)]",children:"Cancel"}),(0,l.jsxs)("button",{onClick:A,disabled:C,className:"inline-flex items-center gap-1.5 px-4 py-2 rounded-lg text-xs font-semibold bg-[#7C3AED] text-white hover:bg-[#6D28D9] disabled:opacity-60",children:[C?(0,l.jsx)(i.A,{size:13,className:"animate-spin"}):null," Save changes"]})]})]})})}}}]);
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.