1import{r as l,j as e}from"./main-BkpAS6Tt.js";import{B as g,a as A}from"./index-CuHgF00K.js";import{c as b,d as E}from"./index-sji67aop.js";import{C as m}from"./card-DoRMGzGn.js";import{B as h}from"./button-CVuE7h15.js";import{I as u}from"./input-D3PXSnUk.js";import{L as c}from"./label-Be_2bmKI.js";import{T as O}from"./textarea-BIurjH0E.js";import{I as z}from"./iconify-BLAYqHQO.js";import{c as G}from"./utils-4perknFd.js";import{P as K,a as L,b as H}from"./popover-CcEl5z_f.js";import{C as V}from"./calendar-m2MJAs-m.js";import{C as q}from"./calendar-78Zcf8WD.js";import{f as M}from"./format-CNjrC8BB.js";import{B as p}from"./badge-BVkGl1_x.js";import{S as R,a as X,b as J,c as $,d as Q,f as U,e as W}from"./select-CTV8gp4j.js";import{B as Y}from"./BreadcrumbComp-DdXArMCY.js";import"./_commonjsHelpers-CE1G-McA.js";import"./chance-BLY6SEPW.js";import"./lodash-Cf87YYze.js";import"./sub-BsIxGhQx.js";import"./toDate-BK_JsdFu.js";import"./addMonths-BQ1GswEf.js";import"./iconBase-DXJqPHOa.js";import"./index-QqyytP6n.js";import"./index-L0SKbviM.js";import"./index-Cft9Cwv8.js";import"./index-DRcYnjBa.js";import"./index-CfThMl9f.js";import"./index-Jo9Y0u8a.js";import"./index-BHinUB-C.js";import"./index-aJTH1M9Z.js";import"./tslib.es6-CmEaCU22.js";import"./index-DfANd6nE.js";import"./index-Ddz03csu.js";import"./floating-ui.dom-D7G01c1r.js";import"./index-B_H36sPx.js";import"./index-DjxFjNHx.js";import"./en-US-Dw4dfe3S.js";import"./createLucideIcon-DRlH1f4M.js";import"./chevron-right-DFxpASjY.js";import"./chevron-down-ChXj5Bit.js";import"./index-BdQq_4o_.js";import"./index-DhQbCedW.js";import"./index-D9jDtrFa.js";import"./check-DIOPK-zC.js";import"./CardBox-CY_4CfKs.js";const Z=()=>{const{posts:t}=l.useContext(g),[a,r]=l.useState([]),[n,d]=l.useState(""),[o,x]=l.useState([]),[v,j]=l.useState(!1),[C]=l.useState(["Technology","Lifestyle","Travel","Food","Business","social"]),[y,N]=l.useState(!1),[S]=l.useState(["Trending","Tips","News","Guide","Popular"]);l.useEffect(()=>{if(t.length>0){const s=t[0];s.category&&x(Array.isArray(s.category)?s.category:[s.category]),r(["Trending"])}},[t]);const w=()=>{j(!0)},T=s=>{s.key==="Enter"&&o.length>0&&(x([]),j(!1))},k=s=>{o.includes(s)||x([...o,s]),j(!1)},P=s=>{const i=o.filter(f=>f!==s);x(i)},B=()=>{N(!0)},D=s=>{s.key==="Enter"&&n&&(r([...a,n.trim()]),d(""))},I=s=>{a.includes(s)||r([...a,s]),N(!1)},F=s=>{const i=a.filter(f=>f!==s);r(i)};return e.jsxs(m,{children:[e.jsx("h5",{className:"card-title mb-4",children:"Blog Category"}),e.jsxs("div",{className:"",children:[e.jsx("div",{className:"mb-2 block",children:e.jsxs(c,{htmlFor:"cat",children:["Categories ",e.jsx("span",{className:"text-error ms-1",children:"*"})]})}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{type:"text",id:"cat",onFocus:w,onKeyDown:T}),e.jsx("small",{className:"text-xs text-muted-foreground",children:"Add blog to a category."}),e.jsx("div",{className:" top-full left-0 mt-1 w-full bg-white dark:bg-dark rounded-md shadow-lg z-10 ",children:v&&e.jsx("div",{children:C.map((s,i)=>e.jsx("div",{className:"py-2 px-3 bg-hover cursor-pointer ",onClick:()=>k(s),children:s},i))})}),e.jsx("div",{className:" top-0 left-0 mt-2 mr-2 flex gap-1 flex-wrap",children:o.map((s,i)=>e.jsxs("span",{className:"bg-lightprimary py-1 px-2 rounded-full text-primary flex items-center",children:[s,e.jsx(b,{onClick:()=>P(s),className:"cursor-pointer ml-1",size:12})]},i))})]})]}),e.jsx("div",{className:"mt-2",children:e.jsxs(h,{variant:"lightprimary",className:"w-fit flex items-center gap-2 rounded-xl",children:[e.jsx(E,{size:18})," Add selected category"]})}),e.jsxs("div",{className:"mt-4",children:[e.jsx("div",{className:"mb-2 block",children:e.jsx(c,{htmlFor:"tags",children:"Tags"})}),e.jsxs("div",{className:"relative",children:[e.jsx(u,{type:"text",id:"tags",onFocus:B,onKeyDown:D,value:n,onChange:s=>d(s.target.value)}),e.jsx("small",{className:"text-xs text-muted-foreground",children:"Add tags for blog."}),e.jsx("div",{className:" mt-1 w-full bg-white dark:bg-dark rounded-md shadow-lg z-10",children:y&&e.jsx("div",{children:S.map((s,i)=>e.jsx("div",{className:"py-2 px-3 bg-hover cursor-pointer",onClick:()=>I(s),children:s},i))})}),e.jsx("div",{className:" mt-2 mr-2 flex gap-1 flex-wrap ",children:a.map((s,i)=>e.jsxs("span",{className:"bg-lightprimary py-1 px-2 rounded-full text-primary flex items-center",children:[s,e.jsx(b,{onClick:()=>F(s),className:"cursor-pointer ml-1",size:12})]},i))})]})]})]})},_=()=>{const{posts:t}=l.useContext(g),[a,r]=l.useState(""),[n,d]=l.useState("");return l.useEffect(()=>{if(t.length>0){const o=t[0];r(o.title??""),d(o.content??"")}},[t]),console.log(a),e.jsx(e.Fragment,{children:e.jsxs(m,{children:[e.jsx("h5",{className:"card-title mb-4",children:"Blog Details"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("div",{className:"mb-2 block",children:e.jsxs(c,{htmlFor:"prednm",children:["Blog Title ",e.jsx("span",{className:"text-error ms-1",children:"*"})]})}),e.jsx(u,{id:"prednm",type:"text",placeholder:"Blog Title",value:a,onChange:o=>r(o.target.value)}),e.jsx("small",{className:"text-xs text-muted-foreground",children:"A blog title is required and recommended to be unique."})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 block",children:e.jsx(c,{htmlFor:"desc",children:"Content"})}),e.jsx(O,{id:"comment",placeholder:"Blog Content...",rows:5,value:n,onChange:o=>d(o.target.value)}),e.jsx("small",{className:"text-xs text-muted-foreground",children:"Set a Content to the blog for better visibility."})]})]})})},ee=()=>{const{posts:t}=l.useContext(g),a=t.length>0?t[0].coverImg:null;return e.jsx(e.Fragment,{children:e.jsxs(m,{children:[e.jsx("h5",{className:"card-title mb-4",children:"Cover Image"}),e.jsx("div",{className:"flex w-full items-center justify-center mb-4",children:e.jsxs(c,{htmlFor:"dropzone-file",className:"flex h-64 w-full cursor-pointer flex-col items-center justify-center rounded-lg border border-dashed border-primary bg-lightprimary dark:bg-darkprimary",children:[a?e.jsx("img",{src:a,alt:"Cover",className:"h-full w-full object-cover rounded-lg"}):e.jsxs("div",{className:"flex flex-col items-center justify-center pb-6 pt-5",children:[e.jsx(z,{icon:"solar:cloud-upload-outline",height:32,className:"mb-3 text-primary "}),e.jsxs("p",{className:"mb-2 text-sm text-primary ",children:[e.jsx("span",{className:"font-semibold",children:"Click to upload"})," or drag and drop"]}),e.jsx("p",{className:"text-xs text-primary ",children:"SVG, PNG, JPG or GIF (MAX. 800x400px)"})]}),e.jsx(u,{type:"file",id:"dropzone-file",className:"hidden"})]})})]})})},se=()=>{const{posts:t}=l.useContext(g),[a,r]=l.useState(new Date);return l.useEffect(()=>{t.length>0&&t[0].createdAt&&r(t[0].createdAt)},[t]),e.jsxs(m,{children:[e.jsx("h5",{className:"card-title mb-4",children:"Publish Date"}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 block",children:e.jsxs(c,{htmlFor:"publishDate",children:["Select publish date ",e.jsx("span",{className:"text-error ms-1",children:"*"})]})}),e.jsxs(K,{children:[e.jsx(L,{asChild:!0,children:e.jsxs(h,{variant:"outline",className:G("w-full justify-start text-left font-normal",!a&&"text-muted-foreground"),children:[e.jsx(q,{className:"mr-2 h-4 w-4"}),a?M(a,"PPP"):e.jsx("span",{children:"Pick a date"})]})}),e.jsx(H,{className:"w-auto p-0",align:"start",children:e.jsx(V,{mode:"single",selected:a,onSelect:r,autoFocus:!0})})]}),e.jsx("small",{className:"text-xs text-muted-foreground",children:"Choose the date when this blog post should be published."})]})]})},te=()=>{const[t,a]=l.useState("Publish"),r=["Draft","Schedule","Publish","Inactive"];return e.jsx(e.Fragment,{children:e.jsxs(m,{children:[e.jsxs("div",{className:"flex justify-between items-center mb-4",children:[e.jsx("h5",{className:"card-title",children:"Blog Status"}),t==="Publish"?e.jsx(p,{variant:"success",className:"h-3 w-3 p-0"}):t==="Schedule"?e.jsx(p,{variant:"secondary",className:"h-3 w-3 p-0"}):t==="Draft"?e.jsx(p,{variant:"error",className:"h-3 w-3 p-0"}):e.jsx(p,{variant:"warning",className:"h-3 w-3 p-0"})]}),e.jsxs("div",{children:[e.jsxs(R,{value:t,onValueChange:a,children:[e.jsx(X,{className:"w-full",id:"countries",children:e.jsx(J,{placeholder:"Select status"})}),e.jsx($,{children:e.jsxs(Q,{children:[e.jsx(U,{children:"Status"}),r.map(n=>e.jsx(W,{value:n,children:n},n))]})})]}),e.jsx("small",{className:"text-xs text-muted-foreground",children:"Set the blog status."})]})]})})},ae=[{to:"/",title:"Home"},{to:"/apps/blog/post",title:"Blog"},{to:"",title:"Blog Edit"}];function Ye(){return e.jsx(e.Fragment,{children:e.jsxs(A,{children:[e.jsx(Y,{title:"Blog app",items:ae}),e.jsxs("div",{className:"grid grid-cols-12 gap-[30px]",children:[e.jsx("div",{className:"lg:col-span-8 col-span-12",children:e.jsxs("div",{className:"flex flex-col gap-[30px]",children:[e.jsx(_,{}),e.jsx(ee,{})]})}),e.jsx("div",{className:"lg:col-span-4 col-span-12",children:e.jsxs("div",{className:"flex flex-col gap-[30px]",children:[e.jsx(te,{}),e.jsx(Z,{}),e.jsx(se,{})]})}),e.jsx("div",{className:"lg:col-span-8 col-span-12",children:e.jsxs("div",{className:"sm:flex gap-3",children:[e.jsx(h,{className:"sm:mb-0 mb-3 w-fit",children:"Save changes"}),e.jsx(h,{variant:"lighterror",className:"w-fit",children:"Cancel"})]})})]})]})})}export{Ye as component};
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.