import{r as n,j as e,u as L,a as E}from"./app-BwDemWQz.js";import{a as H,b as O,c as q,A as D,m as K,n as R,M as U}from"./AppLayout-3zbhnyYw.js";import{u as T}from"./LanguageContext-zkEAKPTE.js";import{P as V,E as Z}from"./EngagementChart-DDUpuDcT.js";import{P as B,A as J}from"./AccountPerformanceChart-Cc4MvIRO.js";import{A as F}from"./index-T7pIFD_D.js";import{m as d}from"./proxy-DQ767J20.js";import{P as Q}from"./PlatformIcon-BoGOJKWv.js";import{s as I}from"./index-CkDmAPFS.js";import{c as G}from"./createLucideIcon-BASx8f0E.js";/* empty css            */import"./index-DxJALBsh.js";import"./Button-B-KWyoQR.js";import"./Label-1lm7x8-L.js";import"./Input-BJaxI6jp.js";import"./zap-BsHQ4DWF.js";import"./rocket-Dt03WmgU.js";import"./users-g1HvrzO9.js";import"./globe-C_ZhZ5i9.js";import"./trending-up-rMXlpbCa.js";import"./chevron-left-BxYqeqJW.js";import"./PostReaction-ieuF_bBa.js";/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const W=[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]],X=G("cloud-sun",W);/**
 * @license lucide-react v0.539.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Y=[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]],ee=G("sunrise",Y);function te({siteName:r="Postuno",siteLogo:s,onComplete:o,primaryColor:t="#667eea",secondaryColor:x="#764ba2"}){const[c,g]=n.useState(!0),[h,u]=n.useState(0),p=T();return n.useEffect(()=>{const i=setInterval(()=>{u(m=>m>=100?(clearInterval(i),setTimeout(()=>{g(!1),o&&o()},300),100):Math.min(m+3,100))},30);return()=>clearInterval(i)},[o]),e.jsx(F,{children:c&&e.jsxs(d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"fixed inset-0 z-[9999] bg-gradient-to-br from-white to-gray-50 dark:from-zinc-900 dark:to-zinc-950 flex flex-col items-center justify-center",children:[e.jsx(d.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.4},className:"mb-8",children:s?e.jsx("img",{src:s,alt:"Logo",className:"w-16 h-16 object-contain"}):e.jsx("div",{className:"w-16 h-16 rounded-xl flex items-center justify-center text-white text-2xl font-bold",style:{background:`linear-gradient(135deg, ${t} 0%, ${x} 100%)`},children:r.charAt(0)})}),e.jsx(d.h1,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.2,duration:.4},className:"text-2xl font-semibold text-gray-900 dark:text-white mb-8",children:r}),e.jsx("div",{className:"relative mb-6",children:e.jsx(d.div,{animate:{rotate:360},transition:{duration:1,repeat:1/0,ease:"linear"},className:"w-8 h-8 border-2 border-gray-200 dark:border-zinc-700 rounded-full",style:{borderTopColor:t}})}),e.jsx("div",{className:"w-64 max-w-sm mb-4",children:e.jsx("div",{className:"w-full bg-gray-200 dark:bg-zinc-800 rounded-full h-1.5 overflow-hidden",children:e.jsx(d.div,{initial:{width:0},animate:{width:`${h}%`},transition:{duration:.3,ease:"easeOut"},className:"h-full rounded-full",style:{background:`linear-gradient(90deg, ${t} 0%, ${x} 100%)`}})})}),e.jsx(d.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.4},className:"text-sm text-gray-500 dark:text-gray-400",children:h<100?p("Loading..."):p("Almost ready!")})]})})}const se=()=>{var y,v,w,N,k,_,a;const{props:r,url:s}=L(),[o,t]=n.useState(!1),[x,c]=n.useState(!1),g=r.site_logo??"/logo.png",h=((y=r.site_settings)==null?void 0:y.site_name)??"MySite",u=((v=r.site_settings)==null?void 0:v.preloader_enabled)==="1",p=((w=r.site_settings)==null?void 0:w.preloader_show_on_home)==="1",i=((N=r.site_settings)==null?void 0:N.preloader_show_on_first_login)==="1",m=parseInt(((k=r.site_settings)==null?void 0:k.preloader_duration)||"3000"),z=((_=r.site_settings)==null?void 0:_.primary_color)??"#667eea",j=((a=r.site_settings)==null?void 0:a.secondary_color)??"#764ba2";n.useEffect(()=>{if(!u){t(!1);return}const f=s==="/"||s.includes("/home")||s.includes("/dashboard"),b=A(),P=`preloader_shown_${b}`,l=`preloader_home_shown_${b}`,S=!sessionStorage.getItem(P),M=sessionStorage.getItem(l);let C=!1;i&&S?(C=!0,sessionStorage.setItem(P,"true")):p&&f&&!M&&(C=!0,sessionStorage.setItem(l,"true")),t(C),f||sessionStorage.removeItem(l)},[s,u,p,i]);const A=()=>{const f=window.navigator,b=window.screen,P=[f.userAgent,f.language,b.colorDepth,b.width+"x"+b.height,new Date().getTimezoneOffset(),f.hardwareConcurrency,f.platform].join("|");let l=0;for(let S=0;S<P.length;S++){const M=P.charCodeAt(S);l=(l<<5)-l+M,l=l&l}return"device_"+Math.abs(l).toString(36)};return{showPreloader:o,siteName:h,siteLogo:g,duration:m,primaryColor:z,secondaryColor:j,onComplete:()=>{c(!0),t(!1)}}},re=({text:r,speed:s=50,className:o="",onComplete:t})=>{const[x,c]=n.useState(""),[g,h]=n.useState(0),[u,p]=n.useState(!0);return n.useEffect(()=>{if(g<r.length){const i=setTimeout(()=>{c(m=>m+r[g]),h(m=>m+1)},s);return()=>clearTimeout(i)}else p(!1),t&&t()},[g,r,s,t]),e.jsxs("span",{className:o,children:[x,u&&e.jsx(d.span,{animate:{opacity:[1,0]},transition:{duration:.5,repeat:1/0,repeatType:"reverse"},className:"inline-block w-0.5 h-[1.2em] bg-current ml-0.5 align-middle"})]})},ae=({data:r=[]})=>{const s=r??[],o=T();return e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg shadow-sm border border-gray-200 dark:border-zinc-800 flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:o("Social Accounts")}),e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:o("Manage and monitor your connected social accounts")})]}),s.length===0?e.jsx("div",{className:"flex-1 flex items-center justify-center p-6 h-[28rem]",children:e.jsx("p",{className:"text-gray-500 dark:text-neutral-400 text-sm",children:o("No accounts found, your connected accounts will appear here")})}):e.jsx("div",{className:"p-6 pt-4 h-[28rem] overflow-y-auto scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-zinc-700 scrollbar-track-transparent",children:e.jsx("div",{className:"space-y-4",children:s.map((t,x)=>{var c;return e.jsxs("div",{className:"flex items-center gap-4 justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("div",{className:"relative",children:[e.jsxs(H,{className:"h-8 w-8 lg:h-10 lg:w-10",children:[e.jsx(O,{src:t==null?void 0:t.avatar,alt:o("User Avatar")}),e.jsx(q,{children:"AV"})]}),e.jsx("div",{className:"absolute -bottom-0.5 -right-0.5 w-5 h-5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center border-2 border-white dark:border-zinc-900",children:e.jsx(Q,{slug:(c=t==null?void 0:t.platform)==null?void 0:c.slug,size:14,round:!0})})]}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium text-sm lg:text-base text-gray-900 dark:text-neutral-200 truncate max-w-[60px] lg:max-w-[150px]",children:t.label||t.name}),t.label&&t.name&&t.label!==t.name&&e.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate max-w-[80px] lg:max-w-[160px]",children:t.name})]})]}),e.jsx("div",{className:"flex-shrink-0",children:t.is_connected==="1"?e.jsx("span",{className:"inline-block px-3 py-1.5 bg-gradient-to-r from-primary to-secondary hover:from-secondary hover:to-primary text-white text-xs font-medium rounded-full",children:o("Connected")}):e.jsx("span",{className:"inline-block px-3 py-1.5 bg-gray-300 dark:bg-zinc-700 text-gray-700 dark:text-neutral-200 text-xs font-medium rounded-full",children:o("Disconnected")})})]},t.id||x)})})})]})};function Se({platforms:r,AnalyticalData:s}){var N,k,_;const o=T(),{showPreloader:t,siteName:x,siteLogo:c,primaryColor:g,secondaryColor:h,onComplete:u}=se(),{props:p}=L(),{auth:i}=p,m=((N=i==null?void 0:i.user)==null?void 0:N.name)||((_=(k=i==null?void 0:i.user)==null?void 0:k.email)==null?void 0:_.split("@")[0])||"User",z=()=>{const a=new Date().getHours();return a>=5&&a<12?{text:"Good Morning",emoji:"☀️",icon:ee}:a>=12&&a<17?{text:"Good Afternoon",emoji:"🌤️",icon:X}:a>=17&&a<21?{text:"Good Evening",emoji:"🌅",icon:R}:{text:"Good Night",emoji:"🌙",icon:U}},j=n.useMemo(()=>z(),[]),A=`${j.text} ${j.emoji}, ${m}`,$=[{label:"Dashboard",href:I("user.home")}],[y,v]=n.useState(I().params.slug||null),w=a=>{a==="all"?(E.get(I("user.home")),v(null)):(E.get(I("user.home"),{slug:a}),v(a))};return e.jsxs(e.Fragment,{children:[t&&e.jsx(te,{siteName:x,siteLogo:c,primaryColor:g,secondaryColor:h,onComplete:u}),e.jsx(D,{breadcrumbs:$,children:e.jsxs("div",{className:"flex-1 p-3 sm:p-4 lg:p-6 overflow-auto bg-gradient-to-br from-gray-50 to-gray-100 dark:from-zinc-950 dark:to-black min-h-screen",children:[e.jsxs("div",{className:"mb-4 sm:mb-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-2 gap-3 sm:gap-0",children:[e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[e.jsx("div",{children:e.jsx(K,{className:"h-5 w-5 sm:h-6 sm:w-6 text-primary"})}),e.jsx("h1",{className:"text-xl sm:text-2xl dark:text-gray-200 font-bold",children:o("Dashboard")})]}),e.jsxs(d.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},transition:{duration:.5,delay:.2},className:"flex items-center gap-2",children:[e.jsx(j.icon,{className:"h-4 w-4 sm:h-5 sm:w-5 text-yellow-500 dark:text-yellow-400"}),e.jsx(re,{text:A,speed:60,className:"text-xs sm:text-sm font-medium text-gray-600 dark:text-gray-300"})]})]}),e.jsx("p",{className:"text-xs sm:text-sm text-gray-500 dark:text-gray-400",children:o("Monitor your social media performance in real-time")})]}),e.jsxs("div",{className:"space-y-6 sm:space-y-6",children:[e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsx("div",{className:"inline-flex min-w-full",children:e.jsxs("div",{className:"bg-white dark:bg-zinc-900 rounded-lg p-1 inline-flex gap-1 border border-gray-200 dark:border-zinc-800",children:[e.jsxs("button",{onClick:()=>w("all"),className:`relative inline-block rounded-lg px-3 sm:px-6 py-2 sm:py-2 text-xs sm:text-sm font-semibold transition-all duration-200 whitespace-nowrap ${y===null?"bg-gradient-to-r from-primary to-secondary text-white shadow-sm":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:["All Platforms",y===null&&e.jsx(d.div,{layoutId:"activeTab",className:"absolute inset-0 bg-gradient-to-r from-primary to-secondary rounded-lg -z-10",transition:{type:"spring",bounce:.2,duration:.5}})]},"all"),r.map(a=>e.jsxs("button",{onClick:()=>w(a.slug),className:`relative inline-block rounded-lg px-3 sm:px-6 py-2 sm:py-2 text-xs sm:text-sm font-semibold transition-all duration-200 whitespace-nowrap ${y===a.slug?"bg-gradient-to-r from-primary to-secondary text-white shadow-sm":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"}`,children:[a.name,y===a.slug&&e.jsx(d.div,{layoutId:"activeTab",className:"absolute inset-0 bg-gradient-to-r from-primary to-secondary rounded-lg -z-10",transition:{type:"spring",bounce:.2,duration:.5}})]},a.slug))]})})}),e.jsx(F,{mode:"wait",children:e.jsxs(d.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15,ease:"easeInOut"},className:"space-y-6 sm:space-y-6",children:[e.jsx(V,{data:s.postSummary,metrics:s.postSummary.metrics}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6 lg:gap-6",children:[e.jsx("div",{className:"xl:col-span-1",children:e.jsx(ae,{data:s.socialAccounts})}),e.jsx("div",{className:"xl:col-span-2",children:e.jsx(B,{data:s.topPosts,col:"3"})})]}),e.jsxs("div",{className:"grid grid-cols-1 xl:grid-cols-3 gap-4 sm:gap-6 lg:gap-6",children:[e.jsx("div",{className:"xl:col-span-2 order-2 xl:order-1",children:e.jsx(Z,{data:s.engagementAnalytics})}),e.jsx("div",{className:"xl:col-span-1 order-1 xl:order-2",children:e.jsx(J,{data:s.accountPerformance,accounts:s.accountPerformance.accounts})})]})]},y||"all")})]})]})})]})}export{Se as default};
