"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5972],{6959:(e,t,l)=>{l.d(t,{A:()=>s});var i=l(4848),n=l(2027);function s(e){let{selectOptions:t,name:l,onChangeHandler:s,required:a,setAlert:r,title:o,defaultValue:d,info:c,id:u}=e;try{function h(e){if(e.type.match(/enter/i)&&window.innerWidth<1200)return;let t=e.target.closest(".info-wrapper"),l=t.querySelector(".info-dropdown");if(e.type.match(/leave/i)&&!l.classList.contains("hidden")){l.classList.add("hidden");return}if(!(e.type.match(/leave/i)&&l.classList.contains("hidden"))){if(!t){l.classList.add("hidden");return}if(l.classList.contains("hidden")){l.classList.remove("hidden");return}l.classList.add("hidden")}}return(0,i.jsxs)("div",{className:"form-select-block flex items-start flex-col gap-0.5 w-full relative"+(c?" pr-8":""),children:[o&&(0,i.jsxs)("label",{htmlFor:l,children:[o,a?"":" (optional)"]}),(0,i.jsxs)("div",{className:"flex items-center w-full relative",children:[(0,i.jsx)("select",{name:l,id:u||l,className:"w-full bg-white",required:a,onChange:e=>{r&&r(null),e.target.classList.remove("warning"),s&&s(e)},defaultValue:d||void 0,children:t.map((e,t)=>{let{payload:l,title:n}=e;return(0,i.jsx)("option",{value:l,selected:!!e.default,children:n},t+1)})}),(0,i.jsx)(n.A,{className:"absolute right-2 text-base text-slate-500 pointer-events-none",size:20}),c&&(0,i.jsxs)("div",{className:"info-wrapper absolute -right-10 w-8 h-8 rounded-full bg-white flex items-center justify-center z-10",style:{top:"50%",transform:"translate(0,-50%)"},onMouseEnter:h,onMouseLeave:h,onClick:h,children:[(0,i.jsx)("img",{src:"/images/info-outlined-black.png",alt:"",className:"w-6 h-6 object-contain opacity-60 pointer-events-none"}),(0,i.jsx)("div",{className:"info-dropdown absolute top-9 right-0 bg-white w-52 md:w-96 p-2 sm:p-6 shadow-xl rounded hidden text-center border border-slate-300 border-solid",children:(0,i.jsx)("span",{children:c})}),(0,i.jsx)("div",{className:"absolute -top-2 w-12",style:{height:"45px"}})]})]})]})}catch(e){return console.log("ERROR in FormSelect =>",e),(0,i.jsx)("div",{children:"Form Select Error"})}}l(6540)},5844:(e,t,l)=>{l.d(t,{A:()=>s});var i=l(4848),n=l(7216);function s(){return(0,i.jsx)("button",{className:"outlined gray p-2 w-9 h-9 flex items-center justify-center rounded-full",onClick:e=>{window.history.back()},children:(0,i.jsx)(n.A,{})})}l(6540)},3647:(e,t,l)=>{l.d(t,{A:()=>s});var i=l(4848),n=l(6540);function s(e){let{confirmedDelegetedUser:t,linksArray:l,user:s}=e,[a,r]=n.useState(l||null);return(n.useEffect(()=>{var e;if(l)return;let t=window.location.pathname,i=t.split("/"),n=[];n.push({title:"Home",path:t.match(/admin/)?"/admin":"/"}),null===(e=window.location.search)||void 0===e||e.match(/delegated=true/),i.forEach((e,t,l)=>{!(null==e?void 0:e.match(/./))||1==t||e.match(/^\d+$/)&&s&&!n.find(e=>!!e.title.match(/^entries$|^users$/))||n.push({title:e,path:(()=>{let e="";for(let i=0;it)&&n.match(/./)&&(e+="/".concat(n))}return e})()})}),r(n)},[]),a&&a[1])?(0,i.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:a.map((e,t,l)=>t===a.length-1?(0,i.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},t):(0,i.jsxs)(n.Fragment,{children:[(0,i.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,i.jsx)("span",{className:"opacity-20",children:"|"})]},t))}):(0,i.jsx)(n.Fragment,{})}},900:(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;if(!e)throw Error("No Button Group Wrapper!");let t=e.childNodes,i=Array.from(t);if((null==i?void 0:i.length)===1)return;i.forEach((e,t)=>{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])}t0&&(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})}},5972:(e,t,l)=>{let i;l.d(t,{A:()=>k});var n=l(4848),s=l(6540),a=l(9268),r=l(1710),o=l(3813),d=l(900),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,r=null==t?void 0:t.value;if(!(null==a?void 0:a.match(/./))||!(null==r?void 0:r.match(/./)))return;l.style[a]=r}}}),(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],r=null==s?void 0:s.value,o=null==a?void 0:a.value;(null==r?void 0:r.match(/./))&&(null==o?void 0:o.match(/./))&&(l.style[r]=o)},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 m(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 r=null===(l=n.getWin().getSelection())||void 0===l?void 0:null===(t=l.anchorNode)||void 0===t?void 0:t.parentElement,o=s||r||null;o&&(null==o||null===(i=o.classList)||void 0===i||i.add("target-node"),a&&a(o))}var x=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,r]=s.useState(!1),[o,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)(d.A,{column:!0,className:"gap-[1px]",children:[(0,n.jsx)("div",{onClick:()=>{m({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)(x.A,{})}),(0,n.jsx)("div",{onClick:()=>{h({targetElement:l})},style:{width:"40px",height:"40px"},className:"button dark",children:(0,n.jsx)(x.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:()=>{r(!0)},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(x.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)(x.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),m({editor:t,node:l,setTargetElement:i})),(null==n?void 0:n.nodeName.match(/html|document|body/i))?(i(l),m({editor:t,node:l,setTargetElement:i})):n&&(i(n),m({editor:t,node:n,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(x.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),m({editor:t,node:n,setTargetElement:i})):(i(l),m({editor:t,node:l,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(x.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),m({editor:t,node:n,setTargetElement:i})):(i(l),m({editor:t,node:l,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(x.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),m({editor:t,node:n,setTargetElement:i})):(i(l),m({editor:t,node:l,setTargetElement:i}))}({editor:t.current,targetElement:l,setTargetElement:i})},style:{width:"40px",height:"40px"},className:"button",children:(0,n.jsx)(x.A,{})}),(0,n.jsx)("div",{onClick:()=>{if(l){let e=l.parentNode;e.removeChild(l),m({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)(x.A,{})})]}),(0,n.jsx)("span",{children:(0,n.jsx)(u,{targetElement:l,setOpenStyleModal:r})})]})}function g(e){let{user:t,blockObject:l,placeholder:i,editorRef:a,height:r,extend:d}=e,[c,u]=s.useState(!1);return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(o.K,{tinymceScriptSrc:"https://datasquirel.com/tinymce-public/tinymce.min.js",onInit:(e,t)=>{if(d){let e=t.getBody();e.style.padding="40px",e.className="RTE-DOCS"}a&&(a.current=t)},initialValue:l&&l.content?l.content:"",init:{height:r||400,width:"100%",relative_urls:!1,remove_script_host:!1,menubar:!1,plugins:d?["advlist","autolink","lists","link","image","charmap","anchor","searchreplace","visualblocks","code","fullscreen","insertdatetime","media","table","preview","help","wordcount","codesample"]:["link"],toolbar:d?"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:d?"/styles/tiny.css":void 0,statusbar:!!d}}),d&&a&&(0,n.jsx)(v,{editorRef:a})]})}var f=l(9020),b=l(5844),y=l(6959),j=l(3647);function k(e){let{data:t,user:l}=e,o=null!=t&&!!t.title,[d,c]=s.useState(!1),[u,h]=s.useState(null==t?void 0:t.level),[m,x]=s.useState(null==t?void 0:t.page_order),[p,v]=s.useState(null),[k,w]=s.useState(null),N=s.useRef(),A=s.useRef();return s.useEffect(()=>{parseInt(u)>1?(window.clearTimeout(i),i=window.setTimeout(()=>{(0,f.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]?w(l[0]):w(e.result[0])}else w(e.result[0])}})},500)):(v(null),w(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)(b.A,{}),(0,n.jsx)("h2",{className:"text-xl m-0",children:o?"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:[d&&(0,n.jsx)(r.A,{}),(0,n.jsxs)("form",{onSubmit:e=>{var l,i,n,s,a;e.preventDefault(),c(!0);let r=e.target.title,d=null===(l=A.current)||void 0===l?void 0:l.getDoc(),h=null===(i=N.current)||void 0===i?void 0:i.getDoc();function x(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==d||d.querySelectorAll(".target-node").forEach(e=>e.classList.remove("target-node")),null==d||d.querySelectorAll("a").forEach(e=>{x(e)}),null==h||h.querySelectorAll("a").forEach(e=>{x(e)});let p=null===(n=N.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,b={title:r.value,description:p,content:v,text_content:g,level:u,page_order:m};o&&(b.id=t.id),(null==k?void 0:k.id)&&(b.parent_id=k.id),(0,f.A)("/api/admin/docs/".concat(o?"update-page":"add-page"),{method:"post",body:b}).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:o?t.title:null}),(0,n.jsxs)("div",{className:"card no-hover",children:[(0,n.jsx)(a.A,{numberText:!0,placeholder:"Level",defaultValue:o?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:o?m:"1",maxWidth:"140px",minValue:1,step:1,name:"page-order",title:"Page Order",setValue:x}),p&&Array.isArray(p)&&(0,n.jsx)(y.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]?w(t[0]):window.alert("No Matching parent page!")}})]}),(0,n.jsx)(g,{placeholder:"Describe this page briefly",editorRef:N,blockObject:o?{content:t.description}:null,height:200}),(0,n.jsx)(g,{placeholder:"Page Content",editorRef:A,blockObject:o?{content:t.content}:null,height:600,extend:!0}),(0,n.jsx)("button",{type:"submit",children:o?"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"}]])},7996:(e,t,l)=>{l.d(t,{A:()=>i});let i=(0,l(5737).A)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])}}]);