1import{u as K,r as j,j as e,H as L,L as k,b as y}from"./app-JqkQZVIN.js";import{C as U}from"./ClientLayout-DWNvp5-y.js";import{b as $}from"./datetime-AtxFCCA-.js";import{S as N}from"./BrandIcons-BCOiPJrS.js";import{u as C}from"./useTranslation-CC9YJjOt.js";import{P as I}from"./plus-DcMxgEln.js";import{F as D}from"./funnel-Dl-hkQqq.js";import{X as P}from"./x-Xjez3RjT.js";import{C as A}from"./chevron-left-DFxvjPSG.js";import{C as M}from"./chevron-right-DgimVMHW.js";import{C as R}from"./chevron-down-BBg5fR1h.js";import"./useClientNav-x9E-3qQa.js";import"./Sidebar-6eadgIJq.js";import"./createLucideIcon-Czgutyob.js";import"./ApplicationLogo--hUvSb0B.js";import"./layers-Bz-FcsEf.js";import"./users-B_b_fWS2.js";import"./file-text-DQIUnHmO.js";import"./book-open-B1oBEsp5.js";import"./image-D5Slqv8P.js";import"./message-square-DDekpcrr.js";import"./mail-DWl3Cvu3.js";import"./bot-B0R2Q_3w.js";import"./database-DzSlrBKX.js";import"./map-pin-Dp_h-MiL.js";import"./calendar-clock-Bmy9BOLB.js";import"./zap-D2xwQbHR.js";import"./Topbar-B1hfr8AF.js";import"./Tabs-CiMIPf0s.js";import"./transition-QUi7Lekh.js";import"./useLocale-vnABZqrL.js";import"./search-D76L6Ums.js";const z={scheduled:"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300",published:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",publishing:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300",failed:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300",draft:"bg-neutral-100 text-neutral-500 dark:bg-neutral-800 dark:text-neutral-400"},Y=[{value:"",labelKey:"social.status_all"},{value:"scheduled",labelKey:"social.status_scheduled"},{value:"published",labelKey:"social.status_published"},{value:"publishing",labelKey:"social.status_publishing"},{value:"draft",labelKey:"social.status_draft"},{value:"failed",labelKey:"social.status_failed"}],H={facebook:"ð",instagram:"ð·",twitter:"ð¦",linkedin:"ð¼",tiktok:"ðµ",youtube:"â¶ï¸"},B=["social.day_sun","social.day_mon","social.day_tue","social.day_wed","social.day_thu","social.day_fri","social.day_sat"],G=["social.month_january","social.month_february","social.month_march","social.month_april","social.month_may","social.month_june","social.month_july","social.month_august","social.month_september","social.month_october","social.month_november","social.month_december"];function W({accounts:d,value:s,onChange:l}){var o,g;const{t:u}=C(),[a,i]=j.useState(!1),c=j.useRef(null);j.useEffect(()=>{const r=b=>{c.current&&!c.current.contains(b.target)&&i(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]);const n=d.find(r=>String(r.id)===s)??null;return e.jsxs("div",{ref:c,className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>i(r=>!r),className:"flex items-center gap-2 rounded-lg border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 text-neutral-700 dark:text-neutral-300 text-xs px-2.5 py-1.5 focus:outline-none focus:ring-2 focus:ring-brand-500 min-w-[130px]",children:[n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative shrink-0",children:[n.picture_url?e.jsx("img",{src:n.picture_url,alt:n.name,className:"h-4 w-4 rounded-full object-cover"}):e.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full bg-neutral-200 dark:bg-neutral-700 text-[8px] font-bold text-neutral-500",children:((g=(o=n.name)==null?void 0:o[0])==null?void 0:g.toUpperCase())??"?"}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-white dark:bg-neutral-900 ring-1 ring-white dark:ring-neutral-900",children:e.jsx(N,{network:n.network,className:"h-2 w-2"})})]}),e.jsx("span",{className:"truncate max-w-[90px]",children:n.name})]}):e.jsx("span",{children:u("social.all_profiles")}),e.jsx(R,{className:`h-3 w-3 ml-auto shrink-0 text-neutral-400 transition-transform ${a?"rotate-180":""}`})]}),a&&e.jsx("div",{className:"absolute z-50 mt-1 left-0 min-w-[190px] rounded-xl border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 shadow-xl overflow-hidden",children:e.jsxs("ul",{className:"max-h-64 overflow-y-auto py-1",children:[e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{l(""),i(!1)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs text-left hover:bg-neutral-50 dark:hover:bg-neutral-800 transition ${s?"text-neutral-700 dark:text-neutral-300":"text-brand-600 font-semibold"}`,children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-neutral-100 dar
1k:bg-neutral-700 shrink-0",children:e.jsx(D,{className:"h-3 w-3 text-neutral-400"})}),u("social.all_profiles")]})}),d.map(r=>{var b,f;return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{l(String(r.id)),i(!1)},className:`w-full flex items-center gap-2.5 px-3 py-2 text-xs text-left hover:bg-neutral-50 dark:hover:bg-neutral-800 transition ${String(r.id)===s?"bg-brand-50 dark:bg-brand-900/20 text-brand-600 dark:text-brand-400 font-medium":"text-neutral-700 dark:text-neutral-300"}`,children:[e.jsxs("div",{className:"relative shrink-0",children:[r.picture_url?e.jsx("img",{src:r.picture_url,alt:r.name,className:"h-5 w-5 rounded-full object-cover"}):e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-neutral-200 dark:bg-neutral-700 text-[9px] font-bold text-neutral-500",children:((f=(b=r.name)==null?void 0:b[0])==null?void 0:f.toUpperCase())??"?"}),e.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-3 w-3 items-center justify-center rounded-full bg-white dark:bg-neutral-900 ring-1 ring-white dark:ring-neutral-900",children:e.jsx(N,{network:r.network,className:"h-2.5 w-2.5"})})]}),e.jsx("span",{className:"truncate",children:r.name})]})},r.id)})]})})]})}function X(d,s){const l=new Date(d,s,1).getDay(),u=new Date(d,s+1,0).getDate(),a=[];let i=1;for(let c=0;c<6;c++){const n=[];for(let o=0;o<7;o++)c===0&&o<l||i>u?n.push(null):n.push(i++);if(a.push(n),i>u)break}return a}function S(d,s){const l=new URLSearchParams({month:d});return s.status&&l.set("status",s.status),s.account_id&&l.set("account_id",s.account_id),s.network&&l.set("network",s.network),`?${l.toString()}`}function Ce({posts:d,month:s,accounts:l=[],filters:u={}}){const{t:a}=C(),{props:i}=K(),c=i.timezone||$()||"Asia/Dhaka",[n,o]=s.split("-").map(Number),g=X(n,o-1),[r,b]=j.useState({status:u.status??"",account_id:u.account_id??"",network:u.network??""}),f=d.reduce((t,m)=>{if(m.scheduled_at){const x=new Intl.DateTimeFormat("en-US",{timeZone:c,day:"numeric"}).format(new Date(m.scheduled_at)),h=parseInt(x,10);t[h]||(t[h]=[]),t[h].push(m)}return t},{}),F=new Date(n,o-2,1),T=new Date(n,o,1),v=t=>`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}`,w=t=>{const m={...r,...t};b(m),y.get(route("client.social.calendar"),{month:s,...Object.fromEntries(Object.entries(m).filter(([,x])=>x))},{preserveScroll:!0,replace:!0})},O=()=>{b({status:"",account_id:"",network:""}),y.get(route("client.social.calendar"),{month:s},{preserveScroll:!0,replace:!0})},_=r.status||r.account_id||r.network,E=[...new Set(l.map(t=>t.network))];return e.jsxs(U,{title:a("social.calendar_title"),children:[e.jsx(L,{title:a("social.calendar_head")}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-semibold text-neutral-900 dark:text-neutral-100",children:a("social.calendar_title")}),e.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400 mt-0.5",children:a("social.calendar_subtitle")})]}),e.jsxs(k,{href:route("client.social.composer"),className:"flex items-center gap-1.5 rounded-lg bg-brand-600 px-3 py-2 text-sm font-medium text-secondary-900 hover:bg-brand-700 transition",children:[e.jsx(I,{className:"h-4 w-4"})," ",a("social.new_post")]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"flex items-center gap-1 text-xs text-neutral-500 dark:text-neutral-400 font-medium",children:[e.jsx(D,{className:"h-3.5 w-3.5"})," ",a("social.filter_label")]}),e.jsx("select",{value:r.status,onChange:t=>w({status:t.target.value}),className:"rounded-lg border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 text-neutral-700 dark:text-neutral-300 text-xs px-2.5 py-1.5 focus:outline-none focus:ring-2 focus:ring-brand-500",children:Y.map(t=>e.jsx("option",{value:t.value,children:a(t.labelKey)},t.value))}),e.jsxs("select",{value:r.network,onChange:t=>w({network:t.target.value,account_id:""}),className:"rounded-lg border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 text-neutral-700 dark:text-neutral-300 text-xs px-2.5 py-1.5 focus:outline-none focus:ring-2 focus:ring-brand-500",children:[e.jsx("option",{value:"",children:a("social.all_networks")}),E.map(t=>e.jsxs("option",{value:t,children:[H[t]??""," ",t.charAt(0).toUpperCase()+t.slice(1)]},t))]}),e.jsx(W,{accounts:l,value:r.account_id,onChange:t=>w({account_id:t,network:""})}),_&&e.jsxs("button",{onClick:O,className:"flex items-center gap-1 rounded-lg border border-neutral-200 dark:border-neutral-700 px-2.5 py-1.5 text-xs text-neutral-500 hover:text-neutral-700 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition",children:[e.jsx(P,{className:"h-3 w-3"})," ",a("social.clear")]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(k,{href:S(v(F),r),className:"rounded p-1 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 dar
1k:hover:bg-neutral-800 transition",children:e.jsx(A,{className:"h-5 w-5"})}),e.jsxs("span",{className:"font-semibold text-neutral-900 dark:text-neutral-100",children:[a(G[o-1])," ",n]}),e.jsx(k,{href:S(v(T),r),className:"rounded p-1 text-neutral-400 hover:text-neutral-600 hover:bg-neutral-100 dark:hover:bg-neutral-800 transition",children:e.jsx(M,{className:"h-5 w-5"})}),_&&e.jsx("span",{className:"text-xs text-brand-600 dark:text-brand-400 font-medium bg-brand-50 dark:bg-brand-900/20 px-2 py-0.5 rounded-full",children:a("social.filtered")})]}),e.jsxs("div",{className:"rounded-xl border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 overflow-hidden",children:[e.jsx("div",{className:"grid grid-cols-7 border-b border-neutral-200 dark:border-neutral-700",children:B.map(t=>e.jsx("div",{className:"px-2 py-2 text-center text-xs font-semibold text-neutral-500 dark:text-neutral-400 uppercase",children:a(t)},t))}),g.map((t,m)=>e.jsx("div",{className:"grid grid-cols-7 border-b last:border-0 border-neutral-100 dark:border-neutral-800",children:t.map((x,h)=>e.jsx("div",{className:`min-h-[90px] p-1.5 border-r last:border-0 border-neutral-100 dark:border-neutral-800 ${x?"hover:bg-neutral-50 dark:hover:bg-neutral-800/30":"bg-neutral-50 dark:bg-neutral-800/20"}`,children:x&&e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400 mb-1",children:x}),(f[x]??[]).map(p=>e.jsx(k,{href:route("client.social.posts.index"),title:p.title??p.status,className:`block rounded px-1.5 py-0.5 text-xs mb-0.5 truncate hover:opacity-80 transition ${z[p.status]??""}`,children:p.title??a("social.post_fallback")},p.id))]})},h))},m))]})]})]})}export{Ce 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.