"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6803],{557:(e,t,l)=>{l.d(t,{A:()=>s});var i=l(4848),n=l(6540);function s(e){let{children:t,column:l,className:s}=e,a=n.useRef();return n.useEffect(()=>{try{let e=a.current.childNodes,t=Array.from(e);if((null==t?void 0:t.length)===1)return;t.forEach((e,i)=>{let n=e;if(n.classList.contains("dropdown-wrapper")){let t=Array.from(e.childNodes).filter(e=>{var t;return(null==e?void 0:null===(t=e.nodeName)||void 0===t?void 0:t.match(/button/i))||e.classList.contains("button")});t&&t[0]&&(n=t[0])}i0&&(n.style[l?"borderTop":"borderLeft"]="none",n.style[l?"borderTopRightRadius":"borderTopLeftRadius"]=0,n.style[l?"borderTopLeftRadius":"borderBottomLeftRadius"]=0)})}catch(e){console.log(e.message)}},[]),(0,i.jsx)("div",{className:"items-stretch gap-0"+(l?" flex-col":" flex-wrap xl:flex-nowrap")+(s?" "+s:""),ref:a,children:t})}},903:(e,t,l)=>{let i;l.d(t,{A:()=>k});var n=l(4848),s=l(6540),a=l(5414),o=l(620),d=l(3813),r=l(557),c=l(7212);function u(e){var t;let{targetElement:l,setOpenStyleModal:i}=e;return l?(0,n.jsxs)("div",{className:"flex flex-col items-stretch p-6 max-w-lg",children:[(0,n.jsxs)("div",{className:"w-full justify-between",children:[(0,n.jsx)("span",{className:"text-xl",children:"Element Style"}),(0,n.jsx)("button",{className:"w-10 h-10 plain-text",onClick:()=>{i(!1)},children:(0,n.jsx)(c.A,{})})]}),(0,n.jsxs)("div",{className:"items-stretch p-2 bg-slate-100 rounded add-css-block",children:[(0,n.jsx)("input",{type:"text",placeholder:"CSS key"}),(0,n.jsx)("input",{type:"text",placeholder:"CSS Value",onKeyDownCapture:e=>{var t,i,n;let s=e.target;if(null===(t=e.key)||void 0===t?void 0:t.match(/enter/i)){let e=null===(i=s.closest(".add-css-block"))||void 0===i?void 0:i.children[0],t=null===(n=s.closest(".add-css-block"))||void 0===n?void 0:n.children[1],a=null==e?void 0:e.value,o=null==t?void 0:t.value;if(!(null==a?void 0:a.match(/./))||!(null==o?void 0:o.match(/./)))return;l.style[a]=o}}}),(0,n.jsx)("button",{onClick:e=>{var t,i;let n=e.target,s=null===(t=n.closest(".add-css-block"))||void 0===t?void 0:t.children[0],a=null===(i=n.closest(".add-css-block"))||void 0===i?void 0:i.children[1],o=null==s?void 0:s.value,d=null==a?void 0:a.value;(null==o?void 0:o.match(/./))&&(null==d?void 0:d.match(/./))&&(l.style[o]=d)},children:"Add"})]}),(0,n.jsxs)("div",{className:"flex-wrap",children:[(0,n.jsx)("button",{onClick:e=>{l.removeAttribute("style")},className:"secondary grow",children:"Reset"}),(0,n.jsx)("button",{onClick:e=>{l.style.display="flex",l.style.alignItems="center",l.style.gap="10px"},className:"outlined black grow",children:"Flex"}),(0,n.jsx)("button",{onClick:e=>{l.style.backgroundColor="rgb(241 245 249)"},className:"outlined black grow",children:"BG-Slate-100"}),(0,n.jsx)("button",{onClick:e=>{l.style.backgroundColor="#F6F4F8"},className:"outlined black grow",children:"BG-Main-light"}),(0,n.jsx)("button",{onClick:e=>{l.style.padding="10px"},className:"outlined black grow",children:"Padding-10px"}),(0,n.jsx)("button",{onClick:e=>{l.style.padding="10px 20px"},className:"outlined black grow",children:"Padding-10px-20px"}),(0,n.jsx)("button",{onClick:e=>{l.style.borderRadius="5px"},className:"outlined black grow",children:"Border-Radius-5px"}),(0,n.jsx)("button",{onClick:e=>{l.style.border="1px solid rgb(241 245 249)"},className:"outlined black grow",children:"Border-Slate-100"}),(0,n.jsx)("button",{onClick:e=>{l.style.border="1px solid rgb(226 232 240)"},className:"outlined black grow",children:"Border-Slate-200"}),(0,n.jsx)("button",{onClick:e=>{l.style.border="1px solid rgb(203 213 225)"},className:"outlined black grow",children:"Border-Slate-300"})]}),(0,n.jsx)("span",{className:"font-semibold text-xl mt-4",children:"Add class Name"}),(0,n.jsxs)("div",{className:"items-stretch p-2 bg-slate-100 rounded add-class-name-block",children:[(0,n.jsx)("input",{type:"text",placeholder:"Class Name",onKeyDownCapture:e=>{var t,i;let n=null===(t=e.target.closest(".add-class-name-block"))||void 0===t?void 0:t.children[0];if(null===(i=e.key)||void 0===i?void 0:i.match(/enter/i)){let e=null==n?void 0:n.value;if(!(null==e?void 0:e.match(/./)))return;l.classList.add(e)}}}),(0,n.jsx)("button",{onClick:e=>{var t;let i=null===(t=e.target.closest(".add-class-name-block"))||void 0===t?void 0:t.children[0],n=null==i?void 0:i.value;(null==n?void 0:n.match(/./))&&l.classList.add(n)},children:"Add"}),(0,n.jsx)("button",{onClick:e=>{var t;let i=null===(t=e.target.closest(".add-class-name-block"))||void 0===t?void 0:t.children[0],n=null==i?void 0:i.value;(null==n?void 0:n.match(/./))&&l.classList.remove(n)},className:"outlined",children:"Remove"})]}),(null==l?void 0:null===(t=l.nodeName)||void 0===t?void 0:t.match(/^a$/i))?(0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)("span",{className:"font-semibold text-xl mt-4",children:"Add URL"}),(0,n.jsxs)("div",{className:"items-stretch p-2 bg-slate-100 rounded href-block",children:[(0,n.jsx)("input",{type:"text",placeholder:"Class Name",onKeyDownCapture:e=>{var t,i;let n=null===(t=e.target.closest(".href-block"))||void 0===t?void 0:t.children[0];if(null===(i=e.key)||void 0===i?void 0:i.match(/enter/i)){let e=null==n?void 0:n.value;if(!(null==e?void 0:e.match(/./)))return;l.href=e}},defaultValue:null==l?void 0:l.href}),(0,n.jsx)("button",{onClick:e=>{var t;let i=null===(t=e.target.closest(".href-block"))||void 0===t?void 0:t.children[0],n=null==i?void 0:i.value;(null==n?void 0:n.match(/./))&&(l.href=n)},children:"Add"})]})]}):(0,n.jsx)(s.Fragment,{})]}):null}function h(e){let{targetElement:t,back:l}=e;if(!t)return;let i=t.nextElementSibling,n=t.previousElementSibling;!l&&i?i.after(t):l&&n&&n.before(t)}function x(e){var t,l,i;let{editor:n,node:s,setTargetElement:a}=e;n.getDoc().querySelectorAll(".target-node").forEach(e=>{e.classList.remove("target-node")});let o=null===(l=n.getWin().getSelection())||void 0===l?void 0:null===(t=l.anchorNode)||void 0===t?void 0:t.parentElement,d=s||o||null;d&&(null==d||null===(i=d.classList)||void 0===i||i.add("target-node"),a&&a(d))}var m=l(7996);let p=(0,l(5737).A)("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);function v(e){let{editorRef:t}=e,[l,i]=s.useState(null),[a,o]=s.useState(!1),[d,v]=s.useState(!1);return(0,n.jsxs)("div",{className:"absolute top-[60px] z-50 -left-[38px] w-[40px] flex flex-col items-end",style:{boxShadow:"0 0 40px rgba(15, 23, 42, 0.2)"},children:[(0,n.jsxs)(r.A,{column:!0,className:"gap-[1px]",children:[(0,n.jsx)("div",{onClick:()=>{x({editor:t.current,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button secondary",children:(0,n.jsx)("span",{children:"Click1"})}),(0,n.jsx)("div",{onClick:()=>{h({targetElement:l,back:!0})},style:{width:"40px",height:"40px"},className:"button dark",children:(0,n.jsx)(m.A,{})}),(0,n.jsx)("div",{onClick:()=>{h({targetElement:l})},style:{width:"40px",height:"40px"},className:"button dark",children:(0,n.jsx)(m.A,{})}),(0,n.jsx)("div",{onClick:()=>{v(!0)},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(p,{})}),(0,n.jsx)("div",{onClick:()=>{o(!0)},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(m.A,{})}),(0,n.jsx)("div",{onClick:()=>{!function(e){let{editor:t,targetElement:l,setTargetElement:i}=e;if(t.getWin(),!l)return;let n=l.cloneNode(!0);n.nodeName.match(/html|document|body/i)||(l.insertAdjacentElement("afterend",n),l.classList.remove("target-node"),i(n))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(m.A,{})}),(0,n.jsx)("div",{onClick:()=>{!function(e){let{editor:t,targetElement:l,setTargetElement:i}=e;if(t.getWin(),!l||l.nodeName.match(/html|document|body/i))return;let n=l.parentElement;n||(i(l),x({editor:t,node:l,setTargetElement:i})),(null==n?void 0:n.nodeName.match(/html|document|body/i))?(i(l),x({editor:t,node:l,setTargetElement:i})):n&&(i(n),x({editor:t,node:n,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(m.A,{})}),(0,n.jsx)("div",{onClick:()=>{!function(e){let{editor:t,targetElement:l,setTargetElement:i}=e;if(t.getWin(),!l)return;let n=l.children[0];n?(i(n),x({editor:t,node:n,setTargetElement:i})):(i(l),x({editor:t,node:l,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(m.A,{className:"rotate-180"})}),(0,n.jsx)("div",{onClick:()=>{!function(e){let{editor:t,targetElement:l,setTargetElement:i}=e;if(!l)return;let n=l.previousElementSibling;n?(i(n),x({editor:t,node:n,setTargetElement:i})):(i(l),x({editor:t,node:l,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(m.A,{})}),(0,n.jsx)("div",{onClick:()=>{!function(e){let{editor:t,targetElement:l,setTargetElement:i}=e;if(!l)return;let n=l.nextElementSibling;n?(i(n),x({editor:t,node:n,setTargetElement:i})):(i(l),x({editor:t,node:l,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(m.A,{})}),(0,n.jsx)("div",{onClick:()=>{if(l){let e=l.parentNode;e.removeChild(l),x({editor:t.current,node:e,setTargetElement:i})}},style:{width:"40px",height:"40px"},className:"button bg-red-500",children:(0,n.jsx)(c.A,{})}),(0,n.jsx)("div",{onClick:()=>{t.current.getDoc().querySelectorAll(".target-node").forEach(e=>{e.classList.remove("target-node")}),i(null)},style:{width:"40px",height:"40px"},className:"button white",children:(0,n.jsx)(m.A,{})})]}),(0,n.jsx)("span",{children:(0,n.jsx)(u,{targetElement:l,setOpenStyleModal:o})})]})}function g(e){let{user:t,blockObject:l,placeholder:i,editorRef:a,height:o,extend:r}=e,[c,u]=s.useState(!1);return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(d.K,{tinymceScriptSrc:"/tinymce/tinymce.min.js",onInit:(e,t)=>{if(r){let e=t.getBody();e.style.padding="40px",e.className="RTE-DOCS"}a&&(a.current=t)},initialValue:l&&l.content?l.content:"",init:{height:o||400,width:"100%",relative_urls:!1,remove_script_host:!1,menubar:!1,plugins:r?["advlist","autolink","lists","link","image","charmap","anchor","searchreplace","visualblocks","code","fullscreen","insertdatetime","media","table","preview","help","wordcount","codesample"]:["link"],toolbar:r?"undo redo | blocks | bold italic forecolor | codesample link image | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat":"undo redo | blocks | link",content_style:"body { font-family:Helvetica,Arial,sans-serif; font-size:18px }",placeholder:i||"Type something ...",content_css:r?"/styles/tiny.css":void 0,statusbar:!!r}}),r&&a&&(0,n.jsx)(v,{editorRef:a})]})}var b=l(3698),y=l(9862),f=l(1301),j=l(4709);function k(e){let{data:t,user:l}=e,d=null!=t&&!!t.title,[r,c]=s.useState(!1),[u,h]=s.useState(null==t?void 0:t.level),[x,m]=s.useState(null==t?void 0:t.page_order),[p,v]=s.useState(null),[k,N]=s.useState(null),w=s.useRef(),A=s.useRef();return s.useEffect(()=>{parseInt(u)>1?(window.clearTimeout(i),i=window.setTimeout(()=>{(0,b.A)("/api/admin/docs/grab-parent-pages",{method:"post",body:{pagesLevel:parseInt(u)-1,currentPageId:null==t?void 0:t.id}}).then(e=>{if(e.success&&e.result&&Array.isArray(e.result)&&e.result[0]){if(v(e.result),t.parent_id){let l=e.result.filter(e=>e.id==t.parent_id);l[0]?N(l[0]):N(e.result[0])}else N(e.result[0])}})},500)):(v(null),N(null))},[u]),(0,n.jsx)(s.Fragment,{children:(0,n.jsxs)("section",{className:"items-start justify-start p-6",children:[(0,n.jsxs)("div",{className:"mb-1",children:[(0,n.jsx)(y.A,{}),(0,n.jsx)("h2",{className:"text-xl m-0",children:d?"Update page":"Create a new Docs Page"})]}),(0,n.jsx)("div",{className:"mb-4",children:(0,n.jsx)(j.A,{user:l})}),(0,n.jsxs)("div",{className:"paper flex-col items-stretch gap-10 w-full relative",children:[r&&(0,n.jsx)(o.A,{}),(0,n.jsxs)("form",{onSubmit:e=>{var l,i,n,s,a;e.preventDefault(),c(!0);let o=e.target.title,r=null===(l=A.current)||void 0===l?void 0:l.getDoc(),h=null===(i=w.current)||void 0===i?void 0:i.getDoc();function m(e){let t=e.href;(null==t?void 0:t.match(/\~/))&&(e.href=t.replace(/.*?\~\//,"/")),(null==t?void 0:t.match(/\.\.\//))&&(e.href=t.replace(/.*?\.\.\//,"/"))}null==r||r.querySelectorAll(".target-node").forEach(e=>e.classList.remove("target-node")),null==r||r.querySelectorAll("a").forEach(e=>{m(e)}),null==h||h.querySelectorAll("a").forEach(e=>{m(e)});let p=null===(n=w.current)||void 0===n?void 0:n.getContent(),v=null===(s=A.current)||void 0===s?void 0:s.getBody().innerHTML,g=null===(a=A.current)||void 0===a?void 0:a.getBody().innerText,y={title:o.value,description:p,content:v,text_content:g,level:u,page_order:x};d&&(y.id=t.id),(null==k?void 0:k.id)&&(y.parent_id=k.id),(0,b.A)("/api/admin/docs/".concat(d?"update-page":"add-page"),{method:"post",body:y}).then(e=>{e.success?window.location.reload():(alert("Operation Failed!"),setTimeout(()=>{c(!1)},1e3))})},className:"flex flex-col gap-4 w-full",children:[(0,n.jsx)(a.A,{placeholder:"Enter a title",fontSize:"30px",name:"title",defaultValue:d?t.title:null}),(0,n.jsxs)("div",{className:"card no-hover",children:[(0,n.jsx)(a.A,{numberText:!0,placeholder:"Level",defaultValue:d?u:"1",maxWidth:"140px",minValue:1,maxValue:4,step:1,name:"page-level",title:"Page Level",setValue:h}),(0,n.jsx)(a.A,{numberText:!0,placeholder:"Level",defaultValue:d?x:"1",maxWidth:"140px",minValue:1,step:1,name:"page-order",title:"Page Order",setValue:m}),p&&Array.isArray(p)&&(0,n.jsx)(f.A,{selectOptions:p.map(e=>({title:e.title,payload:e.id,default:(null==k?void 0:k.id)==e.id})),title:"Parent Page",required:!0,onChangeHandler:e=>{let t=p.filter(t=>t.id==e.target.value);t[0]?N(t[0]):window.alert("No Matching parent page!")}})]}),(0,n.jsx)(g,{placeholder:"Describe this page briefly",editorRef:w,blockObject:d?{content:t.description}:null,height:200}),(0,n.jsx)(g,{placeholder:"Page Content",editorRef:A,blockObject:d?{content:t.content}:null,height:600,extend:!0}),(0,n.jsx)("button",{type:"submit",children:d?"Update Page":"Add Page"})]})]})]})})}},7212:(e,t,l)=>{l.d(t,{A:()=>i});let i=(0,l(5737).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])},4909:(e,t,l)=>{l.d(t,{A:()=>i});let i=(0,l(5737).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])}}]);