1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2701],{10239:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/blog/[id]",function(){return a(33475)}])},92161:function(e,t,a){"use strict";a.d(t,{Y:function(){return c},Z:function(){return u}});var l=a(85893),r=a(67294),n=a(44389),s=a(84858),i=a(32474);let d=e=>(0,s.Px)(e),o=e=>e?e>1048576?`${(0,i.N)(Math.round(e/1024/102.4)/10)} Ù
Ú¯Ø§Ø¨Ø§ÛØª`:`${(0,i.N)(Math.round(e/1024))} Ú©ÛÙÙØ¨Ø§Ûت`:"";function c(e){let{onPick:t,requireAlt:a=!0,confirmLabel:c="Ø§ÙØªØ®Ø§Ø¨",active:u=!0}=e,[x,m]=(0,r.useState)(""),[g,h]=(0,r.useState)(null),[p,b]=(0,r.useState)(""),[f,j]=(0,r.useState)(!1),[y,v]=(0,r.useState)(null),N=(0,r.useRef)(null),{data:C,isLoading:E,mutate:I}=(0,n.u)(u?`/api/admin/blog/media?q=${encodeURIComponent(x)}&pageSize=36`:null,d),w=(null==C?void 0:C.items)??[],D=e=>{h(e),b(e.alt??""),v(null)},S=(0,r.useCallback)(async e=>{if(null==e?void 0:e.length){j(!0),v(null);try{let t=null;for(let a of Array.from(e)){let e=new FormData;e.append("image",a),t=await (0,s.SC)("/api/admin/blog/media",{method:"POST",body:e})}await I(),t&&D(t)}catch(e){v((null==e?void 0:e.message)??"آپÙÙØ¯ ÙØ´Ø¯.")}finally{j(!1),N.current&&(N.current.value="")}}},[I]);async function A(){if(g){if(a&&!p.trim()){v("Ù
ت٠جاÛگزÛÙ ÙØ§Ø²Ù
است â Ø¨Ø¯ÙÙ Ø¢Ù Ø§ÙØªØ´Ø§Ø± رد Ù
ÛâØ´ÙØ¯.");return}if((g.alt??"")!==p.trim())try{await (0,s.SC)(`/api/admin/blog/media/${g.id}`,{method:"PATCH",body:JSON.stringify({alt:p.trim()||null})}),I()}catch{}t({url:g.url,alt:p.trim()})}}async function k(e){window.confirm(`\xab${e.title||e.url}\xbb از کتابخاÙÙ Ø¨Ø±Ø¯Ø§Ø´ØªÙ Ø´ÙØ¯Ø ÙØ§Û٠پاک ÙÙ
ÛâØ´ÙØ¯.`)&&(await (0,s.SC)(`/api/admin/blog/media/${e.id}`,{method:"DELETE"}),(null==g?void 0:g.id)===e.id&&h(null),I())}return(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-8",children:[(0,l.jsx)(i.II,{value:x,onChange:e=>m(e.target.value),placeholder:"جستج٠در ÙØ§Ù
ÛØ§ ØªÙØ¶ÛØ ÙØ§ÛÙ",className:"min-w-0 flex-1"}),(0,l.jsx)("input",{ref:N,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:e=>S(e.target.files)}),(0,l.jsx)(i.zx,{onClick:()=>{var e;return null===(e=N.current)||void 0===e?void 0:e.click()},disabled:f,children:f?"در ØØ§Ù آپÙÙØ¯â¦":"آپÙÙØ¯ تصÙÛØ±"})]}),y&&(0,l.jsx)("div",{className:"rounded-10 border border-red-200 bg-red-50 px-12 py-8 text-12 leading-22 text-red-700",children:y}),(0,l.jsx)("div",{className:"max-h-[46vh] overflow-y-auto rounded-12 border border-gray-E5E5E6 p-8",onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),S(e.dataTransfer.files)},children:E?(0,l.jsx)("div",{className:"grid grid-cols-3 gap-8 md:grid-cols-6",children:Array.from({length:12}).map((e,t)=>(0,l.jsx)("div",{className:"aspect-square animate-pulse rounded-10 bg-gray-F0F0F0"},t))}):0===w.length?(0,l.jsx)("p",{className:"py-40 text-center text-14 text-gray-9B9BAA",children:"ÚÛØ²Û در کتابخاÙÙ ÙÛØ³Øª. ÙØ§Û٠را ÙÙ
ÛÙâØ¬Ø§ Ø±ÙØ§ Ú©ÙÛØ¯ ÛØ§ \xabآپÙÙØ¯ تصÙÛØ±\xbb را بزÙÛØ¯."}):(0,l.jsx)("div",{className:"grid grid-cols-3 gap-8 md:grid-cols-6",children:w.map(e=>(0,l.jsxs)("button",{type:"button",onClick:()=>D(e),className:`group relative aspect-square overflow-hidden rounded-10 border-2 transition ${(null==g?void 0:g.id)===e.id?"border-primary-main":"border-transparent hover:border-gray-D2D2D7"}`,title:e.title??e.url,children:[(0,l.jsx)("img",{src:(0,i.vD)(e.url,240),alt:e.alt??"",loading:"lazy",className:"h-full w-full object-cover"}),!e.alt&&(0,l.jsx)("span",{className:"absolute bottom-0 right-0 left-0 bg-amber-400 py-2 text-10 text-amber-900",children:"بدÙÙ ØªÙØ¶ÛØ"})]},e.id))})}),g&&(0,l.jsxs)("div",{className:"flex flex-col gap-12 rounded-12 border border-gray-E5E5E6 p-12 md:flex-row md:items-start",children:[(0,l.jsx)("img",{src:(0,i.vD)(g.url,320),alt:"",className:"h-96 w-128 shrink-0 rounded-10 object-cover"}),(0,l.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,l.jsx)("p",{className:"truncate text-14 font-m",children:g.title||"بدÙÙ ÙØ§Ù
"}),(0,l.jsx)("p",{dir:"ltr",className:"truncate text-right text-11 text-gray-9B9BAA",children:g.url}),(0,l.jsx)("p",{className:"mt-2 text-11 text-gray-9B9BAA",children:o(g.sizeBytes)}),(0,l.jsx)("div",{className:"mt-8",children:(0,l.jsx)(i.II,{value:p,onChange:e=>b(e.target.value),placeholder:"Ù
ت٠جاÛگزÛÙ â ÚÙ ÚÛØ²Û در تصÙÛØ± استØ"})})]}),(0,l.jsxs)("div",{className:"flex shrink-0 gap-8",children:[(0,l.jsx)(i.zx,{onClick:A,children:c}),(0,l.jsx)(i.zx,{variant:"ghost",onClick:()=>k(g),children:"ØØ°Ù"})]})]})]})}function u(e){let{open:t,onClose:a,onPick:r,requireAlt:n=!0,title:s="کتابخاÙÙâÛ Ø±Ø³Ø§ÙÙ"}=e;return(0,l.jsx)(i.u_,{open:t,onClose:a,title:s,width:"max-w-[900px]",children:(0,l.jsx)(c,{active:t,requireAlt:n,onPick:e=>{r(e),a()}})})}},2251:function(e,t,a){"use strict";a.d(t,{Z:function(){return c}});var l=a(85893),r=a(41664),n=a.n(r),s=a(11163),i=a(44389),d=a(84858);let o=[{href:"/admin/blog",label:"Ù
ÙØ§ÙÙâÙØ§",exact:!0},{href:"/admin/blog/taxonomy",label:"Ø¯Ø³ØªÙØ Ø¨Ø±ÚØ³Ø¨Ø ÙÙÛØ³ÙدÙ"},{href:"/admin/blog/comments",label:"ÙØ¸Ø±Ùا",badge:"comments"},{href:"/admin/blog/media",label:"رساÙÙ"},{href:"/admin/blog/settings",label:"ÙØ¯Ø± Ù ÙÙØªØ±"}];function c(){var e;let t=(0,s.useRouter)(),{data:a}=(0,i.u)("/api/admin/blog/comments?pageSize=1",e=>(0,d.Px)(e)),r=(null===(e=null==a?void 0:a.meta)||void 0===e?void 0:e.pending)??0;return(0,l.jsx)("nav",{className:"mb-16 flex flex-wrap items-center gap-8","aria-label":"بخشâÙØ§Û Ù
جÙÙ",children:o.map(e=>{let a=e.exact?t.pathname===e.href:t.pathname.startsWith(e.href);return(0,l.jsxs)(n(),{href:e.href,className:`inline-flex items-center gap-6 rounded-100 px-14 py-8 text-13 transition ${a?"bg-primary-main text-white":"bg-white text-gray-6C6A7D hover:bg-gray-F0F0F0"}`,children:[e.label,"comments"===e.badge&&r>0&&(0,l.jsx)("span",{className:`inline-flex h-18 min-w-18 items-center justify-center rounded-100 px-4 text-10 ${a?"bg-white text-primary-dark":"bg-red-500 text-white"}
1`,children:r.toLocaleString("fa-IR")})]},e.href)})})}},33475:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return U}});var l=a(85893),r=a(67294),n=a(11163),s=a(5152),i=a.n(s),d=a(44389),o=a(49759),c=a(2251),u=a(92161),x=a(68289),m=a.n(x);let g=["ÙØ±ÙردÛÙ","Ø§Ø±Ø¯ÛØ¨Ùشت","خرداد","ØªÛØ±","Ù
رداد","Ø´ÙØ±ÛÙØ±","Ù
ÙØ±","آباÙ","آذر","دÛ","بÙÙ
Ù","اسÙÙØ¯"],h=["Ø´","Û","د","س","Ú","Ù¾","ج"],p=e=>e.toLocaleString("fa-IR",{useGrouping:!1}),b=e=>String(e).padStart(2,"0");function f(e){let{value:t,onChange:a,minNow:n=!0}=e,s=t?m()(t):m()().add(1,"hour").startOf("hour"),[i,d]=(0,r.useState)(()=>s.clone().startOf("jMonth")),[o,c]=(0,r.useState)(()=>s.clone()),[u,x]=(0,r.useState)(()=>`${b(s.hour())}:${b(s.minute())}`);(0,r.useEffect)(()=>{if(!t)return;let e=m()(t);e.isValid()&&(c(e.clone()),d(e.clone().startOf("jMonth")),x(`${b(e.hour())}:${b(e.minute())}`))},[t]);let f=(e,t)=>{let[l,r]=t.split(":").map(e=>Number(e)||0),n=e.clone().hour(l).minute(r).second(0).millisecond(0);a(n.toISOString())},j=(0,r.useMemo)(()=>{let e=i.clone().startOf("jMonth"),t=m().jDaysInMonth(e.jYear(),e.jMonth()),a=(e.day()+1)%7,l=Array.from({length:a},()=>null);for(let a=1;a<=t;a++)l.push(e.clone().jDate(a));return l},[i]),y=m()().startOf("day"),v=(e,t)=>e.jYear()===t.jYear()&&e.jMonth()===t.jMonth()&&e.jDate()===t.jDate();return(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-12",children:[(0,l.jsxs)("div",{className:"mb-10 flex items-center justify-between",children:[(0,l.jsx)("button",{type:"button","aria-label":"Ù
ا٠بعد",onClick:()=>d(e=>e.clone().add(1,"jMonth")),className:"h-28 w-28 rounded-8 text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"â¹"}),(0,l.jsxs)("span",{className:"text-14 font-m",children:[g[i.jMonth()]," ",p(i.jYear())]}),(0,l.jsx)("button",{type:"button","aria-label":"Ù
Ø§Ù ÙØ¨Ù",onClick:()=>d(e=>e.clone().subtract(1,"jMonth")),className:"h-28 w-28 rounded-8 text-gray-6C6A7D hover:bg-gray-F0F0F0",children:"âº"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-7 gap-2 text-center",children:[h.map(e=>(0,l.jsx)("span",{className:"py-2 text-11 text-gray-6C6A7D",children:e},e)),j.map((e,t)=>{if(!e)return(0,l.jsx)("span",{},`e${t}`);let a=n&&e.isBefore(y,"day"),r=v(e,o);return(0,l.jsx)("button",{type:"button",disabled:a,onClick:()=>{c(e),f(e,u)},className:`h-30 rounded-8 text-13 transition ${r?"bg-primary-main text-white":a?"text-gray-C4CAD3 cursor-not-allowed":"hover:bg-gray-F0F0F0"} ${v(e,y)&&!r?"border border-primary-main":""}`,children:p(e.jDate())},e.format("jYYYY-jMM-jDD"))})]}),(0,l.jsxs)("div",{className:"mt-12 flex items-center gap-8 border-t border-gray-E5E5E6 pt-12",children:[(0,l.jsx)("span",{className:"text-13 text-gray-6C6A7D",children:"ساعت"}),(0,l.jsx)("input",{type:"time",dir:"ltr",value:u,onChange:e=>{x(e.target.value),f(o,e.target.value)},className:"rounded-10 border border-gray-E5E5E6 px-10 py-6 text-14 outline-none focus:border-primary-main"}),(0,l.jsx)("span",{className:"mr-auto text-12 text-gray-6C6A7D",children:t?`${p(o.jDate())} ${g[o.jMonth()]} ${p(o.jYear())}Ø Ø³Ø§Ø¹Øª ${u}`:"ÙÙÙØ² زÙ
اÙÛ Ø§ÙØªØ®Ø§Ø¨ ÙØ´Ø¯Ù"})]})]})}var j=a(32474);let y={metaTitle:"",metaDescription:"",canonicalUrl:"",ogTitle:"",ogDescription:"",ogImageUrl:"",twitterCard:"",isIndexable:!0,isFollowable:!0},v="https://lidomatrip.com",N=[30,60],C=[80,158];function E(e){let{value:t,range:a,labelShort:r,labelLong:n}=e,[s,i]=a,d=0===t?"empty":t<s?"short":t>i?"long":"ok";return(0,l.jsxs)("div",{className:"mt-6",children:[(0,l.jsx)("div",{className:"h-4 w-full overflow-hidden rounded-8 bg-gray-F0F0F0",children:(0,l.jsx)("div",{className:`h-full ${"ok"===d?"bg-primary-main":"long"===d?"bg-red-500":"bg-amber-400"} transition-all`,style:{width:`${Math.min(100,Math.round(t/i*100))}%`}})}),(0,l.jsxs)("p",{className:"mt-4 text-11 text-gray-6C6A7D",children:[t.toLocaleString("fa-IR")," کاراکتر","short"===d&&` â ${r}`,"long"===d&&` â ${n}`,"ok"===d&&" â Ø§ÙدازÙâØ§Ø´ Ø®ÙØ¨ است"]})]})}function I(e){let{value:t,onChange:a,postTitle:n,postExcerpt:s,postSlug:i,featuredImageUrl:d}=e,o=(e,l)=>a({...t,[e]:l}),c=(0,r.useMemo)(()=>({title:t.metaTitle.trim()||n||"بدÙ٠عÙÙØ§Ù",description:t.metaDescription.trim()||s||"",url:t.canonicalUrl.trim()||`${v}/blog/${i||"â¦"}/`}),[t,n,s,i]);return(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 bg-gray-FAFAFF p-16",children:[(0,l.jsx)("p",{className:"mb-10 text-12 text-gray-6C6A7D",children:"اÛÙâØ·ÙØ± در ÙØªØ§Ûج Ú¯ÙÚ¯Ù Ø¯ÛØ¯Ù Ù
ÛâØ´ÙØ¯"}),(0,l.jsxs)("div",{dir:"rtl",className:"rounded-10 bg-white p-14",children:[(0,l.jsx)("p",{dir:"ltr",className:"truncate text-right text-12 text-[#5f6368]",children:c.url}),(0,l.jsx)("p",{className:"mt-2 text-18 leading-28 text-[#1a0dab]",children:c.title}),(0,l.jsx)("p",{className:"mt-2 text-13 leading-24 text-[#4d5156]",children:c.description||(0,l.jsx)("span",{className:"text-gray-C4CAD3",children:"ØªÙØ¶ÛØÛ ÙÛØ³Øª â Ú¯ÙÚ¯Ù Ø®ÙØ¯Ø´ تکÙâØ§Û Ø§Ø² Ù
ت٠را برÙ
ÛâØ¯Ø§Ø±Ø¯Ø Ú©Ù Ù
عÙ
ÙÙØ§Ù بدترÛ٠تک٠است."})})]}),!t.isIndexable&&(0,l.jsxs)("p",{className:"mt-10 rounded-8 bg-amber-50 px-10 py-6 text-11 leading-20 text-amber-800",children:["اÛÙ Ù
ÙØ§ÙÙ ",(0,l.jsx)("b",{children:"noindex"})," Ø§Ø³ØªØ Ù¾Ø³ در عÙ
Ù ÙÛÚâÙÙØª اÛÙâØ·ÙØ± Ø¯ÛØ¯Ù ÙÙ
ÛâØ´ÙØ¯."]})]}),(0,l.jsxs)(j.gN,{label:"عÙÙØ§Ù سئÙ",hint:"خاÙÛ Ø¨Ú¯Ø°Ø§Ø±ÛØ¯ تا عÙÙØ§Ù Ø®ÙØ¯Ù Ù
ÙØ§ÙÙ Ø¨Ø±ÙØ¯.",children:[(0,l.jsx)(j.II,{value:t.metaTitle,onChange:e=>o("metaTitle",e.target.value),placeholder:n||"عÙÙØ§Ù Ù
ÙØ§ÙÙ"}),(0,l.jsx)(E,{value:t.metaTitle.trim().length||(n??"").length,range:N,labelShort:"Ú©ÙØªØ§Ù Ø§Ø³ØªØ Ø¬Ø§Û Ø¨ÛØ´ØªØ±Û Ù
1ست",labelLong:"Ú¯ÙÚ¯Ù Ø§ØØªÙ
Ø§ÙØ§Ù آخرش را Ù
ÛâØ¨Ø±Ø¯"})]}),(0,l.jsxs)(j.gN,{label:"ØªÙØ¶ÛØ Ù
تا",hint:"خاÙÛ Ø¨Ú¯Ø°Ø§Ø±ÛØ¯ تا ÚÚ©ÛØ¯ÙâÛ Ù
ÙØ§ÙÙ Ø¨Ø±ÙØ¯.",children:[(0,l.jsx)("textarea",{value:t.metaDescription,onChange:e=>o("metaDescription",e.target.value),placeholder:s||"ÛÚ© ÛØ§ د٠جÙ
ÙÙ Ú©Ù Ù
ÛâÚ¯ÙÛØ¯ اÛÙ Ù
ÙØ§ÙÙ ÚÙ Ø¬ÙØ§Ø¨Û Ù
ÛâØ¯ÙØ¯.",rows:3,className:"w-full rounded-10 border border-gray-E5E5E6 px-14 py-10 text-14 leading-24 outline-none transition focus:border-primary-main"}),(0,l.jsx)(E,{value:t.metaDescription.trim().length||(s??"").length,range:C,labelShort:"Ú©ÙØªØ§Ù Ø§Ø³ØªØ Ø¬Ø§Û Ø¨ÛØ´ØªØ±Û ÙØ³Øª",labelLong:"Ú¯ÙÚ¯Ù Ø§ØØªÙ
Ø§ÙØ§Ù آخرش را Ù
ÛâØ¨Ø±Ø¯"})]}),(0,l.jsx)(j.gN,{label:"آدرس کاÙÙÛکاÙ",hint:"ÙÙØ· ÙÙØªÛ اÛÙ Ù
ÙØ§ÙÙ ÙØ³Ø®ÙâÛ ØªÚ©Ø±Ø§Ø±Û ÚÛØ² دÛÚ¯Ø±Û Ø§Ø³Øª. خاÙÛ ÛØ¹ÙÛ Ø®ÙØ¯Ø´.",children:(0,l.jsx)(j.II,{dir:"ltr",value:t.canonicalUrl,onChange:e=>o("canonicalUrl",e.target.value),placeholder:`${v}/blog/${i||"â¦"}/`})}),(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-16",children:[(0,l.jsx)("p",{className:"mb-12 text-14 font-m",children:"ÙÙØªÛ ÙÛÙÚ© در شبکÙâÙØ§Û اجتÙ
Ø§Ø¹Û ÙØ±Ø³ØªØ§Ø¯Ù Ù
ÛâØ´ÙØ¯"}),(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsx)(j.gN,{label:"عÙÙØ§Ù اشتراکâگذارÛ",children:(0,l.jsx)(j.II,{value:t.ogTitle,onChange:e=>o("ogTitle",e.target.value),placeholder:c.title})}),(0,l.jsx)(j.gN,{label:"ØªÙØ¶ÛØ Ø§Ø´ØªØ±Ø§Ú©âگذارÛ",children:(0,l.jsx)(j.II,{value:t.ogDescription,onChange:e=>o("ogDescription",e.target.value),placeholder:c.description||"ÙÙ
Ø§Ù ØªÙØ¶ÛØ Ù
تا"})}),(0,l.jsx)(j.gN,{label:"تصÙÛØ± اشتراکâگذارÛ",hint:"خاÙÛ ÛØ¹ÙÛ ØªØµÙÛØ± شاخص. ÙØ³Ø¨Øª Û±Ù«Û¹Û± ب٠۱ Ø¨ÙØªØ±ÛÙ ÙØªÛج٠را Ù
ÛâØ¯ÙØ¯.",children:(0,l.jsx)(j.II,{dir:"ltr",value:t.ogImageUrl,onChange:e=>o("ogImageUrl",e.target.value),placeholder:d||"https://â¦"})})]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-10 rounded-12 border border-gray-E5E5E6 p-16",children:[(0,l.jsx)("p",{className:"text-14 font-m",children:"Ø®Ø²ÙØ¯ÙâÙØ§"}),(0,l.jsx)(j.ZD,{checked:t.isIndexable,onChange:e=>o("isIndexable",e),label:"در ÙØªØ§Ûج جستâÙØ¬Ù ÙØ´Ø§Ù Ø¯Ø§Ø¯Ù Ø´ÙØ¯"}),(0,l.jsx)(j.ZD,{checked:t.isFollowable,onChange:e=>o("isFollowable",e),label:"ÙÛÙÚ©âÙØ§Û داخ٠Ù
ÙØ§ÙÙ Ø¯ÙØ¨Ø§Ù Ø´ÙÙØ¯"}),(0,l.jsx)("p",{className:"text-11 leading-20 text-gray-6C6A7D",children:"ÙØ± Ø¯Ù Ù¾ÛØ´âÙØ±Ø¶ Ø±ÙØ´ÙâØ§ÙØ¯. خاÙ
ÙØ´âکرد٠اÙÙÛ Ù
ÙØ§Ù٠را از Ú¯Ùگ٠برÙ
ÛâØ¯Ø§Ø±Ø¯ â Ú©Ø§Ø±Û Ú©Ù Ø¨Ø±Ú¯Ø´ØªØ´ ÙÙØªÙâÙØ§ Ø·ÙÙ Ù
Ûâکشد."})]})]})}var w=a(84858);let D=i()(()=>Promise.all([a.e(6911),a.e(1509),a.e(7877),a.e(1342)]).then(a.bind(a,81342)),{loadableGenerated:{webpack:()=>[81342]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"min-h-[380px] animate-pulse rounded-16 bg-gray-F0F0F0"})}),S={DRAFT:"Ù¾ÛØ´âÙÙÛØ³",PENDING_REVIEW:"در Ø§ÙØªØ¸Ø§Ø± بازبÛÙÛ",SCHEDULED:"زÙ
اÙâØ¨ÙØ¯ÛâØ´Ø¯Ù",PUBLISHED:"Ù
ÙØªØ´Ø± شدÙ",ARCHIVED:"باÛگاÙÛ"},A={DRAFT:"bg-gray-F0F0F0 text-gray-6C6A7D",PENDING_REVIEW:"bg-amber-100 text-amber-800",SCHEDULED:"bg-blue-100 text-blue-800",PUBLISHED:"bg-primary-light text-[#046d62]",ARCHIVED:"bg-gray-F0F0F0 text-gray-9B9BAA"},k=e=>(0,w.SC)(e);function F(e){let{options:t,value:a,onChange:r,empty:n}=e;return t.length?(0,l.jsx)("div",{className:"flex flex-wrap gap-6",children:t.map(e=>{let t=a.includes(e.id);return(0,l.jsx)("button",{type:"button",onClick:()=>r(t?a.filter(t=>t!==e.id):[...a,e.id]),className:`rounded-100 px-12 py-6 text-12 transition ${t?"bg-primary-main text-white":"bg-gray-F0F0F0 text-gray-6C6A7D hover:bg-gray-E5E5E6"}`,children:e.label},e.id)})}):(0,l.jsx)("p",{className:"text-12 text-gray-9B9BAA",children:n})}function $(e){let{value:t,onChange:a}=e,[n,s]=(0,r.useState)(""),{data:i}=(0,d.u)(n.trim().length>=2?`/api/admin/blog/pick/locations?q=${encodeURIComponent(n.trim())}`:null,k),o=e=>{t.some(t=>t.id===e.id)||(a([...t,{id:e.id,name:e.name,type:e.type}]),s(""))};return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[t.length>0&&(0,l.jsx)("div",{className:"flex flex-wrap gap-6",children:t.map((e,r)=>(0,l.jsxs)("span",{className:"inline-flex items-center gap-6 rounded-100 bg-primary-light px-12 py-6 text-12 text-[#046d62]",children:[0===r&&(0,l.jsx)("b",{className:"text-10",children:"اصÙÛ"}),e.name,(0,l.jsx)("span",{className:"text-10 text-gray-6C6A7D",children:"PROVINCE"===e.type?"استاÙ":"Ø´ÙØ±"}),(0,l.jsx)("button",{type:"button","aria-label":"ØØ°Ù",onClick:()=>a(t.filter(t=>t.id!==e.id)),className:"text-gray-6C6A7D",children:"â"})]},e.id))}),(0,l.jsx)(j.II,{value:n,onChange:e=>s(e.target.value),placeholder:"ÙØ§Ù
Ø´ÙØ± ÛØ§ استاÙâ¦"}),(i??[]).length>0&&(0,l.jsx)("div",{className:"max-h-[180px] overflow-y-auto rounded-10 border border-gray-E5E5E6",children:(i??[]).map(e=>{var t;return(0,l.jsxs)("button",{type:"button",onClick:()=>o(e),className:"flex w-full items-center justify-between px-12 py-8 text-12 transition hover:bg-gray-F8F8F8",children:[(0,l.jsx)("span",{children:e.name}),(0,l.jsx)("span",{className:"text-10 text-gray-9B9BAA",children:"PROVINCE"===e.type?"استاÙ":(null===(t=e.parent)||void 0===t?void 0:t.name)??"Ø´ÙØ±"})]},e.id)})})]})}function U(){let e=(0,n.useRouter)(),t=e.query.id,a="new"===t,s=a?null:Number(t),i=(0,d.u)(s?`/api/admin/blog/posts/${s}`:null,k),x=(0,d.u)("/api/admin/blog/authors",k),m=(0,d.u)("/api/admin/blog/categories",k),g=(0,d.u)("/api/admin/blog/tags",k),[h,p]=(0,r.useState)("content"),[b,v]=(0,r.useState)({title:"",slug:"",excerpt:"",authorIds:[],tagIds:[]}),[N,C]=(0,r.useState)(null),[E,U]=(0,r.useState)(y),[T,B]=(0,r.useState)([]),[O,R]=(0,r.useState)([]),[L,M]=(0,r.useState)("DRAFT"),[_,z]=(0,r.useState)(""),[H,q]=(0,r.useState)(!1),[Y,V]=(0,r.useState)(!1),[Z,J]=(0,r.useState)(null),[G,W]=(0,r.useState)(null),[X,Q]=(0,r.useState)(null),[K,ee]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=i.data;e&&(v({title:e.title??"",slug:e.slug??"",excerpt:e.excerpt??"",categoryId:e.categoryId??"",featuredImageUrl:e.featuredImageUrl??"",featuredImageAlt:e.featuredImageAlt??"",authorIds:(e.authors??[]).map(e=>e.authorId),tagIds:(e.tags??[]).map(e=>e.tagId)}),C(e.contentJson??null),M(e.status??"DRAFT"),z(e.scheduledAt??""),B((e.faqs??[]).map(e=>({question:e.question,answer:e.answer}))),U({...y,...Object.fromEntries(Object.entries(e.seo??{}).filter(e=>{let[t]=e;return t in y}).map(e=>
1{let[t,a]=e;return[t,a??("boolean"==typeof y[t]||"")]}))}))},[i.data]),(0,r.useEffect)(()=>{var e;let t=((null===(e=i.data)||void 0===e?void 0:e.locations)??[]).map(e=>e.locationId);if(!t.length)return;let a=!1;return(0,w.SC)("/api/admin/blog/pick/locations").then(e=>{if(a)return;let l=e.filter(e=>t.includes(e.id));R(t.map(e=>l.find(t=>t.id===e)).filter(Boolean).map(e=>({id:e.id,name:e.name,type:e.type})))}).catch(()=>void 0),()=>{a=!0}},[i.data]);let et=(e,t)=>v(a=>({...a,[e]:t})),ea=(0,r.useMemo)(()=>{var e,t;return{title:b.title,slug:(null===(e=b.slug)||void 0===e?void 0:e.trim())||void 0,excerpt:b.excerpt||null,contentJson:N??void 0,categoryId:b.categoryId?Number(b.categoryId):null,featuredImageUrl:b.featuredImageUrl||null,featuredImageAlt:b.featuredImageAlt||null,authorIds:b.authorIds??[],tagIds:b.tagIds??[],locationIds:O.map(e=>e.id),primaryLocationId:(null===(t=O[0])||void 0===t?void 0:t.id)??null,faqs:T,seo:E}},[b,N,O,T,E]);async function el(){ee(!0),W(null),Q(null);try{if(a){let t=await (0,w.SC)("/api/admin/blog/posts",{method:"POST",body:JSON.stringify(ea)});return e.replace(`/admin/blog/${t.id}`),Q("Ø°Ø®ÛØ±Ù شد."),t.id}return await (0,w.SC)(`/api/admin/blog/posts/${s}`,{method:"PATCH",body:JSON.stringify(ea)}),await i.mutate(),Q("Ø°Ø®ÛØ±Ù شد."),s}catch(e){return W((null==e?void 0:e.message)??"Ø°Ø®ÛØ±Ù ÙØ´Ø¯."),null}finally{ee(!1)}}async function er(e){if(a){W("اÙÙ Ù
ÙØ§Ù٠را Ø°Ø®ÛØ±Ù Ú©ÙÛØ¯.");return}ee(!0),W(null),Q(null);try{await (0,w.SC)(`/api/admin/blog/posts/${s}/status`,{method:"POST",body:JSON.stringify({status:e,scheduledAt:"SCHEDULED"===e&&_||null})}),await i.mutate(),M(e),Q("PUBLISHED"===e?"Ù
ÙØªØ´Ø± شد.":"SCHEDULED"===e?"زÙ
اÙâØ¨ÙØ¯Û شد.":"ÙØ¶Ø¹Ûت تغÛÛØ± کرد.")}catch(e){W((null==e?void 0:e.message)??"تغÛÛØ± ÙØ¶Ø¹Ûت Ø§ÙØ¬Ø§Ù
ÙØ´Ø¯.")}finally{ee(!1)}}async function en(){let e=await el();if(e){ee(!0);try{let{token:t}=await (0,w.SC)(`/api/admin/blog/posts/${e}/preview-token`,{method:"POST"}),a=`/blog/preview/${t}`;J(a),window.open(a,"_blank","noopener")}catch(e){W((null==e?void 0:e.message)??"ÙÛÙÚ© Ù¾ÛØ´âÙÙ
Ø§ÛØ´ Ø³Ø§Ø®ØªÙ ÙØ´Ø¯.")}finally{ee(!1)}}}let es=!a&&i.isLoading,ei=[{key:"content",label:"Ù
ØØªÙا"},{key:"seo",label:"سئÙ"},{key:"faq",label:`پرسشâÙØ§${T.length?` (${T.length.toLocaleString("fa-IR")})`:""}`},{key:"meta",label:"دست٠٠Ù
ÙØµØ¯"}];return(0,l.jsxs)(o.Z,{title:a?"Ù
ÙØ§ÙÙâÛ ØªØ§Ø²Ù":"ÙÛØ±Ø§ÛØ´ Ù
ÙØ§ÙÙ",children:[(0,l.jsx)(c.Z,{}),(0,l.jsxs)("div",{className:"flex flex-col gap-16 md:flex-row md:items-start",children:[(0,l.jsx)("div",{className:"min-w-0 flex-1",children:(0,l.jsx)(j.Zb,{className:"p-16 md:p-20",children:es?(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsx)(j.Od,{className:"h-40"}),(0,l.jsx)(j.Od,{className:"h-[380px]"})]}):(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsx)("input",{value:b.title??"",onChange:e=>et("title",e.target.value),placeholder:"عÙÙØ§Ù Ù
ÙØ§ÙÙ",className:"w-full border-0 border-b border-gray-E5E5E6 pb-10 text-24 font-b leading-40 outline-none transition focus:border-primary-main"}),(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-8",children:ei.map(e=>(0,l.jsx)("button",{type:"button",onClick:()=>p(e.key),className:`rounded-100 px-14 py-8 text-13 transition ${h===e.key?"bg-black text-white":"bg-gray-F0F0F0 text-gray-6C6A7D hover:bg-gray-E5E5E6"}`,children:e.label},e.key))}),"content"===h&&(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsx)(j.gN,{label:"Ø§Ø³ÙØ§Ú¯",hint:"خاÙÛ Ø¨Ú¯Ø°Ø§Ø±ÛØ¯ تا از عÙÙØ§Ù Ø³Ø§Ø®ØªÙ Ø´ÙØ¯. ÙØ§Ø±Ø³Û بÙ
Ø§ÙØ¯ â Ø¢Ø¯Ø±Ø³âÙØ§Û ÙØ¹ÙÛ Ù
جÙÙ ÙØ§Ø±Ø³ÛâØ§ÙØ¯.",children:(0,l.jsx)(j.II,{value:b.slug??"",onChange:e=>et("slug",e.target.value)})}),(0,l.jsx)(j.gN,{label:"ÚÚ©ÛØ¯Ù",hint:"Ø¨Ø§ÙØ§Û Ù
ÙØ§Ù٠٠در کارتâÙØ§Û ÙÙØ±Ø³Øª Ø¯ÛØ¯Ù Ù
ÛâØ´ÙØ¯. اگر ØªÙØ¶ÛØ Ù
تا خاÙÛ Ø¨Ø§Ø´Ø¯Ø ÙÙ
ÛÙ Ù
ÛâØ±ÙØ¯.",children:(0,l.jsx)("textarea",{value:b.excerpt??"",onChange:e=>et("excerpt",e.target.value),rows:2,className:"w-full rounded-10 border border-gray-E5E5E6 px-14 py-10 text-14 leading-24 outline-none transition focus:border-primary-main"})}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"mb-8 text-14 font-m",children:"Ù
ت٠Ù
ÙØ§ÙÙ"}),(0,l.jsx)(D,{value:N,onChange:C})]})]}
1),"seo"===h&&(0,l.jsx)(I,{value:E,onChange:U,postTitle:b.title??"",postExcerpt:b.excerpt??"",postSlug:b.slug??"",featuredImageUrl:b.featuredImageUrl??""}),"faq"===h&&(0,l.jsx)(P,{value:T,onChange:B}),"meta"===h&&(0,l.jsxs)("div",{className:"flex flex-col gap-16",children:[(0,l.jsx)(j.gN,{label:"دستÙâØ¨ÙØ¯Û",children:(0,l.jsxs)(j.Ph,{className:"w-full",value:b.categoryId??"",onChange:e=>et("categoryId",e.target.value),children:[(0,l.jsx)("option",{value:"",children:"â Ø¨Ø¯Ù٠دستÙâØ¨ÙØ¯Û â"}),(m.data??[]).map(e=>(0,l.jsx)("option",{value:e.id,children:e.name},e.id))]})}),(0,l.jsx)(j.gN,{label:"Ù
ÙØµØ¯ Ù
ÙØ§ÙÙ",hint:"Ø§Ø³ÙØ§Ûدر Ø§ÙØ§Ù
تگاÙâÙØ§Û داخ٠Ù
ÙØ§Ù٠از ÙÙ
Û٠ساخت٠Ù
ÛâØ´ÙØ¯. Ø´ÙØ± Ø¨Ø§Ø´Ø¯Ø Ø§Ø³ÙØ§Ûدر Ø¨Ø§ÙØ§ ÙÙ
Ø§Ù Ø´ÙØ± ٠پاÛÛÙÛ Ø§Ø³ØªØ§ÙØ´ را ÙØ´Ø§Ù Ù
ÛâØ¯ÙØ¯Ø Ø§Ø³ØªØ§Ù Ø¨Ø§Ø´Ø¯Ø Ø¨Ø±Ø¹Ú©Ø³. اÙÙÛÙ Ù
ÙØ±Ø¯Ø Ù
ÙØµØ¯ اصÙÛ Ø§Ø³Øª.",children:(0,l.jsx)($,{value:O,onChange:R})}),(0,l.jsx)(j.gN,{label:"ÙÙÛØ³ÙدÙâÙØ§",hint:"اÙÙÛ Ø¯Ø± byline Ù
ÙØ§ÙÙ Ù
ÛâØ¢ÛØ¯.",children:(0,l.jsx)(F,{options:(x.data??[]).map(e=>({id:e.id,label:e.displayName})),value:b.authorIds??[],onChange:e=>et("authorIds",e),empty:"ÙÙÙØ² ÙÙÛØ³ÙدÙâØ§Û Ø³Ø§Ø®ØªÙ ÙØ´Ø¯Ù."})}),(0,l.jsx)(j.gN,{label:"Ø¨Ø±ÚØ³Ø¨âÙØ§",children:(0,l.jsx)(F,{options:(g.data??[]).map(e=>({id:e.id,label:e.name})),value:b.tagIds??[],onChange:e=>et("tagIds",e),empty:"ÙÙÙØ² Ø¨Ø±ÚØ³Ø¨Û Ø³Ø§Ø®ØªÙ ÙØ´Ø¯Ù."})})]})]})})}),(0,l.jsx)("aside",{className:"w-full shrink-0 md:sticky md:top-16 md:w-[330px]",children:(0,l.jsxs)(j.Zb,{className:"flex flex-col gap-14 p-16",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsx)("span",{className:"text-14 font-b",children:"Ø§ÙØªØ´Ø§Ø±"}),(0,l.jsx)("span",{className:`rounded-100 px-10 py-4 text-11 ${A[L]??"bg-gray-F0F0F0 text-gray-6C6A7D"}`,children:S[L]??L})]}),G&&(0,l.jsx)("div",{className:"rounded-10 border border-red-200 bg-red-50 px-12 py-8 text-12 leading-22 text-red-700",children:G}),X&&(0,l.jsx)("div",{className:"rounded-10 border border-green-200 bg-green-50 px-12 py-8 text-12 text-green-700",children:X}),(0,l.jsx)(j.zx,{onClick:el,disabled:K,children:K?"در ØØ§Ù Ø°Ø®ÛØ±Ùâ¦":"Ø°Ø®ÛØ±Ù"}),(0,l.jsx)(j.zx,{variant:"secondary",onClick:en,disabled:K,children:"Ù¾ÛØ´âÙÙ
Ø§ÛØ´"}),Z&&(0,l.jsxs)("p",{className:"text-11 leading-20 text-gray-6C6A7D",children:["ÙÛÙÚ© Ù¾ÛØ´âÙÙ
Ø§ÛØ´ ساخت٠شد â Ø¨Ø¯ÙÙ ÙØ±Ùد باز Ù
ÛâØ´ÙØ¯ ٠در Ú¯ÙÚ¯Ù Ø¯ÛØ¯Ù ÙÙ
ÛâØ´ÙØ¯."," ",(0,l.jsx)("button",{type:"button",className:"text-primary-dark underline",onClick:()=>{var e;return null===(e=navigator.clipboard)||void 0===e?void 0:e.writeText(window.location.origin+Z)},children:"Ú©Ù¾Û ÙÛÙÚ©"})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-10 border-t border-gray-E5E5E6 pt-12",children:[(0,l.jsx)(j.zx,{onClick:()=>er("PUBLISHED"),disabled:K,children:"PUBLISHED"===L?"بÙâØ±ÙØ²Ø±Ø³Ø§ÙÛ Ø§ÙØªØ´Ø§Ø±":"Ø§ÙØªØ´Ø§Ø±"}),(0,l.jsx)("button",{type:"button",onClick:()=>q(e=>!e),className:"text-right text-12 text-gray-6C6A7D underline",children:H?"بست٠زÙ
اÙâØ¨ÙØ¯Û":"بÙâØ¬Ø§Û Ø§ÙØªØ´Ø§Ø± ÙÙØ±ÛØ Ø²Ù
اÙâØ¨ÙØ¯Û Ú©ÙÙ
"}),H&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(f,{value:_,onChange:z}),(0,l.jsx)(j.zx,{variant:"secondary",onClick:()=>er("SCHEDULED"),disabled:K||!_,children:"زÙ
اÙâØ¨ÙØ¯Û Ø§ÙØªØ´Ø§Ø±"})]}),"DRAFT"===L&&(0,l.jsx)(j.zx,{variant:"ghost",onClick:()=>er("PENDING_REVIEW"),disabled:K,children:"ÙØ±Ø³ØªØ§Ø¯Ù Ø¨Ø±Ø§Û Ø¨Ø§Ø²Ø¨ÛÙÛ"}),"PUBLISHED"===L&&(0,l.jsx)(j.zx,{variant:"ghost",onClick:()=>er("ARCHIVED"),disabled:K,children:"باÛگاÙÛ"})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-10 border-t border-gray-E5E5E6 pt-12",children:[(0,l.jsx)("p",{className:"text-14 font-m",children:"تصÙÛØ± شاخص"}),b.featuredImageUrl?(0,l.jsxs)("div",{className:"overflow-hidden rounded-12 border border-gray-E5E5E6",children:[(0,l.jsx)("img",{src:(0,j.vD)(b.featuredImageUrl,640),alt:b.featuredImageAlt||"",className:"aspect-[16/10] w-full object-cover"}),(0,l.jsxs)("div",{className:"flex gap-8 p-8",children:[(0,l.jsx)(j.zx,{variant:"secondary",onClick:()=>V(!0),children:"تغÛÛØ±"}),(0,l.jsx)(j.zx,{variant:"ghost",onClick:()=>{et("featuredImageUrl",""),et("featuredImageAlt","")},children:"برداشتÙ"})]})]}):(0,l.jsxs)("button",{type:"button",onClick:()=>V(!0),className:"flex aspect-[16/10] w-full flex-col items-center justify-center gap-6 rounded-12 border border-dashed border-gray-D2D2D7 text-12 text-gray-6C6A7D transition hover:border-primary-main hover:text-primary-dark",children:[(0,l.jsx)("span",{className:"text-24",children:"ï¼"}),"Ø§ÙØªØ®Ø§Ø¨ از کتابخاÙÙ ÛØ§ آپÙÙØ¯"]}),(0,l.jsx)(j.gN,{label:"Ù
ت٠جاÛگزÛ٠تصÙÛØ±",hint:"بدÙ٠اÛÙØ Ø§ÙØªØ´Ø§Ø± رد Ù
ÛâØ´ÙØ¯.",children:(0,l.jsx)(j.II,{value:b.featuredImageAlt??"",onChange:e=>et("featuredImageAlt",e.target.value)})})]})]})})]}),(0,l.jsx)(u.Z,{open:Y,onClose:()=>V(!1),onPick:e=>{let{url:t,alt:a}=e;et("featuredImageUrl",t),a&&et("featuredImageAlt",a)},title:"تصÙÛØ± شاخص"})]})}function P(e){let{value:t,onChange:a}=e,r=(e,l)=>a(t.map((t,a)=>a===e?{...t,...l}:t));return(0,l.jsxs)("div",{className:"flex flex-col gap-12",children:[(0,l.jsxs)("p",{className:"text-12 leading-22 text-gray-6C6A7D",children:["اÛÙâÙØ§ Ø§ÙØªÙØ§Û Ù
ÙØ§ÙÙ Ù
ÛâØ¢ÛÙØ¯ ٠بÙâØ´Ú©Ù ",(0,l.jsx)("b",{children:"FAQPage"})," Ø¨Ø±Ø§Û Ú¯ÙÚ¯Ù ÙÙ
ÙØ±Ø³ØªØ§Ø¯Ù Ù
ÛâØ´ÙÙØ¯ â ÛØ¹ÙÛ Ù
ÛâØªÙØ§ÙÙØ¯ Ù
ستÙÛÙ
در ÙØªÛجÙâÛ Ø¬Ø³ØªâÙØ¬Ù باز Ø´ÙÙØ¯. ردÛÙÛ Ú©Ù ÛÚ©Û Ø§Ø² د٠ÙÛÙØ¯Ø´ خاÙÛ Ø¨Ù
Ø§ÙØ¯ Ø°Ø®ÛØ±Ù ÙÙ
ÛâØ´ÙØ¯."]}),t.map((e,n)=>(0,l.jsxs)("div",{className:"rounded-12 border border-gray-E5E5E6 p-12",children:[(0,l.jsxs)("div",{className:"mb-8 flex items-center gap-8",children:[(0,l.jsx)("span",{className:"text-11 text-gray-9B9BAA",children:(n+1).toLocaleStr
1ing("fa-IR")}),(0,l.jsx)(j.II,{value:e.question,onChange:e=>r(n,{question:e.target.value}),placeholder:"پرسش"}),(0,l.jsx)("button",{type:"button","aria-label":"ØØ°Ù",onClick:()=>a(t.filter((e,t)=>t!==n)),className:"shrink-0 text-gray-6C6A7D",children:"â"})]}),(0,l.jsx)("textarea",{value:e.answer,onChange:e=>r(n,{answer:e.target.value}),placeholder:"پاسخ â Ú©ÙØªØ§Ù Ù Ù
ستÙÛÙ
Ø Ú¯ÙÚ¯Ù Ø¬ÙØ§Ø¨ بÙÙØ¯ را ÙÙ
ÛâØ¢ÙØ±Ø¯.",rows:2,className:"w-full rounded-10 border border-gray-E5E5E6 px-14 py-10 text-14 leading-24 outline-none transition focus:border-primary-main"})]},n)),(0,l.jsx)(j.zx,{variant:"secondary",onClick:()=>a([...t,{question:"",answer:""}]),children:"Ø§ÙØ²Ùد٠پرسش"})]})}}},function(e){e.O(0,[4885,4389,8289,9759,9774,2888,179],function(){return e(e.s=10239)}),_N_E=e.O()}]);
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.