From 038106fd7b055b5d4dc02798d47147b2808c3780 Mon Sep 17 00:00:00 2001 From: Aloento Date: Mon, 5 Feb 2024 21:22:51 +0000 Subject: [PATCH] deploy: ece4f8d128bd38a5c1f8353b0b2ba68db19de954 --- assets/{Columns-WM0v5PCO.js => Columns-YyE5CF5f.js} | 2 +- .../{Component-3Xt-99h9.js => Component-_hAU7BS-.js} | 2 +- .../{Component-HpG_cdPN.js => Component-n2P2KSDI.js} | 2 +- assets/{Lazy-S42ziN8Y.js => Lazy-oj3UQ1nd.js} | 4 ++-- ...-bPIc0uls.js => LexicalNestedComposer-rgrcCsEX.js} | 2 +- assets/{index-93jUDCdv.js => index-0za8jBCT.js} | 4 ++-- assets/index-3wZvIsDj.js | 11 ----------- assets/{index-7IQKV8Y7.js => index-DkQbb1fo.js} | 2 +- assets/{index-HwnTnK21.js => index-Tn4RgmZa.js} | 2 +- assets/index-cu2bTZMb.js | 1 + assets/{index-mm5L4EFF.js => index-lt_pJMTs.js} | 8 ++++---- assets/index-mYNP8E8_.js | 1 - assets/index-no0JSIPh.js | 11 +++++++++++ index.html | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) rename assets/{Columns-WM0v5PCO.js => Columns-YyE5CF5f.js} (99%) rename assets/{Component-3Xt-99h9.js => Component-_hAU7BS-.js} (97%) rename assets/{Component-HpG_cdPN.js => Component-n2P2KSDI.js} (99%) rename assets/{Lazy-S42ziN8Y.js => Lazy-oj3UQ1nd.js} (80%) rename assets/{LexicalNestedComposer-bPIc0uls.js => LexicalNestedComposer-rgrcCsEX.js} (96%) rename assets/{index-93jUDCdv.js => index-0za8jBCT.js} (88%) delete mode 100644 assets/index-3wZvIsDj.js rename assets/{index-7IQKV8Y7.js => index-DkQbb1fo.js} (99%) rename assets/{index-HwnTnK21.js => index-Tn4RgmZa.js} (59%) create mode 100644 assets/index-cu2bTZMb.js rename assets/{index-mm5L4EFF.js => index-lt_pJMTs.js} (99%) delete mode 100644 assets/index-mYNP8E8_.js create mode 100644 assets/index-no0JSIPh.js diff --git a/assets/Columns-WM0v5PCO.js b/assets/Columns-YyE5CF5f.js similarity index 99% rename from assets/Columns-WM0v5PCO.js rename to assets/Columns-YyE5CF5f.js index f0ab031..352e18b 100644 --- a/assets/Columns-WM0v5PCO.js +++ b/assets/Columns-YyE5CF5f.js @@ -1 +1 @@ -import{m as D,t as P,x as R,j as e,F as c,L as u,y as w,T as v,b as S,B as N,r as k,ai as L,aO as z,aP as B,o as M,aH as $,ad as q,ae as Q,af as U,ag as W,ah as V,a6 as i,a7 as d,a8 as h,E as _,a9 as J,aa as K}from"./vendor--JR89aB4.js";import{L as X,F as I,a as H,A as Y,H as f,c as F,e as A,f as Z,M as ee}from"./index-3wZvIsDj.js";const re=D({flex:I,box:{...H,flexBasis:"50%",rowGap:P.spacingVerticalM}}),E=new X("Order","Info");function se({OrderId:r,Order:s,Admin:n}){const a=re(),{data:j}=R(()=>Y.User.Get.OrderUser(r),{manual:!n,onError:E.error}),m=f.User.Get.useMe(E),l=n?j:m;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:a.flex,children:[e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Name",size:"large",children:e.jsx(u,{children:l?.Name})})}),e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Phone",size:"large",children:e.jsx(u,{children:l?.Phone})})})]}),e.jsxs("div",{className:a.flex,children:[e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Order Date",size:"large",children:e.jsx(u,{children:s?.CreateAt.toLocaleDateString()})})}),e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Status",size:"large",children:e.jsx(u,{children:s?.Status})})})]}),e.jsxs("div",{className:a.flex,children:[e.jsx("div",{className:a.box,children:e.jsx(c,{label:"E-Mail",size:"large",children:e.jsx(u,{children:l?.EMail})})}),!n&&e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Tracking Number",size:"large",children:e.jsx(u,{children:s?.TrackingNumber})})})]}),e.jsx(c,{label:"Address",size:"large",children:e.jsx(u,{children:l?.Address})})]})}const ne=D({body:{...H,alignItems:"flex-start"}});function ae({OrderId:r,Status:s,Refresh:n,ParentLog:a}){const j=w(()=>a.With("Action")),m=ne(),{Reload:l}=F(),{dispatch:o,dispatchToast:p}=A(j),{run:C}=f.Order.Post.useReceived({manual:!0,onError(g,t){o({Message:"Failed Mark Receive",Request:t,Error:g})},onSuccess(){p(e.jsx(v,{children:e.jsx(S,{children:"Order Received"})}),{intent:"success"}),n()}}),{run:y}=f.Order.Delete.useDelete({manual:!0,onError(g,t){o({Message:"Failed Delete Order",Request:t,Error:g})},onSuccess(){p(e.jsx(v,{children:e.jsx(S,{children:"Order Deleted"})}),{intent:"success"}),l("History")}});switch(s){case"Pending":case"Processing":case"Finished":case"Returning":return null}return e.jsx(c,{label:"Action",size:"large",children:e.jsxs("div",{className:m.body,children:[s==="Cancelled"&&e.jsx(N,{appearance:"subtle",onClick:()=>y(r),children:"Delete Order"}),s==="Shipping"&&e.jsx(N,{appearance:"subtle",onClick:()=>C(r),children:"I Received Order"})]})})}const le=D({body:{...I,justifyContent:"space-between"}});function te({OrderId:r,Status:s,Refresh:n,ParentLog:a}){const j=w(()=>a.With("Append")),m=le(),[l,o]=k.useState(),{dispatch:p,dispatchToast:C}=A(j),{run:y}=f.Order.Post.useAppend({manual:!0,onError(t,b){p({Message:"Failed Append Comment",Request:b,Error:t})},onSuccess(){C(e.jsx(v,{children:e.jsx(S,{children:"Comment Appended"})}),{intent:"success"}),n()}}),{run:g}=f.Order.Post.useCancel({manual:!0,onError(t,b){p({Message:"Failed Cancel Order",Request:b,Error:t})},onSuccess(){C(e.jsx(v,{children:e.jsx(S,{children:"Order Canceled"})}),{intent:"success"}),n()}});switch(s){case"Cancelled":case"Finished":return null}return e.jsxs(e.Fragment,{children:[e.jsx(c,{label:"Append",size:"large",children:e.jsx(L,{value:l,onChange:(t,b)=>o(b.value),maxLength:1e3})}),e.jsxs("div",{className:m.body,children:[!(s==="Finished"||s==="Returning")&&e.jsxs(N,{onClick:()=>g(r,l),children:[s==="Shipping"?"Ask Return":"Cancel Order"," with Reason"]}),e.jsx(N,{appearance:"primary",onClick:()=>y(r,l),children:"Add Comment"})]})]})}function ce({Comments:r}){return e.jsx(c,{label:"Comment",size:"large",children:r?.length===0?e.jsx(u,{children:"No Comment"}):r?.map((s,n)=>e.jsxs("div",{children:[e.jsxs(z,{children:[s.User," ",s.Time.toLocaleString()]}),e.jsx("br",{}),e.jsx(B,{children:s.Content})]},n))})}const O=D({body:{...H,rowGap:P.spacingVerticalL},prod:{...H,alignItems:"flex-start",justifyContent:"center"},qua:{flexBasis:"10%",flexGrow:0,justifyContent:"center"}}),de=[i({columnId:"Product",renderHeaderCell(){return e.jsx(d,{children:"Product Name & Types"})},renderCell(r){return e.jsxs(h,{className:O().prod,children:[e.jsx(_,{href:`/Product/${r.ProdId}`,appearance:"subtle",children:e.jsx(J,{children:r.Name})}),e.jsx(K,{children:Object.values(r.Type).reduce((s,n)=>`${s} ${n},`,"")})]})}}),i({columnId:"Quantity",renderHeaderCell(){return e.jsx(d,{className:O().qua,children:"Quantity"})},renderCell(r){return e.jsx(h,{className:O().qua,children:r.Quantity})}})];function ie({OrderId:r,ParentLog:s}){const n=w(()=>s.With("Detail")),a=O(),[j,{setTrue:m,setFalse:l}]=M(),{Nav:o,Paths:p}=F(),C=parseInt(p.at(1)),{data:y,run:g}=R(()=>f.Order.Get.Detail(r,n),{manual:!0,onError:n.error}),{data:t,run:b}=R(()=>f.Order.Get.Order(r),{onError(G){o("History"),n.error(G)},manual:!0});function T(){b(),g()}return k.useEffect(()=>{C===r?(T(),m()):l()},[C]),e.jsxs(e.Fragment,{children:[e.jsx(N,{appearance:"subtle",icon:e.jsx($,{}),onClick:()=>o("History",r)}),e.jsxs(q,{open:j,position:"end",size:"medium",modalType:"alert",children:[e.jsx(Q,{children:e.jsx(U,{action:e.jsx(N,{appearance:"subtle",icon:e.jsx(W,{}),onClick:()=>o("History")}),children:"Order Detail"})}),e.jsx(V,{children:e.jsxs("div",{className:a.body,children:[e.jsx(se,{OrderId:r,Order:t}),e.jsx(Z,{Items:y?.ShopCart,Columns:[ee(44,n),...de]}),e.jsx(ce,{Comments:y?.Comments}),e.jsx(te,{OrderId:r,Status:t?.Status,Refresh:T,ParentLog:n}),e.jsx(ae,{OrderId:r,Status:t?.Status,Refresh:T,ParentLog:n})]})})]})]})}const x=D({five:{flexBasis:"5%",flexGrow:0},ten:{flexBasis:"10%",flexGrow:0},two:{flexBasis:"2.5%",flexGrow:0}}),oe=[i({columnId:"OrderId",renderHeaderCell:()=>e.jsx(d,{className:x().five,children:"Order Id"}),renderCell(r){return e.jsx(h,{className:x().five,children:r.Id})}}),i({columnId:"Products",renderHeaderCell:()=>e.jsx(d,{children:"Products"}),renderCell(r){return e.jsxs(h,{children:[r.Items[0]," ",r.Items.length>1&&`& +${r.Items.length-1}`]})}}),i({columnId:"OrderDate",renderHeaderCell:()=>e.jsx(d,{children:"Order Date"}),renderCell(r){return e.jsx(d,{children:r.OrderDate.toLocaleDateString()})}}),i({columnId:"TrackNumber",renderHeaderCell:()=>e.jsx(d,{children:"Track Number"}),renderCell(r){return e.jsx(h,{children:r.TrackNumber})}}),i({columnId:"Quantity",renderHeaderCell:()=>e.jsx(d,{className:x().ten,children:"Quantity"}),renderCell(r){return e.jsx(h,{className:x().ten,children:r.Quantity})}}),i({columnId:"Status",renderHeaderCell:()=>e.jsx(d,{className:x().ten,children:"Order State"}),renderCell(r){return e.jsx(h,{className:x().ten,children:r.Status})}})];function he(r){return[...oe,i({columnId:"Detail",renderHeaderCell:()=>e.jsx(d,{className:x().two,children:"Detail"}),renderCell(s){return e.jsx(h,{className:x().two,children:e.jsx(ie,{OrderId:s.Id,ParentLog:r})})}})]}export{he as H,se as O,ce as a}; +import{m as D,t as P,x as R,j as e,F as c,L as u,y as w,T as v,b as S,B as N,r as k,ai as L,aO as z,aP as B,o as M,aH as $,ad as q,ae as Q,af as U,ag as W,ah as V,a6 as i,a7 as d,a8 as h,E as _,a9 as J,aa as K}from"./vendor--JR89aB4.js";import{L as X,F as I,a as H,A as Y,H as f,c as F,e as A,f as Z,M as ee}from"./index-no0JSIPh.js";const re=D({flex:I,box:{...H,flexBasis:"50%",rowGap:P.spacingVerticalM}}),E=new X("Order","Info");function se({OrderId:r,Order:s,Admin:n}){const a=re(),{data:j}=R(()=>Y.User.Get.OrderUser(r),{manual:!n,onError:E.error}),m=f.User.Get.useMe(E),l=n?j:m;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:a.flex,children:[e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Name",size:"large",children:e.jsx(u,{children:l?.Name})})}),e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Phone",size:"large",children:e.jsx(u,{children:l?.Phone})})})]}),e.jsxs("div",{className:a.flex,children:[e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Order Date",size:"large",children:e.jsx(u,{children:s?.CreateAt.toLocaleDateString()})})}),e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Status",size:"large",children:e.jsx(u,{children:s?.Status})})})]}),e.jsxs("div",{className:a.flex,children:[e.jsx("div",{className:a.box,children:e.jsx(c,{label:"E-Mail",size:"large",children:e.jsx(u,{children:l?.EMail})})}),!n&&e.jsx("div",{className:a.box,children:e.jsx(c,{label:"Tracking Number",size:"large",children:e.jsx(u,{children:s?.TrackingNumber})})})]}),e.jsx(c,{label:"Address",size:"large",children:e.jsx(u,{children:l?.Address})})]})}const ne=D({body:{...H,alignItems:"flex-start"}});function ae({OrderId:r,Status:s,Refresh:n,ParentLog:a}){const j=w(()=>a.With("Action")),m=ne(),{Reload:l}=F(),{dispatch:o,dispatchToast:p}=A(j),{run:C}=f.Order.Post.useReceived({manual:!0,onError(g,t){o({Message:"Failed Mark Receive",Request:t,Error:g})},onSuccess(){p(e.jsx(v,{children:e.jsx(S,{children:"Order Received"})}),{intent:"success"}),n()}}),{run:y}=f.Order.Delete.useDelete({manual:!0,onError(g,t){o({Message:"Failed Delete Order",Request:t,Error:g})},onSuccess(){p(e.jsx(v,{children:e.jsx(S,{children:"Order Deleted"})}),{intent:"success"}),l("History")}});switch(s){case"Pending":case"Processing":case"Finished":case"Returning":return null}return e.jsx(c,{label:"Action",size:"large",children:e.jsxs("div",{className:m.body,children:[s==="Cancelled"&&e.jsx(N,{appearance:"subtle",onClick:()=>y(r),children:"Delete Order"}),s==="Shipping"&&e.jsx(N,{appearance:"subtle",onClick:()=>C(r),children:"I Received Order"})]})})}const le=D({body:{...I,justifyContent:"space-between"}});function te({OrderId:r,Status:s,Refresh:n,ParentLog:a}){const j=w(()=>a.With("Append")),m=le(),[l,o]=k.useState(),{dispatch:p,dispatchToast:C}=A(j),{run:y}=f.Order.Post.useAppend({manual:!0,onError(t,b){p({Message:"Failed Append Comment",Request:b,Error:t})},onSuccess(){C(e.jsx(v,{children:e.jsx(S,{children:"Comment Appended"})}),{intent:"success"}),n()}}),{run:g}=f.Order.Post.useCancel({manual:!0,onError(t,b){p({Message:"Failed Cancel Order",Request:b,Error:t})},onSuccess(){C(e.jsx(v,{children:e.jsx(S,{children:"Order Canceled"})}),{intent:"success"}),n()}});switch(s){case"Cancelled":case"Finished":return null}return e.jsxs(e.Fragment,{children:[e.jsx(c,{label:"Append",size:"large",children:e.jsx(L,{value:l,onChange:(t,b)=>o(b.value),maxLength:1e3})}),e.jsxs("div",{className:m.body,children:[!(s==="Finished"||s==="Returning")&&e.jsxs(N,{onClick:()=>g(r,l),children:[s==="Shipping"?"Ask Return":"Cancel Order"," with Reason"]}),e.jsx(N,{appearance:"primary",onClick:()=>y(r,l),children:"Add Comment"})]})]})}function ce({Comments:r}){return e.jsx(c,{label:"Comment",size:"large",children:r?.length===0?e.jsx(u,{children:"No Comment"}):r?.map((s,n)=>e.jsxs("div",{children:[e.jsxs(z,{children:[s.User," ",s.Time.toLocaleString()]}),e.jsx("br",{}),e.jsx(B,{children:s.Content})]},n))})}const O=D({body:{...H,rowGap:P.spacingVerticalL},prod:{...H,alignItems:"flex-start",justifyContent:"center"},qua:{flexBasis:"10%",flexGrow:0,justifyContent:"center"}}),de=[i({columnId:"Product",renderHeaderCell(){return e.jsx(d,{children:"Product Name & Types"})},renderCell(r){return e.jsxs(h,{className:O().prod,children:[e.jsx(_,{href:`/Product/${r.ProdId}`,appearance:"subtle",children:e.jsx(J,{children:r.Name})}),e.jsx(K,{children:Object.values(r.Type).reduce((s,n)=>`${s} ${n},`,"")})]})}}),i({columnId:"Quantity",renderHeaderCell(){return e.jsx(d,{className:O().qua,children:"Quantity"})},renderCell(r){return e.jsx(h,{className:O().qua,children:r.Quantity})}})];function ie({OrderId:r,ParentLog:s}){const n=w(()=>s.With("Detail")),a=O(),[j,{setTrue:m,setFalse:l}]=M(),{Nav:o,Paths:p}=F(),C=parseInt(p.at(1)),{data:y,run:g}=R(()=>f.Order.Get.Detail(r,n),{manual:!0,onError:n.error}),{data:t,run:b}=R(()=>f.Order.Get.Order(r),{onError(G){o("History"),n.error(G)},manual:!0});function T(){b(),g()}return k.useEffect(()=>{C===r?(T(),m()):l()},[C]),e.jsxs(e.Fragment,{children:[e.jsx(N,{appearance:"subtle",icon:e.jsx($,{}),onClick:()=>o("History",r)}),e.jsxs(q,{open:j,position:"end",size:"medium",modalType:"alert",children:[e.jsx(Q,{children:e.jsx(U,{action:e.jsx(N,{appearance:"subtle",icon:e.jsx(W,{}),onClick:()=>o("History")}),children:"Order Detail"})}),e.jsx(V,{children:e.jsxs("div",{className:a.body,children:[e.jsx(se,{OrderId:r,Order:t}),e.jsx(Z,{Items:y?.ShopCart,Columns:[ee(44,n),...de]}),e.jsx(ce,{Comments:y?.Comments}),e.jsx(te,{OrderId:r,Status:t?.Status,Refresh:T,ParentLog:n}),e.jsx(ae,{OrderId:r,Status:t?.Status,Refresh:T,ParentLog:n})]})})]})]})}const x=D({five:{flexBasis:"5%",flexGrow:0},ten:{flexBasis:"10%",flexGrow:0},two:{flexBasis:"2.5%",flexGrow:0}}),oe=[i({columnId:"OrderId",renderHeaderCell:()=>e.jsx(d,{className:x().five,children:"Order Id"}),renderCell(r){return e.jsx(h,{className:x().five,children:r.Id})}}),i({columnId:"Products",renderHeaderCell:()=>e.jsx(d,{children:"Products"}),renderCell(r){return e.jsxs(h,{children:[r.Items[0]," ",r.Items.length>1&&`& +${r.Items.length-1}`]})}}),i({columnId:"OrderDate",renderHeaderCell:()=>e.jsx(d,{children:"Order Date"}),renderCell(r){return e.jsx(d,{children:r.OrderDate.toLocaleDateString()})}}),i({columnId:"TrackNumber",renderHeaderCell:()=>e.jsx(d,{children:"Track Number"}),renderCell(r){return e.jsx(h,{children:r.TrackNumber})}}),i({columnId:"Quantity",renderHeaderCell:()=>e.jsx(d,{className:x().ten,children:"Quantity"}),renderCell(r){return e.jsx(h,{className:x().ten,children:r.Quantity})}}),i({columnId:"Status",renderHeaderCell:()=>e.jsx(d,{className:x().ten,children:"Order State"}),renderCell(r){return e.jsx(h,{className:x().ten,children:r.Status})}})];function he(r){return[...oe,i({columnId:"Detail",renderHeaderCell:()=>e.jsx(d,{className:x().two,children:"Detail"}),renderCell(s){return e.jsx(h,{className:x().two,children:e.jsx(ie,{OrderId:s.Id,ParentLog:r})})}})]}export{he as H,se as O,ce as a}; diff --git a/assets/Component-3Xt-99h9.js b/assets/Component-_hAU7BS-.js similarity index 97% rename from assets/Component-3Xt-99h9.js rename to assets/Component-_hAU7BS-.js index b5e9c46..990c60a 100644 --- a/assets/Component-3Xt-99h9.js +++ b/assets/Component-_hAU7BS-.js @@ -1 +1 @@ -import{m as H,s as b,r as f,j as a,B as T,b3 as N}from"./vendor--JR89aB4.js";import{u as B,L as X,a as r,$,b as K,c as F,d as U,e as G,f as V,P as q,g as J}from"./index-mm5L4EFF.js";import{L as Q}from"./LexicalNestedComposer-bPIc0uls.js";import"./index-3wZvIsDj.js";function k(h,C,p){return Math.min(Math.max(h,C),p)}const o={east:1,north:8,south:2,west:4};function Z({onResizeStart:h,onResizeEnd:C,buttonRef:p,imageRef:E,maxWidth:v,editor:S,showCaption:_,setShowCaption:M,captionsEnabled:z}){const O=f.useRef(null),y=f.useRef({priority:"",value:"default"}),P=f.useRef({currentHeight:0,currentWidth:0,direction:0,isResizing:!1,ratio:0,startHeight:0,startWidth:0,startX:0,startY:0}),l=S.getRootElement(),m=v||(l?l.getBoundingClientRect().width-20:100),j=l?l.getBoundingClientRect().height-20:100,L=100,A=100;function u(t){const n=t===o.east||t===o.west,s=t===o.north||t===o.south,w=t&o.north&&t&o.west||t&o.south&&t&o.east,g=n?"ew":s?"ns":w?"nwse":"nesw";l&&l.style.setProperty("cursor",`${g}-resize`,"important"),document.body&&(document.body.style.setProperty("cursor",`${g}-resize`,"important"),y.current.value=document.body.style.getPropertyValue("-webkit-user-select"),y.current.priority=document.body.style.getPropertyPriority("-webkit-user-select"),document.body.style.setProperty("-webkit-user-select","none","important"))}function I(){l&&l.style.setProperty("cursor","default"),document.body&&(document.body.style.setProperty("cursor","default"),document.body.style.setProperty("-webkit-user-select",y.current.value,y.current.priority))}function x(t,n){if(!S.isEditable())return;const s=E.current,w=O.current;if(s&&w){const{width:g,height:i}=s.getBoundingClientRect(),e=P.current;e.startWidth=g,e.startHeight=i,e.ratio=g/i,e.currentWidth=g,e.currentHeight=i,e.startX=t.clientX,e.startY=t.clientY,e.isResizing=!0,e.direction=n,u(n),h(),w.classList.add("image-control-wrapper--resizing"),s.style.height=`${i}px`,s.style.width=`${g}px`,document.addEventListener("pointermove",W),document.addEventListener("pointerup",D)}}function W(t){const n=E.current,s=P.current,w=s.direction&(o.east|o.west),g=s.direction&(o.south|o.north);if(n&&s.isResizing)if(w&&g){let i=Math.floor(s.startX-t.clientX);i=s.direction&o.east?-i:i;const e=k(s.startWidth+i,L,m),d=e/s.ratio;n.style.width=`${e}px`,n.style.height=`${d}px`,s.currentHeight=d,s.currentWidth=e}else if(g){let i=Math.floor(s.startY-t.clientY);i=s.direction&o.south?-i:i;const e=k(s.startHeight+i,A,j);n.style.height=`${e}px`,s.currentHeight=e}else{let i=Math.floor(s.startX-t.clientX);i=s.direction&o.east?-i:i;const e=k(s.startWidth+i,L,m);n.style.width=`${e}px`,s.currentWidth=e}}function D(){const t=E.current,n=P.current,s=O.current;if(t&&s&&n.isResizing){const w=n.currentWidth,g=n.currentHeight;n.startWidth=0,n.startHeight=0,n.ratio=0,n.startX=0,n.startY=0,n.currentWidth=0,n.currentHeight=0,n.isResizing=!1,s.classList.remove("image-control-wrapper--resizing"),I(),C(w,g),document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",D)}}const c=ee();return a.jsxs("div",{ref:O,children:[!_&&z&&a.jsx(T,{className:c.button,ref:p,onClick:()=>M(!_),children:"Add Caption"}),a.jsx("div",{className:N(c.resizer,c.n),onPointerDown:t=>x(t,o.north)}),a.jsx("div",{className:N(c.resizer,c.ne),onPointerDown:t=>x(t,o.north|o.east)}),a.jsx("div",{className:N(c.resizer,c.e),onPointerDown:t=>x(t,o.east)}),a.jsx("div",{className:N(c.resizer,c.se),onPointerDown:t=>x(t,o.south|o.east)}),a.jsx("div",{className:N(c.resizer,c.s),onPointerDown:t=>x(t,o.south)}),a.jsx("div",{className:N(c.resizer,c.sw),onPointerDown:t=>x(t,o.south|o.west)}),a.jsx("div",{className:N(c.resizer,c.w),onPointerDown:t=>x(t,o.west)}),a.jsx("div",{className:N(c.resizer,c.nw),onPointerDown:t=>x(t,o.north|o.west)})]})}const ee=H({button:{minWidth:"unset",fontWeight:"unset",width:"fit-content",position:"absolute",bottom:"20px",marginLeft:"auto",left:0,right:0,...b.margin(0,"auto")},resizer:{display:"block",width:"7px",height:"7px",position:"absolute",backgroundColor:"rgb(60, 132, 244)",...b.border("1px","solid","#fff")},n:{top:"-6px",left:"48%",cursor:"n-resize"},ne:{top:"-6px",right:"-6px",cursor:"ne-resize"},e:{bottom:"48%",right:"-6px",cursor:"e-resize"},se:{bottom:"-2px",right:"-6px",cursor:"nwse-resize"},s:{bottom:"-2px",left:"48%",cursor:"s-resize"},sw:{bottom:"-2px",left:"-6px",cursor:"sw-resize"},w:{bottom:"48%",left:"-6px",cursor:"w-resize"},nw:{top:"-6px",left:"-6px",cursor:"nw-resize"}}),te=H({caption:{display:"block",position:"absolute",bottom:"4px",left:0,right:0,...b.padding(0),...b.margin(0),...b.borderTop("1px","solid","#fff"),backgroundColor:"rgba(255, 255, 255, 0.9)",minWidth:"100px",color:"#000",...b.overflow("hidden")},content:{minHeight:"20px",...b.border(0),resize:"none",cursor:"text",caretColor:"rgb(5, 5, 5)",display:"block",position:"relative",tabSize:1,...b.outline(0),...b.padding("10px"),userSelect:"text",fontSize:"12px",width:"calc(100% - 20px)",whiteSpace:"pre-wrap",wordBreak:"break-word"},placeholder:{fontSize:"12px",color:"#888",...b.overflow("hidden"),position:"absolute",textOverflow:"ellipsis",top:"10px",left:"10px",userSelect:"none",whiteSpace:"nowrap",display:"inline-block",pointerEvents:"none"}}),Y=new Set;function se(h){if(!Y.has(h))throw new Promise(C=>{const p=new Image;p.src=h,p.onload=()=>{Y.add(h),C(null)}})}function re({altText:h,className:C,imageRef:p,src:E,width:v,height:S,maxWidth:_}){return se(E),a.jsx("img",{className:C||void 0,src:E,alt:h,ref:p,style:{height:S,maxWidth:_,width:v},draggable:"false"})}function ce({src:h,altText:C,nodeKey:p,width:E,height:v,maxWidth:S,resizable:_,showCaption:M,caption:z,captionsEnabled:O}){const y=f.useRef(null),P=f.useRef(null),[l,m,j]=B.useLexicalNodeSelection(p),[L,A]=f.useState(!1),[u]=X.useLexicalComposerContext(),[I,x]=f.useState(null),W=f.useRef(null),D=f.useCallback(e=>{if(l&&r.$isNodeSelection(r.$getSelection())){e.preventDefault();const R=r.$getNodeByKey(p);$(R)&&R.remove(),m(!1)}return!1},[l,p,m]),c=f.useCallback(e=>{const d=r.$getSelection(),R=P.current;if(l&&r.$isNodeSelection(d)&&d.getNodes().length===1){if(M)return r.$setSelection(null),e.preventDefault(),z.focus(),!0;if(R!==null&&R!==document.activeElement)return e.preventDefault(),R.focus(),!0}return!1},[z,l,M]),t=f.useCallback(e=>W.current===z||P.current===e.target?(r.$setSelection(null),u.update(()=>{m(!0);const d=u.getRootElement();d!==null&&d.focus()}),!0):!1,[z,u,m]);f.useEffect(()=>K.mergeRegister(u.registerUpdateListener(({editorState:e})=>{x(e.read(()=>r.$getSelection()))}),u.registerCommand(r.SELECTION_CHANGE_COMMAND,(e,d)=>(W.current=d,!1),r.COMMAND_PRIORITY_LOW),u.registerCommand(r.CLICK_COMMAND,e=>{const d=e;return L?!0:d.target===y.current?(d.shiftKey?m(!l):(j(),m(!0)),!0):!1},r.COMMAND_PRIORITY_LOW),u.registerCommand(r.DRAGSTART_COMMAND,e=>e.target===y.current?(e.preventDefault(),!0):!1,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_DELETE_COMMAND,D,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_BACKSPACE_COMMAND,D,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_ENTER_COMMAND,c,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_ESCAPE_COMMAND,t,r.COMMAND_PRIORITY_LOW)),[j,u,L,l,p,D,c,t,m]);function n(){u.update(()=>{const e=r.$getNodeByKey(p);$(e)&&e.setShowCaption(!0)})}function s(e,d){setTimeout(()=>{A(!1)},200),u.update(()=>{const R=r.$getNodeByKey(p);$(R)&&R.setWidthAndHeight(e,d)})}const w=l&&r.$isNodeSelection(I)&&!L,g=l||L,i=te();return a.jsxs(f.Suspense,{children:[a.jsx("div",{draggable:w,children:a.jsx(re,{className:g?`focused ${r.$isNodeSelection(I)?"draggable":""}`:null,src:h,altText:C,imageRef:y,width:E,height:v,maxWidth:S})}),M&&a.jsx("div",{className:N("LexEditor_ImageCaption",i.caption),children:a.jsxs(Q.LexicalNestedComposer,{initialEditor:z,children:[a.jsx(F.AutoFocusPlugin,{}),a.jsx(U,{}),a.jsx(G.RichTextPlugin,{contentEditable:a.jsx(V,{className:i.content}),placeholder:a.jsx(q,{className:i.placeholder,children:"Enter a caption..."}),ErrorBoundary:J})]})}),_&&r.$isNodeSelection(I)&&g&&a.jsx(Z,{showCaption:M,setShowCaption:n,editor:u,buttonRef:P,imageRef:y,maxWidth:S,onResizeStart:()=>A(!0),onResizeEnd:s,captionsEnabled:O})]})}export{ce as default}; +import{m as H,s as b,r as f,j as a,B as T,b3 as N}from"./vendor--JR89aB4.js";import{u as B,L as X,a as r,$,b as K,c as F,d as U,e as G,f as V,P as q,g as J}from"./index-lt_pJMTs.js";import{L as Q}from"./LexicalNestedComposer-rgrcCsEX.js";import"./index-no0JSIPh.js";function k(h,C,p){return Math.min(Math.max(h,C),p)}const o={east:1,north:8,south:2,west:4};function Z({onResizeStart:h,onResizeEnd:C,buttonRef:p,imageRef:E,maxWidth:v,editor:S,showCaption:_,setShowCaption:M,captionsEnabled:z}){const O=f.useRef(null),y=f.useRef({priority:"",value:"default"}),P=f.useRef({currentHeight:0,currentWidth:0,direction:0,isResizing:!1,ratio:0,startHeight:0,startWidth:0,startX:0,startY:0}),l=S.getRootElement(),m=v||(l?l.getBoundingClientRect().width-20:100),j=l?l.getBoundingClientRect().height-20:100,L=100,A=100;function u(t){const n=t===o.east||t===o.west,s=t===o.north||t===o.south,w=t&o.north&&t&o.west||t&o.south&&t&o.east,g=n?"ew":s?"ns":w?"nwse":"nesw";l&&l.style.setProperty("cursor",`${g}-resize`,"important"),document.body&&(document.body.style.setProperty("cursor",`${g}-resize`,"important"),y.current.value=document.body.style.getPropertyValue("-webkit-user-select"),y.current.priority=document.body.style.getPropertyPriority("-webkit-user-select"),document.body.style.setProperty("-webkit-user-select","none","important"))}function I(){l&&l.style.setProperty("cursor","default"),document.body&&(document.body.style.setProperty("cursor","default"),document.body.style.setProperty("-webkit-user-select",y.current.value,y.current.priority))}function x(t,n){if(!S.isEditable())return;const s=E.current,w=O.current;if(s&&w){const{width:g,height:i}=s.getBoundingClientRect(),e=P.current;e.startWidth=g,e.startHeight=i,e.ratio=g/i,e.currentWidth=g,e.currentHeight=i,e.startX=t.clientX,e.startY=t.clientY,e.isResizing=!0,e.direction=n,u(n),h(),w.classList.add("image-control-wrapper--resizing"),s.style.height=`${i}px`,s.style.width=`${g}px`,document.addEventListener("pointermove",W),document.addEventListener("pointerup",D)}}function W(t){const n=E.current,s=P.current,w=s.direction&(o.east|o.west),g=s.direction&(o.south|o.north);if(n&&s.isResizing)if(w&&g){let i=Math.floor(s.startX-t.clientX);i=s.direction&o.east?-i:i;const e=k(s.startWidth+i,L,m),d=e/s.ratio;n.style.width=`${e}px`,n.style.height=`${d}px`,s.currentHeight=d,s.currentWidth=e}else if(g){let i=Math.floor(s.startY-t.clientY);i=s.direction&o.south?-i:i;const e=k(s.startHeight+i,A,j);n.style.height=`${e}px`,s.currentHeight=e}else{let i=Math.floor(s.startX-t.clientX);i=s.direction&o.east?-i:i;const e=k(s.startWidth+i,L,m);n.style.width=`${e}px`,s.currentWidth=e}}function D(){const t=E.current,n=P.current,s=O.current;if(t&&s&&n.isResizing){const w=n.currentWidth,g=n.currentHeight;n.startWidth=0,n.startHeight=0,n.ratio=0,n.startX=0,n.startY=0,n.currentWidth=0,n.currentHeight=0,n.isResizing=!1,s.classList.remove("image-control-wrapper--resizing"),I(),C(w,g),document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",D)}}const c=ee();return a.jsxs("div",{ref:O,children:[!_&&z&&a.jsx(T,{className:c.button,ref:p,onClick:()=>M(!_),children:"Add Caption"}),a.jsx("div",{className:N(c.resizer,c.n),onPointerDown:t=>x(t,o.north)}),a.jsx("div",{className:N(c.resizer,c.ne),onPointerDown:t=>x(t,o.north|o.east)}),a.jsx("div",{className:N(c.resizer,c.e),onPointerDown:t=>x(t,o.east)}),a.jsx("div",{className:N(c.resizer,c.se),onPointerDown:t=>x(t,o.south|o.east)}),a.jsx("div",{className:N(c.resizer,c.s),onPointerDown:t=>x(t,o.south)}),a.jsx("div",{className:N(c.resizer,c.sw),onPointerDown:t=>x(t,o.south|o.west)}),a.jsx("div",{className:N(c.resizer,c.w),onPointerDown:t=>x(t,o.west)}),a.jsx("div",{className:N(c.resizer,c.nw),onPointerDown:t=>x(t,o.north|o.west)})]})}const ee=H({button:{minWidth:"unset",fontWeight:"unset",width:"fit-content",position:"absolute",bottom:"20px",marginLeft:"auto",left:0,right:0,...b.margin(0,"auto")},resizer:{display:"block",width:"7px",height:"7px",position:"absolute",backgroundColor:"rgb(60, 132, 244)",...b.border("1px","solid","#fff")},n:{top:"-6px",left:"48%",cursor:"n-resize"},ne:{top:"-6px",right:"-6px",cursor:"ne-resize"},e:{bottom:"48%",right:"-6px",cursor:"e-resize"},se:{bottom:"-2px",right:"-6px",cursor:"nwse-resize"},s:{bottom:"-2px",left:"48%",cursor:"s-resize"},sw:{bottom:"-2px",left:"-6px",cursor:"sw-resize"},w:{bottom:"48%",left:"-6px",cursor:"w-resize"},nw:{top:"-6px",left:"-6px",cursor:"nw-resize"}}),te=H({caption:{display:"block",position:"absolute",bottom:"4px",left:0,right:0,...b.padding(0),...b.margin(0),...b.borderTop("1px","solid","#fff"),backgroundColor:"rgba(255, 255, 255, 0.9)",minWidth:"100px",color:"#000",...b.overflow("hidden")},content:{minHeight:"20px",...b.border(0),resize:"none",cursor:"text",caretColor:"rgb(5, 5, 5)",display:"block",position:"relative",tabSize:1,...b.outline(0),...b.padding("10px"),userSelect:"text",fontSize:"12px",width:"calc(100% - 20px)",whiteSpace:"pre-wrap",wordBreak:"break-word"},placeholder:{fontSize:"12px",color:"#888",...b.overflow("hidden"),position:"absolute",textOverflow:"ellipsis",top:"10px",left:"10px",userSelect:"none",whiteSpace:"nowrap",display:"inline-block",pointerEvents:"none"}}),Y=new Set;function se(h){if(!Y.has(h))throw new Promise(C=>{const p=new Image;p.src=h,p.onload=()=>{Y.add(h),C(null)}})}function re({altText:h,className:C,imageRef:p,src:E,width:v,height:S,maxWidth:_}){return se(E),a.jsx("img",{className:C||void 0,src:E,alt:h,ref:p,style:{height:S,maxWidth:_,width:v},draggable:"false"})}function ce({src:h,altText:C,nodeKey:p,width:E,height:v,maxWidth:S,resizable:_,showCaption:M,caption:z,captionsEnabled:O}){const y=f.useRef(null),P=f.useRef(null),[l,m,j]=B.useLexicalNodeSelection(p),[L,A]=f.useState(!1),[u]=X.useLexicalComposerContext(),[I,x]=f.useState(null),W=f.useRef(null),D=f.useCallback(e=>{if(l&&r.$isNodeSelection(r.$getSelection())){e.preventDefault();const R=r.$getNodeByKey(p);$(R)&&R.remove(),m(!1)}return!1},[l,p,m]),c=f.useCallback(e=>{const d=r.$getSelection(),R=P.current;if(l&&r.$isNodeSelection(d)&&d.getNodes().length===1){if(M)return r.$setSelection(null),e.preventDefault(),z.focus(),!0;if(R!==null&&R!==document.activeElement)return e.preventDefault(),R.focus(),!0}return!1},[z,l,M]),t=f.useCallback(e=>W.current===z||P.current===e.target?(r.$setSelection(null),u.update(()=>{m(!0);const d=u.getRootElement();d!==null&&d.focus()}),!0):!1,[z,u,m]);f.useEffect(()=>K.mergeRegister(u.registerUpdateListener(({editorState:e})=>{x(e.read(()=>r.$getSelection()))}),u.registerCommand(r.SELECTION_CHANGE_COMMAND,(e,d)=>(W.current=d,!1),r.COMMAND_PRIORITY_LOW),u.registerCommand(r.CLICK_COMMAND,e=>{const d=e;return L?!0:d.target===y.current?(d.shiftKey?m(!l):(j(),m(!0)),!0):!1},r.COMMAND_PRIORITY_LOW),u.registerCommand(r.DRAGSTART_COMMAND,e=>e.target===y.current?(e.preventDefault(),!0):!1,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_DELETE_COMMAND,D,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_BACKSPACE_COMMAND,D,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_ENTER_COMMAND,c,r.COMMAND_PRIORITY_LOW),u.registerCommand(r.KEY_ESCAPE_COMMAND,t,r.COMMAND_PRIORITY_LOW)),[j,u,L,l,p,D,c,t,m]);function n(){u.update(()=>{const e=r.$getNodeByKey(p);$(e)&&e.setShowCaption(!0)})}function s(e,d){setTimeout(()=>{A(!1)},200),u.update(()=>{const R=r.$getNodeByKey(p);$(R)&&R.setWidthAndHeight(e,d)})}const w=l&&r.$isNodeSelection(I)&&!L,g=l||L,i=te();return a.jsxs(f.Suspense,{children:[a.jsx("div",{draggable:w,children:a.jsx(re,{className:g?`focused ${r.$isNodeSelection(I)?"draggable":""}`:null,src:h,altText:C,imageRef:y,width:E,height:v,maxWidth:S})}),M&&a.jsx("div",{className:N("LexEditor_ImageCaption",i.caption),children:a.jsxs(Q.LexicalNestedComposer,{initialEditor:z,children:[a.jsx(F.AutoFocusPlugin,{}),a.jsx(U,{}),a.jsx(G.RichTextPlugin,{contentEditable:a.jsx(V,{className:i.content}),placeholder:a.jsx(q,{className:i.placeholder,children:"Enter a caption..."}),ErrorBoundary:J})]})}),_&&r.$isNodeSelection(I)&&g&&a.jsx(Z,{showCaption:M,setShowCaption:n,editor:u,buttonRef:P,imageRef:y,maxWidth:S,onResizeStart:()=>A(!0),onResizeEnd:s,captionsEnabled:O})]})}export{ce as default}; diff --git a/assets/Component-HpG_cdPN.js b/assets/Component-n2P2KSDI.js similarity index 99% rename from assets/Component-HpG_cdPN.js rename to assets/Component-n2P2KSDI.js index 3048002..c142af6 100644 --- a/assets/Component-HpG_cdPN.js +++ b/assets/Component-n2P2KSDI.js @@ -1 +1 @@ -import{j as g,Y as Te,$ as W,bG as ne,m as pe,s as Ie,r as N,b3 as ae,R as we,U as Ae,B as je,bJ as Le,W as $e}from"./vendor--JR89aB4.js";import{a as e,h as ue,i as he,j as de,C as xe,u as Pe,L as Ye,b as ke,T as Ke,I as fe,k as se,l as We,m as Se,n as ze,o as ve,p as Je}from"./index-mm5L4EFF.js";import{L as Be}from"./LexicalNestedComposer-bPIc0uls.js";import"./index-3wZvIsDj.js";function He({cell:t,rows:s,cellCoordMap:c,updateCellsByID:a,onClose:C,updateTableNode:y,setSortingOptions:x,sortingOptions:n}){const j=c.get(t.id);if(!j)return null;const[_,w]=j,S=[];return t.type==="header"&&w===0&&(n&&n.x===_&&S.push(g.jsx(W,{onClick:()=>{x(null),C()},children:"Remove Sorting"})),(!n||n.x!==_||n.type==="descending")&&S.push(g.jsx(W,{onClick:()=>{x({type:"ascending",x:_}),C()},children:"Sort Ascending"})),(!n||n.x!==_||n.type==="ascending")&&S.push(g.jsx(W,{onClick:()=>{x({type:"descending",x:_}),C()},children:"Sort Descending"})),S.push(g.jsx(ne,{}))),g.jsxs(Te,{children:[g.jsx(W,{onClick:()=>{y(M=>{M.updateCellType(_,w,t.type==="normal"?"header":"normal")}),C()},children:t.type==="normal"?"Make header":"Remove header"}),g.jsx(W,{onClick:()=>{a([t.id],()=>{const M=e.$getRoot();M.clear(),M.append(e.$createParagraphNode())}),C()},children:"Clear Cell"}),g.jsx(ne,{}),S,g.jsx(W,{onClick:()=>{y(M=>{M.insertRowAt(w)}),C()},children:"Insert row above"}),g.jsx(W,{onClick:()=>{y(M=>{M.insertRowAt(w+1)}),C()},children:"Insert row below"}),g.jsx(ne,{}),g.jsx(W,{onClick:()=>{y(M=>{M.insertColumnAt(_)}),C()},children:"Insert column left"}),g.jsx(W,{onClick:()=>{y(M=>{M.insertColumnAt(_+1)}),C()},children:"Insert column right"}),g.jsx(ne,{}),s[0].cells.length!==1&&g.jsx(W,{onClick:()=>{y(M=>{M.deleteColumnAt(_)}),C()},children:"Delete column"}),s.length!==1&&g.jsx(W,{onClick:()=>{y(M=>{M.deleteRowAt(w)}),C()},children:"Delete row"}),g.jsx(W,{onClick:()=>{y(M=>{M.selectNext(),M.remove()}),C()},children:"Delete table"})]})}function Xe(t){return`


`}function Fe(t,s){const c=s.parseEditorState(t);let a=ue.get(t);if(!a){a=c.read(()=>he.$generateHtmlFromNodes(s,null));const C=c.read(()=>e.$getRoot().getTextContent());ue.set(t,a),de.set(t,C)}return a}function Ue({cellEditor:t}){const{cellEditorConfig:s,cellEditorPlugins:c}=N.useContext(xe);return!c||!s?null:g.jsx(Be.LexicalNestedComposer,{initialEditor:t,initialTheme:s.theme,initialNodes:s.nodes,skipCollabChecks:!0,children:c})}function qe({cell:t,cellCoordMap:s,cellEditor:c,isEditing:a,isSelected:C,isPrimarySelected:y,theme:x,updateCellsByID:n,updateTableNode:j,rows:_,setSortingOptions:w,sortingOptions:S}){const[M,k]=N.useState(!1),u=t.type!=="normal",v=t.json,H=u?"th":"td",oe=t.width,P=s.get(t.id),z=S&&P&&P[0]===S.x&&P[1]===0;N.useEffect(()=>{(a||!y)&&k(!1)},[a,y]);const J=Ge();return g.jsxs(H,{className:ae(x.tableCell,u&&x.tableCellHeader,C&&x.tableCellSelected),"data-id":t.id,tabIndex:-1,style:{width:oe},children:[y&&g.jsx("div",{className:ae(x.tableCellPrimarySelected,a&&x.tableCellEditing)}),y&&a?g.jsx(Ue,{cellEditor:c}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:J.prim,dangerouslySetInnerHTML:{__html:v?Fe(v,c):Xe(x)}}),g.jsx("div",{className:x.tableCellResizer,"data-table-resize":"true"})]}),y&&!a&&g.jsx("div",{className:x.tableCellActionButtonContainer,children:g.jsxs(we,{open:M,children:[g.jsx(Ae,{disableButtonEnhancement:!0,children:g.jsx(je,{size:"small",shape:"circular",className:J.btn,children:g.jsx(Le,{}),onClick:Q=>{k(!M),Q.stopPropagation()}})}),g.jsx($e,{children:g.jsx(He,{cell:t,updateCellsByID:n,onClose:()=>k(!1),updateTableNode:j,cellCoordMap:s,rows:_,setSortingOptions:w,sortingOptions:S})})]})}),z&&g.jsx("div",{className:x.tableCellSortedIndicator})]})}const Ge=pe({prim:{position:"relative",zIndex:3},btn:{maxWidth:"unset",minWidth:"unset",...Ie.padding("4px")}}),X=[];function Qe(){const t=e.$createRangeSelection();return t.focus.set("root",e.$getRoot().getChildrenSize(),"element"),t}function ie(t,s){const c=t.querySelector(`[data-id=${s}]`);c&&c.focus()}function Ve(t){return t.nodeType===1&&t.hasAttribute("data-table-resize")}function ge(t){const s=t.getRootElement();return s?s.ownerDocument:document}function Ze(t,s,c,a){return s?!1:t===67?fe?c:a:!1}function et(t,s,c,a){return s?!1:t===88?fe?c:a:!1}function tt(t,s,c,a){return s?!1:t===86?fe?c:a:!1}function ce(t){let s=t;for(;s;){const c=s.getAttribute("data-id");if(c)return c;s=s.parentElement}return null}function nt(t){let s=t;for(;s;){if(s.nodeName==="TH"||s.nodeName==="TD")return s.getBoundingClientRect().width;s=s.parentElement}return 0}function G(t,s,c,a,C,y){for(const x of s){const n=re(t,x,c);if(n&&a){const j=a.parseEditorState(n.json);a._headless=!0,a.setEditorState(j),a.update(y,{discrete:!0}),a._headless=!1;const _=JSON.stringify(a.getEditorState());C(w=>{const[S,M]=c.get(x);w.updateCellJSON(S,M,_)})}}}function st(t){let s=t;for(;s;){const c=s.nodeName;if(c==="BUTTON"||c==="INPUT"||c==="TEXTAREA")return!0;s=s.parentElement}return!1}function Re(t,s,c){const a=c.get(t),C=c.get(s);if(!a||!C)return null;const y=Math.min(a[0],C[0]),x=Math.max(a[0],C[0]),n=Math.min(a[1],C[1]),j=Math.max(a[1],C[1]);return{endX:x,endY:j,startX:y,startY:n}}function Ce(t,s,c,a){const C=Re(s,c,a);if(!C)return[];const{startX:y,endY:x,endX:n,startY:j}=C,_=[];for(let w=y;w<=n;w++)for(let S=j;S<=x;S++)_.push(t[S].cells[w].id);return _}function rt(t,s){const{startX:c,endY:a,endX:C,startY:y}=s,x=[];for(let n=y;n<=a;n++){const j=t[n],_=Se();for(let w=c;w<=C;w++){const S={...j.cells[w]};S.id=ze(),_.cells.push(S)}x.push(_)}return x}function re(t,s,c){const a=c.get(s);if(!a)return null;const[C,y]=a;return t[y].cells[C]}function ot(t){const s=t.querySelectorAll("tr"),c=[];for(let a=0;a{const i=new Map;for(let R=0;R{if(!H)return s;const i=s.slice(1);return i.sort((R,L)=>{const A=R.cells,m=L.cells,b=H.x,Y=de.get(A[b].json),T=de.get(m[b].json);return!Y||!T?1:H.type==="ascending"?Y.localeCompare(T):T.localeCompare(Y)}),i.unshift(s[0]),i},[s,H]),E=N.useMemo(()=>{if(!x)return null;const i=e.createEditor({namespace:x.namespace,nodes:x.nodes,onError:R=>x.onError(R,i),theme:x.theme});return i},[x]),me=N.useMemo(()=>new Set(P),[P]),$=N.useCallback(i=>{n.update(()=>{const R=e.$getNodeByKey(t);lt(R)&&i(R)})},[n,t]),F=N.useCallback((i,R,L)=>{const A=O[R].cells[i].id;if(S.current=A,L){const m=Ce(O,u,A,D);z(m)}else v(A),z(X),ie(M.current,A)},[D,u,O]),q=N.useCallback(()=>{if(E&&u){const i=JSON.stringify(E.getEditorState());$(R=>{const L=D.get(u);if(L===void 0)return;const[A,m]=L;R.updateCellJSON(A,m,i)})}},[D,E,u,$]),V=N.useCallback(()=>{setTimeout(()=>{const i=n.getRootElement();i&&(i.focus({preventScroll:!0}),window.getSelection()?.removeAllRanges())},20)},[n]),le=N.useCallback((i,R)=>{G(O,i,D,E,$,R)},[D,E,O,$]),Z=N.useCallback(()=>u&&!I?(le([u,...P],()=>{const i=e.$getRoot();i.clear(),i.append(e.$createParagraphNode())}),!0):(a&&$(i=>{i.selectNext(),i.remove()}),!1),[I,a,u,P,le,$]);N.useEffect(()=>{const i=M.current;a&&document.activeElement===document.body&&i&&i.focus()},[a]),N.useEffect(()=>{const i=M.current;if(!i)return;const R=ge(n);function L(T){const r=T.clientX-m.x,o=T.clientY-m.y;return r<5||o<5}function A(T){const r=ce(T.target);if(r&&n.isEditable()&&i.contains(T.target)){if(L(T)){C(!0),v(null),V();return}if(C(!1),Ve(T.target)){Q(r),i.style.userSelect="none",j.current={point:T.clientX,size:nt(T.target)};return}k.current=!0,u!==r?(I&&q(),v(r),U(!1),S.current=r):S.current=null,z(X)}else u&&!st(T.target)&&(C(!1),k.current=!1,I&&q(),v(null),z(X),U(!1),S.current=null)}const m=i.getBoundingClientRect();function b(T){if(J){const o=_.current;if(o){const{size:l,point:d}=j.current,p=T.clientX-d,h=l+p;let f=T.clientX-m.x;f<10?f=10:f>m.width-10?f=m.width-10:h<20&&(f=d-l+20-m.x),o.style.left=`${f}px`}return}if(!I){const{clientX:o,clientY:l}=T,{width:d,x:p,y:h,height:f}=m,B=o>p+d*.9&&oh+f*.85&&l{const[h]=D.get(J);p.updateColumnWidth(h,d)}),Q(null)}i&&P.length>1&&k.current&&(i.style.userSelect="text",window.getSelection()?.removeAllRanges()),k.current=!1}return R.addEventListener("pointerdown",A),R.addEventListener("pointermove",b),R.addEventListener("pointerup",Y),()=>{R.removeEventListener("pointerdown",A),R.removeEventListener("pointermove",b),R.removeEventListener("pointerup",Y)}},[E,n,I,O,q,u,me,P,D,J,$,C,V]),N.useEffect(()=>{if(!I&&u){let i=function(m){if(m&&E){const b=m.json,Y=E.parseEditorState(b);E.setEditorState(Y)}},R=function(m){const b=ce(m.target);if(b===u&&n.isEditable()){const Y=re(O,b,D);i(Y),U(!0),z(X)}},L=function(m){const b=m.keyCode;if(b===16||b===27||b===9||b===37||b===38||b===39||b===40||b===8||b===46||!n.isEditable())return;if(b===13&&m.preventDefault(),!I&&u&&n.getEditorState().read(()=>!e.$getSelection())&&m.target.contentEditable!=="true"){if(Ze(b,m.shiftKey,m.metaKey,m.ctrlKey)){n.dispatchCommand(e.COPY_COMMAND,m);return}if(et(b,m.shiftKey,m.metaKey,m.ctrlKey)){n.dispatchCommand(e.CUT_COMMAND,m);return}if(tt(b,m.shiftKey,m.metaKey,m.ctrlKey)){n.dispatchCommand(e.PASTE_COMMAND,m);return}}if(m.metaKey||m.ctrlKey||m.altKey)return;const Y=re(O,u,D);i(Y),U(!0),z(X)};const A=ge(n);return A.addEventListener("dblclick",R),A.addEventListener("keydown",L),()=>{A.removeEventListener("dblclick",R),A.removeEventListener("keydown",L)}}},[E,n,I,O,u,D]),N.useEffect(()=>{const i=M.current;if(!i)return;function R(r,o,l,d){const p=r instanceof KeyboardEvent?null:r.clipboardData;if(r.preventDefault(),p)p.setData("text/html",o),p.setData("text/plain",d),p.setData("application/x-lexical-editor",l);else{const h=navigator.clipboard;if(h){const f=[new ClipboardItem({"text/html":new Blob([o],{type:"text/html"})})];h.write(f)}}}async function L(r,o){try{return r instanceof DataTransfer?r.getData(o):r instanceof ClipboardItem?await(await r.getType(o)).text():""}catch{return""}}async function A(r){let o=(r instanceof InputEvent?null:r.clipboardData)||null;if(u&&E){if(r.preventDefault(),!o)try{o=(await navigator.clipboard.read())[0]}catch{}const l=o?await L(o,"application/x-lexical-editor"):"";if(l)try{const h=JSON.parse(l);if(h.namespace===n._config.namespace&&Array.isArray(h.nodes)){G(O,[u],D,E,$,()=>{const f=e.$getRoot();f.clear(),f.append(e.$createParagraphNode()),f.selectEnd();const B=se.$generateNodesFromSerializedNodes(h.nodes),K=e.$getSelection();e.$isRangeSelection(K)&&se.$insertGeneratedNodes(E,B,K)});return}}catch{}const d=o?await L(o,"text/html"):"";if(d)try{const f=new DOMParser().parseFromString(d,"text/html"),B=f.querySelector("table");if(B){const K=ot(B);$(ee=>{const[te,_e]=D.get(u);ee.mergeRows(te,_e,K)});return}G(O,[u],D,E,$,()=>{const K=e.$getRoot();K.clear(),K.append(e.$createParagraphNode()),K.selectEnd();const ee=he.$generateNodesFromDOM(n,f),te=e.$getSelection();e.$isRangeSelection(te)&&se.$insertGeneratedNodes(E,ee,te)});return}catch{}const p=o?await L(o,"text/plain"):"";p&&G(O,[u],D,E,$,()=>{const h=e.$getRoot();h.clear(),h.selectEnd();const f=e.$getSelection();f&&f.insertRawText(p)})}}function m(r){if(u&&E){const l=re(O,u,D).json,d=ue.get(l)||null;if(!d)return;const p=E.parseEditorState(l),h=p.read(()=>e.$getRoot().getTextContent()),f=p.read(()=>JSON.stringify(se.$generateJSONFromSelectedNodes(E,null)));R(r,d,f,h)}}function b(r){const o=S.current;if(u&&E&&o){const l=Re(u,o,D);if(!l)return;const d=We(O,l),p=d.outerHTML,h=d.outerText,f=n.getEditorState().read(()=>e.$getNodeByKey(t).exportJSON());f.rows=rt(O,l);const B={namespace:E._config.namespace,nodes:[f]},K=JSON.stringify(B);R(r,p,K,h)}}function Y(r,o){const l=e.$getSelection();return u&&!I&&!l&&o===n?(A(r),k.current=!1,z(X),!0):!1}function T(r,o){const l=e.$getSelection();return u&&!I&&!l&&o===n?(P.length===0?m(r):b(r),!0):!1}return ke.mergeRegister(n.registerCommand(e.CLICK_COMMAND,r=>{const o=e.$getSelection();return!!e.$isNodeSelection(o)},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.PASTE_COMMAND,Y,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.COPY_COMMAND,T,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.CUT_COMMAND,(r,o)=>T(r,o)?(Z(),!0):!1,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_BACKSPACE_COMMAND,Z,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_DELETE_COMMAND,Z,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.FORMAT_TEXT_COMMAND,r=>u&&!I?(G(O,[u,...P],D,E,$,()=>{Qe().formatText(r)}),!0):!1,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ENTER_COMMAND,(r,o)=>{const l=e.$getSelection();if(!u&&!I&&e.$isNodeSelection(l)&&l.has(t)&&l.getNodes().length===1&&o===n){const d=O[0].cells[0].id;return v(d),ie(i,d),r.preventDefault(),r.stopPropagation(),y(),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_TAB_COMMAND,r=>{const o=e.$getSelection();if(!I&&!o&&u){const l=r.shiftKey,[d,p]=D.get(u);r.preventDefault();let h=null,f=null;if(d===0&&l?p!==0&&(f=p-1,h=O[f].cells.length-1):d===O[p].cells.length-1&&!l?p!==O.length-1&&(f=p+1,h=0):l?(h=d-1,f=p):(h=d+1,f=p),h&&f)return F(h,f,!1),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_UP_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(f!==0)return F(h,f-1,d),!0}}return!e.$isRangeSelection(l)||o!==E?!1:l.isCollapsed()&&!l.anchor.getNode().getTopLevelElementOrThrow().getPreviousSibling()?(r.preventDefault(),!0):!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_DOWN_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(f!==O.length-1)return F(h,f+1,d),!0}}return!e.$isRangeSelection(l)||o!==E?!1:l.isCollapsed()&&!l.anchor.getNode().getTopLevelElementOrThrow().getNextSibling()?(r.preventDefault(),!0):!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_LEFT_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(h!==0)return F(h-1,f,d),!0}}return!e.$isRangeSelection(l)||o!==E?!1:l.isCollapsed()&&l.anchor.offset===0?(r.preventDefault(),!0):!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_RIGHT_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(h!==O[f].cells.length-1)return F(h+1,f,d),!0}}if(!e.$isRangeSelection(l)||o!==E)return!1;if(l.isCollapsed()){const d=l.anchor;if(d.type==="text"&&d.offset===d.getNode().getTextContentSize()||d.type==="element"&&d.offset===d.getNode().getChildrenSize())return r.preventDefault(),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ESCAPE_COMMAND,(r,o)=>{const l=e.$getSelection();return!I&&!l&&o===n?(C(!0),v(null),V(),!0):e.$isRangeSelection(l)&&I?(q(),U(!1),u&&setTimeout(()=>{ie(i,u)},20),!0):!1},e.COMMAND_PRIORITY_LOW))},[D,E,Z,y,n,I,F,t,u,O,q,V,P,C,$]);function be(){$(i=>{i.addColumns(1)})}function De(){$(i=>{i.addRows(1)})}if(!E)return null;const Oe=it();return g.jsxs("div",{className:Oe.box,children:[g.jsx("table",{className:ae(c.table,a&&c.tableSelected),ref:M,tabIndex:-1,children:g.jsx("tbody",{children:O.map(i=>g.jsx("tr",{className:c.tableRow,children:i.cells.map(R=>{const{id:L}=R;return g.jsx(qe,{cell:R,theme:c,isSelected:me.has(L),isPrimarySelected:u===L,isEditing:I,sortingOptions:H,cellEditor:E,updateCellsByID:le,updateTableNode:$,cellCoordMap:D,rows:O,setSortingOptions:oe},L)})},i.id))})}),ye&&g.jsx("button",{className:c.tableAddColumns,onClick:be}),Me&&g.jsx("button",{className:c.tableAddRows,onClick:De,ref:w}),J&&g.jsx("div",{className:c.tableResizeRuler,ref:_})]})}const it=pe({box:{position:"relative"}});export{ft as default}; +import{j as g,Y as Te,$ as W,bG as ne,m as pe,s as Ie,r as N,b3 as ae,R as we,U as Ae,B as je,bJ as Le,W as $e}from"./vendor--JR89aB4.js";import{a as e,h as ue,i as he,j as de,C as xe,u as Pe,L as Ye,b as ke,T as Ke,I as fe,k as se,l as We,m as Se,n as ze,o as ve,p as Je}from"./index-lt_pJMTs.js";import{L as Be}from"./LexicalNestedComposer-rgrcCsEX.js";import"./index-no0JSIPh.js";function He({cell:t,rows:s,cellCoordMap:c,updateCellsByID:a,onClose:C,updateTableNode:y,setSortingOptions:x,sortingOptions:n}){const j=c.get(t.id);if(!j)return null;const[_,w]=j,S=[];return t.type==="header"&&w===0&&(n&&n.x===_&&S.push(g.jsx(W,{onClick:()=>{x(null),C()},children:"Remove Sorting"})),(!n||n.x!==_||n.type==="descending")&&S.push(g.jsx(W,{onClick:()=>{x({type:"ascending",x:_}),C()},children:"Sort Ascending"})),(!n||n.x!==_||n.type==="ascending")&&S.push(g.jsx(W,{onClick:()=>{x({type:"descending",x:_}),C()},children:"Sort Descending"})),S.push(g.jsx(ne,{}))),g.jsxs(Te,{children:[g.jsx(W,{onClick:()=>{y(M=>{M.updateCellType(_,w,t.type==="normal"?"header":"normal")}),C()},children:t.type==="normal"?"Make header":"Remove header"}),g.jsx(W,{onClick:()=>{a([t.id],()=>{const M=e.$getRoot();M.clear(),M.append(e.$createParagraphNode())}),C()},children:"Clear Cell"}),g.jsx(ne,{}),S,g.jsx(W,{onClick:()=>{y(M=>{M.insertRowAt(w)}),C()},children:"Insert row above"}),g.jsx(W,{onClick:()=>{y(M=>{M.insertRowAt(w+1)}),C()},children:"Insert row below"}),g.jsx(ne,{}),g.jsx(W,{onClick:()=>{y(M=>{M.insertColumnAt(_)}),C()},children:"Insert column left"}),g.jsx(W,{onClick:()=>{y(M=>{M.insertColumnAt(_+1)}),C()},children:"Insert column right"}),g.jsx(ne,{}),s[0].cells.length!==1&&g.jsx(W,{onClick:()=>{y(M=>{M.deleteColumnAt(_)}),C()},children:"Delete column"}),s.length!==1&&g.jsx(W,{onClick:()=>{y(M=>{M.deleteRowAt(w)}),C()},children:"Delete row"}),g.jsx(W,{onClick:()=>{y(M=>{M.selectNext(),M.remove()}),C()},children:"Delete table"})]})}function Xe(t){return`


`}function Fe(t,s){const c=s.parseEditorState(t);let a=ue.get(t);if(!a){a=c.read(()=>he.$generateHtmlFromNodes(s,null));const C=c.read(()=>e.$getRoot().getTextContent());ue.set(t,a),de.set(t,C)}return a}function Ue({cellEditor:t}){const{cellEditorConfig:s,cellEditorPlugins:c}=N.useContext(xe);return!c||!s?null:g.jsx(Be.LexicalNestedComposer,{initialEditor:t,initialTheme:s.theme,initialNodes:s.nodes,skipCollabChecks:!0,children:c})}function qe({cell:t,cellCoordMap:s,cellEditor:c,isEditing:a,isSelected:C,isPrimarySelected:y,theme:x,updateCellsByID:n,updateTableNode:j,rows:_,setSortingOptions:w,sortingOptions:S}){const[M,k]=N.useState(!1),u=t.type!=="normal",v=t.json,H=u?"th":"td",oe=t.width,P=s.get(t.id),z=S&&P&&P[0]===S.x&&P[1]===0;N.useEffect(()=>{(a||!y)&&k(!1)},[a,y]);const J=Ge();return g.jsxs(H,{className:ae(x.tableCell,u&&x.tableCellHeader,C&&x.tableCellSelected),"data-id":t.id,tabIndex:-1,style:{width:oe},children:[y&&g.jsx("div",{className:ae(x.tableCellPrimarySelected,a&&x.tableCellEditing)}),y&&a?g.jsx(Ue,{cellEditor:c}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:J.prim,dangerouslySetInnerHTML:{__html:v?Fe(v,c):Xe(x)}}),g.jsx("div",{className:x.tableCellResizer,"data-table-resize":"true"})]}),y&&!a&&g.jsx("div",{className:x.tableCellActionButtonContainer,children:g.jsxs(we,{open:M,children:[g.jsx(Ae,{disableButtonEnhancement:!0,children:g.jsx(je,{size:"small",shape:"circular",className:J.btn,children:g.jsx(Le,{}),onClick:Q=>{k(!M),Q.stopPropagation()}})}),g.jsx($e,{children:g.jsx(He,{cell:t,updateCellsByID:n,onClose:()=>k(!1),updateTableNode:j,cellCoordMap:s,rows:_,setSortingOptions:w,sortingOptions:S})})]})}),z&&g.jsx("div",{className:x.tableCellSortedIndicator})]})}const Ge=pe({prim:{position:"relative",zIndex:3},btn:{maxWidth:"unset",minWidth:"unset",...Ie.padding("4px")}}),X=[];function Qe(){const t=e.$createRangeSelection();return t.focus.set("root",e.$getRoot().getChildrenSize(),"element"),t}function ie(t,s){const c=t.querySelector(`[data-id=${s}]`);c&&c.focus()}function Ve(t){return t.nodeType===1&&t.hasAttribute("data-table-resize")}function ge(t){const s=t.getRootElement();return s?s.ownerDocument:document}function Ze(t,s,c,a){return s?!1:t===67?fe?c:a:!1}function et(t,s,c,a){return s?!1:t===88?fe?c:a:!1}function tt(t,s,c,a){return s?!1:t===86?fe?c:a:!1}function ce(t){let s=t;for(;s;){const c=s.getAttribute("data-id");if(c)return c;s=s.parentElement}return null}function nt(t){let s=t;for(;s;){if(s.nodeName==="TH"||s.nodeName==="TD")return s.getBoundingClientRect().width;s=s.parentElement}return 0}function G(t,s,c,a,C,y){for(const x of s){const n=re(t,x,c);if(n&&a){const j=a.parseEditorState(n.json);a._headless=!0,a.setEditorState(j),a.update(y,{discrete:!0}),a._headless=!1;const _=JSON.stringify(a.getEditorState());C(w=>{const[S,M]=c.get(x);w.updateCellJSON(S,M,_)})}}}function st(t){let s=t;for(;s;){const c=s.nodeName;if(c==="BUTTON"||c==="INPUT"||c==="TEXTAREA")return!0;s=s.parentElement}return!1}function Re(t,s,c){const a=c.get(t),C=c.get(s);if(!a||!C)return null;const y=Math.min(a[0],C[0]),x=Math.max(a[0],C[0]),n=Math.min(a[1],C[1]),j=Math.max(a[1],C[1]);return{endX:x,endY:j,startX:y,startY:n}}function Ce(t,s,c,a){const C=Re(s,c,a);if(!C)return[];const{startX:y,endY:x,endX:n,startY:j}=C,_=[];for(let w=y;w<=n;w++)for(let S=j;S<=x;S++)_.push(t[S].cells[w].id);return _}function rt(t,s){const{startX:c,endY:a,endX:C,startY:y}=s,x=[];for(let n=y;n<=a;n++){const j=t[n],_=Se();for(let w=c;w<=C;w++){const S={...j.cells[w]};S.id=ze(),_.cells.push(S)}x.push(_)}return x}function re(t,s,c){const a=c.get(s);if(!a)return null;const[C,y]=a;return t[y].cells[C]}function ot(t){const s=t.querySelectorAll("tr"),c=[];for(let a=0;a{const i=new Map;for(let R=0;R{if(!H)return s;const i=s.slice(1);return i.sort((R,L)=>{const A=R.cells,m=L.cells,b=H.x,Y=de.get(A[b].json),T=de.get(m[b].json);return!Y||!T?1:H.type==="ascending"?Y.localeCompare(T):T.localeCompare(Y)}),i.unshift(s[0]),i},[s,H]),E=N.useMemo(()=>{if(!x)return null;const i=e.createEditor({namespace:x.namespace,nodes:x.nodes,onError:R=>x.onError(R,i),theme:x.theme});return i},[x]),me=N.useMemo(()=>new Set(P),[P]),$=N.useCallback(i=>{n.update(()=>{const R=e.$getNodeByKey(t);lt(R)&&i(R)})},[n,t]),F=N.useCallback((i,R,L)=>{const A=O[R].cells[i].id;if(S.current=A,L){const m=Ce(O,u,A,D);z(m)}else v(A),z(X),ie(M.current,A)},[D,u,O]),q=N.useCallback(()=>{if(E&&u){const i=JSON.stringify(E.getEditorState());$(R=>{const L=D.get(u);if(L===void 0)return;const[A,m]=L;R.updateCellJSON(A,m,i)})}},[D,E,u,$]),V=N.useCallback(()=>{setTimeout(()=>{const i=n.getRootElement();i&&(i.focus({preventScroll:!0}),window.getSelection()?.removeAllRanges())},20)},[n]),le=N.useCallback((i,R)=>{G(O,i,D,E,$,R)},[D,E,O,$]),Z=N.useCallback(()=>u&&!I?(le([u,...P],()=>{const i=e.$getRoot();i.clear(),i.append(e.$createParagraphNode())}),!0):(a&&$(i=>{i.selectNext(),i.remove()}),!1),[I,a,u,P,le,$]);N.useEffect(()=>{const i=M.current;a&&document.activeElement===document.body&&i&&i.focus()},[a]),N.useEffect(()=>{const i=M.current;if(!i)return;const R=ge(n);function L(T){const r=T.clientX-m.x,o=T.clientY-m.y;return r<5||o<5}function A(T){const r=ce(T.target);if(r&&n.isEditable()&&i.contains(T.target)){if(L(T)){C(!0),v(null),V();return}if(C(!1),Ve(T.target)){Q(r),i.style.userSelect="none",j.current={point:T.clientX,size:nt(T.target)};return}k.current=!0,u!==r?(I&&q(),v(r),U(!1),S.current=r):S.current=null,z(X)}else u&&!st(T.target)&&(C(!1),k.current=!1,I&&q(),v(null),z(X),U(!1),S.current=null)}const m=i.getBoundingClientRect();function b(T){if(J){const o=_.current;if(o){const{size:l,point:d}=j.current,p=T.clientX-d,h=l+p;let f=T.clientX-m.x;f<10?f=10:f>m.width-10?f=m.width-10:h<20&&(f=d-l+20-m.x),o.style.left=`${f}px`}return}if(!I){const{clientX:o,clientY:l}=T,{width:d,x:p,y:h,height:f}=m,B=o>p+d*.9&&oh+f*.85&&l{const[h]=D.get(J);p.updateColumnWidth(h,d)}),Q(null)}i&&P.length>1&&k.current&&(i.style.userSelect="text",window.getSelection()?.removeAllRanges()),k.current=!1}return R.addEventListener("pointerdown",A),R.addEventListener("pointermove",b),R.addEventListener("pointerup",Y),()=>{R.removeEventListener("pointerdown",A),R.removeEventListener("pointermove",b),R.removeEventListener("pointerup",Y)}},[E,n,I,O,q,u,me,P,D,J,$,C,V]),N.useEffect(()=>{if(!I&&u){let i=function(m){if(m&&E){const b=m.json,Y=E.parseEditorState(b);E.setEditorState(Y)}},R=function(m){const b=ce(m.target);if(b===u&&n.isEditable()){const Y=re(O,b,D);i(Y),U(!0),z(X)}},L=function(m){const b=m.keyCode;if(b===16||b===27||b===9||b===37||b===38||b===39||b===40||b===8||b===46||!n.isEditable())return;if(b===13&&m.preventDefault(),!I&&u&&n.getEditorState().read(()=>!e.$getSelection())&&m.target.contentEditable!=="true"){if(Ze(b,m.shiftKey,m.metaKey,m.ctrlKey)){n.dispatchCommand(e.COPY_COMMAND,m);return}if(et(b,m.shiftKey,m.metaKey,m.ctrlKey)){n.dispatchCommand(e.CUT_COMMAND,m);return}if(tt(b,m.shiftKey,m.metaKey,m.ctrlKey)){n.dispatchCommand(e.PASTE_COMMAND,m);return}}if(m.metaKey||m.ctrlKey||m.altKey)return;const Y=re(O,u,D);i(Y),U(!0),z(X)};const A=ge(n);return A.addEventListener("dblclick",R),A.addEventListener("keydown",L),()=>{A.removeEventListener("dblclick",R),A.removeEventListener("keydown",L)}}},[E,n,I,O,u,D]),N.useEffect(()=>{const i=M.current;if(!i)return;function R(r,o,l,d){const p=r instanceof KeyboardEvent?null:r.clipboardData;if(r.preventDefault(),p)p.setData("text/html",o),p.setData("text/plain",d),p.setData("application/x-lexical-editor",l);else{const h=navigator.clipboard;if(h){const f=[new ClipboardItem({"text/html":new Blob([o],{type:"text/html"})})];h.write(f)}}}async function L(r,o){try{return r instanceof DataTransfer?r.getData(o):r instanceof ClipboardItem?await(await r.getType(o)).text():""}catch{return""}}async function A(r){let o=(r instanceof InputEvent?null:r.clipboardData)||null;if(u&&E){if(r.preventDefault(),!o)try{o=(await navigator.clipboard.read())[0]}catch{}const l=o?await L(o,"application/x-lexical-editor"):"";if(l)try{const h=JSON.parse(l);if(h.namespace===n._config.namespace&&Array.isArray(h.nodes)){G(O,[u],D,E,$,()=>{const f=e.$getRoot();f.clear(),f.append(e.$createParagraphNode()),f.selectEnd();const B=se.$generateNodesFromSerializedNodes(h.nodes),K=e.$getSelection();e.$isRangeSelection(K)&&se.$insertGeneratedNodes(E,B,K)});return}}catch{}const d=o?await L(o,"text/html"):"";if(d)try{const f=new DOMParser().parseFromString(d,"text/html"),B=f.querySelector("table");if(B){const K=ot(B);$(ee=>{const[te,_e]=D.get(u);ee.mergeRows(te,_e,K)});return}G(O,[u],D,E,$,()=>{const K=e.$getRoot();K.clear(),K.append(e.$createParagraphNode()),K.selectEnd();const ee=he.$generateNodesFromDOM(n,f),te=e.$getSelection();e.$isRangeSelection(te)&&se.$insertGeneratedNodes(E,ee,te)});return}catch{}const p=o?await L(o,"text/plain"):"";p&&G(O,[u],D,E,$,()=>{const h=e.$getRoot();h.clear(),h.selectEnd();const f=e.$getSelection();f&&f.insertRawText(p)})}}function m(r){if(u&&E){const l=re(O,u,D).json,d=ue.get(l)||null;if(!d)return;const p=E.parseEditorState(l),h=p.read(()=>e.$getRoot().getTextContent()),f=p.read(()=>JSON.stringify(se.$generateJSONFromSelectedNodes(E,null)));R(r,d,f,h)}}function b(r){const o=S.current;if(u&&E&&o){const l=Re(u,o,D);if(!l)return;const d=We(O,l),p=d.outerHTML,h=d.outerText,f=n.getEditorState().read(()=>e.$getNodeByKey(t).exportJSON());f.rows=rt(O,l);const B={namespace:E._config.namespace,nodes:[f]},K=JSON.stringify(B);R(r,p,K,h)}}function Y(r,o){const l=e.$getSelection();return u&&!I&&!l&&o===n?(A(r),k.current=!1,z(X),!0):!1}function T(r,o){const l=e.$getSelection();return u&&!I&&!l&&o===n?(P.length===0?m(r):b(r),!0):!1}return ke.mergeRegister(n.registerCommand(e.CLICK_COMMAND,r=>{const o=e.$getSelection();return!!e.$isNodeSelection(o)},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.PASTE_COMMAND,Y,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.COPY_COMMAND,T,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.CUT_COMMAND,(r,o)=>T(r,o)?(Z(),!0):!1,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_BACKSPACE_COMMAND,Z,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_DELETE_COMMAND,Z,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.FORMAT_TEXT_COMMAND,r=>u&&!I?(G(O,[u,...P],D,E,$,()=>{Qe().formatText(r)}),!0):!1,e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ENTER_COMMAND,(r,o)=>{const l=e.$getSelection();if(!u&&!I&&e.$isNodeSelection(l)&&l.has(t)&&l.getNodes().length===1&&o===n){const d=O[0].cells[0].id;return v(d),ie(i,d),r.preventDefault(),r.stopPropagation(),y(),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_TAB_COMMAND,r=>{const o=e.$getSelection();if(!I&&!o&&u){const l=r.shiftKey,[d,p]=D.get(u);r.preventDefault();let h=null,f=null;if(d===0&&l?p!==0&&(f=p-1,h=O[f].cells.length-1):d===O[p].cells.length-1&&!l?p!==O.length-1&&(f=p+1,h=0):l?(h=d-1,f=p):(h=d+1,f=p),h&&f)return F(h,f,!1),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_UP_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(f!==0)return F(h,f-1,d),!0}}return!e.$isRangeSelection(l)||o!==E?!1:l.isCollapsed()&&!l.anchor.getNode().getTopLevelElementOrThrow().getPreviousSibling()?(r.preventDefault(),!0):!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_DOWN_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(f!==O.length-1)return F(h,f+1,d),!0}}return!e.$isRangeSelection(l)||o!==E?!1:l.isCollapsed()&&!l.anchor.getNode().getTopLevelElementOrThrow().getNextSibling()?(r.preventDefault(),!0):!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_LEFT_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(h!==0)return F(h-1,f,d),!0}}return!e.$isRangeSelection(l)||o!==E?!1:l.isCollapsed()&&l.anchor.offset===0?(r.preventDefault(),!0):!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ARROW_RIGHT_COMMAND,(r,o)=>{const l=e.$getSelection();if(!I&&!l){const d=r.shiftKey,p=d&&S.current||u;if(p){const[h,f]=D.get(p);if(h!==O[f].cells.length-1)return F(h+1,f,d),!0}}if(!e.$isRangeSelection(l)||o!==E)return!1;if(l.isCollapsed()){const d=l.anchor;if(d.type==="text"&&d.offset===d.getNode().getTextContentSize()||d.type==="element"&&d.offset===d.getNode().getChildrenSize())return r.preventDefault(),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerCommand(e.KEY_ESCAPE_COMMAND,(r,o)=>{const l=e.$getSelection();return!I&&!l&&o===n?(C(!0),v(null),V(),!0):e.$isRangeSelection(l)&&I?(q(),U(!1),u&&setTimeout(()=>{ie(i,u)},20),!0):!1},e.COMMAND_PRIORITY_LOW))},[D,E,Z,y,n,I,F,t,u,O,q,V,P,C,$]);function be(){$(i=>{i.addColumns(1)})}function De(){$(i=>{i.addRows(1)})}if(!E)return null;const Oe=it();return g.jsxs("div",{className:Oe.box,children:[g.jsx("table",{className:ae(c.table,a&&c.tableSelected),ref:M,tabIndex:-1,children:g.jsx("tbody",{children:O.map(i=>g.jsx("tr",{className:c.tableRow,children:i.cells.map(R=>{const{id:L}=R;return g.jsx(qe,{cell:R,theme:c,isSelected:me.has(L),isPrimarySelected:u===L,isEditing:I,sortingOptions:H,cellEditor:E,updateCellsByID:le,updateTableNode:$,cellCoordMap:D,rows:O,setSortingOptions:oe},L)})},i.id))})}),ye&&g.jsx("button",{className:c.tableAddColumns,onClick:be}),Me&&g.jsx("button",{className:c.tableAddRows,onClick:De,ref:w}),J&&g.jsx("div",{className:c.tableResizeRuler,ref:_})]})}const it=pe({box:{position:"relative"}});export{ft as default}; diff --git a/assets/Lazy-S42ziN8Y.js b/assets/Lazy-oj3UQ1nd.js similarity index 80% rename from assets/Lazy-S42ziN8Y.js rename to assets/Lazy-oj3UQ1nd.js index 6aaa1bb..4fed41e 100644 --- a/assets/Lazy-S42ziN8Y.js +++ b/assets/Lazy-oj3UQ1nd.js @@ -1,7 +1,7 @@ -import{r as i,at as f,j as o,as as j}from"./vendor--JR89aB4.js";var g=typeof global=="object"&&global&&global.Object===Object&&global,p=typeof self=="object"&&self&&self.Object===Object&&self,u=g||p||Function("return this")(),n=u.Symbol,c=Object.prototype,d=c.hasOwnProperty,y=c.toString,e=n?n.toStringTag:void 0;function O(t){var r=d.call(t,e),s=t[e];try{t[e]=void 0;var l=!0}catch{}var b=y.call(t);return l&&(r?t[e]=s:delete t[e]),b}var S=Object.prototype,T=S.toString;function v(t){return T.call(t)}var m="[object Null]",x="[object Undefined]",a=n?n.toStringTag:void 0;function w(t){return t==null?t===void 0?x:m:a&&a in Object(t)?O(t):v(t)}function E(t){return t!=null&&typeof t=="object"}function L(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}function $(t){return o.jsx(i.Suspense,{fallback:o.jsx(j,{}),children:o.jsx(_,{...t})})}const _=i.lazy(()=>f(()=>import("./index-mm5L4EFF.js").then(t=>t.q),__vite__mapDeps([0,1,2,3])));export{$ as L,n as S,E as a,w as b,g as f,L as i,u as r}; +import{r as i,at as f,j as o,as as j}from"./vendor--JR89aB4.js";var g=typeof global=="object"&&global&&global.Object===Object&&global,p=typeof self=="object"&&self&&self.Object===Object&&self,u=g||p||Function("return this")(),n=u.Symbol,c=Object.prototype,d=c.hasOwnProperty,y=c.toString,e=n?n.toStringTag:void 0;function O(t){var r=d.call(t,e),s=t[e];try{t[e]=void 0;var l=!0}catch{}var b=y.call(t);return l&&(r?t[e]=s:delete t[e]),b}var S=Object.prototype,T=S.toString;function v(t){return T.call(t)}var m="[object Null]",x="[object Undefined]",a=n?n.toStringTag:void 0;function w(t){return t==null?t===void 0?x:m:a&&a in Object(t)?O(t):v(t)}function E(t){return t!=null&&typeof t=="object"}function L(t){var r=typeof t;return t!=null&&(r=="object"||r=="function")}function $(t){return o.jsx(i.Suspense,{fallback:o.jsx(j,{}),children:o.jsx(_,{...t})})}const _=i.lazy(()=>f(()=>import("./index-lt_pJMTs.js").then(t=>t.q),__vite__mapDeps([0,1,2,3])));export{$ as L,n as S,E as a,w as b,g as f,L as i,u as r}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-mm5L4EFF.js","assets/vendor--JR89aB4.js","assets/index-3wZvIsDj.js","assets/index-mRiAC1cH.css"] + __vite__mapDeps.viteFileDeps = ["assets/index-lt_pJMTs.js","assets/vendor--JR89aB4.js","assets/index-no0JSIPh.js","assets/index-mRiAC1cH.css"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } diff --git a/assets/LexicalNestedComposer-bPIc0uls.js b/assets/LexicalNestedComposer-rgrcCsEX.js similarity index 96% rename from assets/LexicalNestedComposer-bPIc0uls.js rename to assets/LexicalNestedComposer-rgrcCsEX.js index b434356..05cf39f 100644 --- a/assets/LexicalNestedComposer-bPIc0uls.js +++ b/assets/LexicalNestedComposer-rgrcCsEX.js @@ -1 +1 @@ -import{r as u}from"./vendor--JR89aB4.js";import{L as y}from"./index-mm5L4EFF.js";var x={},b={},f=u;let p=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],C=p[Math.floor(Math.random()*p.length)],m=f.createContext({clientID:0,color:C[1],isCollabActive:!1,name:C[0],yjsDocMap:new Map});b.CollaborationContext=m;b.useCollaborationContext=function(e,a){let r=f.useContext(m);return e!=null&&(r.name=e),a!=null&&(r.color=a),r};const N=b;var D=N,K=D,d=y,l=u;x.LexicalNestedComposer=function({initialEditor:e,children:a,initialNodes:r,initialTheme:h,skipCollabChecks:v}){let g=l.useRef(!1),i=l.useContext(d.LexicalComposerContext);if(i==null)throw Error("Minified Lexical error #9; visit https://lexical.dev/docs/error?code=9 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let[t,{getTheme:L}]=i,_=l.useMemo(()=>{var o=h||L()||void 0;const M=d.createLexicalComposerContext(i,o);if(o!==void 0&&(e._config.theme=o),e._parentEditor=t,r)for(var n of r)o=n.getType(),e._nodes.set(o,{klass:n,replace:null,replaceWithKlass:null,transforms:new Set});else{n=e._nodes=new Map(t._nodes);for(const[k,c]of n)e._nodes.set(k,{klass:c.klass,replace:c.replace,replaceWithKlass:c.replaceWithKlass,transforms:new Set})}return e._config.namespace=t._config.namespace,e._editable=t._editable,[e,M]},[]),{isCollabActive:E,yjsDocMap:w}=K.useCollaborationContext(),s=v||g.current||w.has(e.getKey());return l.useEffect(()=>{s&&(g.current=!0)},[s]),l.useEffect(()=>t.registerEditableListener(o=>{e.setEditable(o)}),[e,t]),l.createElement(d.LexicalComposerContext.Provider,{value:_},!E||s?a:null)};const S=x;var j=S;export{j as L}; +import{r as u}from"./vendor--JR89aB4.js";import{L as y}from"./index-lt_pJMTs.js";var x={},b={},f=u;let p=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],C=p[Math.floor(Math.random()*p.length)],m=f.createContext({clientID:0,color:C[1],isCollabActive:!1,name:C[0],yjsDocMap:new Map});b.CollaborationContext=m;b.useCollaborationContext=function(e,a){let r=f.useContext(m);return e!=null&&(r.name=e),a!=null&&(r.color=a),r};const N=b;var D=N,K=D,d=y,l=u;x.LexicalNestedComposer=function({initialEditor:e,children:a,initialNodes:r,initialTheme:h,skipCollabChecks:v}){let g=l.useRef(!1),i=l.useContext(d.LexicalComposerContext);if(i==null)throw Error("Minified Lexical error #9; visit https://lexical.dev/docs/error?code=9 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let[t,{getTheme:L}]=i,_=l.useMemo(()=>{var o=h||L()||void 0;const M=d.createLexicalComposerContext(i,o);if(o!==void 0&&(e._config.theme=o),e._parentEditor=t,r)for(var n of r)o=n.getType(),e._nodes.set(o,{klass:n,replace:null,replaceWithKlass:null,transforms:new Set});else{n=e._nodes=new Map(t._nodes);for(const[k,c]of n)e._nodes.set(k,{klass:c.klass,replace:c.replace,replaceWithKlass:c.replaceWithKlass,transforms:new Set})}return e._config.namespace=t._config.namespace,e._editable=t._editable,[e,M]},[]),{isCollabActive:E,yjsDocMap:w}=K.useCollaborationContext(),s=v||g.current||w.has(e.getKey());return l.useEffect(()=>{s&&(g.current=!0)},[s]),l.useEffect(()=>t.registerEditableListener(o=>{e.setEditable(o)}),[e,t]),l.createElement(d.LexicalComposerContext.Provider,{value:_},!E||s?a:null)};const S=x;var j=S;export{j as L}; diff --git a/assets/index-93jUDCdv.js b/assets/index-0za8jBCT.js similarity index 88% rename from assets/index-93jUDCdv.js rename to assets/index-0za8jBCT.js index f0da961..01e071d 100644 --- a/assets/index-93jUDCdv.js +++ b/assets/index-0za8jBCT.js @@ -1,4 +1,4 @@ -import{m as h,s as d,t as u,aQ as B,j as n,a5 as E,aD as C,e as k,D,n as O,B as I,g as q,h as A,i as H,k as R,aE as F,x as f,aR as G,aS as z,aT as M,N as X,E as $,aB as W,a4 as m,aU as Q,ar as U}from"./vendor--JR89aB4.js";import{C as w,F as T,a as P,L as b,H as v,G as V,D as Y}from"./index-3wZvIsDj.js";function y(){return y=Object.assign?Object.assign.bind():function(r){for(var i=1;i0&&(t.strPos=t.currentElContent.length-1,t.strings.unshift(t.currentElContent)),t.sequence=[],t.strings)t.sequence[c]=c;t.arrayPos=0,t.stopNum=0,t.loop=t.options.loop,t.loopCount=t.options.loopCount,t.curLoop=0,t.shuffle=t.options.shuffle,t.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},t.typingComplete=!1,t.autoInsertCss=t.options.autoInsertCss,t.autoInsertCss&&(this.appendCursorAnimationCss(t),this.appendFadeOutAnimationCss(t))},i.getCurrentElContent=function(t){return t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:t.contentType==="html"?t.el.innerHTML:t.el.textContent},i.appendCursorAnimationCss=function(t){var s="data-typed-js-cursor-css";if(t.showCursor&&!document.querySelector("["+s+"]")){var e=document.createElement("style");e.setAttribute(s,"true"),e.innerHTML=` +import{m as h,s as d,t as u,aQ as B,j as n,a5 as E,aD as C,e as k,D,n as O,B as I,g as q,h as A,i as H,k as R,aE as F,x as f,E as G,aR as z,aS as M,aT as X,N as $,aB as W,a4 as m,aU as Q,ar as U}from"./vendor--JR89aB4.js";import{C as w,F as T,a as P,L as b,H as v,G as V,D as Y}from"./index-no0JSIPh.js";function y(){return y=Object.assign?Object.assign.bind():function(r){for(var i=1;i0&&(t.strPos=t.currentElContent.length-1,t.strings.unshift(t.currentElContent)),t.sequence=[],t.strings)t.sequence[c]=c;t.arrayPos=0,t.stopNum=0,t.loop=t.options.loop,t.loopCount=t.options.loopCount,t.curLoop=0,t.shuffle=t.options.shuffle,t.pause={status:!1,typewrite:!0,curString:"",curStrPos:0},t.typingComplete=!1,t.autoInsertCss=t.options.autoInsertCss,t.autoInsertCss&&(this.appendCursorAnimationCss(t),this.appendFadeOutAnimationCss(t))},i.getCurrentElContent=function(t){return t.attr?t.el.getAttribute(t.attr):t.isInput?t.el.value:t.contentType==="html"?t.el.innerHTML:t.el.textContent},i.appendCursorAnimationCss=function(t){var s="data-typed-js-cursor-css";if(t.showCursor&&!document.querySelector("["+s+"]")){var e=document.createElement("style");e.setAttribute(s,"true"),e.innerHTML=` .typed-cursor{ opacity: 1; } @@ -24,4 +24,4 @@ import{m as h,s as d,t as u,aQ as B,j as n,a5 as E,aD as C,e as k,D,n as O,B as -webkit-animation: 0; animation: 0; } - `,document.body.appendChild(e)}},r}()),S=new(function(){function r(){}var i=r.prototype;return i.typeHtmlChars=function(t,s,e){if(e.contentType!=="html")return s;var o=t.substring(s).charAt(0);if(o==="<"||o==="&"){var a;for(a=o==="<"?">":";";t.substring(s+1).charAt(0)!==a&&!(1+ ++s>t.length););s++}return s},i.backSpaceHtmlChars=function(t,s,e){if(e.contentType!=="html")return s;var o=t.substring(s).charAt(0);if(o===">"||o===";"){var a;for(a=o===">"?"<":"&";t.substring(s-1).charAt(0)!==a&&!(--s<0););s--}return s},r}()),Z=function(){function r(t,s){K.load(this,s,t),this.begin()}var i=r.prototype;return i.toggle=function(){this.pause.status?this.start():this.stop()},i.stop=function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))},i.start=function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))},i.destroy=function(){this.reset(!1),this.options.onDestroy(this)},i.reset=function(t){t===void 0&&(t=!0),clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())},i.begin=function(){var t=this;this.options.onBegin(this),this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.strPos===0?t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos):t.backspace(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)},i.typewrite=function(t,s){var e=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var o=this.humanizer(this.typeSpeed),a=1;this.pause.status!==!0?this.timeout=setTimeout(function(){s=S.typeHtmlChars(t,s,e);var l=0,c=t.substring(s);if(c.charAt(0)==="^"&&/^\^\d+/.test(c)){var p=1;p+=(c=/\d+/.exec(c)[0]).length,l=parseInt(c),e.temporaryPause=!0,e.options.onTypingPaused(e.arrayPos,e),t=t.substring(0,s)+t.substring(s+p),e.toggleBlinking(!0)}if(c.charAt(0)==="`"){for(;t.substring(s+a).charAt(0)!=="`"&&(a++,!(s+a>t.length)););var x=t.substring(0,s),L=t.substring(x.length+1,s+a),N=t.substring(s+a+1);t=x+L+N,a--}e.timeout=setTimeout(function(){e.toggleBlinking(!1),s>=t.length?e.doneTyping(t,s):e.keepTyping(t,s,a),e.temporaryPause&&(e.temporaryPause=!1,e.options.onTypingResumed(e.arrayPos,e))},l)},o):this.setPauseStatus(t,s,!0)},i.keepTyping=function(t,s,e){s===0&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this));var o=t.substring(0,s+=e);this.replaceText(o),this.typewrite(t,s)},i.doneTyping=function(t,s){var e=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),this.loop===!1||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){e.backspace(t,s)},this.backDelay))},i.backspace=function(t,s){var e=this;if(this.pause.status!==!0){if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var o=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){s=S.backSpaceHtmlChars(t,s,e);var a=t.substring(0,s);if(e.replaceText(a),e.smartBackspace){var l=e.strings[e.arrayPos+1];e.stopNum=l&&a===l.substring(0,s)?s:0}s>e.stopNum?(s--,e.backspace(t,s)):s<=e.stopNum&&(e.arrayPos++,e.arrayPos===e.strings.length?(e.arrayPos=0,e.options.onLastStringBackspaced(),e.shuffleStringsIfNeeded(),e.begin()):e.typewrite(e.strings[e.sequence[e.arrayPos]],s))},o)}else this.setPauseStatus(t,s,!1)},i.complete=function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0},i.setPauseStatus=function(t,s,e){this.pause.typewrite=e,this.pause.curString=t,this.pause.curStrPos=s},i.toggleBlinking=function(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))},i.humanizer=function(t){return Math.round(Math.random()*t/2)+t},i.shuffleStringsIfNeeded=function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))},i.initFadeOut=function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)},i.replaceText=function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:this.contentType==="html"?this.el.innerHTML=t:this.el.textContent=t},i.bindFocusEvents=function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(s){t.stop()}),this.el.addEventListener("blur",function(s){t.el.value&&t.el.value.length!==0||t.start()}))},i.insertCursor=function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.setAttribute("aria-hidden",!0),this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))},r}();const _=h({main:{position:"relative"},img:{...w,aspectRatio:"42/9",width:"100%",minHeight:"320px",...d.borderRadius(u.borderRadiusXLarge)},mask:{position:"absolute",top:0,left:0,right:0,bottom:"4px",...d.borderRadius(u.borderRadiusXLarge),backdropFilter:"blur(1px) brightness(105%)"},info:{...T,position:"absolute",top:0,...d.padding(u.spacingHorizontalXXXL),height:"-webkit-fill-available"},space:{flexBasis:"50%",flexShrink:0,"@media screen and (max-width: 1024px)":{flexBasis:0}},txt:{...P,justifyContent:"space-around"},white:{color:"white !important","@media screen and (max-width: 600px)":{fontSize:u.fontSizeBase300,lineHeight:u.lineHeightBase300}}});function j(){const r=_(),i=B(t=>{const s=new Z(t,{strings:["AwaiShop","Together","Dream","Forever"],typeSpeed:60,backSpeed:40,startDelay:1500,backDelay:3e3,showCursor:!1});return()=>s.destroy()});return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:r.main,children:[n.jsx(E,{className:r.img,src:"/banner.jpg"}),n.jsx("div",{className:r.mask,style:{background:"linear-gradient(to right, transparent, var(--colorBackgroundOverlay))"}}),n.jsxs("div",{className:r.info,children:[n.jsx("div",{className:r.space}),n.jsxs("div",{className:r.txt,children:[n.jsxs("div",{children:[n.jsx(C,{className:r.white,children:"Play "}),n.jsx(k,{ref:i,size:900,weight:"semibold",underline:!0,className:r.white,children:"?"}),n.jsx(C,{className:r.white,children:" With SoarCraft"})]}),n.jsx(k,{size:500,truncate:!0,className:r.white,children:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged."}),n.jsxs(D,{modalType:"non-modal",children:[n.jsx(O,{disableButtonEnhancement:!0,children:n.jsx("div",{children:n.jsx(I,{appearance:"outline",size:"large",className:r.white,children:"Learn More"})})}),n.jsx(q,{children:n.jsxs(A,{children:[n.jsx(H,{children:"Welcome to AwaiShop"}),n.jsx(R,{children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed maximus nec erat vel hendrerit. Nulla tempus placerat turpis dictum placerat. Suspendisse ut justo diam. Donec auctor augue feugiat purus mollis, vitae congue erat pretium. Nulla blandit orci ante, a posuere mauris eleifend vel. Nam dapibus venenatis scelerisque. Nullam nisl turpis, cursus in convallis in, eleifend eget arcu. Curabitur scelerisque pretium turpis, consectetur congue nulla convallis tincidunt. Quisque rhoncus lectus a nunc tempor scelerisque. Quisque non augue eget augue ultricies viverra. Maecenas aliquam nisi orci, id volutpat risus efficitur et. Aliquam ac nunc euismod, interdum mi ac, faucibus enim. Donec nec finibus metus. Phasellus iaculis elit finibus sem aliquam, ut viverra tortor dapibus. Phasellus rhoncus, libero sit amet pulvinar tempus, velit lorem venenatis nisi, id ornare quam quam eget orci. In hac habitasse platea dictumst."})]})})]})]})]})]}),n.jsx(F,{})]})}const tt=h({img:{aspectRatio:"1",...w,borderTopLeftRadius:u.borderRadiusMedium,borderTopRightRadius:u.borderRadiusMedium}}),g=new b("Gallery","Category","Card");function st({Id:r}){const i=tt(),{data:t}=f(()=>v.Product.Get.Basic(r,g),{onError:g.error});return n.jsxs(G,{children:[n.jsx(z,{children:n.jsx(V,{className:i.img,Guid:t?.Cover,Log:g})}),n.jsx(M,{children:n.jsx(X,{children:n.jsx($,{href:`/Product/${r}`,children:t?.Name||"Loading..."})})})]})}const et=h({card:{flexBasis:"20%",flexGrow:1,flexShrink:0,maxWidth:"25%",minWidth:`${375/2}px`,boxSizing:"border-box",paddingRight:u.spacingHorizontalL,paddingLeft:u.spacingHorizontalL},cate:{...T,flexWrap:"wrap",rowGap:u.spacingVerticalXL}}),it=new b("Gallery","Category");function nt({Category:r}){const i=et(),{data:t,loading:s}=f(()=>v.Gallery.Get.Products(r),{onError:it.error});return n.jsxs(n.Fragment,{children:[n.jsx(W,{children:r}),n.jsx("div",{className:i.cate,children:s?n.jsx(m,{size:128}):t.map((e,o)=>n.jsx("div",{className:i.card,children:n.jsx(st,{Id:e},o)}))})]})}const rt=h({main:{...P,rowGap:u.spacingVerticalXL}}),at=new b("Gallery");function lt(){const r=rt(),{data:i,loading:t}=f(()=>v.Gallery.Get.Categories(),{onError:at.error});return t?n.jsxs(Q,{className:r.main,children:[n.jsx(j,{}),n.jsx(m,{appearance:"translucent",size:32}),n.jsx(m,{size:128})]}):n.jsxs("div",{className:r.main,children:[n.jsx(U,{children:n.jsxs("title",{children:["Gallery - ",Y.Name]})}),n.jsx(j,{}),i?.map((s,e)=>n.jsx(nt,{Category:s},e))]})}export{lt as default}; + `,document.body.appendChild(e)}},r}()),S=new(function(){function r(){}var i=r.prototype;return i.typeHtmlChars=function(t,s,e){if(e.contentType!=="html")return s;var o=t.substring(s).charAt(0);if(o==="<"||o==="&"){var a;for(a=o==="<"?">":";";t.substring(s+1).charAt(0)!==a&&!(1+ ++s>t.length););s++}return s},i.backSpaceHtmlChars=function(t,s,e){if(e.contentType!=="html")return s;var o=t.substring(s).charAt(0);if(o===">"||o===";"){var a;for(a=o===">"?"<":"&";t.substring(s-1).charAt(0)!==a&&!(--s<0););s--}return s},r}()),Z=function(){function r(t,s){K.load(this,s,t),this.begin()}var i=r.prototype;return i.toggle=function(){this.pause.status?this.start():this.stop()},i.stop=function(){this.typingComplete||this.pause.status||(this.toggleBlinking(!0),this.pause.status=!0,this.options.onStop(this.arrayPos,this))},i.start=function(){this.typingComplete||this.pause.status&&(this.pause.status=!1,this.pause.typewrite?this.typewrite(this.pause.curString,this.pause.curStrPos):this.backspace(this.pause.curString,this.pause.curStrPos),this.options.onStart(this.arrayPos,this))},i.destroy=function(){this.reset(!1),this.options.onDestroy(this)},i.reset=function(t){t===void 0&&(t=!0),clearInterval(this.timeout),this.replaceText(""),this.cursor&&this.cursor.parentNode&&(this.cursor.parentNode.removeChild(this.cursor),this.cursor=null),this.strPos=0,this.arrayPos=0,this.curLoop=0,t&&(this.insertCursor(),this.options.onReset(this),this.begin())},i.begin=function(){var t=this;this.options.onBegin(this),this.typingComplete=!1,this.shuffleStringsIfNeeded(this),this.insertCursor(),this.bindInputFocusEvents&&this.bindFocusEvents(),this.timeout=setTimeout(function(){t.strPos===0?t.typewrite(t.strings[t.sequence[t.arrayPos]],t.strPos):t.backspace(t.strings[t.sequence[t.arrayPos]],t.strPos)},this.startDelay)},i.typewrite=function(t,s){var e=this;this.fadeOut&&this.el.classList.contains(this.fadeOutClass)&&(this.el.classList.remove(this.fadeOutClass),this.cursor&&this.cursor.classList.remove(this.fadeOutClass));var o=this.humanizer(this.typeSpeed),a=1;this.pause.status!==!0?this.timeout=setTimeout(function(){s=S.typeHtmlChars(t,s,e);var l=0,c=t.substring(s);if(c.charAt(0)==="^"&&/^\^\d+/.test(c)){var p=1;p+=(c=/\d+/.exec(c)[0]).length,l=parseInt(c),e.temporaryPause=!0,e.options.onTypingPaused(e.arrayPos,e),t=t.substring(0,s)+t.substring(s+p),e.toggleBlinking(!0)}if(c.charAt(0)==="`"){for(;t.substring(s+a).charAt(0)!=="`"&&(a++,!(s+a>t.length)););var x=t.substring(0,s),L=t.substring(x.length+1,s+a),N=t.substring(s+a+1);t=x+L+N,a--}e.timeout=setTimeout(function(){e.toggleBlinking(!1),s>=t.length?e.doneTyping(t,s):e.keepTyping(t,s,a),e.temporaryPause&&(e.temporaryPause=!1,e.options.onTypingResumed(e.arrayPos,e))},l)},o):this.setPauseStatus(t,s,!0)},i.keepTyping=function(t,s,e){s===0&&(this.toggleBlinking(!1),this.options.preStringTyped(this.arrayPos,this));var o=t.substring(0,s+=e);this.replaceText(o),this.typewrite(t,s)},i.doneTyping=function(t,s){var e=this;this.options.onStringTyped(this.arrayPos,this),this.toggleBlinking(!0),this.arrayPos===this.strings.length-1&&(this.complete(),this.loop===!1||this.curLoop===this.loopCount)||(this.timeout=setTimeout(function(){e.backspace(t,s)},this.backDelay))},i.backspace=function(t,s){var e=this;if(this.pause.status!==!0){if(this.fadeOut)return this.initFadeOut();this.toggleBlinking(!1);var o=this.humanizer(this.backSpeed);this.timeout=setTimeout(function(){s=S.backSpaceHtmlChars(t,s,e);var a=t.substring(0,s);if(e.replaceText(a),e.smartBackspace){var l=e.strings[e.arrayPos+1];e.stopNum=l&&a===l.substring(0,s)?s:0}s>e.stopNum?(s--,e.backspace(t,s)):s<=e.stopNum&&(e.arrayPos++,e.arrayPos===e.strings.length?(e.arrayPos=0,e.options.onLastStringBackspaced(),e.shuffleStringsIfNeeded(),e.begin()):e.typewrite(e.strings[e.sequence[e.arrayPos]],s))},o)}else this.setPauseStatus(t,s,!1)},i.complete=function(){this.options.onComplete(this),this.loop?this.curLoop++:this.typingComplete=!0},i.setPauseStatus=function(t,s,e){this.pause.typewrite=e,this.pause.curString=t,this.pause.curStrPos=s},i.toggleBlinking=function(t){this.cursor&&(this.pause.status||this.cursorBlinking!==t&&(this.cursorBlinking=t,t?this.cursor.classList.add("typed-cursor--blink"):this.cursor.classList.remove("typed-cursor--blink")))},i.humanizer=function(t){return Math.round(Math.random()*t/2)+t},i.shuffleStringsIfNeeded=function(){this.shuffle&&(this.sequence=this.sequence.sort(function(){return Math.random()-.5}))},i.initFadeOut=function(){var t=this;return this.el.className+=" "+this.fadeOutClass,this.cursor&&(this.cursor.className+=" "+this.fadeOutClass),setTimeout(function(){t.arrayPos++,t.replaceText(""),t.strings.length>t.arrayPos?t.typewrite(t.strings[t.sequence[t.arrayPos]],0):(t.typewrite(t.strings[0],0),t.arrayPos=0)},this.fadeOutDelay)},i.replaceText=function(t){this.attr?this.el.setAttribute(this.attr,t):this.isInput?this.el.value=t:this.contentType==="html"?this.el.innerHTML=t:this.el.textContent=t},i.bindFocusEvents=function(){var t=this;this.isInput&&(this.el.addEventListener("focus",function(s){t.stop()}),this.el.addEventListener("blur",function(s){t.el.value&&t.el.value.length!==0||t.start()}))},i.insertCursor=function(){this.showCursor&&(this.cursor||(this.cursor=document.createElement("span"),this.cursor.className="typed-cursor",this.cursor.setAttribute("aria-hidden",!0),this.cursor.innerHTML=this.cursorChar,this.el.parentNode&&this.el.parentNode.insertBefore(this.cursor,this.el.nextSibling)))},r}();const _=h({main:{position:"relative"},img:{...w,aspectRatio:"42/9",width:"100%",minHeight:"320px",...d.borderRadius(u.borderRadiusXLarge)},mask:{position:"absolute",top:0,left:0,right:0,bottom:"4px",...d.borderRadius(u.borderRadiusXLarge),backdropFilter:"blur(1px) brightness(105%)"},info:{...T,position:"absolute",top:0,...d.padding(u.spacingHorizontalXXXL),height:"-webkit-fill-available"},space:{flexBasis:"50%",flexShrink:0,"@media screen and (max-width: 1024px)":{flexBasis:0}},txt:{...P,justifyContent:"space-around"},white:{color:"white !important","@media screen and (max-width: 600px)":{fontSize:u.fontSizeBase300,lineHeight:u.lineHeightBase300}}});function j(){const r=_(),i=B(t=>{const s=new Z(t,{strings:["AwaiShop","Together","Dream","Forever"],typeSpeed:60,backSpeed:40,startDelay:1500,backDelay:3e3,showCursor:!1});return()=>s.destroy()});return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:r.main,children:[n.jsx(E,{className:r.img,src:"/banner.jpg"}),n.jsx("div",{className:r.mask,style:{background:"linear-gradient(to right, transparent, var(--colorBackgroundOverlay))"}}),n.jsxs("div",{className:r.info,children:[n.jsx("div",{className:r.space}),n.jsxs("div",{className:r.txt,children:[n.jsxs("div",{children:[n.jsx(C,{className:r.white,children:"Play "}),n.jsx(k,{ref:i,size:900,weight:"semibold",underline:!0,className:r.white,children:"?"}),n.jsx(C,{className:r.white,children:" With SoarCraft"})]}),n.jsx(k,{size:500,truncate:!0,className:r.white,children:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged."}),n.jsxs(D,{modalType:"non-modal",children:[n.jsx(O,{disableButtonEnhancement:!0,children:n.jsx("div",{children:n.jsx(I,{appearance:"outline",size:"large",className:r.white,children:"Learn More"})})}),n.jsx(q,{children:n.jsxs(A,{children:[n.jsx(H,{children:"Welcome to AwaiShop"}),n.jsx(R,{children:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed maximus nec erat vel hendrerit. Nulla tempus placerat turpis dictum placerat. Suspendisse ut justo diam. Donec auctor augue feugiat purus mollis, vitae congue erat pretium. Nulla blandit orci ante, a posuere mauris eleifend vel. Nam dapibus venenatis scelerisque. Nullam nisl turpis, cursus in convallis in, eleifend eget arcu. Curabitur scelerisque pretium turpis, consectetur congue nulla convallis tincidunt. Quisque rhoncus lectus a nunc tempor scelerisque. Quisque non augue eget augue ultricies viverra. Maecenas aliquam nisi orci, id volutpat risus efficitur et. Aliquam ac nunc euismod, interdum mi ac, faucibus enim. Donec nec finibus metus. Phasellus iaculis elit finibus sem aliquam, ut viverra tortor dapibus. Phasellus rhoncus, libero sit amet pulvinar tempus, velit lorem venenatis nisi, id ornare quam quam eget orci. In hac habitasse platea dictumst."})]})})]})]})]})]}),n.jsx(F,{})]})}const tt=h({img:{aspectRatio:"1",...w,borderTopLeftRadius:u.borderRadiusMedium,borderTopRightRadius:u.borderRadiusMedium},fore:{color:u.colorBrandForegroundLink}}),g=new b("Gallery","Category","Card");function st({Id:r}){const i=tt(),{data:t}=f(()=>v.Product.Get.Basic(r,g),{onError:g.error});return n.jsx(G,{href:`/Product/${r}`,children:n.jsxs(z,{children:[n.jsx(M,{children:n.jsx(V,{className:i.img,Guid:t?.Cover,Log:g})}),n.jsx(X,{children:n.jsx($,{className:i.fore,children:t?.Name||"Loading..."})})]})})}const et=h({card:{flexBasis:"20%",flexGrow:1,flexShrink:0,maxWidth:"25%",minWidth:`${375/2}px`,boxSizing:"border-box",paddingRight:u.spacingHorizontalL,paddingLeft:u.spacingHorizontalL},cate:{...T,flexWrap:"wrap",rowGap:u.spacingVerticalXL}}),it=new b("Gallery","Category");function nt({Category:r}){const i=et(),{data:t,loading:s}=f(()=>v.Gallery.Get.Products(r),{onError:it.error});return n.jsxs(n.Fragment,{children:[n.jsx(W,{children:r}),n.jsx("div",{className:i.cate,children:s?n.jsx(m,{size:128}):t.map((e,o)=>n.jsx("div",{className:i.card,children:n.jsx(st,{Id:e},o)}))})]})}const rt=h({main:{...P,rowGap:u.spacingVerticalXL}}),at=new b("Gallery");function lt(){const r=rt(),{data:i,loading:t}=f(()=>v.Gallery.Get.Categories(),{onError:at.error});return t?n.jsxs(Q,{className:r.main,children:[n.jsx(j,{}),n.jsx(m,{appearance:"translucent",size:32}),n.jsx(m,{size:128})]}):n.jsxs("div",{className:r.main,children:[n.jsx(U,{children:n.jsxs("title",{children:["Gallery - ",Y.Name]})}),n.jsx(j,{}),i?.map((s,e)=>n.jsx(nt,{Category:s},e))]})}export{lt as default}; diff --git a/assets/index-3wZvIsDj.js b/assets/index-3wZvIsDj.js deleted file mode 100644 index f4584ae..0000000 --- a/assets/index-3wZvIsDj.js +++ /dev/null @@ -1,11 +0,0 @@ -import{r as x,u as jt,j as n,d as w,t as m,s as B,m as P,a as Xt,T as _,b as W,c as st,e as tt,f as bt,D as vt,g as Et,h as Tt,i as qt,k as Lt,F as S,I as F,L as H,l as St,n as ht,B as b,S as mt,o as $,A as q,X as Yt,P as Jt,p as ft,H as X,q as Nt,v as It,M as Ot,w as At,x as h,y as G,z as kt,C as Kt,E as U,G as ot,J as Zt,K as te,N as ee,O as se,Q as ne,R as re,U as ae,V as oe,W as ie,Y as ce,Z as ue,_ as de,$ as V,a0 as le,a1 as he,a2 as wt,a3 as me,a4 as pe,a5 as Gt,a6 as Y,a7 as ge,a8 as J,a9 as xe,aa as fe,ab as we,ac as ye,ad as Pe,ae as Ce,af as je,ag as be,ah as ve,ai as Ee,aj as Te,ak as Le,al as Se,am as Ne,an as Ie,ao as Oe,ap as Ae,aq as ke,ar as Ge,as as K,at as nt,au as $e,av as Ue,aw as Me,ax as Re,ay as De}from"./vendor--JR89aB4.js";function it(o){return`/${o.filter(e=>e).map(e=>e.toString().replace(/^\/+/,"")).join("/")}`}const $t=x.createContext({});function R(){return x.useContext($t)}function Be({children:o}){const[t,e]=x.useState(()=>({Paths:location.pathname.split("/").filter(c=>c),Search:new URLSearchParams(location.search),Put:s,Nav:(...c)=>a(it(c)),Rep:(...c)=>i(it(c)),Reload:(...c)=>u(c)}));function s(c){history.replaceState(null,"",`${location.pathname}${c.size?"?":""}${c.toString()}`),t.Search=new URLSearchParams(c),e({...t})}function r(c){t.Paths=c.split("/").filter(d=>d),t.Search=new URLSearchParams(location.search),e({...t})}function a(c){history.pushState(null,"",c),r(c)}function i(c){history.replaceState(null,"",c),r(c)}function u(c){history.replaceState(null,"","/Reload"),r("/Reload"),setTimeout(()=>{const d=c.length?it(c):location.pathname;history.pushState(null,"",d),r(d)},100)}return jt(()=>{location.pathname==="/"&&location.search.startsWith("?/")&&i(location.search.substring(2)),addEventListener("click",c=>{const d=c.target?.closest("a");if(d){if(d.origin!==location.origin){d.target="_blank";return}c.preventDefault(),a(d.pathname)}}),addEventListener("popstate",c=>{c.preventDefault(),r(location.pathname)})}),n.jsx($t.Provider,{value:t,children:o})}class A{namespace;info;error;warn;debug;throw;constructor(...t){this.namespace=t.join(" > "),this.error=console.error.bind(this,this.baseColor(101,"error"),` - `),this.warn=console.warn.bind(this,this.baseColor(103,"warn"),` - `),this.info=console.info.bind(this,this.baseColor(104,"info"),` - `),this.debug=console.debug.bind(this,this.baseColor(102,"debug"),` - `),this.throw=console.log.bind(this,this.baseColor(105,"throw"),"↓ The Following Error is Thrown ↓")}With(...t){return new A(this.namespace,...t)}baseColor(t,e){return`\x1B[${t};30;1m ${e.toUpperCase()} \x1B[0m\x1B[100;97m ${w().format("YY-M-D H:m:s")} \x1B[1m\x1B[40;97m ${this.namespace} `}}const O={display:"flex"},Ve={flexDirection:"column"},M={...O,...Ve},Js={...O,backgroundColor:m.colorNeutralBackground1,boxShadow:m.shadow4,...B.borderRadius(m.borderRadiusMedium)},He={whiteSpace:"pre-line"},pt=60,gt="1636px",Fe={objectFit:"cover",objectPosition:"center"},ze=P({pre:He});function Q(o){const t=ze(),{dispatchToast:e}=Xt();return{dispatch:s=>{const r=s.Error.message,a=r.indexOf("Exception:");let i=r;a!==-1&&(i=r.substring(a+10)),e(n.jsxs(_,{children:[n.jsx(W,{children:"Internal Error"}),n.jsx(st,{subtitle:n.jsxs(tt,{className:t.pre,children:[i,n.jsx("br",{}),"More Info, See Console"]}),children:n.jsx(tt,{className:t.pre,children:s.Message})})]}),{intent:"error",timeout:1e4}),o.error(s)},dispatchToast:e}}const _e=P({box:{...M,rowGap:m.spacingVerticalM},one:{...O,columnGap:m.spacingVerticalXXXL}}),yt=new A("Setting");function Ut({Open:o,Toggle:t,New:e}){const s=_e(),r=bt().instance.getActiveAccount(),[a,i]=x.useState(),[u,c]=x.useState(),[d,l]=x.useState(),p=v.User.Get.useMe(yt);x.useEffect(()=>{if(e||!p)return;const{Name:f,Phone:g,Address:Qt}=p;i(f),c(g),l(Qt)},[p]);const{dispatch:y,dispatchToast:E}=Q(yt),{run:T}=v.User.Post.useUpdate({manual:!0,onError(f,[g]){y({Message:`Failed ${e?"Create":"Update"} Info`,Error:f,Request:g})},onSuccess(f,[g]){E(n.jsxs(_,{children:[n.jsxs(W,{children:["Info ",e?"Created":"Updated"]}),n.jsxs(st,{children:[g.Name,n.jsx("br",{}),g.Phone,n.jsx("br",{}),g.Address]})]}),{intent:"success"}),e&&(D.next(!1),D.complete(),D.closed=!0),t()}});return n.jsx(vt,{open:o,onOpenChange:t,modalType:e?"alert":"modal",children:n.jsx(Et,{children:n.jsxs(Tt,{children:[n.jsx(qt,{children:e?"Welcome! Fill in your info to get started.":"Personal Information"}),n.jsxs(Lt,{className:s.box,children:[n.jsxs("div",{className:s.one,children:[n.jsx(S,{label:"Name",size:"large",required:!0,children:n.jsx(F,{size:"medium",value:a,maxLength:20,onChange:(f,g)=>i(g.value)})}),n.jsx(S,{label:"Phone",size:"large",required:!0,children:n.jsx(F,{size:"medium",value:u,maxLength:20,onChange:(f,g)=>c(g.value)})})]}),n.jsx(S,{label:"E-Mail",size:"large",children:n.jsx(H,{children:r?.username})}),n.jsx(S,{label:"Address",size:"large",required:!0,children:n.jsx(F,{size:"medium",value:d,maxLength:100,minLength:20,onChange:(f,g)=>l(g.value)})})]}),n.jsxs(St,{children:[!e&&n.jsx(ht,{disableButtonEnhancement:!0,children:n.jsx(b,{appearance:"secondary",children:"Cancel"})}),n.jsx(b,{appearance:"primary",onClick:()=>T({EMail:r?.username,Name:a,Address:d,Phone:u}),children:"Submit"})]})]})})})}const D=new mt;function We(){const[o,{toggle:t}]=$();return jt(()=>D.subscribe(e=>e&&t())),n.jsx(q,{children:n.jsx(Ut,{Open:o,Toggle:t,New:!0})})}const rt={Name:"AwaiShop"};class Qe{constructor(t,e){this.DB=t,this.Name=e,this.Sto=t.table(e),this.Trim()}Sto;async Get(t,e){const s=await this.Sto.get(t);return s?e&&await Promise.resolve(e(s))||typeof s.Exp=="number"&&s.Exptypeof t.Exp=="number"&&t.Exp{const e=setInterval(()=>{this.Hub.state===X.Connected&&(clearInterval(e),t())},100)}))}static async Invoke(t,...e){return await this.EnsureConnected(),this.Hub.invoke(t,...e)}static EnsureLogin(){if(!I.getActiveAccount())throw new Rt}static EnsureTrue(t){if(!t)throw new Xe}static Index(t,e){return`${e}_${t}`}static async UpdateCache(t,e,s,r){const a=this.Index(e,s),i=await L.Get(a);if(!i)return;const u=t(i);i.QueryExp?await L.Set(a,{...u,QueryExp:w().add(1,"m").unix()},w().add(1,"w")):await L.Set(a,u,r||null)}static async GetVersionCache(t,e){const s=this.Index(t,e),r=await L.Get(s);if(r&&r.QueryExp>w().unix())return r;const a=await Promise.resolve(this.Invoke(e,t,r?.Version));if(a===!0)return L.Set(s,{...r,QueryExp:w().add(1,"m").unix()},w().add(1,"w")),r;if(!a)throw L.Sto.delete(s),new Dt;return await L.Set(s,{...a,QueryExp:w().add(1,"m").unix()},w().add(1,"w")),a}static async GetTimeCache(t,e,s,...r){return await L.GetOrSet(this.Index(t,e),async()=>await this.Invoke(e,...r),s(w()))}static async HandleFileStream(t,e,s){const a=Math.ceil(t.size/30720);let i=0;for(;i{l.onload=()=>y(new Uint8Array(l.result)),l.onerror=()=>E(l.error),l.readAsArrayBuffer(d)});e.next(p),s?.debug(`Sent chunk ${i+1}/${a}`),i++}e.complete()}}class k extends Bt{static Log=["|","ShopNet"];static Hub=new Nt().withUrl("https://awaishop.aloen.to:3389/Hub",{skipNegotiation:!0,transport:It.WebSockets,logMessageContent:!1,async accessTokenFactory(){const t=await Mt();return t||""}}).withAutomaticReconnect().withStatefulReconnect().withHubProtocol(new Ot).configureLogging(At.Information).build()}k.Hub.on("OnNewUser",()=>{D.next(!0),console.debug("OnNewUser")});class qe extends k{static Categories(){return this.GetTimeCache("","GalleryGetCategories",t=>t.add(1,"m"))}static async Products(t){return await this.GetTimeCache(t,"GalleryGetProducts",s=>s.add(1,"m"),t)}}const Ye={Get:qe};class Je extends k{static async Get(t){if(!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(t))throw new Error(`Invalid ObjectId ${t}`);return await this.EnsureConnected(),this.Hub.stream("ObjectStorageGet",t)}static GetBySlice(t,e){const s=[];return L.GetOrSet(t,()=>new Promise((r,a)=>{this.Get(t).then(i=>i.subscribe({error(u){a(u)},next(u){s.push(u),e.debug("Received Slice",t,s.length)},complete(){r(s)}}))}))}}class Ke extends k{static useDelete(t){return h(async e=>{this.EnsureLogin();const s=await this.Invoke("OrderDeleteCancel",e);return this.EnsureTrue(s),s},t)}}class j extends k{static product="ProductEntity";static Product(t){return this.GetVersionCache(t,this.product)}static ProductUpdate(t,e){return this.UpdateCache(e,t,this.product)}static Lexical(t){return this.GetVersionCache(t,"LexicalEntity")}static photo="PhotoEntity";static Photo(t){return this.GetVersionCache(t,this.photo)}static PhotoUpdate(t,e){return this.UpdateCache(e,t,this.photo)}static Type(t){return this.GetVersionCache(t,"TypeEntity")}static Variant(t){return this.GetVersionCache(t,"VariantEntity")}}class N extends j{static Log=[...super.Log,"Product","Get"];static async Basic(t,e){const s=e.With(...this.Log,"Basic"),r=await this.Product(t);if(!r)throw new Error(`Product ${t} Not Found`);const[a,i]=await this.PhotoList(t,e);return i?{Name:r.Name,Cover:i}:(s.warn(`Product ${t} has no photo`),{Name:r.Name,Cover:""})}static Limit(t){return this.Invoke("ProdGetLimit",t)}static async Combo(t,e){const s=e.With(...this.Log,"Combo"),r=await this.ComboList(t),a=[];for(const i of r){const u={};for(const c of i.Types){const d=await this.Type(c);if(!d){s.error(`[Mismatch] Type ${c} not found. Combo ${i.ComboId} : Product ${t}`);continue}const l=await this.Variant(d.VariantId);if(!l){s.error(`[Mismatch] Variant ${d.VariantId} not found. Combo ${i.ComboId} : Type ${c} : Product ${t}`);continue}u[l.Name]=d.Name}a.push({Id:i.ComboId,Stock:i.Stock,Combo:u})}return a}static ComboList(t){return this.GetTimeCache(t,"ProductGetComboList",e=>e.add(1,"m"),t)}static photoList="ProductGetPhotoList";static async PhotoList(t,e){const s=e.With(...this.Log,"PhotoList"),r=await this.GetTimeCache(t,this.photoList,u=>u.add(1,"m"),t).catch(s.error);let a=[],i="";for(const u of r||[]){const c=await this.Photo(u).catch(s.error);c?(a.push(c),c.Cover&&(i=c.ObjectId)):s.warn(`Photo ${u} not found in Product ${t}`)}return a=a.sort((u,c)=>u.Order-c.Order),!i&&a.length>0?(s.warn(`Product ${t} has no cover photo, using first photo instead`),[a,a[0].ObjectId]):[a,i]}static PhotoListUpdate(t,e){return this.UpdateCache(e,t,this.photoList,w().add(1,"m"))}}class Ze extends k{static Order(t){return this.EnsureLogin(),this.GetVersionCache(t,"OrderEntity")}static Comment(t){return this.EnsureLogin(),this.GetVersionCache(t,"CommentEntity")}}class ts extends Ze{static Log=[...super.Log,"Order","Get"];static async List(t){this.EnsureLogin();const e=t.With(...this.Log,"List"),s=await this.GetTimeCache("","OrderGetList",a=>a.add(1,"m")),r=[];for(const a of s){const i=await this.Order(a.OrderId);if(!i){e.warn(`[Mismatch] Order ${a.OrderId} not found`);continue}const u=[];for(const c of a.Products){const d=await j.Product(c);if(!d){e.warn(`[Mismatch] Product ${c} not found`);continue}u.push(d.Name)}r.push({Id:a.OrderId,Items:u,Quantity:a.Quantity,Status:i.Status,TrackNumber:i.TrackingNumber,OrderDate:i.CreateAt})}return r.sort((a,i)=>i.OrderDate.getTime()-a.OrderDate.getTime())}static async Detail(t,e){this.EnsureLogin();const s=e.With(...this.Log,"Detail"),r=await this.GetTimeCache(t,"OrderGetDetail",c=>c.add(1,"m"),t),a=[];let i=0;for(const c of r.Items){const d={};let l=0;for(const T of c.Types){const f=await j.Type(T);if(!f){s.warn(`[Mismatch] Type ${T} not found. Order : ${t}`);continue}const g=await j.Variant(f.VariantId);if(!g){s.warn(`[Mismatch] Variant ${f.VariantId} not found. Type : ${T}, Order : ${t}`);continue}d[g.Name]=f.Name,l=g.ProductId}const p=await j.Product(l);if(!p){s.warn(`[Mismatch] Product ${l} not found. Order : ${t}`);continue}const[y,E]=await N.PhotoList(l,s);E||s.warn(`Product ${l} has no photo`),a.push({Id:i++,ProdId:l,Cover:E||"",Name:p.Name,Type:d,Quantity:c.Quantity})}const u=[];for(const c of r.Comments){const d=await this.Comment(c);if(!d){s.warn(`[Mismatch] Comment ${c} not found. Order : ${t}`);continue}u.push({Content:d.Content,Time:d.CreateAt,User:d.Name||"You"})}return{ShopCart:a,Comments:u.sort((c,d)=>c.Time.getTime()-d.Time.getTime())}}}class es extends k{static useNew(t){return h((e,s)=>{this.EnsureLogin();const r=e.map(a=>({ProdId:a.ProdId,Type:Object.values(a.Type),Quantity:a.Quantity}));return this.Invoke("OrderPostNew",r,s)},t)}static useAppend(t){return h(async(e,s)=>{this.EnsureLogin();const r=await this.Invoke("OrderPostAppend",e,s);return this.EnsureTrue(r),r},t)}static useCancel(t){return h(async(e,s)=>{this.EnsureLogin();const r=await this.Invoke("OrderPostCancel",e,s);return this.EnsureTrue(r),r},t)}static useReceived(t){return h(async e=>{this.EnsureLogin();const s=await this.Invoke("OrderPostReceived",e);return this.EnsureTrue(s),s},t)}}const ss={Get:ts,Post:es,Delete:Ke},ns={Get:N};class Vt extends k{static Log=[...super.Log,"User","Get"];static me="UserGetMe";static useMe(t){const e=G(()=>t.With(...this.Log,"Me")),{dispatch:s}=Q(e);return kt(async()=>{try{return this.EnsureLogin(),await this.GetVersionCache(0,this.me)}catch(a){if(a instanceof Dt)return;a instanceof Rt?e.info(a):s({Message:"Failed to Get Your Info",Error:a,Request:""})}})}static MeUpdate(t){return this.UpdateCache(t,0,this.me)}}class rs extends k{static useUpdate(t){return h(async e=>{this.EnsureLogin();const s=await this.Invoke("UserPostUpdate",e);return this.EnsureTrue(s),Vt.MeUpdate(r=>({...r,...e})),s},t)}}const as={Get:Vt,Post:rs},v={Gallery:Ye,Product:ns,User:as,Order:ss,Storage:Je},Ht=x.createContext({});function z(){return x.useContext(Ht)}const ut=new A("ShopCart","Context");function os({children:o}){const[t,e]=x.useState([]);h(async()=>{const a=await ct.toArray(),i=[];for(const u of a){const c=await v.Product.Get.Basic(u.ProdId,ut);i.push({...u,...c})}e(i)},{onError:ut.error});async function s(a){for(let i=0;i({Id:i.Id,ProdId:i.ProdId,Type:i.Type,Quantity:i.Quantity})))}async function r(a,i,u){const c=await v.Product.Get.Basic(a,ut);t.push({...c,Id:t.length,ProdId:a,Type:i,Quantity:u}),s(t)}return n.jsx(Ht.Provider,{value:{List:t,Add:r,Update:s},children:o})}const is=P({box:{width:"-webkit-fill-available",marginTop:m.spacingVerticalXXXL,...B.padding(m.spacingVerticalXXXL,0),backgroundColor:m.colorNeutralBackgroundInverted},main:{...O,maxWidth:gt,...B.margin(0,"auto")},logo:{width:"150px",filter:"invert(96%)"},otc:{color:"white"}});function cs(){const o=is();return n.jsx("footer",{className:o.box,children:n.jsx("div",{className:o.main,children:n.jsx("img",{src:"/safari-pinned-tab.svg",className:o.logo})})})}const us=P({box:{...O,flexGrow:1,height:"inherit",marginLeft:m.spacingHorizontalS,alignItems:"center"},div:{color:m.colorNeutralForegroundDisabled},link:{textDecorationLine:"unset !important"}});function ds(){const o=us(),{Paths:t}=R(),e=t.at(0),s=t.at(1)||"Product";return e==="Admin"&&n.jsxs("div",{className:o.box,children:[n.jsx(tt,{size:600,font:"monospace",className:o.div,children:"|"}),n.jsxs(Kt,{selectedValue:s,children:[n.jsx(U,{appearance:"subtle",href:"/Admin",className:o.link,children:n.jsx(ot,{value:"Product",children:"Product List"})}),n.jsx(U,{appearance:"subtle",href:"/Admin/Order",className:o.link,children:n.jsx(ot,{value:"Order",children:"Order List"})}),n.jsx(U,{appearance:"subtle",href:"/Admin/User",className:o.link,children:n.jsx(ot,{value:"User",children:"User List"})})]})]})}class C extends Bt{static Log=["|","AdminNet"];static Hub=new Nt().withUrl("https://awaishop.aloen.to:3389/AdminHub",{skipNegotiation:!0,transport:It.WebSockets,logMessageContent:!1,async accessTokenFactory(){const t=await Mt();if(t)return t;throw new Error("Please Login First")}}).withAutomaticReconnect().withStatefulReconnect().withHubProtocol(new Ot).configureLogging(At.Information).build();static Index(t,e){return`${e}_Admin_${t}`}}class et extends C{static User(t){return this.EnsureLogin(),this.GetVersionCache(t,"UserEntity")}}class Z extends C{static Order(t){return this.EnsureLogin(),this.GetVersionCache(t,"OrderEntity")}static Comment(t){return this.EnsureLogin(),this.GetVersionCache(t,"CommentEntity")}}class ls extends C{static async Export(t){this.EnsureLogin(),await this.EnsureConnected();const e=[];return new Promise((s,r)=>{this.Hub.stream("ExportOrder").subscribe({error(a){t.error(a),r(a)},next(a){e.push(a),t.debug("Received Slice",e.length)},complete(){t.debug("Received All Slices",e.length),s(URL.createObjectURL(new Blob(e)))}})})}}class hs extends C{static Log=[...super.Log,"Order","Get"];static async List(t){this.EnsureLogin();const e=t.With(...this.Log,"List"),s=await this.GetTimeCache("","OrderGetList",a=>a.add(1,"m")),r=[];for(const a of s){const i=await Z.Order(a.OrderId);if(!i){e.warn(`[Mismatch] Order ${a.OrderId} not found`);continue}const u=[];for(const d of a.Products){const l=await j.Product(d);if(!l){e.warn(`[Mismatch] Product ${d} not found`);continue}u.push(l.Name)}const c=await et.User(i.UserId);if(!c){e.error(`[Mismatch] User ${i.UserId} not found`);continue}r.push({Id:a.OrderId,Items:u,Quantity:a.Quantity,Status:i.Status,TrackNumber:i.TrackingNumber,OrderDate:i.CreateAt,User:c.Name})}return r.sort((a,i)=>i.OrderDate.getTime()-a.OrderDate.getTime())}static async Detail(t,e){this.EnsureLogin();const s=e.With(...this.Log,"Detail"),r=await this.GetTimeCache(t,"OrderGetDetail",c=>c.add(1,"m"),t),a=[];let i=0;for(const c of r.Items){const d={};let l=0;for(const T of c.Types){const f=await j.Type(T);if(!f){s.warn(`[Mismatch] Type ${T} not found. Order : ${t}`);continue}const g=await j.Variant(f.VariantId);if(!g){s.warn(`[Mismatch] Variant ${f.VariantId} not found. Type : ${T}, Order : ${t}`);continue}d[g.Name]=f.Name,l=g.ProductId}const p=await j.Product(l);if(!p){s.warn(`[Mismatch] Product ${l} not found. Order : ${t}`);continue}const[y,E]=await N.PhotoList(l,s);E||s.warn(`Product ${l} has no photo`),a.push({Id:i++,ProdId:l,Cover:E||"",Name:p.Name,Type:d,Quantity:c.Quantity})}const u=[];for(const c of r.Comments){const d=await Z.Comment(c);if(!d){s.warn(`[Mismatch] Comment ${c} not found. Order : ${t}`);continue}let l="Client";if(d.UserId){const p=await et.User(d.UserId);p?l=p.Name:s.warn(`[Mismatch] User ${d.UserId} not found. Order : ${t}`)}u.push({Content:d.Content,Time:d.CreateAt,User:l})}return{ShopCart:a,Comments:u.sort((c,d)=>c.Time.getTime()-d.Time.getTime())}}static Order=Z.Order;static Export=ls.Export}class ms extends C{static useAppend(t){return h(async(e,s)=>{const r=await this.Invoke("OrderPostAppend",e,s);return this.EnsureTrue(r),r},t)}static useClose(t){return h(async(e,s)=>{const r=await this.Invoke("OrderPostClose",e,s);return this.EnsureTrue(r),r},t)}static useShip(t){return h(async(e,s)=>{const r=await this.Invoke("OrderPostShip",e,s);return this.EnsureTrue(r),r},t)}static useAccept(t){return h(async e=>{const s=await this.Invoke("OrderPostAccept",e);return this.EnsureTrue(s),s},t)}}const ps={Get:hs,Post:ms};class xt extends C{static Log=[...super.Log,"Product","Get"];static list="ProductGetList";static useList(t){const e=G(()=>t.With(...this.Log,"List"));return kt(()=>this.GetTimeCache("",this.list,r=>r.add(1,"m")).catch(e.error))}static ListUpdate(t){return this.UpdateCache(t,"",this.list,w().add(1,"m"))}static Count(t){return this.GetTimeCache(t,"ProductGetCount",e=>e.add(1,"m"),t)}static async Name(t){const e=await N.Product(t);if(!e)throw new Error(`Product ${t} Not Found`);return e.Name}static async Category(t){const e=await N.Product(t);if(!e)throw new Error(`Product ${t} Not Found`);return e.Category}static async Variants(t,e){const s=e.With(...this.Log,"Variants"),r=await this.GetTimeCache(t,"ProductGetVariants",i=>i.add(1,"m"),t),a=[];for(const i of r){const u=await N.Variant(i.VariantId);if(!u){s.warn(`Variant ${i} Not Found. Product : ${t}`);continue}const c=[];for(const d of i.Types){const l=await N.Type(d);if(!l){s.warn(`Type ${d} Not Found. Variant : ${i.VariantId}, Product : ${t}`);continue}c.push(l.Name)}a.push({Id:i.VariantId,Name:u.Name,Types:c})}return a}}class gs extends C{static usePhoto(t){return h(async(e,s)=>{const r=await this.Invoke("ProductDeletePhoto",s);return this.EnsureTrue(r),N.PhotoListUpdate(e,a=>a.filter(i=>i!==s)),r},t)}static useVariant(t){return h(async e=>{const s=await this.Invoke("ProductDeleteVariant",e);return this.EnsureTrue(s),s},t)}static useType(t){return h(async(e,s)=>{const r=await this.Invoke("ProductDeleteType",e,s);return this.EnsureTrue(r),r},t)}static useCombo(t){return h(async e=>{const s=await this.Invoke("ProductDeleteCombo",e);return this.EnsureTrue(s),s},t)}static useProduct(t){return h(async e=>{const s=await this.Invoke("ProductDeleteProduct",e);return this.EnsureTrue(s),xt.ListUpdate(r=>r.filter(a=>a!==e)),s},t)}static useCategory(t){return h(async e=>{const s=await this.Invoke("ProductDetachCategory",e);return this.EnsureTrue(s),j.ProductUpdate(e,r=>(r.Category=void 0,r)),s},t)}}class xs extends C{static Log=[...super.Log,"Product","Patch"];static useName(t){return h(async(e,s)=>{const r=await this.Invoke("ProductPatchName",e,s);return this.EnsureTrue(r),r},t)}static useCategory(t){return h(async(e,s)=>{const r=await this.Invoke("ProductPatchCategory",e,s);return this.EnsureTrue(r),r},t)}static usePhoto(t,e){const s=G(()=>t.With(...this.Log,"Photo"));return h(async(r,a)=>{if(!a.type.startsWith("image/"))throw new TypeError("File is not an image");if(a.size>10*1024*1024)throw new RangeError("File is too large, max 10MB");await this.EnsureConnected();const i=new mt,u=this.Hub.invoke("ProductPatchPhoto",r,i);return await this.HandleFileStream(a,i,s),this.EnsureTrue(await u),!0},e)}static useCaption(t){return h(async(e,s)=>{const r=await this.Invoke("ProductPatchCaption",e,s);return this.EnsureTrue(r),j.PhotoUpdate(e,a=>(a.Caption=s,a)),r},t)}static useVariantName(t){return h(async(e,s)=>{const r=await this.Invoke("ProductPatchVariantName",e,s);return this.EnsureTrue(r),r},t)}static useType(t){return h(async(e,s,r)=>{const a=await this.Invoke("ProductPatchType",e,s,r);return this.EnsureTrue(a),a},t)}static useCombo(t){return h(async(e,s,r)=>{const a=await this.Invoke("ProductPatchCombo",e,s,r);return this.EnsureTrue(a),a},t)}}let Ft;function Ks(o){Ft=o}class fs extends C{static Log=[...super.Log,"Product","Post"];static useCreate(t){return h(async e=>{const s=await this.Invoke("ProductPostCreate",e);return xt.ListUpdate(r=>[s,...r]),s},t)}static useMovePhoto(t){return h(async(e,s)=>{const r=await this.Invoke("ProductPostMovePhoto",e,s);return this.EnsureTrue(r),r},t)}static usePhoto(t,e){const s=G(()=>t.With(...this.Log,"Photo"));return h(async(r,a)=>{if(!a.type.startsWith("image/"))throw new TypeError("File is not an image");if(a.size>10*1024*1024)throw new RangeError("File is too large, max 10MB");const i=new mt,u=this.Invoke("ProductPostPhoto",r,i);await this.HandleFileStream(a,i,s);const c=await u;return N.PhotoListUpdate(r,d=>[...d,c]),c},e)}static useVariant(t){return h((e,s)=>this.Invoke("ProductPostVariant",e,s),t)}static useType(t){return h((e,s)=>this.Invoke("ProductPostType",e,s),t)}static useCombo(t){return h((e,s,r)=>this.Invoke("ProductPostCombo",e,s,r),t)}static useLexical(t){return h(async e=>{const s=Ft?.getEditorState();let r;s&&!s.isEmpty()&&(r=JSON.stringify(s.toJSON()));const a=await this.Invoke("ProductPostDescription",e,r);return this.EnsureTrue(a),a},t)}}const ws={Get:xt,Post:fs,Patch:xs,Delete:gs};class ys extends C{static useUser(t){return h(async e=>{const s=await this.Invoke("UserDeleteUser",e);return this.EnsureTrue(s),s},t)}static useAdmin(t){return h(async e=>{const s=await this.Invoke("UserDeleteAdmin",e);return this.EnsureTrue(s),s},t)}}class Ps extends C{static async OrderUser(t){const e=await Z.Order(t);if(!e)throw new Error(`Order ${t} not found`);const s=await et.User(e.UserId);if(!s)throw new Error(`User ${e.UserId} not found in order ${t}`);return s}static async List(){const t=await this.GetTimeCache("","UserGetList",s=>s.add(1,"m")),e=[];for(const s of t){const r=await et.User(s);if(!r){console.warn(`User ${s} not found`);continue}e.push({Id:s,Name:r.Name,EMail:r.EMail,Admin:r.Admin})}return e}}class Cs extends C{static useAdmin(t){return h(async e=>{const s=await this.Invoke("UserPostAdmin",e);return this.EnsureTrue(s),s},t)}}const js={Get:Ps,Post:Cs,Delete:ys},zt={Product:ws,Order:ps,User:js},Pt=new A("Admin","Order","ExportButton");function bs(){const{Paths:o}=R(),t=o.at(0),e=o.at(1),{dispatch:s,dispatchToast:r}=Q(Pt),{run:a,loading:i}=h(()=>zt.Order.Get.Export(Pt),{manual:!0,onError(u,c){s({Message:"Failed Export Orders",Request:c,Error:u})},onSuccess(u){r(n.jsx(_,{children:n.jsx(W,{children:"Orders Exported"})}),{intent:"success"});const c=document.createElement("a");c.href=u,c.download=`AllOrders_${new Date().toISOString()}.xlsx`,c.click()}});return t==="Admin"&&e==="Order"&&n.jsx(b,{appearance:"subtle",icon:n.jsx(Zt,{}),onClick:a,disabled:i,children:"Export Orders"})}const vs=P({body:M}),Es=new A("Admin","Product","AddButton");function Ts(){const{Nav:o,Paths:t}=R(),e=t.at(0),s=t.at(1),r=vs(),[a,i]=x.useState(""),{dispatch:u,dispatchToast:c}=Q(Es),{run:d,loading:l}=zt.Product.Post.useCreate({manual:!0,onError(p,y){u({Message:`Failed Create ${a}`,Request:y,Error:p})},onSuccess(p){c(n.jsxs(_,{children:[n.jsx(W,{children:"New Product Created"}),n.jsxs(st,{children:[p," ",a]})]}),{intent:"success"}),o("Admin",p),i("")}});return e==="Admin"&&!s&&n.jsxs(vt,{children:[n.jsx(ht,{disableButtonEnhancement:!0,children:n.jsx(b,{appearance:"primary",icon:n.jsx(te,{}),children:"New Product"})}),n.jsx(Et,{children:n.jsxs(Tt,{children:[n.jsx(Lt,{className:r.body,children:n.jsx(F,{required:!0,size:"large",value:a,maxLength:15,appearance:"underline",onChange:(p,y)=>i(y.value),contentBefore:n.jsx(ee,{children:"Give A Name"})})}),n.jsxs(St,{children:[n.jsx(ht,{disableButtonEnhancement:!0,children:n.jsx(b,{appearance:"secondary",children:"Cancel"})}),n.jsx(b,{disabled:l,appearance:"primary",onClick:()=>d(a),children:"Create"})]})]})})]})}function Ls(){const{Paths:o,Search:t,Put:e}=R(),s=o.at(0),r=o.at(1);return s==="Admin"&&r==="User"&&n.jsxs(n.Fragment,{children:[n.jsx(F,{placeholder:"Search by E-Mail",contentBefore:n.jsx(se,{}),appearance:"underline",onChange:(a,i)=>{i.value?t.set("search",i.value):t.delete("search"),e(t)}}),n.jsx(ne,{label:"Only Admin",checked:t.get("admin")==="",onChange:(a,i)=>{i.checked?t.set("admin",""):t.delete("admin"),e(t)}})]})}const Ss=new A("Avatar","Menu");function Ns(){const[o,{toggle:t}]=$(),[e,{toggle:s}]=$(),{instance:r}=bt(),[a,{set:i}]=$(!0);x.useEffect(()=>{D.subscribe(l=>i(!l))},[]);const u=v.User.Get.useMe(Ss),c=r.getActiveAccount(),d=c?.name||c?.username;return n.jsxs(n.Fragment,{children:[n.jsxs(re,{open:o,onOpenChange:t,children:[n.jsx(ae,{children:n.jsx(oe,{size:36,active:o?"active":"unset",name:d})}),n.jsx(ie,{children:n.jsxs(ce,{children:[n.jsx(q,{children:n.jsxs(ue,{children:["Hi ",d]})}),n.jsx(de,{children:n.jsx(V,{onClick:()=>r.loginRedirect(),children:"Login"})}),n.jsxs(q,{children:[n.jsx(U,{appearance:"subtle",href:"/History",children:n.jsx(V,{children:"History"})}),u?.Admin&&n.jsx(U,{appearance:"subtle",href:"/Admin",children:n.jsx(V,{children:"Admin"})}),n.jsx(V,{onClick:s,children:"Setting"}),n.jsx(V,{onClick:()=>r.logoutRedirect(),children:"Logout"})]})]})})]}),a&&n.jsx(q,{children:n.jsx(Ut,{Open:e,Toggle:s})})]})}function _t({Items:o,Columns:t,NoHeader:e}){return n.jsxs(le,{items:o||[],columns:t,getRowId:s=>s.Id,children:[!e&&n.jsx(he,{children:n.jsx(wt,{children:({renderHeaderCell:s})=>s()})}),n.jsx(me,{children:({item:s,rowId:r})=>n.jsx(wt,{children:({renderCell:a})=>a(s)},r)}),!o&&n.jsx(pe,{size:48})]})}function Is({Guid:o,Log:t,...e}){const s=G(()=>t.With("GuidImage")),{data:r,run:a}=h(v.Storage.GetBySlice.bind(v.Storage),{manual:!0,onError:s.error});return x.useEffect(()=>{o&&a(o,s)},[o]),n.jsx(Gt,{...e,src:r?URL.createObjectURL(new Blob(r)):"https://placehold.co/400?text=Loading..."})}const Ct=P({unset:{flexBasis:"unset",flexGrow:0},img:{...Fe,aspectRatio:"1",marginTop:m.spacingVerticalXS,marginBottom:m.spacingVerticalXS}});function Os(o,t){const e={width:`${o}px`};return Y({columnId:"Cover",renderHeaderCell:()=>{const s=Ct();return n.jsx(ge,{className:s.unset,children:n.jsx("div",{style:e})})},renderCell(s){const r=Ct();return n.jsx(J,{className:r.unset,children:n.jsx(Is,{className:r.img,style:e,Guid:s.Cover,Log:t})})}})}function As(o){const{List:t}=z(),{data:e}=h(()=>v.Product.Get.Limit(o)),s=e||3;let r=0;for(const a of t)if(a.ProdId===o&&(r+=a.Quantity),r>=s)return[!0,s];return[!1,s]}const dt=P({prod:{...M,alignItems:"flex-start",justifyContent:"center"},qua:{flexBasis:"12%",flexGrow:0},act:{flexBasis:"7%",flexGrow:0}}),ks=[Y({columnId:"Product",renderCell(o){return n.jsxs(J,{className:dt().prod,children:[n.jsx(U,{href:`/Product/${o.ProdId}`,appearance:"subtle",children:n.jsx(xe,{children:o.Name})}),n.jsx(fe,{children:Object.values(o.Type).reduce((t,e)=>`${t} ${e},`,"")})]})}}),Y({columnId:"Quantity",renderCell(o){const{List:t,Update:e}=z(),[s,r]=As(o.ProdId);return n.jsx(J,{className:dt().qua,children:n.jsx(we,{min:1,max:r,value:o.Quantity,onChange:(a,i)=>{s&&i.value>=o.Quantity||(o.Quantity=i.value,e(t))}})})}}),Y({columnId:"Action",renderCell(o){const{List:t,Update:e}=z();return n.jsx(J,{className:dt().act,children:n.jsx(b,{appearance:"subtle",icon:n.jsx(ye,{}),onClick:()=>e(t.filter(s=>s.Id!==o.Id))})})}})];function Wt(o){return[Os(44,o),...ks]}const Gs=P({person:O,inf:{...M,flexBasis:"50%",rowGap:m.spacingVerticalM}});function $s({Log:o}){const t=Gs(),e=G(()=>o.With("PersonaInfo")),s=v.User.Get.useMe(e);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:t.person,children:[n.jsx("div",{className:t.inf,children:n.jsx(S,{label:"Name",size:"large",children:n.jsx(H,{children:s?.Name})})}),n.jsx("div",{className:t.inf,children:n.jsx(S,{label:"Phone",size:"large",children:n.jsx(H,{children:s?.Phone})})})]}),n.jsx(S,{label:"E-Mail",size:"large",children:n.jsx(H,{children:s?.EMail})}),n.jsx(S,{label:"Address",size:"large",children:n.jsx(H,{children:s?.Address})})]})}const Us=P({body:{...M,rowGap:m.spacingVerticalXL},sub:{width:"fit-content",alignSelf:"flex-end"}}),lt=new A("TopNavBar","ShopCart","Confirm");function Ms(){const[o,t]=x.useState(),[e,{toggle:s}]=$(),{List:r,Update:a}=z(),{Nav:i}=R(),u=Us(),{dispatch:c,dispatchToast:d}=Q(lt),{run:l}=v.Order.Post.useNew({manual:!0,onError(p,y){c({Message:"Failed Create Order",Request:y,Error:p})},onSuccess(p){d(n.jsxs(_,{children:[n.jsx(W,{children:"Order Placed"}),n.jsxs(st,{children:["Order Id: ",p]})]}),{intent:"success"}),a([]),s(),i("History",p)}});return n.jsxs(n.Fragment,{children:[n.jsx(b,{appearance:"primary",onClick:s,disabled:!r.length,children:"Checkout"}),n.jsxs(Pe,{open:e,onOpenChange:s,position:"end",size:"medium",modalType:"alert",children:[n.jsx(Ce,{children:n.jsx(je,{action:n.jsx(b,{appearance:"subtle",icon:n.jsx(be,{}),onClick:s}),children:"Confirm Order"})}),n.jsx(ve,{children:n.jsxs("div",{className:u.body,children:[n.jsx($s,{Log:lt}),n.jsx(_t,{Items:r,Columns:G(()=>Wt(lt)),NoHeader:!0}),n.jsx(S,{label:"Comment",size:"large",children:n.jsx(Ee,{value:o,onChange:(p,y)=>t(y.value),maxLength:1e3})}),n.jsx(b,{appearance:"primary",className:u.sub,disabled:!r.length,onClick:()=>l(r,o),children:"Submit"})]})})]})]})}const Rs=P({conf:{...O,width:"100%",alignItems:"center",justifyContent:"space-between",marginTop:m.spacingVerticalS,columnGap:m.spacingHorizontalL},tooltip:{backgroundColor:m.colorBrandBackground,color:m.colorNeutralForegroundInverted,...B.borderRadius(m.borderRadiusCircular)}}),Ds=new A("TopNavBar","ShopCart");function Bs(){const[o,{toggle:t}]=$(),[e,{toggle:s}]=$(),r=Rs(),{List:a}=z();return Te(()=>{if(o)return;s();const i=setTimeout(s,2e3);return()=>clearTimeout(i)},[a]),n.jsxs(Le,{withArrow:!0,open:o,onOpenChange:t,children:[n.jsx(Se,{disableButtonEnhancement:!0,children:n.jsx(Ne,{visible:e,withArrow:!0,content:{children:"↑",className:r.tooltip},relationship:"inaccessible",children:n.jsx(Ie,{icon:n.jsx(Oe,{}),appearance:"subtle",size:"large",checked:o})})}),n.jsxs(Ae,{children:[n.jsx(_t,{Items:a,Columns:G(()=>Wt(Ds)),NoHeader:!0}),n.jsxs("div",{className:r.conf,children:[a.map(i=>i.Quantity).reduce((i,u)=>i+u,0)," items in shopping cart",n.jsx(Ms,{})]})]})]})}const Vs=P({navBox:{position:"fixed",top:0,width:"100%",height:`${pt}px`,...B.padding(0,m.spacingHorizontalXXXL),backgroundColor:"#fff",boxSizing:"border-box",boxShadow:m.shadow4},navBar:{...O,maxWidth:gt,height:"100%",...B.margin(0,"auto"),alignItems:"center",justifyContent:"space-between"},logoBox:{...O,columnGap:m.spacingHorizontalL,alignItems:"center"},logoText:{color:m.colorBrandForeground2}});function Hs(){const o=Vs();return n.jsx(ke,{children:n.jsx("header",{className:o.navBox,children:n.jsxs("nav",{className:o.navBar,children:[n.jsxs(U,{className:o.logoBox,href:"/",appearance:"subtle",children:[n.jsx(Gt,{src:"/Awai.png",height:pt}),n.jsx(tt,{size:600,font:"monospace",className:o.logoText,children:rt.Name})]}),n.jsx(ds,{}),n.jsxs("div",{className:o.logoBox,children:[n.jsx(Ts,{}),n.jsx(Ls,{}),n.jsx(bs,{}),n.jsx(Bs,{}),n.jsx(Ns,{})]})]})})})}function Fs(){const{Rep:o}=R();return setTimeout(()=>o("/"),3e3),n.jsxs(n.Fragment,{children:[n.jsxs(Ge,{children:[n.jsxs("title",{children:["Redirect - Not Found - ",rt.Name]}),n.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),n.jsx(K,{size:"huge",label:"Redirecting..."})]})}const zs=P({body:{...M,minWidth:"375px",position:"absolute",marginTop:`${pt}px`,width:"100%",minHeight:"-webkit-fill-available",justifyContent:"space-between",backgroundColor:m.colorNeutralBackground2},content:{...M,maxWidth:gt,width:"-webkit-fill-available",marginLeft:"auto",marginRight:"auto",paddingLeft:m.spacingHorizontalM,paddingRight:m.spacingHorizontalM,paddingTop:m.spacingVerticalXXXL}});function _s(){const o=zs(),{Paths:t}=R(),e=t.at(0),s=x.useMemo(()=>{switch(e){case"Product":return n.jsx(Ws,{});case"Admin":return n.jsx(Qs,{});case"History":return n.jsx(Xs,{});case"Login":return n.jsx(K,{size:"huge",label:"Login Redirecting..."});case"Reload":return n.jsx(K,{size:"huge",label:"Reloading..."});case"":case void 0:return n.jsx(qs,{});default:return n.jsx(Fs,{})}},[e]);return n.jsxs(n.Fragment,{children:[n.jsx(Hs,{}),n.jsxs("div",{className:o.body,children:[n.jsx("main",{className:o.content,children:n.jsx(x.Suspense,{fallback:n.jsx(K,{}),children:s})}),n.jsx(cs,{})]}),n.jsx(We,{})]})}const Ws=x.lazy(()=>nt(()=>import("./index-7IQKV8Y7.js"),__vite__mapDeps([0,1,2,3]))),Qs=x.lazy(()=>nt(()=>import("./index-mYNP8E8_.js"),__vite__mapDeps([4,1,5,2]))),Xs=x.lazy(()=>nt(()=>import("./index-HwnTnK21.js"),__vite__mapDeps([6,1,5]))),qs=x.lazy(()=>nt(()=>import("./index-93jUDCdv.js"),__vite__mapDeps([7,1])));$e.createRoot(document.getElementById(rt.Name)).render(n.jsx(Ue,{theme:Me,children:n.jsx(Be,{children:n.jsx(Re,{instance:I,children:n.jsxs(os,{children:[n.jsx(De,{pauseOnHover:!0}),n.jsx(_s,{})]})})})}));export{zt as A,Js as B,Fe as C,rt as D,O as F,Is as G,v as H,A as L,Os as M,Ks as S,M as a,As as b,R as c,Ve as d,Q as e,_t as f,z as u}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-7IQKV8Y7.js","assets/vendor--JR89aB4.js","assets/Lazy-S42ziN8Y.js","assets/index-scunr7sf.css","assets/index-mYNP8E8_.js","assets/Columns-WM0v5PCO.js","assets/index-HwnTnK21.js","assets/index-93jUDCdv.js"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} diff --git a/assets/index-7IQKV8Y7.js b/assets/index-DkQbb1fo.js similarity index 99% rename from assets/index-7IQKV8Y7.js rename to assets/index-DkQbb1fo.js index 8911272..e935932 100644 --- a/assets/index-7IQKV8Y7.js +++ b/assets/index-DkQbb1fo.js @@ -1,4 +1,4 @@ -import{r as D,az as Yt,aA as It,m as oe,x as Pe,j as w,s as Ke,t as R,B as Vt,aB as At,aC as Qt,ab as Jt,an as Zt,a4 as er,ar as tr,aD as rr,aE as Je}from"./vendor--JR89aB4.js";import{L as Xe,H as re,C as nr,B as Ct,a as Oe,u as ir,b as Mt,F as ye,c as ar,D as or,d as sr}from"./index-3wZvIsDj.js";import{i as Lt,b as se,r as k,a as ne,f as ur,S as Ze,L as lr}from"./Lazy-S42ziN8Y.js";var xt={},Te={},qe={},Le={},et;function cr(){return et||(et=1,function(e){(function(t,n){n(e,D,Yt)})(It,function(t,n,i){Object.defineProperty(t,"__esModule",{value:!0}),t.setHasSupportToCaptureOption=P;var r=o(n),a=o(i);function o(f){return f&&f.__esModule?f:{default:f}}var s=Object.assign||function(f){for(var m=1;m=0||Object.prototype.hasOwnProperty.call(f,c)&&(S[c]=f[c]);return S}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}var p=function(){function f(m,S){for(var c=0;c0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return g?f:f.capture}function L(f){if("touches"in f){var m=f.touches[0],S=m.pageX,c=m.pageY;return{x:S,y:c}}var O=f.screenX,x=f.screenY;return{x:O,y:x}}var C=function(f){h(m,f);function m(){var S;l(this,m);for(var c=arguments.length,O=Array(c),x=0;xO&&this.props.onSwipeRight(1,c),this.movePosition.deltaY<-O?this.props.onSwipeUp(1,c):this.movePosition.deltaY>O&&this.props.onSwipeDown(1,c)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(c){this.swiper=c,this.props.innerRef(c)}},{key:"render",value:function(){var c=this.props;c.tagName;var O=c.className,x=c.style,b=c.children;c.allowMouseEvents,c.onSwipeUp,c.onSwipeDown,c.onSwipeLeft,c.onSwipeRight,c.onSwipeStart,c.onSwipeMove,c.onSwipeEnd,c.innerRef,c.tolerance;var pe=u(c,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return r.default.createElement(this.props.tagName,s({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:O,style:x},pe),b)}}]),m}(n.Component);C.displayName="ReactSwipe",C.propTypes={tagName:a.default.string,className:a.default.string,style:a.default.object,children:a.default.node,allowMouseEvents:a.default.bool,onSwipeUp:a.default.func,onSwipeDown:a.default.func,onSwipeLeft:a.default.func,onSwipeRight:a.default.func,onSwipeStart:a.default.func,onSwipeMove:a.default.func,onSwipeEnd:a.default.func,innerRef:a.default.func,tolerance:a.default.number.isRequired},C.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},t.default=C})}(Le)),Le}(function(e){(function(t,n){n(e,cr())})(It,function(t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=r(n);function r(a){return a&&a.__esModule?a:{default:a}}t.default=i.default})})(qe);var ue={},Dt={exports:{}};/*! +import{r as D,az as Yt,aA as It,m as oe,x as Pe,j as w,s as Ke,t as R,B as Vt,aB as At,aC as Qt,ab as Jt,an as Zt,a4 as er,ar as tr,aD as rr,aE as Je}from"./vendor--JR89aB4.js";import{L as Xe,H as re,C as nr,B as Ct,a as Oe,u as ir,b as Mt,F as ye,c as ar,D as or,d as sr}from"./index-no0JSIPh.js";import{i as Lt,b as se,r as k,a as ne,f as ur,S as Ze,L as lr}from"./Lazy-oj3UQ1nd.js";var xt={},Te={},qe={},Le={},et;function cr(){return et||(et=1,function(e){(function(t,n){n(e,D,Yt)})(It,function(t,n,i){Object.defineProperty(t,"__esModule",{value:!0}),t.setHasSupportToCaptureOption=P;var r=o(n),a=o(i);function o(f){return f&&f.__esModule?f:{default:f}}var s=Object.assign||function(f){for(var m=1;m=0||Object.prototype.hasOwnProperty.call(f,c)&&(S[c]=f[c]);return S}function l(f,m){if(!(f instanceof m))throw new TypeError("Cannot call a class as a function")}var p=function(){function f(m,S){for(var c=0;c0&&arguments[0]!==void 0?arguments[0]:{capture:!0};return g?f:f.capture}function L(f){if("touches"in f){var m=f.touches[0],S=m.pageX,c=m.pageY;return{x:S,y:c}}var O=f.screenX,x=f.screenY;return{x:O,y:x}}var C=function(f){h(m,f);function m(){var S;l(this,m);for(var c=arguments.length,O=Array(c),x=0;xO&&this.props.onSwipeRight(1,c),this.movePosition.deltaY<-O?this.props.onSwipeUp(1,c):this.movePosition.deltaY>O&&this.props.onSwipeDown(1,c)),this.moveStart=null,this.moving=!1,this.movePosition=null}},{key:"_setSwiperRef",value:function(c){this.swiper=c,this.props.innerRef(c)}},{key:"render",value:function(){var c=this.props;c.tagName;var O=c.className,x=c.style,b=c.children;c.allowMouseEvents,c.onSwipeUp,c.onSwipeDown,c.onSwipeLeft,c.onSwipeRight,c.onSwipeStart,c.onSwipeMove,c.onSwipeEnd,c.innerRef,c.tolerance;var pe=u(c,["tagName","className","style","children","allowMouseEvents","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","onSwipeStart","onSwipeMove","onSwipeEnd","innerRef","tolerance"]);return r.default.createElement(this.props.tagName,s({ref:this._setSwiperRef,onMouseDown:this._onMouseDown,onTouchStart:this._handleSwipeStart,onTouchEnd:this._handleSwipeEnd,className:O,style:x},pe),b)}}]),m}(n.Component);C.displayName="ReactSwipe",C.propTypes={tagName:a.default.string,className:a.default.string,style:a.default.object,children:a.default.node,allowMouseEvents:a.default.bool,onSwipeUp:a.default.func,onSwipeDown:a.default.func,onSwipeLeft:a.default.func,onSwipeRight:a.default.func,onSwipeStart:a.default.func,onSwipeMove:a.default.func,onSwipeEnd:a.default.func,innerRef:a.default.func,tolerance:a.default.number.isRequired},C.defaultProps={tagName:"div",allowMouseEvents:!1,onSwipeUp:function(){},onSwipeDown:function(){},onSwipeLeft:function(){},onSwipeRight:function(){},onSwipeStart:function(){},onSwipeMove:function(){},onSwipeEnd:function(){},innerRef:function(){},tolerance:0},t.default=C})}(Le)),Le}(function(e){(function(t,n){n(e,cr())})(It,function(t,n){Object.defineProperty(t,"__esModule",{value:!0});var i=r(n);function r(a){return a&&a.__esModule?a:{default:a}}t.default=i.default})})(qe);var ue={},Dt={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames diff --git a/assets/index-HwnTnK21.js b/assets/index-Tn4RgmZa.js similarity index 59% rename from assets/index-HwnTnK21.js rename to assets/index-Tn4RgmZa.js index fa49c09..e1743db 100644 --- a/assets/index-HwnTnK21.js +++ b/assets/index-Tn4RgmZa.js @@ -1 +1 @@ -import{x as o,j as t,y as e}from"./vendor--JR89aB4.js";import{L as a,H as n,f as i}from"./index-3wZvIsDj.js";import{H as m}from"./Columns-WM0v5PCO.js";const s=new a("History");function l(){const{data:r}=o(()=>n.Order.Get.List(s),{onError:s.error});return t.jsx(i,{Items:r,Columns:e(()=>m(s))})}export{l as default}; +import{x as o,j as t,y as e}from"./vendor--JR89aB4.js";import{L as a,H as n,f as i}from"./index-no0JSIPh.js";import{H as m}from"./Columns-YyE5CF5f.js";const s=new a("History");function l(){const{data:r}=o(()=>n.Order.Get.List(s),{onError:s.error});return t.jsx(i,{Items:r,Columns:e(()=>m(s))})}export{l as default}; diff --git a/assets/index-cu2bTZMb.js b/assets/index-cu2bTZMb.js new file mode 100644 index 0000000..f51f86d --- /dev/null +++ b/assets/index-cu2bTZMb.js @@ -0,0 +1 @@ +import{m as w,j as e,T as f,b,F as M,B as i,r as S,ai as Be,a6 as h,a7 as C,a8 as g,o as k,I as L,aF as J,aG as F,t as E,x as I,aH as Re,ad as xe,ae as pe,af as je,ag as q,ah as Ce,L as B,ab as ge,aI as fe,aJ as Q,ac as Z,D as ee,n as V,g as ne,h as re,i as se,k as te,K as ae,aC as be,ak as ye,al as Pe,ap as Ae,N as ve,z as Le,aK as qe,aL as ze,c as _e,l as Xe,aM as Qe,a2 as Ve,a0 as We,a1 as Ye,a3 as Ke,a4 as Je,a9 as Ne,aN as Ze,as as en}from"./vendor--JR89aB4.js";import{L as x,a as H,e as A,A as m,F as G,f as R,c as Y,H as z,C as nn,G as rn,M as Fe}from"./index-no0JSIPh.js";import{O as sn,a as tn,H as an}from"./Columns-YyE5CF5f.js";import{a as on,b as cn,i as we,L as ln}from"./Lazy-oj3UQ1nd.js";var dn="[object Symbol]";function un(n){return typeof n=="symbol"||on(n)&&cn(n)==dn}var mn=/\s/;function hn(n){for(var r=n.length;r--&&mn.test(n.charAt(r)););return r}var xn=/^\s+/;function pn(n){return n&&n.slice(0,hn(n)+1).replace(xn,"")}var Se=NaN,jn=/^[-+]0x[0-9a-f]+$/i,Cn=/^0b[01]+$/i,gn=/^0o[0-7]+$/i,fn=parseInt;function bn(n){if(typeof n=="number")return n;if(un(n))return Se;if(we(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=we(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=pn(n);var s=Cn.test(n);return s||gn.test(n)?fn(n.slice(2),s?2:8):jn.test(n)?Se:+n}var Ee=1/0,yn=17976931348623157e292;function Pn(n){if(!n)return n===0?n:0;if(n=bn(n),n===Ee||n===-Ee){var r=n<0?-1:1;return r*yn}return n===n?n:0}function An(n){var r=Pn(n),s=r%1;return r===r?s?r-s:r:0}function He(n){return typeof n=="number"&&n==An(n)}const Nn=w({body:{...H,alignItems:"flex-start"}}),wn=new x("Admin","Order","Detail","Action");function Sn({OrderId:n,Status:r,Refresh:s}){const t=Nn(),{dispatch:a,dispatchToast:o}=A(wn),{run:c}=m.Order.Post.useAccept({manual:!0,onError(l,u){a({Message:"Failed Accept Order",Request:u,Error:l})},onSuccess(){o(e.jsx(f,{children:e.jsx(b,{children:"Order Accepted"})}),{intent:"success"}),s()}});switch(r){case"Processing":case"Shipping":case"Finished":case"Cancelled":case"Returning":return null}return e.jsx(M,{label:"Action",size:"large",children:e.jsx("div",{className:t.body,children:r==="Pending"&&e.jsx(i,{appearance:"subtle",onClick:()=>c(n),children:"Accept Order"})})})}const En=w({body:{...G,justifyContent:"space-between"}}),Dn=new x("Admin","Order","Detail","Append");function Tn({OrderId:n,Refresh:r}){const s=En(),[t,a]=S.useState(),{dispatch:o,dispatchToast:c}=A(Dn),{run:l}=m.Order.Post.useAppend({manual:!0,onError(p,d){o({Message:"Failed Append Comment",Request:d,Error:p})},onSuccess(){c(e.jsx(f,{children:e.jsx(b,{children:"Comment Appended"})}),{intent:"success"}),r()}}),{run:u}=m.Order.Post.useClose({manual:!0,onError(p,d){o({Message:"Failed Close Order",Request:d,Error:p})},onSuccess(){c(e.jsx(f,{children:e.jsx(b,{children:"Order Closed"})}),{intent:"success"}),r()}});return e.jsxs(e.Fragment,{children:[e.jsx(M,{label:"Append",size:"large",children:e.jsx(Be,{value:t,onChange:(p,d)=>a(d.value),maxLength:1e3})}),e.jsxs("div",{className:s.body,children:[e.jsx(i,{onClick:()=>u(n,t),children:"Force Close with Reason"}),e.jsx(i,{appearance:"primary",onClick:()=>l(n,t),children:"Add Comment"})]})]})}const De=w({ten:{flexBasis:"10%",flexGrow:0}}),In=[h({columnId:"Product",renderHeaderCell(){return e.jsx(C,{children:"Name"})},renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Type",renderHeaderCell(){return e.jsx(C,{children:"Type"})},renderCell(n){return e.jsx(g,{children:Object.entries(n.Type).reduce((r,s)=>`${r} ${s[0]} : ${s[1]} ;`,"")})}}),h({columnId:"Quantity",renderHeaderCell(){return e.jsx(C,{className:De().ten,children:"Quantity"})},renderCell(n){return e.jsx(g,{className:De().ten,children:n.Quantity})}})];function $n({Items:n}){return e.jsx(R,{Items:n,Columns:In})}const kn=new x("Admin","Order","Detail","Shipment");function Gn({OrderId:n,TrackingNumber:r,Refresh:s}){const[t,{setTrue:a,setFalse:o}]=k(),[c,l]=S.useState(r),{dispatch:u,dispatchToast:p}=A(kn),{run:d}=m.Order.Post.useShip({manual:!0,onError(j,y){u({Message:"Failed Update Tracking Number",Request:y,Error:j})},onSuccess(){p(e.jsx(f,{children:e.jsx(b,{children:"Tracking Number Updated"})}),{intent:"success"}),o(),s()}});return e.jsx(M,{label:"Shipment",size:"large",children:e.jsx(L,{value:c,disabled:!t,appearance:"underline",onChange:(j,y)=>l(y.value),placeholder:"Fill in this field to ship the order.",contentAfter:t?e.jsx(i,{appearance:"subtle",icon:e.jsx(J,{}),onClick:()=>d(n,c)}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:a})})})}const Rn=w({body:{...H,rowGap:E.spacingVerticalXL}}),oe=new x("Admin","Order","Detail");function vn({OrderId:n}){const r=Rn(),[s,{setTrue:t,setFalse:a}]=k(),{Nav:o,Paths:c}=Y(),l=parseInt(c.at(2)),{data:u,run:p}=I(()=>m.Order.Get.Detail(n,oe),{manual:!0,onError:oe.error}),{data:d,run:j}=I(()=>m.Order.Get.Order(n),{onError(N){o("Admin","Order"),oe.error(N)},manual:!0});function y(){j(),p()}return S.useEffect(()=>{l===n?(y(),t()):a()},[l]),e.jsxs(e.Fragment,{children:[e.jsx(i,{appearance:"subtle",icon:e.jsx(Re,{}),onClick:()=>o("Admin","Order",n)}),e.jsxs(xe,{open:s,position:"end",size:"medium",modalType:"alert",children:[e.jsx(pe,{children:e.jsx(je,{action:e.jsx(i,{appearance:"subtle",icon:e.jsx(q,{}),onClick:()=>o("Admin","Order")}),children:"Order Detail"})}),e.jsxs(Ce,{className:r.body,children:[e.jsx(sn,{OrderId:n,Order:d,Admin:!0}),e.jsx(M,{label:"Required Products",size:"large",children:e.jsx($n,{Items:u?.ShopCart})}),e.jsx(Gn,{OrderId:n,TrackingNumber:d?.TrackingNumber,Refresh:y}),e.jsx(tn,{Comments:u?.Comments}),e.jsx(Tn,{OrderId:n,Refresh:y}),e.jsx(Sn,{OrderId:n,Status:d?.Status,Refresh:y})]})]})]})}const X=w({two:{flexBasis:"2.5%",flexGrow:0},twoc:{flexBasis:"2.5%",flexGrow:0,justifyContent:"center"},ten:{flexBasis:"10%",flexGrow:0},page:{...G,alignItems:"center",justifyContent:"flex-end",paddingTop:E.spacingVerticalXL,columnGap:E.spacingHorizontalM},spin:{width:"4rem"}}),K=new x("Admin","Order"),Vn=[...an(K).slice(0,-1),h({columnId:"User",renderHeaderCell:()=>e.jsx(C,{className:X().ten,children:"User"}),renderCell(n){return e.jsx(g,{className:X().ten,children:n.User})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:X().two,children:"Action"}),renderCell(n){return e.jsx(g,{className:X().twoc,children:e.jsx(vn,{OrderId:n.Id})})}})];function Fn(){const n=X(),{data:r}=I(()=>m.Order.Get.Count(),{onError:K.error}),s=Math.ceil((r||1)/30),{data:t,run:a}=I(o=>m.Order.Get.List(o,K),{defaultParams:[1],debounceWait:300,onError:K.error});return e.jsxs(e.Fragment,{children:[e.jsx(R,{Items:t,Columns:Vn}),e.jsxs("div",{className:n.page,children:[e.jsxs(B,{children:["Total ",r," Records"]}),e.jsx(ge,{min:1,max:s,defaultValue:1,className:n.spin,onChange:(o,c)=>{const l=parseInt(c.value||c.displayValue);!Number.isNaN(l)&&l&&l<=s&&a(l)}}),e.jsx(B,{children:"/"}),e.jsx(B,{children:s})]})]})}const Hn=w({body:{...G,alignItems:"center"},input:{flexGrow:1}}),ce=new x("Admin","Product","Detail","Category");function On({ProdId:n}){const[r,s]=S.useState(""),[t,{setTrue:a,setFalse:o}]=k();I(()=>m.Product.Get.Category(n),{onSuccess(P){P&&s(P)},onError:ce.error});const{dispatch:c,dispatchToast:l}=A(ce),{run:u}=m.Product.Patch.useCategory({manual:!0,onError(P,$){c({Message:"Failed Update Category",Request:$,Error:P})},onSuccess(){l(e.jsx(f,{children:e.jsx(b,{children:"Category Updated"})}),{intent:"success"}),o()}}),{run:p}=m.Product.Delete.useCategory({manual:!0,onError(P,$){c({Message:"Failed Detach Category",Request:$,Error:P})},onSuccess(){l(e.jsx(f,{children:e.jsx(b,{children:"Category Detached"})}),{intent:"success"}),o()}}),{data:d}=I(()=>z.Gallery.Get.Categories(),{onSuccess(P){y(P)},onError:ce.error}),[j,y]=S.useState(d),[N,D]=S.useState(""),T=Hn();return e.jsxs("div",{className:T.body,children:[e.jsx(B,{size:"large",disabled:!t,children:"Category"}),e.jsxs(fe,{className:T.input,size:"large",disabled:!t,freeform:!0,placeholder:r||"Pending",appearance:"underline",onChange:P=>{const $=P.target.value.trim(),v=d?.filter(Me=>Me.toLowerCase().indexOf($.toLowerCase())===0);y(v),$&&v&&v.length<1?D($):D("")},onOptionSelect:(P,$)=>{const v=$.optionText;s(v),v&&d?.includes(v)?D(""):D(v)},children:[N&&e.jsxs(Q,{text:N,children:['Create New "',N,'"']},N),j?.map(P=>e.jsx(Q,{children:P},P)),j?.length===d?.length?e.jsx(Q,{text:"",children:"Pending"},""):null]}),t?e.jsx(i,{appearance:"subtle",icon:e.jsx(J,{}),onClick:()=>{r?u(n,r):p(n)}}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:a})]})}const Un=new x("Admin","Product","Detail","Combo","Delete");function Mn({ComboId:n,Refresh:r}){const{dispatch:s,dispatchToast:t}=A(Un),{run:a}=m.Product.Delete.useCombo({manual:!0,onError(o,c){s({Message:"Failed Delete Combo",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Combo Deleted"})}),{intent:"success"}),r()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(Z,{}),onClick:()=>a(n)})}const Bn=[h({columnId:"Variant",renderHeaderCell:()=>e.jsx(C,{children:"Variant"}),renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Type",renderHeaderCell:()=>e.jsx(C,{children:"Type"}),renderCell(n){return e.jsx(g,{children:e.jsx(fe,{defaultValue:n.Current,defaultSelectedOptions:[n.Current],onOptionSelect:(r,s)=>n.Update(s.optionValue),children:n.Types.map((r,s)=>e.jsx(Q,{children:r},s))})})}})],Ln=w({body:{...G,justifyContent:"flex-end",alignItems:"center",columnGap:E.spacingVerticalM,marginTop:E.spacingHorizontalM}}),le=new x("Admin","Product","Detail","Combo","Detail");function qn({Id:n,ProdId:r,Combo:s,Stock:t,Refresh:a}){const[o,{toggle:c}]=k(),[l,u]=S.useState(s),[p,d]=S.useState(t),{data:j}=I(()=>m.Product.Get.Variants(r,le),{onError:le.error}),{dispatch:y,dispatchToast:N}=A(le),{run:D}=m.Product.Patch.useCombo({manual:!0,onError(T,P){y({Message:"Failed Update Combo",Request:P,Error:T})},onSuccess(){N(e.jsx(f,{children:e.jsx(b,{children:"Combo Updated"})}),{intent:"success"}),a(),c()}});return e.jsxs(ee,{open:o,onOpenChange:c,children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsx(ne,{children:e.jsxs(re,{children:[e.jsx(se,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(q,{})})}),children:"Combo Detail"}),e.jsxs(te,{children:[e.jsx(R,{Items:j?.map(T=>({Current:l[T.Name],Update(P){l[T.Name]=P,u({...l})},...T})),Columns:Bn}),e.jsxs("div",{className:Ln().body,children:[e.jsx(B,{children:"Stock"}),e.jsx(ge,{value:p,min:0,onChange:(T,P)=>{if(P.value)d(P.value);else if(P.displayValue){const $=parseInt(P.displayValue);He($)&&d($)}}}),e.jsx(i,{appearance:"primary",onClick:()=>D(n,l,p),children:"Submit"})]})]})]})})]})}const zn=[h({columnId:"Variant",renderHeaderCell:()=>e.jsx(C,{children:"Variant"}),renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Type",renderHeaderCell:()=>e.jsx(C,{children:"Type"}),renderCell(n){return e.jsx(g,{children:e.jsx(fe,{onOptionSelect:(r,s)=>n.Update(s.optionValue),children:n.Types.map((r,s)=>e.jsx(Q,{children:r},s))})})}})],_n=w({body:{...G,justifyContent:"flex-end",alignItems:"center",columnGap:E.spacingVerticalM,marginTop:E.spacingHorizontalM}}),ie=new x("Admin","Product","Detail","Combo","NewCombo");function Xn({ProdId:n,Refresh:r}){const[s,{toggle:t}]=k(),[a,o]=S.useState({}),[c,l]=S.useState(1),{data:u}=I(()=>m.Product.Get.Variants(n,ie),{onSuccess(y){for(const N of y)a[N.Name]="";o({...a})},onError:ie.error}),{dispatch:p,dispatchToast:d}=A(ie),{run:j}=m.Product.Post.useCombo({manual:!0,onError(y,N){p({Message:"Failed Create Combo",Request:N,Error:y})},onSuccess(){d(e.jsx(f,{children:e.jsx(b,{children:"Combo Created"})}),{intent:"success"}),r(),t()}});return e.jsxs(ee,{open:s,onOpenChange:t,children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"primary",icon:e.jsx(ae,{}),children:"New Combo"})}),e.jsx(ne,{children:e.jsxs(re,{children:[e.jsx(se,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(q,{})})}),children:"New Combo"}),e.jsxs(te,{children:[e.jsx(R,{Items:u?.map(y=>({Update(N){a[y.Name]=N,o({...a})},...y})),Columns:zn}),e.jsxs("div",{className:_n().body,children:[e.jsx(B,{children:"Stock"}),e.jsx(ge,{value:c,min:0,onChange:(y,N)=>{if(N.value)l(N.value);else if(N.displayValue){const D=parseInt(N.displayValue);He(D)&&l(D)}}}),e.jsx(i,{appearance:"primary",onClick:()=>j(n,a,c),children:"Create"})]})]})]})})]})}const O=w({body:{...G,justifyContent:"space-between"},four:{flexBasis:"4%",flexGrow:0},seven:{flexBasis:"7%",flexGrow:0},five:{flexBasis:"5%",flexGrow:0}}),Te=new x("Admin","Product","Detail","Combo"),Qn=[h({columnId:"Id",renderHeaderCell:()=>e.jsx(C,{className:O().four,children:"Id"}),renderCell(n){return e.jsx(g,{className:O().four,children:n.Id})}}),h({columnId:"Combo",renderHeaderCell:()=>e.jsx(C,{children:"Combo"}),renderCell(n){return e.jsx(g,{children:Object.entries(n.Combo).reduce((r,s)=>`${r} ${s[0]} : ${s[1]} ;`,"")})}}),h({columnId:"Stock",renderHeaderCell:()=>e.jsx(C,{className:O().five,children:"Stock"}),renderCell(n){return e.jsx(g,{className:O().five,children:n.Stock})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:O().seven,children:"Action"}),renderCell(n){return e.jsxs(g,{className:O().seven,children:[e.jsx(qn,{...n}),e.jsx(Mn,{ComboId:n.Id,Refresh:n.Refresh})]})}})];function Wn({ProdId:n}){const{data:r,run:s}=I(()=>z.Product.Get.Combo(n,Te),{onError:Te.error});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:O().body,children:[e.jsx(be,{children:"Combo"}),e.jsx(Xn,{ProdId:n,Refresh:s})]}),e.jsx(R,{Items:r?.map(t=>({ProdId:n,Refresh:s,...t})),Columns:Qn})]})}const Yn=new x("Admin","Product","Detail","Delete"),Kn=w({root:{...H,rowGap:E.spacingHorizontalS}});function Jn({ProdId:n}){const{Nav:r}=Y(),{dispatch:s,dispatchToast:t}=A(Yn),{run:a,loading:o}=m.Product.Delete.useProduct({manual:!0,onError(l,u){s({Message:"Failed Delete Product",Request:u,Error:l})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Product Deleted"})}),{intent:"success"}),r("/Admin")}}),c=Kn();return e.jsx("div",{children:e.jsxs(ye,{withArrow:!0,children:[e.jsx(Pe,{disableButtonEnhancement:!0,children:e.jsx(i,{children:"Delete Product"})}),e.jsxs(Ae,{className:c.root,children:["Are You Sure?",e.jsx(i,{disabled:o,appearance:"primary",onClick:()=>a(n),children:"Yes"})]})]})})}const Zn=w({btn:{...G,columnGap:E.spacingVerticalS},drawer:{width:"1100px"}}),er=new x("Admin","Product","Lexical");function nr({ProdId:n}){const r=Zn(),[s,{toggle:t,setTrue:a}]=k(),{data:o,run:c}=I(()=>z.Product.Get.Lexical(n)),{dispatch:l,dispatchToast:u}=A(er),{run:p}=m.Product.Post.useLexical({manual:!0,onError(d,j){l({Message:"Failed Update Description",Request:j,Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Description Updated"})}),{intent:"success"}),c(),t()}});return e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsx(i,{onClick:()=>a(),children:"Open Description Editor"})}),e.jsxs(xe,{open:s,onOpenChange:t,position:"start",size:"large",modalType:"alert",className:r.drawer,children:[e.jsx(pe,{children:e.jsx(je,{action:e.jsxs("div",{className:r.btn,children:[e.jsx(i,{appearance:"primary",onClick:()=>p(n),children:"Save"}),e.jsx(i,{onClick:()=>t(),children:"Cancel"})]}),children:"Edit Product Description"})}),e.jsx(Ce,{children:e.jsx(ln,{State:o?.Description})})]})]})}const Ie=new x("Admin","Product","Detail","Name");function rr({ProdId:n}){const[r,s]=S.useState(""),[t,{setTrue:a,setFalse:o}]=k(),{Nav:c}=Y();I(()=>m.Product.Get.Name(n),{onSuccess(d){s(d)},onError(d){c("Admin"),Ie.error(d)}});const{dispatch:l,dispatchToast:u}=A(Ie),{run:p}=m.Product.Patch.useName({manual:!0,onError(d,j){l({Message:"Failed Update Name",Request:j,Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Name Updated"})}),{intent:"success"}),o()}});return e.jsx(L,{size:"large",value:r,disabled:!t,appearance:"underline",onChange:(d,j)=>s(j.value),contentBefore:e.jsx(ve,{children:"Name"}),contentAfter:t?e.jsx(i,{appearance:"subtle",icon:e.jsx(J,{}),onClick:()=>p(n,r)}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:a})})}const sr=new x("Admin","Product","Detail","Photo","Edit","Caption");function tr({Id:n,Caption:r}){const[s,t]=S.useState(r||""),{dispatch:a,dispatchToast:o}=A(sr),{run:c}=m.Product.Patch.useCaption({manual:!0,onError(l,u){a({Message:"Failed Update Caption",Request:u,Error:l})},onSuccess(){o(e.jsx(f,{children:e.jsx(b,{children:"Caption Updated"})}),{intent:"success"})}});return e.jsxs(e.Fragment,{children:[e.jsx(M,{label:"Caption",children:e.jsx(L,{value:s,placeholder:"Write some infomation here?",onChange:(l,u)=>t(u.value)})}),e.jsx(i,{onClick:()=>c(n,s),children:"Save Caption"})]})}const ar=new x("Admin","Product","Detail","Photo","Edit","Delete");function or({Id:n,ProductId:r}){const{dispatch:s,dispatchToast:t}=A(ar),{run:a}=m.Product.Delete.usePhoto({manual:!0,onError(o,c){s({Message:"Failed Delete Photo",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Photo Deleted"})}),{intent:"success"})}});return e.jsx(i,{appearance:"primary",onClick:()=>a(r,n),children:"Delete"})}const $e=new x("Admin","Product","Detail","Photo","Edit","Replace");function cr({Id:n}){const{dispatch:r,dispatchToast:s}=A($e),{run:t}=m.Product.Patch.usePhoto($e,{manual:!0,onBefore([a,o]){s(e.jsx(f,{children:e.jsxs(b,{children:["Uploading Photo ",o.name," for Product ",a," to replace ",n]})}),{intent:"info"})},onError(a,o){r({Message:"Failed Update Photo",Request:o,Error:a})},onSuccess(){s(e.jsx(f,{children:e.jsx(b,{children:"Photo Updated"})}),{intent:"success"})}});return e.jsx(i,{onClick:()=>{const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=()=>{a.files&&t(n,a.files[0])},a.click()},children:"Replace"})}const lr=w({box:{...G,columnGap:E.spacingHorizontalL},img:{...nn,aspectRatio:"1",width:"50%"},cap:{...H,flexGrow:1,rowGap:E.spacingVerticalL}}),ir=new x("Admin","Product","Detail","Photo","Edit");function dr(n){const{Id:r,Cover:s}=n,t=lr();return e.jsxs(ee,{children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsx(ne,{children:e.jsxs(re,{children:[e.jsx(se,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(q,{})})}),children:"Image Detail"}),e.jsxs(te,{className:t.box,children:[e.jsx(rn,{shape:"rounded",className:t.img,Guid:s,Log:ir}),e.jsxs("div",{className:t.cap,children:[e.jsx(tr,{...n}),e.jsx(cr,{Id:r}),e.jsx(or,{...n})]})]})]})})]})}const de=w({f11:{flexBasis:"11%",flexGrow:0},box:{...G,justifyContent:"space-between"}}),W=new x("Admin","Product","Detail","Photo"),ur=[Fe(70,W),h({columnId:"Caption",renderHeaderCell:()=>e.jsx(C,{children:"Caption"}),renderCell(n){return e.jsx(g,{children:n.Caption||"No Caption"})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:de().f11,children:"Action"}),renderCell(n){const{dispatch:r}=A(W),{run:s}=m.Product.Post.useMovePhoto({manual:!0,onError(t,a){r({Message:"Failed Update Order",Request:a,Error:t})},onSuccess:mr});return e.jsxs(g,{className:de().f11,children:[e.jsx(i,{appearance:"subtle",icon:e.jsx(qe,{}),onClick:()=>s(n.Id,!0)}),e.jsx(i,{appearance:"subtle",icon:e.jsx(ze,{}),onClick:()=>s(n.Id,!1)}),e.jsx(dr,{...n})]})}})];let mr=()=>{};function hr({ProdId:n}){const r=Le(async()=>{const[o]=await z.Product.Get.PhotoList(n,W);return o.map(l=>({Id:l.PhotoId,Cover:l.ObjectId,Caption:l.Caption,ProductId:l.ProductId}))}),{dispatch:s,dispatchToast:t}=A(W),{run:a}=m.Product.Post.usePhoto(W,{manual:!0,onBefore([o,c]){t(e.jsx(f,{children:e.jsxs(b,{children:["Uploading Photo ",c.name," for Product ",o]})}),{intent:"info"})},onError(o,c){s({Message:"Failed Upload Photo",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Photo Uploaded"})}),{intent:"success"})}});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:de().box,children:[e.jsx(be,{children:"Photos"}),e.jsx(i,{appearance:"primary",icon:e.jsx(ae,{}),onClick:()=>{const o=document.createElement("input");o.type="file",o.accept="image/*",o.onchange=()=>{o.files&&a(n,o.files[0])},o.click()},children:"New Image"})]}),e.jsx(R,{Items:r,Columns:ur})]})}const xr=new x("Admin","Product","Detail","Variant","Delete");function pr({VariantId:n,Refresh:r}){const{dispatch:s,dispatchToast:t}=A(xr),{run:a}=m.Product.Delete.useVariant({manual:!0,onError(o,c){s({Message:"Failed Delete Variant",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Variant Deleted"})}),{intent:"success"}),r()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(Z,{}),onClick:()=>a(n)})}const jr=new x("Admin","Product","Detail","Variant","Edit","TypeDelete");function Cr({VariantId:n,Type:r,Refresh:s}){const{dispatch:t,dispatchToast:a}=A(jr),{run:o}=m.Product.Delete.useType({manual:!0,onError(c,l){t({Message:"Failed Delete Type",Request:l,Error:c})},onSuccess(){a(e.jsx(f,{children:e.jsx(b,{children:"Type Deleted"})}),{intent:"success"}),s()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(Z,{}),onClick:()=>o(n,r)})}const gr=new x("Admin","Product","Detail","Variant","Edit","Name");function fr({Id:n,Name:r}){const[s,t]=S.useState(r),[a,{setTrue:o,setFalse:c}]=k(),{dispatch:l,dispatchToast:u}=A(gr),{run:p}=m.Product.Patch.useVariantName({manual:!0,onError(d,j){l({Message:"Failed Update Variant Name",Request:j[0],Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Variant Name Updated"})}),{intent:"success"}),c()}});return e.jsx(L,{size:"large",value:s,disabled:!a,appearance:"underline",onChange:(d,j)=>t(j.value),contentBefore:e.jsx(ve,{children:"Name"}),contentAfter:a?e.jsx(i,{appearance:"subtle",icon:e.jsx(J,{}),onClick:()=>p(n,s)}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:o})})}const br=w({body:{...H,rowGap:E.spacingVerticalM}}),yr=new x("Admin","Product","Detail","Variant","Edit","Type");function Oe({VariantId:n,Type:r,Refresh:s,New:t}){const a=br(),[o,{toggle:c}]=k(),[l,u]=S.useState(r||""),{dispatch:p,dispatchToast:d}=A(yr),j={manual:!0,onError(D,T){p({Message:`Failed ${t?"Create":"Update"} Type ${l}`,Request:T,Error:D})},onSuccess(D){d(e.jsxs(f,{children:[e.jsxs(b,{children:["Type ",t?"Created":"Updated"]}),e.jsxs(_e,{children:[D," ",l]})]}),{intent:"success"}),s(),u(""),c()}},{run:y}=m.Product.Post.useType(j),{run:N}=m.Product.Patch.useType(j);return e.jsxs(ye,{withArrow:!0,open:o,onOpenChange:c,children:[e.jsx(Pe,{disableButtonEnhancement:!0,children:t?e.jsx(i,{icon:e.jsx(ae,{}),appearance:"primary",children:"New Type"}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsxs(Ae,{className:a.body,children:[e.jsx(M,{label:"Type Name",children:e.jsx(L,{value:l,onChange:(D,T)=>u(T.value)})}),e.jsx(i,{onClick:()=>t?y(n,l):N(n,r,l),children:"Submit"})]})]})}const ue=w({body:{...H,rowGap:E.spacingVerticalM},twelve:{flexBasis:"12%",flexGrow:0}}),Pr=[h({columnId:"Name",renderHeaderCell:()=>e.jsx(C,{children:"Name"}),renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:ue().twelve,children:"Action"}),renderCell(n){return e.jsxs(g,{className:ue().twelve,children:[e.jsx(Oe,{VariantId:n.VariantId,Type:n.Name,Refresh:n.Refresh}),e.jsx(Cr,{VariantId:n.VariantId,Type:n.Name,Refresh:n.Refresh})]})}})];function Ar({Variant:n,Refresh:r}){return e.jsxs(ee,{children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsx(ne,{children:e.jsxs(re,{children:[e.jsx(se,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(q,{})})}),children:"Variant Detail"}),e.jsxs(te,{className:ue().body,children:[e.jsx(fr,{Id:n.Id,Name:n.Name}),e.jsx(R,{Items:n.Types.map((s,t)=>({Id:t,Name:s,VariantId:n.Id,Refresh:r})),Columns:Pr})]}),e.jsx(Xe,{children:e.jsx(Oe,{VariantId:n.Id,Refresh:r,New:!0})})]})})]})}const Nr=w({body:{...H,rowGap:E.spacingVerticalM}}),wr=new x("Admin","Product","Detail","Variant","New");function Sr({ProdId:n,Refresh:r}){const s=Nr(),[t,{toggle:a}]=k(),[o,c]=S.useState(""),{dispatch:l,dispatchToast:u}=A(wr),{run:p}=m.Product.Post.useVariant({manual:!0,onError(d,j){l({Message:"Failed Create Variant",Request:j,Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Variant Created"})}),{intent:"success"}),r(),c(""),a()}});return e.jsxs(ye,{withArrow:!0,open:t,onOpenChange:a,children:[e.jsx(Pe,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"primary",icon:e.jsx(ae,{}),children:"New Variant"})}),e.jsxs(Ae,{className:s.body,children:[e.jsx(M,{required:!0,label:"Variant Name",children:e.jsx(L,{value:o,onChange:(d,j)=>c(j.value)})}),e.jsx(i,{onClick:()=>p(n,o),children:"Add"})]})]})}const U=w({body:{...G,justifyContent:"space-between"},four:{flexBasis:"4%",flexGrow:0},seven:{flexBasis:"7%",flexGrow:0},twelve:{flexBasis:"12%",flexGrow:0}}),ke=new x("Admin","Product","Detail","Variant"),Er=[h({columnId:"Id",renderHeaderCell:()=>e.jsx(C,{className:U().four,children:"Id"}),renderCell(n){return e.jsx(g,{className:U().four,children:n.Id})}}),h({columnId:"Name",renderHeaderCell:()=>e.jsx(C,{className:U().twelve,children:"Name"}),renderCell(n){return e.jsx(g,{className:U().twelve,children:n.Name})}}),h({columnId:"Type",renderHeaderCell:()=>e.jsx(C,{children:"Type"}),renderCell(n){return e.jsx(g,{children:n.Types.reduce((r,s)=>`${r} ${s} ;`,"")})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:U().seven,children:"Action"}),renderCell(n){return e.jsxs(g,{className:U().seven,children:[e.jsx(Ar,{Variant:n,Refresh:me}),e.jsx(pr,{VariantId:n.Id,Refresh:me})]})}})];let me;function Dr({ProdId:n}){const r=U(),{data:s,run:t}=I(()=>m.Product.Get.Variants(n,ke),{onError:ke.error});return me=t,e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.body,children:[e.jsx(be,{children:"Variant"}),e.jsx(Sr,{ProdId:n,Refresh:t})]}),e.jsx(R,{Items:s,Columns:Er})]})}const Tr=w({body:{...H,rowGap:E.spacingVerticalXL,paddingBottom:E.spacingVerticalXXXL}});function Ir({ProdId:n}){const r=Tr(),[s,{setFalse:t,setTrue:a}]=k(),{Nav:o,Paths:c}=Y(),l=parseInt(c.at(1));return S.useEffect(()=>{l===n?a():t()},[c]),e.jsxs(e.Fragment,{children:[e.jsx(i,{appearance:"subtle",icon:e.jsx(Re,{}),onClick:()=>{o("Admin",n),a()}}),e.jsxs(xe,{open:s,position:"end",size:"large",modalType:"alert",children:[e.jsx(pe,{children:e.jsx(je,{action:e.jsx(i,{appearance:"subtle",icon:e.jsx(q,{}),onClick:()=>{o("Admin"),t()}}),children:"Product Detail"})}),e.jsxs(Ce,{className:r.body,children:[e.jsx(rr,{ProdId:n}),e.jsx(On,{ProdId:n}),e.jsx(hr,{ProdId:n}),e.jsx(Dr,{ProdId:n}),e.jsx(Wn,{ProdId:n}),e.jsx(nr,{ProdId:n}),e.jsx(Jn,{ProdId:n})]})]})]})}const _=new x("Admin","Product","Row");function $r({item:n}){const[r,s]=S.useState(()=>({Id:n,Cover:"",Name:"Loading..."})),[t,{setTrue:a}]=k(),o=z.Product.Get;return Qe(async()=>{const c=await o.Product(n).catch(_.error);if(!c)return _.warn(`Product ${n} Not Found`),a();let l={...r,Name:c.Name,Category:c.Category||"Pending"};s(l);const[u,p]=await o.PhotoList(n,_);p||_.warn(`Product ${n} has no photo`),s(l={...l,Cover:p});const d=await m.Product.Get.Count(n).catch(_.error);d&&s({...l,...d})},[]),t?null:e.jsx(Ve,{children:({renderCell:c})=>c(r)},n)}const Ge=w({two:{flexBasis:"2.5%",flexGrow:0},twoc:{flexBasis:"2.5%",flexGrow:0,justifyContent:"center"}}),Ue=new x("Admin","Product"),kr=[Fe(50,Ue),h({columnId:"Product",renderHeaderCell:()=>e.jsx(C,{children:"Product"}),renderCell(n){return e.jsx(g,{children:e.jsx(Ne,{children:n.Name})})}}),h({columnId:"Category",renderHeaderCell:()=>e.jsx(C,{children:"Category"}),renderCell(n){return e.jsx(g,{children:e.jsx(Ne,{children:n.Category})})}}),h({columnId:"Variant",renderHeaderCell:()=>e.jsx(C,{children:"Variant"}),renderCell(n){return e.jsx(g,{children:n.Variant})}}),h({columnId:"Combo",renderHeaderCell:()=>e.jsx(C,{children:"Combo"}),renderCell(n){return e.jsx(g,{children:n.Combo})}}),h({columnId:"Stock",renderHeaderCell:()=>e.jsx(C,{children:"Stock"}),renderCell(n){return e.jsx(g,{children:n.Stock})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:Ge().two,children:"Detail"}),renderCell(n){return e.jsx(g,{className:Ge().twoc,children:e.jsx(Ir,{ProdId:n.Id})})}})];function Gr(){const n=m.Product.Get.useList(Ue);return e.jsxs(We,{items:n?n.reverse():[],columns:kr,children:[e.jsx(Ye,{children:e.jsx(Ve,{children:({renderHeaderCell:r})=>r()})}),e.jsx(Ke,{children:r=>e.jsx($r,{...r})}),!n&&e.jsx(Je,{size:48})]})}const Rr=new x("Admin","User","Delete");function vr({UserId:n,Refresh:r}){const{dispatch:s,dispatchToast:t}=A(Rr),{run:a}=m.User.Delete.useUser({manual:!0,onError(o,c){s({Message:"Failed Delete User",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"User Deleted"})}),{intent:"success"}),r()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(Z,{}),onClick:()=>a(n)})}const Vr=new x("Admin","User","Grant");function Fr({UserId:n,Admin:r,Refresh:s}){const{dispatch:t,dispatchToast:a}=A(Vr),{run:o}=m.User.Post.useAdmin({manual:!0,onError(l,u){t({Message:"Failed Grant Admin",Request:u,Error:l})},onSuccess(){a(e.jsx(f,{children:e.jsx(b,{children:"Admin Granted"})}),{intent:"success"}),s()}}),{run:c}=m.User.Delete.useAdmin({manual:!0,onError(l,u){t({Message:"Failed Revoke Admin",Request:u,Error:l})},onSuccess(){a(e.jsx(f,{children:e.jsx(b,{children:"Admin Revoked"})}),{intent:"success"}),s()}});return e.jsx(Ze,{checked:r,onChange:(l,u)=>{u.checked?o(n):c(n)}})}const Hr=new x("Admin","User"),Or=[h({columnId:"Id",renderHeaderCell:()=>"Id",renderCell(n){return n.Id}}),h({columnId:"Name",renderHeaderCell:()=>"Real Name",renderCell(n){return n.Name}}),h({columnId:"Email",renderHeaderCell:()=>"E-Mail",renderCell(n){return n.EMail}}),h({columnId:"Admin",renderHeaderCell:()=>"Admin",renderCell(n){return e.jsx(Fr,{UserId:n.Id,Admin:n.Admin,Refresh:he})}}),h({columnId:"Delete",renderHeaderCell:()=>"Delete",renderCell(n){return e.jsx(vr,{UserId:n.Id,Refresh:he})}})].map(({renderHeaderCell:n,renderCell:r,...s})=>({...s,renderHeaderCell:()=>e.jsx(C,{children:n()}),renderCell:t=>e.jsx(g,{children:r(t)})}));let he;function Ur(){const{data:n,run:r}=I(()=>m.User.Get.List(),{onError:Hr.error});return he=r,e.jsx(R,{Items:n,Columns:Or})}const Mr=new x("Admin");function _r(){const{Paths:n,Nav:r}=Y(),s=n.at(1),t=S.useMemo(()=>{switch(s){case"Order":return e.jsx(Fn,{});case"User":return e.jsx(Ur,{});default:return e.jsx(Gr,{})}},[s]),a=z.User.Get.useMe(Mr);return a?a.Admin?t:r("/"):e.jsx(en,{size:"huge",label:"Authenticating..."})}export{_r as default}; diff --git a/assets/index-mm5L4EFF.js b/assets/index-lt_pJMTs.js similarity index 99% rename from assets/index-mm5L4EFF.js rename to assets/index-lt_pJMTs.js index 67e141e..1e8c511 100644 --- a/assets/index-mm5L4EFF.js +++ b/assets/index-lt_pJMTs.js @@ -1,4 +1,4 @@ -import{r as $,j as p,aV as yg,aW as vg,aA as ns,at as Ja,an as Va,aX as Sg,aY as $g,aZ as Rg,B as Un,a_ as Ag,a$ as Og,m as it,s as P,aq as Wr,t as an,b0 as Xa,b1 as wg,b2 as Dg,b3 as gt,I as Gn,E as Lg,b4 as Mg,b5 as Za,b6 as Le,b7 as qa,b8 as Qa,b9 as eu,ba as tu,bb as nu,bc as ru,bd as Ti,be as iu,h as ou,i as lu,k as su,F as Or,l as au,n as yi,R as pr,U as mr,bf as yt,bg,bh as rs,bi as is,bj as os,bk as ls,bl as ss,bm as as,bn as us,bo as cs,W as _r,Y as Cr,$ as ue,ak as kg,al as Ig,ap as Pg,bp as Fg,bq as Bg,br as jg,bs as zg,bt as sr,bu as Kg,bv as Hg,bw as Wg,bx as Ug,K as Gg,by as Yg,D as ds,bz as Jg,g as gs,bA as Vg,bB as Xg,bC as fs,bD as Zg,bE as qg,bF as Qg,bG as ef,bH as tf,bI as nf}from"./vendor--JR89aB4.js";import{F as uu,B as cu,d as rf,D as du,S as of}from"./index-3wZvIsDj.js";var gu={},Ui={},fu=$;let hu=fu.createContext(null);Ui.LexicalComposerContext=hu;Ui.createLexicalComposerContext=function(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e??(n!=null?n.getTheme():null)}}};Ui.useLexicalComposerContext=function(){let t=fu.useContext(hu);if(t==null)throw Error("Minified Lexical error #8; visit https://lexical.dev/docs/error?code=8 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return t};const lf=Ui;var X=lf,R={};let ul={},pu={},wr={},xr={},Do={},Fn={},cl={},Lo={},Dr={},Lr={},Pt={},dl={},gl={},mu={},_u={},Cu={},xu={},Nu={},Eu={},Tu={},vi={},yu={},vu={},Su={},$u={},Ru={},Au={},Ou={},wu={},Du={},fl={},hl={},Lu={},Mu={},bu={};function D(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let At=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sf=At&&"documentMode"in document?document.documentMode:null,Ie=At&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),un=At&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Si=At&&"InputEvent"in window&&!sf?"getTargetRanges"in new window.InputEvent("input"):!1,pl=At&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ml=At&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,af=At&&/^(?=.*Chrome).*/i.test(navigator.userAgent),_l=At&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!af,Gi=pl||ml||_l?" ":"​",uf=un?" ":Gi,cf=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,df=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,nn={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},gf={directionless:1,unmergeable:2},hs={center:2,end:6,justify:4,left:1,right:3,start:5},ff={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},hf={normal:0,segmented:2,token:1},pf={0:"normal",2:"segmented",1:"token"},Mo=!1,Cl=0;function mf(t){Cl=t.timeStamp}function uo(t,e,n){return e.__lexicalLineBreak===t||t[`__lexicalKey_${n._key}`]!==void 0}function _f(t){return t.getEditorState().read(()=>{let e=Q();return e!==null?e.clone():null})}function ku(t,e,n){Mo=!0;let r=100{let i=Q()||_f(t);var o=new Map,l=t.getRootElement(),s=t._editorState,a=t._blockCursorElement;let c=!1,g="";for(var d=0;d{ku(t,e,n)})}let Cf=1,xf=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function xl(t){let e=document.activeElement;if(e===null)return!1;let n=e.nodeName;return q(Gr(t))&&(n==="INPUT"||n==="TEXTAREA"||e.contentEditable==="true"&&e.__lexicalEditor==null)}function Ur(t,e,n){let r=t.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(n)&&e!==null&&!xl(e)&&Nl(e)===t}catch{return!1}}function Nl(t){for(;t!=null;){let e=t.__lexicalEditor;if(e!=null)return e;t=Yi(t)}return null}function bo(t){return t.isToken()||t.isSegmented()}function $i(t){for(;t!=null;){if(t.nodeType===3)return t;t=t.firstChild}return null}function Fu(t,e,n){return e=nn[e],t&e&&(n===null||!(n&e))?t^e:n===null||n&e?t|e:t}function Bu(t){return M(t)||Pr(t)||q(t)}function ju(t,e){if(e!=null)t.__key=e;else{je(),99pt().getTextContent())}function Nf(t,e){Ye(t,()=>{var n=_t();if(!n.isEmpty())if(e==="root")pt().markDirty();else{n=n._nodeMap;for(let[,r]of n)r.markDirty()}},t._pendingEditorState===null?{tag:"history-merge"}:void 0)}function pt(){return _t()._nodeMap.get("root")}function zt(t){je();let e=_t();t!==null&&(t.dirty=!0,t._cachedNodes=null),e._selection=t}function bn(t){var e=se(),n;e:{for(n=t;n!=null;){let r=n[`__lexicalKey_${e._key}`];if(r!==void 0){n=r;break e}n=Yi(n)}n=null}return n===null?(e=e.getRootElement(),t===e?Ce("root"):null):Ce(n)}function Hu(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function El(t){let e=[];for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Wu(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Tl(t,e,n){if(e=mt(e._window),e!==null){var r=e.anchorNode,{anchorOffset:i,focusOffset:o}=e;if(r!==null&&(e=r.nodeType===3?r.nodeValue:null,r=Gr(r),e!==null&&M(r))){if(r.canContainTabs()){var l=e.includes(" ");if(n&&0{c.update(()=>{o.isAttached()&&o.remove()})},20)}else{i=o.getParent(),e=Vr();var s=Ft(),a=o.getKey();o.isToken()||s!==null&&a===s&&!l||i!==null&&z(e)&&!i.canInsertTextBefore()&&e.anchor.offset===0?o.markDirty():(l=Q(),z(l)&&n!==null&&r!==null&&(l.setTextNodeRange(o,n,o,r),o.isSegmented()&&(n=o.getTextContent(),n=ve(n),o.replace(n),o=n)),o.setTextContent(t))}}}function Ef(t,e){if(e.isSegmented())return!0;if(!t.isCollapsed())return!1;t=t.anchor.offset;let n=e.getParentOrThrow(),r=e.isToken();return t===0?((t=!e.canInsertTextBefore()||!n.canInsertTextBefore()||r)||(e=e.getPreviousSibling(),t=(M(e)||O(e)&&e.isInline())&&!e.canInsertTextAfter()),t):t===e.getTextContentSize()?!e.canInsertTextAfter()||!n.canInsertTextAfter()||r:!1}function Nr(t,e){var n=t[e];return typeof n=="string"?(n=n.split(" "),t[e]=n):n}function vl(t,e,n,r,i){n.size!==0&&(n=r.__key,e=e.get(r.__type),e===void 0&&D(33),r=e.klass,e=t.get(r),e===void 0&&(e=new Map,t.set(r,e)),t=e.get(n),r=t==="destroyed"&&i==="created",(t===void 0||r)&&e.set(n,r?"updated":i))}function ms(t,e,n){let r=t.getParent(),i=n;return r!==null&&(e&&n===0?(i=t.getIndexWithinParent(),t=r):e||n!==t.getChildrenSize()||(i=t.getIndexWithinParent()+1,t=r)),t.getChildAtIndex(e?i-1:i)}function ko(t,e){var n=t.offset;return t.type==="element"?(t=t.getNode(),ms(t,e,n)):(t=t.getNode(),e&&n===0||!e&&n===t.getTextContentSize()?(n=e?t.getPreviousSibling():t.getNextSibling(),n===null?ms(t.getParentOrThrow(),e,t.getIndexWithinParent()+(e?0:1)):n):null)}function Uu(t){return t=(t=Ji(t).event)&&t.inputType,t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function Ai(t){return!We(t)&&!t.isLastChild()&&!t.isInline()}function Oi(t,e){return t=t._keyToDOMMap.get(e),t===void 0&&D(75),t}function Yi(t){return t=t.assignedSlot||t.parentElement,t!==null&&t.nodeType===11?t.host:t}function Tf(t,e=0){if(e!==0&&D(1),e=Q(),!z(e)||!O(t))return e;let{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();return wi(i,t)&&n.set(t.__key,0,"element"),wi(o,t)&&r.set(t.__key,0,"element"),e}function wi(t,e){for(t=t.getParent();t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Ji(t){return t=t._window,t===null&&D(78),t}function Gu(t){for(t=t.getParentOrThrow();t!==null&&!nt(t);)t=t.getParentOrThrow();return t}function nt(t){return We(t)||O(t)&&t.isShadowRoot()}function Yu(t){return t=t.constructor.clone(t),ju(t,null),t}function Vi(t){var e=se();let n=t.constructor.getType();return e=e._nodes.get(n),e===void 0&&D(97),e=e.replace,e!==null?(e=e(t),e instanceof t.constructor||D(98),e):t}function co(t,e){t=t.getParent(),!We(t)||O(e)||q(e)||D(99)}function go(t){return(q(t)||O(t)&&!t.canBeEmpty())&&!t.isInline()}function Io(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null,e=t.parentElement,e!==null&&e.removeChild(t)}function mt(t){return At?(t||window).getSelection():null}function Ju(t,e){let n=t.getChildAtIndex(e);n==null&&(n=t),nt(t)&&D(102);let r=l=>{const s=l.getParentOrThrow(),a=nt(s),c=l!==n||a?Yu(l):l;if(a)return l.insertAfter(c),[l,c,c];const[g,d,u]=r(s);return l=l.getNextSiblings(),u.append(c,...l),[g,d,c]},[i,o]=r(n);return[i,o]}function Di(t,e){for(;t!==pt()&&t!=null;){if(e(t))return t;t=t.getParent()}return null}function yf(t){let e=[],n=[t];for(;0e&&r&&t.classList.remove(n)}n=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||"40px",t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function ec(t,e){t=t.style,e===0?Vt(t,""):e===1?Vt(t,"left"):e===2?Vt(t,"center"):e===3?Vt(t,"right"):e===4?Vt(t,"justify"):e===5?Vt(t,"start"):e===6&&Vt(t,"end")}function hi(t,e,n){let r=Ht.get(t);r===void 0&&D(60);let i=r.createDOM(Kt,Me);var o=Me._keyToDOMMap;if(i["__lexicalKey_"+Me._key]=t,o.set(t,i),M(r)?i.setAttribute("data-lexical-text","true"):q(r)&&i.setAttribute("data-lexical-decorator","true"),O(r)){if(t=r.__indent,o=r.__size,t!==0&&Qu(i,t),o!==0){--o,t=Li(r,Ht);var l=Be;Be="",zo(t,r,0,o,i,null),nc(r,i),Be=l}t=r.__format,t!==0&&ec(i,t),r.isInline()||tc(null,r,i),Ai(r)&&(me+=` +import{r as $,j as p,aV as yg,aW as vg,aA as ns,at as Ja,an as Va,aX as Sg,aY as $g,aZ as Rg,B as Un,a_ as Ag,a$ as Og,m as it,s as P,aq as Wr,t as an,b0 as Xa,b1 as wg,b2 as Dg,b3 as gt,I as Gn,E as Lg,b4 as Mg,b5 as Za,b6 as Le,b7 as qa,b8 as Qa,b9 as eu,ba as tu,bb as nu,bc as ru,bd as Ti,be as iu,h as ou,i as lu,k as su,F as Or,l as au,n as yi,R as pr,U as mr,bf as yt,bg,bh as rs,bi as is,bj as os,bk as ls,bl as ss,bm as as,bn as us,bo as cs,W as _r,Y as Cr,$ as ue,ak as kg,al as Ig,ap as Pg,bp as Fg,bq as Bg,br as jg,bs as zg,bt as sr,bu as Kg,bv as Hg,bw as Wg,bx as Ug,K as Gg,by as Yg,D as ds,bz as Jg,g as gs,bA as Vg,bB as Xg,bC as fs,bD as Zg,bE as qg,bF as Qg,bG as ef,bH as tf,bI as nf}from"./vendor--JR89aB4.js";import{F as uu,B as cu,d as rf,D as du,S as of}from"./index-no0JSIPh.js";var gu={},Ui={},fu=$;let hu=fu.createContext(null);Ui.LexicalComposerContext=hu;Ui.createLexicalComposerContext=function(t,e){let n=null;return t!=null&&(n=t[1]),{getTheme:function(){return e??(n!=null?n.getTheme():null)}}};Ui.useLexicalComposerContext=function(){let t=fu.useContext(hu);if(t==null)throw Error("Minified Lexical error #8; visit https://lexical.dev/docs/error?code=8 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return t};const lf=Ui;var X=lf,R={};let ul={},pu={},wr={},xr={},Do={},Fn={},cl={},Lo={},Dr={},Lr={},Pt={},dl={},gl={},mu={},_u={},Cu={},xu={},Nu={},Eu={},Tu={},vi={},yu={},vu={},Su={},$u={},Ru={},Au={},Ou={},wu={},Du={},fl={},hl={},Lu={},Mu={},bu={};function D(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let At=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sf=At&&"documentMode"in document?document.documentMode:null,Ie=At&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),un=At&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Si=At&&"InputEvent"in window&&!sf?"getTargetRanges"in new window.InputEvent("input"):!1,pl=At&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),ml=At&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,af=At&&/^(?=.*Chrome).*/i.test(navigator.userAgent),_l=At&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!af,Gi=pl||ml||_l?" ":"​",uf=un?" ":Gi,cf=/^[^A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]*[\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]/,df=/^[^\u0591-\u07ff\ufb1d-\ufdfd\ufe70-\ufefc]*[A-Za-z\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02b8\u0300-\u0590\u0800-\u1fff\u200e\u2c00-\ufb1c\ufe00-\ufe6f\ufefd-\uffff]/,nn={bold:1,code:16,highlight:128,italic:2,strikethrough:4,subscript:32,superscript:64,underline:8},gf={directionless:1,unmergeable:2},hs={center:2,end:6,justify:4,left:1,right:3,start:5},ff={2:"center",6:"end",4:"justify",1:"left",3:"right",5:"start"},hf={normal:0,segmented:2,token:1},pf={0:"normal",2:"segmented",1:"token"},Mo=!1,Cl=0;function mf(t){Cl=t.timeStamp}function uo(t,e,n){return e.__lexicalLineBreak===t||t[`__lexicalKey_${n._key}`]!==void 0}function _f(t){return t.getEditorState().read(()=>{let e=Q();return e!==null?e.clone():null})}function ku(t,e,n){Mo=!0;let r=100{let i=Q()||_f(t);var o=new Map,l=t.getRootElement(),s=t._editorState,a=t._blockCursorElement;let c=!1,g="";for(var d=0;d{ku(t,e,n)})}let Cf=1,xf=typeof queueMicrotask=="function"?queueMicrotask:t=>{Promise.resolve().then(t)};function xl(t){let e=document.activeElement;if(e===null)return!1;let n=e.nodeName;return q(Gr(t))&&(n==="INPUT"||n==="TEXTAREA"||e.contentEditable==="true"&&e.__lexicalEditor==null)}function Ur(t,e,n){let r=t.getRootElement();try{return r!==null&&r.contains(e)&&r.contains(n)&&e!==null&&!xl(e)&&Nl(e)===t}catch{return!1}}function Nl(t){for(;t!=null;){let e=t.__lexicalEditor;if(e!=null)return e;t=Yi(t)}return null}function bo(t){return t.isToken()||t.isSegmented()}function $i(t){for(;t!=null;){if(t.nodeType===3)return t;t=t.firstChild}return null}function Fu(t,e,n){return e=nn[e],t&e&&(n===null||!(n&e))?t^e:n===null||n&e?t|e:t}function Bu(t){return M(t)||Pr(t)||q(t)}function ju(t,e){if(e!=null)t.__key=e;else{je(),99pt().getTextContent())}function Nf(t,e){Ye(t,()=>{var n=_t();if(!n.isEmpty())if(e==="root")pt().markDirty();else{n=n._nodeMap;for(let[,r]of n)r.markDirty()}},t._pendingEditorState===null?{tag:"history-merge"}:void 0)}function pt(){return _t()._nodeMap.get("root")}function zt(t){je();let e=_t();t!==null&&(t.dirty=!0,t._cachedNodes=null),e._selection=t}function bn(t){var e=se(),n;e:{for(n=t;n!=null;){let r=n[`__lexicalKey_${e._key}`];if(r!==void 0){n=r;break e}n=Yi(n)}n=null}return n===null?(e=e.getRootElement(),t===e?Ce("root"):null):Ce(n)}function Hu(t){return/[\uD800-\uDBFF][\uDC00-\uDFFF]/g.test(t)}function El(t){let e=[];for(;t!==null;)e.push(t),t=t._parentEditor;return e}function Wu(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,5)}function Tl(t,e,n){if(e=mt(e._window),e!==null){var r=e.anchorNode,{anchorOffset:i,focusOffset:o}=e;if(r!==null&&(e=r.nodeType===3?r.nodeValue:null,r=Gr(r),e!==null&&M(r))){if(r.canContainTabs()){var l=e.includes(" ");if(n&&0{c.update(()=>{o.isAttached()&&o.remove()})},20)}else{i=o.getParent(),e=Vr();var s=Ft(),a=o.getKey();o.isToken()||s!==null&&a===s&&!l||i!==null&&z(e)&&!i.canInsertTextBefore()&&e.anchor.offset===0?o.markDirty():(l=Q(),z(l)&&n!==null&&r!==null&&(l.setTextNodeRange(o,n,o,r),o.isSegmented()&&(n=o.getTextContent(),n=ve(n),o.replace(n),o=n)),o.setTextContent(t))}}}function Ef(t,e){if(e.isSegmented())return!0;if(!t.isCollapsed())return!1;t=t.anchor.offset;let n=e.getParentOrThrow(),r=e.isToken();return t===0?((t=!e.canInsertTextBefore()||!n.canInsertTextBefore()||r)||(e=e.getPreviousSibling(),t=(M(e)||O(e)&&e.isInline())&&!e.canInsertTextAfter()),t):t===e.getTextContentSize()?!e.canInsertTextAfter()||!n.canInsertTextAfter()||r:!1}function Nr(t,e){var n=t[e];return typeof n=="string"?(n=n.split(" "),t[e]=n):n}function vl(t,e,n,r,i){n.size!==0&&(n=r.__key,e=e.get(r.__type),e===void 0&&D(33),r=e.klass,e=t.get(r),e===void 0&&(e=new Map,t.set(r,e)),t=e.get(n),r=t==="destroyed"&&i==="created",(t===void 0||r)&&e.set(n,r?"updated":i))}function ms(t,e,n){let r=t.getParent(),i=n;return r!==null&&(e&&n===0?(i=t.getIndexWithinParent(),t=r):e||n!==t.getChildrenSize()||(i=t.getIndexWithinParent()+1,t=r)),t.getChildAtIndex(e?i-1:i)}function ko(t,e){var n=t.offset;return t.type==="element"?(t=t.getNode(),ms(t,e,n)):(t=t.getNode(),e&&n===0||!e&&n===t.getTextContentSize()?(n=e?t.getPreviousSibling():t.getNextSibling(),n===null?ms(t.getParentOrThrow(),e,t.getIndexWithinParent()+(e?0:1)):n):null)}function Uu(t){return t=(t=Ji(t).event)&&t.inputType,t==="insertFromPaste"||t==="insertFromPasteAsQuotation"}function Ai(t){return!We(t)&&!t.isLastChild()&&!t.isInline()}function Oi(t,e){return t=t._keyToDOMMap.get(e),t===void 0&&D(75),t}function Yi(t){return t=t.assignedSlot||t.parentElement,t!==null&&t.nodeType===11?t.host:t}function Tf(t,e=0){if(e!==0&&D(1),e=Q(),!z(e)||!O(t))return e;let{anchor:n,focus:r}=e,i=n.getNode(),o=r.getNode();return wi(i,t)&&n.set(t.__key,0,"element"),wi(o,t)&&r.set(t.__key,0,"element"),e}function wi(t,e){for(t=t.getParent();t!==null;){if(t.is(e))return!0;t=t.getParent()}return!1}function Ji(t){return t=t._window,t===null&&D(78),t}function Gu(t){for(t=t.getParentOrThrow();t!==null&&!nt(t);)t=t.getParentOrThrow();return t}function nt(t){return We(t)||O(t)&&t.isShadowRoot()}function Yu(t){return t=t.constructor.clone(t),ju(t,null),t}function Vi(t){var e=se();let n=t.constructor.getType();return e=e._nodes.get(n),e===void 0&&D(97),e=e.replace,e!==null?(e=e(t),e instanceof t.constructor||D(98),e):t}function co(t,e){t=t.getParent(),!We(t)||O(e)||q(e)||D(99)}function go(t){return(q(t)||O(t)&&!t.canBeEmpty())&&!t.isInline()}function Io(t,e,n){n.style.removeProperty("caret-color"),e._blockCursorElement=null,e=t.parentElement,e!==null&&e.removeChild(t)}function mt(t){return At?(t||window).getSelection():null}function Ju(t,e){let n=t.getChildAtIndex(e);n==null&&(n=t),nt(t)&&D(102);let r=l=>{const s=l.getParentOrThrow(),a=nt(s),c=l!==n||a?Yu(l):l;if(a)return l.insertAfter(c),[l,c,c];const[g,d,u]=r(s);return l=l.getNextSiblings(),u.append(c,...l),[g,d,c]},[i,o]=r(n);return[i,o]}function Di(t,e){for(;t!==pt()&&t!=null;){if(e(t))return t;t=t.getParent()}return null}function yf(t){let e=[],n=[t];for(;0e&&r&&t.classList.remove(n)}n=getComputedStyle(t).getPropertyValue("--lexical-indent-base-value")||"40px",t.style.setProperty("padding-inline-start",e===0?"":`calc(${e} * ${n})`)}function ec(t,e){t=t.style,e===0?Vt(t,""):e===1?Vt(t,"left"):e===2?Vt(t,"center"):e===3?Vt(t,"right"):e===4?Vt(t,"justify"):e===5?Vt(t,"start"):e===6&&Vt(t,"end")}function hi(t,e,n){let r=Ht.get(t);r===void 0&&D(60);let i=r.createDOM(Kt,Me);var o=Me._keyToDOMMap;if(i["__lexicalKey_"+Me._key]=t,o.set(t,i),M(r)?i.setAttribute("data-lexical-text","true"):q(r)&&i.setAttribute("data-lexical-decorator","true"),O(r)){if(t=r.__indent,o=r.__size,t!==0&&Qu(i,t),o!==0){--o,t=Li(r,Ht);var l=Be;Be="",zo(t,r,0,o,i,null),nc(r,i),Be=l}t=r.__format,t!==0&&ec(i,t),r.isInline()||tc(null,r,i),Ai(r)&&(me+=` `,vt+=` @@ -32,7 +32,7 @@ import{r as $,j as p,aV as yg,aW as vg,aA as ns,at as Ja,an as Va,aX as Sg,aY as `&&r[i-2].getTextContent()===` `&&e.isCollapsed()&&e.anchor.key===this.__key&&e.anchor.offset===i)return r[i-1].remove(),r[i-2].remove(),e=b.$createParagraphNode(),this.insertAfter(e,n),e;if(n=e.anchor.getNode(),i=jr(n),i!=null){for(r=0,i=i.getTextContent();re.append(n)),this.replace(e),!0}setLanguage(e){this.getWritable().__language=sa(e)}getLanguage(){return this.getLatest().__language}};function tr(t){return b.$applyNodeReplacement(new Hn(t))}function to(t){return t instanceof Hn}function aa(){return{node:tr(),preformatted:!0}}function yp(t){let e=t.style.fontFamily.match("monospace")!==null;return e||$p(t)?{after:n=>{let r=t.parentNode;return r!=null&&t!==r.lastChild&&n.push(b.$createLineBreakNode()),n},node:e?tr():null,preformatted:e}:{node:null}}function vp(){return{node:tr(),preformatted:!0}}function ua(){return{node:null}}function Sp(t){return{after:e=>(t.parentNode&&t.parentNode.nextSibling&&e.push(b.$createLineBreakNode()),e),node:null}}function $p(t){for(t=t.parentElement;t!==null;){if(t.style.fontFamily.match("monospace")!==null)return!0;t=t.parentElement}return!1}function Eo(t){return t.classList.contains("js-file-line-container")}let ad={c:"C",clike:"C-like",cpp:"C++",css:"CSS",html:"HTML",java:"Java",js:"JavaScript",markdown:"Markdown",objc:"Objective-C",plain:"Plain Text",py:"Python",rust:"Rust",sql:"SQL",swift:"Swift",typescript:"TypeScript",xml:"XML"},ud={cpp:"cpp",java:"java",javascript:"js",md:"markdown",plaintext:"plain",python:"py",text:"plain",ts:"typescript"};function cd(t){return ud[t]||t}let Br=class dd extends b.TextNode{constructor(e,n,r){super(e,r),this.__highlightType=n}static getType(){return"code-highlight"}static clone(e){return new dd(e.__text,e.__highlightType||void 0,e.__key)}getHighlightType(){return this.getLatest().__highlightType}createDOM(e){let n=super.createDOM(e);return e=To(e.theme,this.__highlightType),Kn.addClassNamesToElement(n,e),n}updateDOM(e,n,r){let i=super.updateDOM(e,n,r);return e=To(r.theme,e.__highlightType),r=To(r.theme,this.__highlightType),e!==r&&(e&&Kn.removeClassNamesFromElement(n,e),r&&Kn.addClassNamesToElement(n,r)),i}static importJSON(e){let n=ln(e.text,e.highlightType);return n.setFormat(e.format),n.setDetail(e.detail),n.setMode(e.mode),n.setStyle(e.style),n}exportJSON(){return{...super.exportJSON(),highlightType:this.getHighlightType(),type:"code-highlight",version:1}}setFormat(){return this}isParentRequired(){return!0}createParentElementNode(){return tr()}};function To(t,e){return e&&t&&t.codeHighlight&&t.codeHighlight[e]}function ln(t,e){return b.$applyNodeReplacement(new Br(t,e))}function Re(t){return t instanceof Br}function jr(t){let e=null,n=t.getPreviousSiblings();for(n.push(t);0{Rp(r,()=>{var i=b.$getNodeByKey(r);if(!to(i)||!i.isAttached())return!1;var o=i.getTextContent();o=n.tokenize(o,i.getLanguage()||n.defaultLanguage),o=md(o);var l=i.getChildren();for(i=0;i{yo.delete(r)},skipTransforms:!0}))}function md(t){let e=[];return t.forEach(n=>{if(typeof n=="string"){n=n.split(` `);for(var r=0;rs+a.getTextContentSize(),0)}e()&&(i?n.getNode().select(r,r):t.getChildren().some(l=>{let s=b.$isTextNode(l);if(s||b.$isLineBreakNode(l)){let a=l.getTextContentSize();if(s&&a>=o)return l.select(o,o),!0;o-=a}return!1}))}else e()}}function da(t,e){return Re(t)&&Re(e)?t.__text===e.__text&&t.__highlightType===e.__highlightType:!!(b.$isLineBreakNode(t)&&b.$isLineBreakNode(e))}function ga(t){var e=b.$getSelection();if(!b.$isRangeSelection(e)||e.isCollapsed())return!1;e=e.getNodes();for(var n=0;nh.remove()),t===b.KEY_ARROW_UP_COMMAND?(u.forEach(h=>f.insertBefore(h)),f.insertBefore(e)):(f.insertAfter(e),f=e,u.forEach(h=>{f.insertAfter(h),f=h})),n.setTextNodeRange(s,o,a,l),!0}function pa(t,e){let n=b.$getSelection();if(!b.$isRangeSelection(n))return!1;let{anchor:r,focus:i}=n,o=r.getNode(),l=i.getNode();if(t=t===b.MOVE_TO_START,!Re(o)||!Re(l))return!1;let s,a;return t?{node:s,offset:a}=fd(l):{node:s,offset:a}=hd(l),s!==null&&a!==-1&&n.setTextNodeRange(s,a,s,a),e.preventDefault(),e.stopPropagation(),!0}pe.$createCodeHighlightNode=ln;pe.$createCodeNode=tr;pe.$isCodeHighlightNode=Re;pe.$isCodeNode=to;pe.CODE_LANGUAGE_FRIENDLY_NAME_MAP=ad;pe.CODE_LANGUAGE_MAP=ud;pe.CodeHighlightNode=Br;pe.CodeNode=Hn;pe.DEFAULT_CODE_LANGUAGE="javascript";pe.PrismTokenizer=gd;pe.getCodeLanguages=()=>Object.keys(zn.languages).filter(t=>typeof zn.languages[t]!="function").sort();pe.getDefaultCodeLanguage=()=>"javascript";pe.getEndOfCodeInLine=hd;pe.getFirstCodeHighlightNodeOfLine=jr;pe.getLanguageFriendlyName=function(t){return t=cd(t),ad[t]||t};pe.getLastCodeHighlightNodeOfLine=nl;pe.getStartOfCodeInLine=fd;pe.normalizeCodeLang=cd;pe.registerCodeHighlighting=function(t,e){if(!t.hasNodes([Hn,Br]))throw Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");return e==null&&(e=gd),Kn.mergeRegister(t.registerMutationListener(Hn,n=>{t.update(()=>{for(let[o,l]of n)if(l!=="destroyed"){var r=b.$getNodeByKey(o);if(r!==null)e:{var i=r;if(r=t.getElementByKey(i.getKey()),r===null)break e;i=i.getChildren();let s=i.length;if(s===r.__cachedChildrenLength)break e;r.__cachedChildrenLength=s;let a="1",c=1;for(let g=0;gpd(n,t,e)),t.registerNodeTransform(b.TextNode,n=>ca(n,t,e)),t.registerNodeTransform(Br,n=>ca(n,t,e)),t.registerCommand(b.INDENT_CONTENT_COMMAND,()=>ga(b.INDENT_CONTENT_COMMAND),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.OUTDENT_CONTENT_COMMAND,()=>ga(b.OUTDENT_CONTENT_COMMAND),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.KEY_ARROW_UP_COMMAND,n=>ha(b.KEY_ARROW_UP_COMMAND,n),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.KEY_ARROW_DOWN_COMMAND,n=>ha(b.KEY_ARROW_DOWN_COMMAND,n),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.MOVE_TO_END,n=>pa(b.MOVE_TO_END,n),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.MOVE_TO_START,n=>pa(b.MOVE_TO_START,n),b.COMMAND_PRIORITY_LOW))};const Ap=pe;var he=Ap,wt={},_d=V,ft=C;let Op=new Set(["http:","https:","mailto:","sms:","tel:"]),no=class Cd extends ft.ElementNode{static getType(){return"link"}static clone(e){return new Cd(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,n={},r){super(r);let{target:i=null,rel:o=null,title:l=null}=n;this.__url=e,this.__target=i,this.__rel=o,this.__title=l}createDOM(e){let n=document.createElement("a");return n.href=this.sanitizeUrl(this.__url),this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),this.__title!==null&&(n.title=this.__title),_d.addClassNamesToElement(n,e.theme.link),n}updateDOM(e,n){let r=this.__url,i=this.__target,o=this.__rel,l=this.__title;return r!==e.__url&&(n.href=r),i!==e.__target&&(i?n.target=i:n.removeAttribute("target")),o!==e.__rel&&(o?n.rel=o:n.removeAttribute("rel")),l!==e.__title&&(l?n.title=l:n.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:wp,priority:1})}}static importJSON(e){let n=zr(e.url,{rel:e.rel,target:e.target,title:e.title});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}sanitizeUrl(e){try{let n=new URL(e);if(!Op.has(n.protocol))return"about:blank"}catch{return"https://"}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,n=!0){return e=this.getParentOrThrow().insertNewAfter(e,n),ft.$isElementNode(e)?(n=zr(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),e.append(n),n):null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n){if(!ft.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&0{if(l=l.getParent(),Zt(l)){let s=l.getChildren();for(let a=0;a{var c=a.getParent();if(c!==s&&c!==null&&(!ft.$isElementNode(a)||a.isInline()))if(Zt(c))s=c,c.setURL(t),n!==void 0&&c.setTarget(n),i!==null&&s.setRel(i),r!==void 0&&s.setTitle(r);else if(c.is(l)||(l=c,s=zr(t,{rel:i,target:n}),Zt(c)?a.getPreviousSibling()===null?c.insertBefore(s):c.insertAfter(s):a.insertBefore(s)),Zt(a)){if(!a.is(s)){if(s!==null){c=a.getChildren();for(let g=0;g({conversion:bp,priority:0})}}exportJSON(){return{altText:this.getAltText(),caption:this.caption.toJSON(),height:this.height==="inherit"?0:this.height,maxWidth:this.maxWidth,showCaption:this.showCaption,src:this.getSrc(),type:"image",version:1,width:this.width==="inherit"?0:this.width}}setWidthAndHeight(e,n){const r=this.getWritable();r.width=e,r.height=n}setShowCaption(e){const n=this.getWritable();n.showCaption=e}createDOM(e){const n=document.createElement("span"),i=e.theme.image;return i&&(n.className=i),n}updateDOM(){return!1}getSrc(){return this.src}getAltText(){return this.altText}decorate(){return p.jsx($.Suspense,{fallback:null,children:p.jsx(kp,{src:this.src,altText:this.altText,width:this.width,height:this.height,maxWidth:this.maxWidth,nodeKey:this.getKey(),showCaption:this.showCaption,caption:this.caption,captionsEnabled:this.captionsEnabled,resizable:!0})})}}const kp=$.lazy(()=>Ja(()=>import("./Component-3Xt-99h9.js"),__vite__mapDeps([0,1,2,3,4])));function ro({altText:t,height:e,maxWidth:n=500,captionsEnabled:r,src:i,width:o,showCaption:l,caption:s,key:a}){return C.$applyNodeReplacement(new Ut(i,t,n,o,e,l,s,r,a))}function Nd(t){return t instanceof Ut}const Ip=[rt.HeadingNode,fe.ListNode,fe.ListItemNode,rt.QuoteNode,he.CodeNode,he.CodeHighlightNode,ce.AutoLinkNode,ce.LinkNode,Ut];function Pp(){const[t]=X.useLexicalComposerContext(),e=t.isEditable();return p.jsx(Va,{appearance:"outline",icon:e?p.jsx(Sg,{}):p.jsx($g,{}),checked:!e,onClick:()=>t.setEditable(!e)})}var te={},U=C,Rr=he,Ae=fe,Bt=rt,Fp=V,vo=ce;function il(t,e){let n={};for(let r of t)t=e(r),n[t]?n[t].push(r):n[t]=[r];return n}function Bl(t){return t=il(t,e=>e.type),{element:t.element||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}let zi=/[!-/:-@[-`{-~\s]/;function Bp(t){let e=Bl(t),n=e.textFormat.filter(r=>r.format.length===1);return r=>{let i=[];r=(r||U.$getRoot()).getChildren();for(let o of r)r=jp(o,e.element,n,e.textMatch),r!=null&&i.push(r);return i.join(` +`+ ++c);r.setAttribute("data-gutter",a)}}})}),t.registerNodeTransform(Hn,n=>pd(n,t,e)),t.registerNodeTransform(b.TextNode,n=>ca(n,t,e)),t.registerNodeTransform(Br,n=>ca(n,t,e)),t.registerCommand(b.INDENT_CONTENT_COMMAND,()=>ga(b.INDENT_CONTENT_COMMAND),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.OUTDENT_CONTENT_COMMAND,()=>ga(b.OUTDENT_CONTENT_COMMAND),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.KEY_ARROW_UP_COMMAND,n=>ha(b.KEY_ARROW_UP_COMMAND,n),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.KEY_ARROW_DOWN_COMMAND,n=>ha(b.KEY_ARROW_DOWN_COMMAND,n),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.MOVE_TO_END,n=>pa(b.MOVE_TO_END,n),b.COMMAND_PRIORITY_LOW),t.registerCommand(b.MOVE_TO_START,n=>pa(b.MOVE_TO_START,n),b.COMMAND_PRIORITY_LOW))};const Ap=pe;var he=Ap,wt={},_d=V,ft=C;let Op=new Set(["http:","https:","mailto:","sms:","tel:"]),no=class Cd extends ft.ElementNode{static getType(){return"link"}static clone(e){return new Cd(e.__url,{rel:e.__rel,target:e.__target,title:e.__title},e.__key)}constructor(e,n={},r){super(r);let{target:i=null,rel:o=null,title:l=null}=n;this.__url=e,this.__target=i,this.__rel=o,this.__title=l}createDOM(e){let n=document.createElement("a");return n.href=this.sanitizeUrl(this.__url),this.__target!==null&&(n.target=this.__target),this.__rel!==null&&(n.rel=this.__rel),this.__title!==null&&(n.title=this.__title),_d.addClassNamesToElement(n,e.theme.link),n}updateDOM(e,n){let r=this.__url,i=this.__target,o=this.__rel,l=this.__title;return r!==e.__url&&(n.href=r),i!==e.__target&&(i?n.target=i:n.removeAttribute("target")),o!==e.__rel&&(o?n.rel=o:n.removeAttribute("rel")),l!==e.__title&&(l?n.title=l:n.removeAttribute("title")),!1}static importDOM(){return{a:()=>({conversion:wp,priority:1})}}static importJSON(e){let n=zr(e.url,{rel:e.rel,target:e.target,title:e.title});return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}sanitizeUrl(e){try{let n=new URL(e);if(!Op.has(n.protocol))return"about:blank"}catch{return"https://"}return e}exportJSON(){return{...super.exportJSON(),rel:this.getRel(),target:this.getTarget(),title:this.getTitle(),type:"link",url:this.getURL(),version:1}}getURL(){return this.getLatest().__url}setURL(e){this.getWritable().__url=e}getTarget(){return this.getLatest().__target}setTarget(e){this.getWritable().__target=e}getRel(){return this.getLatest().__rel}setRel(e){this.getWritable().__rel=e}getTitle(){return this.getLatest().__title}setTitle(e){this.getWritable().__title=e}insertNewAfter(e,n=!0){return e=this.getParentOrThrow().insertNewAfter(e,n),ft.$isElementNode(e)?(n=zr(this.__url,{rel:this.__rel,target:this.__target,title:this.__title}),e.append(n),n):null}canInsertTextBefore(){return!1}canInsertTextAfter(){return!1}canBeEmpty(){return!1}isInline(){return!0}extractWithChild(e,n){if(!ft.$isRangeSelection(n))return!1;e=n.anchor.getNode();let r=n.focus.getNode();return this.isParentOf(e)&&this.isParentOf(r)&&0{if(l=l.getParent(),Zt(l)){let s=l.getChildren();for(let a=0;a{var c=a.getParent();if(c!==s&&c!==null&&(!ft.$isElementNode(a)||a.isInline()))if(Zt(c))s=c,c.setURL(t),n!==void 0&&c.setTarget(n),i!==null&&s.setRel(i),r!==void 0&&s.setTitle(r);else if(c.is(l)||(l=c,s=zr(t,{rel:i,target:n}),Zt(c)?a.getPreviousSibling()===null?c.insertBefore(s):c.insertAfter(s):a.insertBefore(s)),Zt(a)){if(!a.is(s)){if(s!==null){c=a.getChildren();for(let g=0;g({conversion:bp,priority:0})}}exportJSON(){return{altText:this.getAltText(),caption:this.caption.toJSON(),height:this.height==="inherit"?0:this.height,maxWidth:this.maxWidth,showCaption:this.showCaption,src:this.getSrc(),type:"image",version:1,width:this.width==="inherit"?0:this.width}}setWidthAndHeight(e,n){const r=this.getWritable();r.width=e,r.height=n}setShowCaption(e){const n=this.getWritable();n.showCaption=e}createDOM(e){const n=document.createElement("span"),i=e.theme.image;return i&&(n.className=i),n}updateDOM(){return!1}getSrc(){return this.src}getAltText(){return this.altText}decorate(){return p.jsx($.Suspense,{fallback:null,children:p.jsx(kp,{src:this.src,altText:this.altText,width:this.width,height:this.height,maxWidth:this.maxWidth,nodeKey:this.getKey(),showCaption:this.showCaption,caption:this.caption,captionsEnabled:this.captionsEnabled,resizable:!0})})}}const kp=$.lazy(()=>Ja(()=>import("./Component-_hAU7BS-.js"),__vite__mapDeps([0,1,2,3,4])));function ro({altText:t,height:e,maxWidth:n=500,captionsEnabled:r,src:i,width:o,showCaption:l,caption:s,key:a}){return C.$applyNodeReplacement(new Ut(i,t,n,o,e,l,s,r,a))}function Nd(t){return t instanceof Ut}const Ip=[rt.HeadingNode,fe.ListNode,fe.ListItemNode,rt.QuoteNode,he.CodeNode,he.CodeHighlightNode,ce.AutoLinkNode,ce.LinkNode,Ut];function Pp(){const[t]=X.useLexicalComposerContext(),e=t.isEditable();return p.jsx(Va,{appearance:"outline",icon:e?p.jsx(Sg,{}):p.jsx($g,{}),checked:!e,onClick:()=>t.setEditable(!e)})}var te={},U=C,Rr=he,Ae=fe,Bt=rt,Fp=V,vo=ce;function il(t,e){let n={};for(let r of t)t=e(r),n[t]?n[t].push(r):n[t]=[r];return n}function Bl(t){return t=il(t,e=>e.type),{element:t.element||[],textFormat:t["text-format"]||[],textMatch:t["text-match"]||[]}}let zi=/[!-/:-@[-`{-~\s]/;function Bp(t){let e=Bl(t),n=e.textFormat.filter(r=>r.format.length===1);return r=>{let i=[];r=(r||U.$getRoot()).getChildren();for(let o of r)r=jp(o,e.element,n,e.textMatch),r!=null&&i.push(r);return i.join(` `)}}function jp(t,e,n,r){for(let i of e)if(e=i.export(t,o=>Ki(o,n,r)),e!=null)return e;return U.$isElementNode(t)?Ki(t,n,r):U.$isDecoratorNode(t)?t.getTextContent():null}function Ki(t,e,n){let r=[];t=t.getChildren();e:for(let i of t){for(let o of n)if(t=o.export(i,l=>Ki(l,e,n),(l,s)=>ma(l,s,e)),t!=null){r.push(t);continue e}U.$isLineBreakNode(i)?r.push(` `):U.$isTextNode(i)?r.push(ma(i,i.getTextContent(),e)):U.$isElementNode(i)?r.push(Ki(i,e,n)):U.$isDecoratorNode(i)&&r.push(i.getTextContent())}return r.join("")}function ma(t,e,n){let r=e.trim(),i=r,o=new Set;for(let s of n){n=s.format[0];let a=s.tag;if(So(t,n)&&!o.has(n)){o.add(n);var l=_a(t,!0);So(l,n)||(i=a+i),l=_a(t,!1),So(l,n)||(i+=a)}}return e.replace(r,i)}function _a(t,e){let n=e?t.getPreviousSibling():t.getNextSibling();for(n||(t=t.getParentOrThrow(),t.isInline()&&(n=e?t.getPreviousSibling():t.getNextSibling()));n;){if(U.$isElementNode(n)){if(!n.isInline())break;if(t=e?n.getLastDescendant():n.getFirstDescendant(),U.$isTextNode(t))return t;n=e?n.getPreviousSibling():n.getNextSibling()}if(U.$isTextNode(n))return n;if(!U.$isElementNode(n))break}return null}function So(t,e){return U.$isTextNode(t)&&t.hasFormat(e)}let nr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",zp=nr&&"documentMode"in document?document.documentMode:null;nr&&"InputEvent"in window&&!zp&&"getTargetRanges"in new window.InputEvent("input");let Ca=nr&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),xa=nr&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Kp=nr&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Na=nr&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Kp,Hp=/^\s{0,3}$/,Ea=/^```(\w{1,10})?\s?$/;function Wp(t){let e=Bl(t),n=Gp(e.textFormat);return(r,i)=>{r=r.split(` @@ -44,10 +44,10 @@ import{r as $,j as p,aV as yg,aW as vg,aA as ns,at as Ja,an as Va,aX as Sg,aY as `+e:"")+"\n```"},regExp:/^```(\w{1,10})?\s/,replace:yd(t=>Rr.$createCodeNode(t?t[1]:void 0)),type:"element"},Rd={dependencies:[Ae.ListNode,Ae.ListItemNode],export:(t,e)=>Ae.$isListNode(t)?io(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:jl("bullet"),type:"element"},Yp={dependencies:[Ae.ListNode,Ae.ListItemNode],export:(t,e)=>Ae.$isListNode(t)?io(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:jl("check"),type:"element"},Ad={dependencies:[Ae.ListNode,Ae.ListItemNode],export:(t,e)=>Ae.$isListNode(t)?io(t,e,0):null,regExp:/^(\s*)(\d{1,})\.\s/,replace:jl("number"),type:"element"},Od={format:["code"],tag:"`",type:"text-format"},wd={format:["highlight"],tag:"==",type:"text-format"},Dd={format:["bold","italic"],tag:"***",type:"text-format"},Ld={format:["bold","italic"],intraword:!1,tag:"___",type:"text-format"},Md={format:["bold"],tag:"**",type:"text-format"},bd={format:["bold"],intraword:!1,tag:"__",type:"text-format"},kd={format:["strikethrough"],tag:"~~",type:"text-format"},Id={format:["italic"],tag:"*",type:"text-format"},Pd={format:["italic"],intraword:!1,tag:"_",type:"text-format"},Fd={dependencies:[vo.LinkNode],export:(t,e,n)=>{if(!vo.$isLinkNode(t))return null;e=(e=t.getTitle())?`[${t.getTextContent()}](${t.getURL()} "${e}")`:`[${t.getTextContent()}](${t.getURL()})`;const r=t.getFirstChild();return t.getChildrenSize()===1&&U.$isTextNode(r)?n(r,e):e},importRegExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))/,regExp:/(?:\[([^[]+)\])(?:\((?:([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?)\))$/,replace:(t,e)=>{const[,n,r,i]=e;e=vo.$createLinkNode(r,{title:i});const o=U.$createTextNode(n);o.setFormat(t.getFormat()),e.append(o),t.replace(e)},trigger:")",type:"text-match"},Bd=[vd,Sd,$d,Rd,Ad],jd=[Od,Dd,Ld,Md,bd,wd,Id,Pd,kd],zd=[Fd],oo=[...Bd,...jd,...zd];te.$convertFromMarkdownString=function(t,e=oo,n){return Wp(e)(t,n)};te.$convertToMarkdownString=function(t=oo,e){return Bp(t)(e)};te.BOLD_ITALIC_STAR=Dd;te.BOLD_ITALIC_UNDERSCORE=Ld;te.BOLD_STAR=Md;te.BOLD_UNDERSCORE=bd;te.CHECK_LIST=Yp;te.CODE=$d;te.ELEMENT_TRANSFORMERS=Bd;te.HEADING=vd;te.HIGHLIGHT=wd;te.INLINE_CODE=Od;te.ITALIC_STAR=Id;te.ITALIC_UNDERSCORE=Pd;te.LINK=Fd;te.ORDERED_LIST=Ad;te.QUOTE=Sd;te.STRIKETHROUGH=kd;te.TEXT_FORMAT_TRANSFORMERS=jd;te.TEXT_MATCH_TRANSFORMERS=zd;te.TRANSFORMERS=oo;te.UNORDERED_LIST=Rd;te.registerMarkdownShortcuts=function(t,e=oo){let n=Bl(e),r=il(n.textFormat,({tag:o})=>o[o.length-1]),i=il(n.textMatch,({trigger:o})=>o);for(let o of e)if(e=o.type,(e==="element"||e==="text-match")&&!t.hasNodes(o.dependencies))throw Error("Minified Lexical error #79; visit https://lexical.dev/docs/error?code=79 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");return t.registerUpdateListener(({tags:o,dirtyLeaves:l,editorState:s,prevEditorState:a})=>{if(!o.has("historic")){var c=s.read(U.$getSelection);if(o=a.read(U.$getSelection),U.$isRangeSelection(o)&&U.$isRangeSelection(c)&&c.isCollapsed()){a=c.anchor.key;var g=c.anchor.offset,d=s._nodeMap.get(a);U.$isTextNode(d)&&l.has(a)&&(g===1||g===o.anchor.offset+1)&&t.update(()=>{if(!d.hasFormat("code")){var u=d.getParent();if(u!==null&&!Rr.$isCodeNode(u)){var f=c.anchor.offset;e:{var h=n.element,m=u.getParent();if(U.$isRootOrShadowRoot(m)&&u.getFirstChild()===d&&(m=d.getTextContent(),m[f-1]===" ")){for(let{regExp:S,replace:A}of h)if((h=m.match(S))&&h[0].length===f){m=d.getNextSiblings();let[w,B]=d.splitText(f);w.remove(),m=B?[B,...m]:m,A(u,m,h,!1),u=!0;break e}}u=!1}if(!u){e:{if(h=d.getTextContent(),u=i[h[f-1]],u!=null){fh&&(v=v.getPreviousSibling())&&!U.$isLineBreakNode(v);)U.$isTextNode(v)&&(h=v.getTextContent(),u=v,h=Ta(h,h.length,x));if(!(0>h||u===N&&h+y===A||(x=u.getTextContent(),0{let n=qt.$getNodeByKey(e);return n===null?!1:n.isSelected()})}Kd.useLexicalNodeSelection=function(t){let[e]=Vp.useLexicalComposerContext(),[n,r]=ai.useState(()=>ya(e,t));ai.useEffect(()=>{let l=!0,s=e.registerUpdateListener(()=>{l&&r(ya(e,t))});return()=>{l=!1,s()}},[e,t]);let i=ai.useCallback(l=>{e.update(()=>{let s=qt.$getSelection();qt.$isNodeSelection(s)||(s=qt.$createNodeSelection(),qt.$setSelection(s)),l?s.add(t):s.delete(t)})},[e,t]),o=ai.useCallback(()=>{e.update(()=>{const l=qt.$getSelection();qt.$isNodeSelection(l)&&l.clear()})},[e]);return[n,i,o]};const Xp=Kd;var Zp=Xp,qp=X,Qp=Zp,em=V,qe=C,_i=$;let tm=qe.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");function nm({nodeKey:t}){let[e]=qp.useLexicalComposerContext(),[n,r,i]=Qp.useLexicalNodeSelection(t),o=_i.useCallback(l=>(n&&qe.$isNodeSelection(qe.$getSelection())&&(l.preventDefault(),l=qe.$getNodeByKey(t),Hd(l)&&l.remove(),r(!1)),!1),[n,t,r]);return _i.useEffect(()=>em.mergeRegister(e.registerCommand(qe.CLICK_COMMAND,l=>{let s=e.getElementByKey(t);return l.target===s?(l.shiftKey||i(),r(!n),!0):!1},qe.COMMAND_PRIORITY_LOW),e.registerCommand(qe.KEY_DELETE_COMMAND,o,qe.COMMAND_PRIORITY_LOW),e.registerCommand(qe.KEY_BACKSPACE_COMMAND,o,qe.COMMAND_PRIORITY_LOW)),[i,e,n,t,o,r]),_i.useEffect(()=>{let l=e.getElementByKey(t);l!==null&&(l.className=n?"selected":"")},[e,n,t]),null}class Zr extends qe.DecoratorNode{static getType(){return"horizontalrule"}static clone(e){return new Zr(e.__key)}static importJSON(){return zl()}static importDOM(){return{hr:()=>({conversion:rm,priority:0})}}exportJSON(){return{type:"horizontalrule",version:1}}exportDOM(){return{element:document.createElement("hr")}}createDOM(){return document.createElement("hr")}getTextContent(){return` `}isInline(){return!1}updateDOM(){return!1}decorate(){return _i.createElement(nm,{nodeKey:this.__key})}}function rm(){return{node:zl()}}function zl(){return qe.$applyNodeReplacement(new Zr)}function Hd(t){return t instanceof Zr}Xr.$createHorizontalRuleNode=zl;Xr.$isHorizontalRuleNode=Hd;Xr.HorizontalRuleNode=Zr;Xr.INSERT_HORIZONTAL_RULE_COMMAND=tm;const im=Xr;var jt=im,Y={},E=C,le=V;let ee={BOTH:3,COLUMN:2,NO_STATUS:0,ROW:1};class qr extends E.DEPRECATED_GridCellNode{static getType(){return"tablecell"}static clone(e){let n=new qr(e.__headerState,e.__colSpan,e.__width,e.__key);return n.__rowSpan=e.__rowSpan,n.__backgroundColor=e.__backgroundColor,n}static importDOM(){return{td:()=>({conversion:va,priority:0}),th:()=>({conversion:va,priority:0})}}static importJSON(e){let n=et(e.headerState,e.colSpan,e.width||void 0);return n.__rowSpan=e.rowSpan,n.__backgroundColor=e.backgroundColor||null,n}constructor(e=ee.NO_STATUS,n=1,r,i){super(n,i),this.__headerState=e,this.__width=r,this.__backgroundColor=null}createDOM(e){let n=document.createElement(this.getTag());return this.__width&&(n.style.width=`${this.__width}px`),1H(r)&&!E.$isElementNode(n)?(r=E.$createParagraphNode(),E.$isLineBreakNode(n)&&n.getTextContent()===` `?null:(r.append(n),r)):n,node:e}}function et(t,e=1,n){return E.$applyNodeReplacement(new qr(t,e,n))}function H(t){return t instanceof qr}let Kl=class Wd extends E.DEPRECATED_GridRowNode{static getType(){return"tablerow"}static clone(e){return new Wd(e.__height,e.__key)}static importDOM(){return{tr:()=>({conversion:om,priority:0})}}static importJSON(e){return hn(e.height)}constructor(e,n){super(n),this.__height=e}exportJSON(){return{...super.exportJSON(),type:"tablerow",version:1}}createDOM(e){let n=document.createElement("tr");return this.__height&&(n.style.height=`${this.__height}px`),le.addClassNamesToElement(n,e.theme.tableRow),n}isShadowRoot(){return!0}setHeight(e){return this.getWritable().__height=e,this.__height}getHeight(){return this.getLatest().__height}updateDOM(e){return e.__height!==this.__height}canBeEmpty(){return!1}canIndent(){return!1}};function om(){return{node:hn()}}function hn(t){return E.$applyNodeReplacement(new Kl(t))}function pn(t){return t instanceof Kl}function Oe(t){throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?code=${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let lm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ud=class{constructor(e,n){this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.listenersToRemove=new Set,this.tableNodeKey=n,this.editor=e,this.grid={cells:[],columns:0,rows:0},this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null,this.hasHijackedSelectionStyles=!1,this.trackTableGrid()}getGrid(){return this.grid}removeListeners(){Array.from(this.listenersToRemove).forEach(e=>e())}trackTableGrid(){let e=new MutationObserver(n=>{this.editor.update(()=>{var r=!1;for(let i=0;i{let n=this.editor.getElementByKey(this.tableNodeKey);if(!n)throw Error("Expected to find TableElement in DOM");this.grid=xi(n),e.observe(n,{childList:!0,subtree:!0})})}clearHighlight(){let e=this.editor;this.isHighlightingCells=!1,this.focusY=this.focusX=this.anchorY=this.anchorX=-1,this.focusCell=this.anchorCell=this.focusCellNodeKey=this.anchorCellNodeKey=this.gridSelection=null,this.hasHijackedSelectionStyles=!1,this.enableHighlightStyle(),e.update(()=>{var n=E.$getNodeByKey(this.tableNodeKey);if(!Wn(n))throw Error("Expected TableNode.");if(n=e.getElementByKey(this.tableNodeKey),!n)throw Error("Expected to find TableElement in DOM");n=xi(n),ui(e,n,null),E.$setSelection(null),e.dispatchCommand(E.SELECTION_CHANGE_COMMAND,void 0)})}enableHighlightStyle(){let e=this.editor;e.update(()=>{let n=e.getElementByKey(this.tableNodeKey);if(!n)throw Error("Expected to find TableElement in DOM");n.classList.remove("disable-selection"),this.hasHijackedSelectionStyles=!1})}disableHighlightStyle(){let e=this.editor;e.update(()=>{let n=e.getElementByKey(this.tableNodeKey);if(!n)throw Error("Expected to find TableElement in DOM");n.classList.add("disable-selection"),this.hasHijackedSelectionStyles=!0})}updateTableGridSelection(e){if(e!=null&&e.gridKey===this.tableNodeKey){let n=this.editor;this.gridSelection=e,this.isHighlightingCells=!0,this.disableHighlightStyle(),ui(n,this.grid,this.gridSelection)}else e==null&&this.clearHighlight()}setFocusCellForSelection(e,n=!1){let r=this.editor;r.update(()=>{var i=E.$getNodeByKey(this.tableNodeKey);if(!Wn(i))throw Error("Expected TableNode.");if(!r.getElementByKey(this.tableNodeKey))throw Error("Expected to find TableElement in DOM");i=e.x;let o=e.y;if(this.focusCell=e,this.anchorCell!==null){let l=lm?(r._window||window).getSelection():null;l&&l.setBaseAndExtent(this.anchorCell.elem,0,this.focusCell.elem,0)}if(!this.isHighlightingCells&&(this.anchorX!==i||this.anchorY!==o||n))this.isHighlightingCells=!0,this.disableHighlightStyle();else if(i===this.focusX&&o===this.focusY)return;this.focusX=i,this.focusY=o,this.isHighlightingCells&&(i=E.$getNearestNodeFromDOMNode(e.elem),this.gridSelection!=null&&this.anchorCellNodeKey!=null&&H(i)&&(i=i.getKey(),this.gridSelection=this.gridSelection.clone()||E.DEPRECATED_$createGridSelection(),this.focusCellNodeKey=i,this.gridSelection.set(this.tableNodeKey,this.anchorCellNodeKey,this.focusCellNodeKey),E.$setSelection(this.gridSelection),r.dispatchCommand(E.SELECTION_CHANGE_COMMAND,void 0),ui(r,this.grid,this.gridSelection)))})}setAnchorCellForSelection(e){this.isHighlightingCells=!1,this.anchorCell=e,this.anchorX=e.x,this.anchorY=e.y,this.editor.update(()=>{var n=E.$getNearestNodeFromDOMNode(e.elem);H(n)&&(n=n.getKey(),this.gridSelection=E.DEPRECATED_$createGridSelection(),this.anchorCellNodeKey=n)})}formatCells(e){this.editor.update(()=>{let n=E.$getSelection();E.DEPRECATED_$isGridSelection(n)||Oe(11);let r=E.$createRangeSelection(),i=r.anchor,o=r.focus;n.getNodes().forEach(l=>{H(l)&&l.getTextContentSize()!==0&&(i.set(l.getKey(),0,"element"),o.set(l.getKey(),l.getChildrenSize(),"element"),r.formatText(e))}),E.$setSelection(n),this.editor.dispatchCommand(E.SELECTION_CHANGE_COMMAND,void 0)})}clearText(){let e=this.editor;e.update(()=>{let n=E.$getNodeByKey(this.tableNodeKey);if(!Wn(n))throw Error("Expected TableNode.");var r=E.$getSelection();E.DEPRECATED_$isGridSelection(r)||Oe(11),r=r.getNodes().filter(H),r.length===this.grid.columns*this.grid.rows?(n.selectPrevious(),n.remove(),E.$getRoot().selectStart()):(r.forEach(i=>{if(E.$isElementNode(i)){let o=E.$createParagraphNode(),l=E.$createTextNode();o.append(l),i.append(o),i.getChildren().forEach(s=>{s!==o&&s.remove()})}}),ui(e,this.grid,null),E.$setSelection(null),e.dispatchCommand(E.SELECTION_CHANGE_COMMAND,void 0))})}};function Ci(t){for(;t!=null;){let e=t.nodeName;if(e==="TD"||e==="TH"){if(t=t._cell,t===void 0)break;return t}t=t.parentNode}return null}function xi(t){let e=[],n={cells:e,columns:0,rows:0};var r=t.firstChild;let i=t=0;for(e.length=0;r!=null;){var o=r.nodeName;if(o==="TD"||o==="TH")o=r,o={elem:o,hasBackgroundColor:o.style.backgroundColor!=="",highlighted:!1,x:t,y:i},r._cell=o,e[i]===void 0&&(e[i]=[]),e[i][t]=o;else if(o=r.firstChild,o!=null){r=o;continue}if(o=r.nextSibling,o!=null)t++,r=o;else if(o=r.parentNode,o!=null){if(r=o.nextSibling,r==null)break;i++,t=0}}return n.columns=t+1,n.rows=i+1,n}function ui(t,e,n){let r=[],i=new Set(n?n.getNodes():[]);return Hl(e,(o,l)=>{let s=o.elem;i.has(l)?(o.highlighted=!0,Gd(t,o),r.push(o)):(o.highlighted=!1,Yd(t,o),s.getAttribute("style")||s.removeAttribute("style"))}),r}function Hl(t,e){({cells:t}=t);for(let n=0;n{n.highlighted=!0,Gd(t,n)})}function sm(t,e){e.enableHighlightStyle(),Hl(e.grid,n=>{let r=n.elem;n.highlighted=!1,Yd(t,n),r.getAttribute("style")||r.removeAttribute("style")})}let ur=(t,e,n,r,i)=>{const o=i==="forward";switch(i){case"backward":case"forward":return n!==(o?t.grid.columns-1:0)?ci(e.getCellNodeFromCordsOrThrow(n+(o?1:-1),r,t.grid)):r!==(o?t.grid.rows-1:0)?ci(e.getCellNodeFromCordsOrThrow(o?0:t.grid.columns-1,r+(o?1:-1),t.grid)):o?e.selectNext():e.selectPrevious(),!0;case"up":return r!==0?ci(e.getCellNodeFromCordsOrThrow(n,r-1,t.grid)):e.selectPrevious(),!0;case"down":return r!==t.grid.rows-1?ci(e.getCellNodeFromCordsOrThrow(n,r+1,t.grid)):e.selectNext(),!0;default:return!1}},bt=(t,e,n,r,i)=>{const o=i==="forward";switch(i){case"backward":case"forward":return n!==(o?t.grid.columns-1:0)&&t.setFocusCellForSelection(e.getCellFromCordsOrThrow(n+(o?1:-1),r,t.grid)),!0;case"up":return r!==0?(t.setFocusCellForSelection(e.getCellFromCordsOrThrow(n,r-1,t.grid)),!0):!1;case"down":return r!==t.grid.rows-1?(t.setFocusCellForSelection(e.getCellFromCordsOrThrow(n,r+1,t.grid)),!0):!1;default:return!1}};function Et(t,e){if(E.$isRangeSelection(t)||E.DEPRECATED_$isGridSelection(t)){let n=e.isParentOf(t.anchor.getNode());return t=e.isParentOf(t.focus.getNode()),n&&t}return!1}function ci(t){let e=t.getChildren().find(n=>E.$isParagraphNode(n));E.$isParagraphNode(e)?e.selectEnd():t.selectEnd()}function Gd(t,e){if(t=e.elem,e=E.$getNearestNodeFromDOMNode(t),!H(e))throw Error("Expected to find LexicalNode from Table Cell DOMNode");e.getBackgroundColor()===null?t.style.setProperty("background-color","rgb(172,206,247)"):t.style.setProperty("background-image","linear-gradient(to right, rgba(172,206,247,0.85), rgba(172,206,247,0.85))"),t.style.setProperty("caret-color","transparent")}function Yd(t,e){if(t=e.elem,e=E.$getNearestNodeFromDOMNode(t),!H(e))throw Error("Expected to find LexicalNode from Table Cell DOMNode");e.getBackgroundColor()===null&&t.style.removeProperty("background-color"),t.style.removeProperty("background-image"),t.style.removeProperty("caret-color")}class Qr extends E.DEPRECATED_GridNode{static getType(){return"table"}static clone(e){return new Qr(e.__key)}static importDOM(){return{table:()=>({conversion:am,priority:1})}}static importJSON(){return lo()}constructor(e){super(e)}exportJSON(){return{...super.exportJSON(),type:"table",version:1}}createDOM(e){let n=document.createElement("table");return le.addClassNamesToElement(n,e.theme.table),n}updateDOM(){return!1}exportDOM(e){return{...super.exportDOM(e),after:n=>{if(n){let r=n.cloneNode(),i=document.createElement("colgroup"),o=document.createElement("tbody");if(o.append(...n.children),n=this.getFirstChildOrThrow(),!pn(n))throw Error("Expected to find row node.");n=n.getChildrenSize();for(let l=0;lE.$getNearestNodeFromDOMNode(l)===e),o!==-1)return{x:o,y:n}}throw Error("Cell not found in table.")}getCellFromCords(e,n,r){return{cells:r}=r,n=r[n],n==null?null:(e=n[e],e??null)}getCellFromCordsOrThrow(e,n,r){if(e=this.getCellFromCords(e,n,r),!e)throw Error("Cell not found at cords.");return e}getCellNodeFromCords(e,n,r){return e=this.getCellFromCords(e,n,r),e==null?null:(e=E.$getNearestNodeFromDOMNode(e.elem),H(e)?e:null)}getCellNodeFromCordsOrThrow(e,n,r){if(e=this.getCellNodeFromCords(e,n,r),!e)throw Error("Node at cords not TableCellNode.");return e}canSelectBefore(){return!0}canIndent(){return!1}}function am(){return{node:lo()}}function lo(){return E.$applyNodeReplacement(new Qr)}function Wn(t){return t instanceof Qr}function Wl(t){if(t=le.$findMatchingParent(t,e=>pn(e)),pn(t))return t;throw Error("Expected table cell to be inside of table row.")}function Ul(t){if(t=le.$findMatchingParent(t,e=>Wn(e)),Wn(t))return t;throw Error("Expected table cell to be inside of table.")}function Jd(t,e){let n=Ul(t),{x:r,y:i}=n.getCordsFromCellNode(t,e);return{above:n.getCellNodeFromCords(r,i-1,e),below:n.getCellNodeFromCords(r,i+1,e),left:n.getCellNodeFromCords(r-1,i,e),right:n.getCellNodeFromCords(r+1,i,e)}}function Hr(t){t=t.getFirstDescendant(),t===null&&Oe(124),t.getParentOrThrow().selectStart()}function Gl(t,e){let n=t.getFirstChild();n!==null?n.insertBefore(e):t.append(e)}let um=E.createCommand("INSERT_TABLE_COMMAND");Y.$createTableCellNode=et;Y.$createTableNode=lo;Y.$createTableNodeWithDimensions=function(t,e,n=!0){let r=lo();for(let o=0;o=r.length||0>e)throw Error("Table column target index out of range");r[e].remove()}}return t};Y.$deleteTableColumn__EXPERIMENTAL=function(){var t=E.$getSelection();E.$isRangeSelection(t)||E.DEPRECATED_$isGridSelection(t)||Oe(118);var e=t.anchor.getNode();t=t.focus.getNode();let[n,,r]=E.DEPRECATED_$getNodeTriplet(e);[e]=E.DEPRECATED_$getNodeTriplet(t);let[i,o,l]=E.DEPRECATED_$computeGridMap(r,n,e);var{startColumn:s}=o;let{startRow:a,startColumn:c}=l;t=Math.min(s,c),s=Math.max(s+n.__colSpan-1,c+e.__colSpan-1);let g=s-t+1;if(i[0].length===s-t+1)r.selectPrevious(),r.remove();else{var d=i.length;for(let u=0;us?f===s&&h.setColSpan(h.__colSpan-(s-m+1)):h.remove()}t=i[a],e=t[c+e.__colSpan],e!==void 0?({cell:e}=e,Hr(e)):({cell:e}=t[c-1],Hr(e))}};Y.$deleteTableRow__EXPERIMENTAL=function(){var t=E.$getSelection();E.$isRangeSelection(t)||E.DEPRECATED_$isGridSelection(t)||Oe(118);var e=t.anchor.getNode();t=t.focus.getNode();let[n,,r]=E.DEPRECATED_$getNodeTriplet(e);[t]=E.DEPRECATED_$getNodeTriplet(t);let[i,o,l]=E.DEPRECATED_$computeGridMap(r,n,t);({startRow:e}=o);var{startRow:s}=l;if(t=s+t.__rowSpan-1,i.length===t-e+1)r.remove();else{s=i[0].length;var a=i[t+1],c=r.getChildAtIndex(t+1);for(let d=t;d>=e;d--){for(var g=s-1;0<=g;g--){let{cell:u,startRow:f,startColumn:h}=i[d][g];if(h===g&&(d===e&&f=e&&f+u.__rowSpan-1>t))if(u.setRowSpan(u.__rowSpan-(t-f+1)),c===null&&Oe(122),g===0)Gl(c,u);else{let{cell:m}=a[g-1];m.insertAfter(u)}}g=r.getChildAtIndex(d),E.DEPRECATED_$isGridRowNode(g)||Oe(123),g.remove()}a!==void 0?({cell:e}=a[0],Hr(e)):({cell:e}=i[e-1][0],Hr(e))}};Y.$getElementGridForTableNode=function(t,e){if(t=t.getElementByKey(e.getKey()),t==null)throw Error("Table Element Not Found");return xi(t)};Y.$getTableCellNodeFromLexicalNode=function(t){return t=le.$findMatchingParent(t,e=>H(e)),H(t)?t:null};Y.$getTableColumnIndexFromTableCellNode=function(t){return Wl(t).getChildren().findIndex(e=>e.is(t))};Y.$getTableNodeFromLexicalNodeOrThrow=Ul;Y.$getTableRowIndexFromTableCellNode=function(t){let e=Wl(t);return Ul(e).getChildren().findIndex(n=>n.is(e))};Y.$getTableRowNodeFromTableCellNodeOrThrow=Wl;Y.$insertTableColumn=function(t,e,n=!0,r,i){let o=t.getChildren();for(let a=0;a=l.length||0>e)throw Error("Table column target index out of range");l=l[e],H(l)||Oe(12);let{left:d,right:u}=Jd(l,i);var s=ee.NO_STATUS;(d&&d.hasHeaderState(ee.ROW)||u&&u.hasHeaderState(ee.ROW))&&(s|=ee.ROW),s=et(s),s.append(E.$createParagraphNode()),n?l.insertAfter(s):l.insertBefore(s)}}return t};Y.$insertTableColumn__EXPERIMENTAL=function(t=!0){function e(){let g=et(ee.NO_STATUS).append(E.$createParagraphNode());return a===null&&(a=g),g}var n=E.$getSelection();E.$isRangeSelection(n)||E.DEPRECATED_$isGridSelection(n)||Oe(118),n=n.focus.getNode();let[r,,i]=E.DEPRECATED_$getNodeTriplet(n),[o,l]=E.DEPRECATED_$computeGridMap(i,r,r);n=o.length;var{startColumn:s}=l;t=t?s+r.__colSpan-1:s-1,s=i.getFirstChild(),E.DEPRECATED_$isGridRowNode(s)||Oe(120);let a=null;var c=s;e:for(s=0;st){Gl(c,e());continue}let{cell:d,startColumn:u,startRow:f}=g[t];if(u+d.__colSpan-1<=t){let h=d,m=f,N=t;for(;m!==s&&1=o.length||0>e)throw Error("Table row target index out of range");if(e=o[e],pn(e))for(o=0;o=n.length||0>e)throw Error("Expected table cell to be inside of table row.");return n[e].remove(),t};Y.$unmergeCell=function(){var t=E.$getSelection();E.$isRangeSelection(t)||E.DEPRECATED_$isGridSelection(t)||Oe(118),t=t.anchor.getNode();let[e,n,r]=E.DEPRECATED_$getNodeTriplet(t);t=e.__colSpan;let i=e.__rowSpan;if(1{let u=Ci(d.target);u!==null&&(d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),i.setAnchorCellForSelection(u),i.setFocusCellForSelection(u,!0),o=!1)}),e.addEventListener("mousedown",d=>{setTimeout(()=>{if(d.button===0){var u=Ci(d.target);u!==null&&(d.preventDefault(),d.stopPropagation(),d.stopImmediatePropagation(),i.setAnchorCellForSelection(u))}},0)}),e.addEventListener("mousemove",d=>{if(l&&(d.preventDefault(),d.stopPropagation(),d.stopImmediatePropagation()),o){let u=Ci(d.target);if(u!==null){let f=u.x,h=u.y;o&&(i.anchorX!==f||i.anchorY!==h||i.isHighlightingCells)&&(d.preventDefault(),i.setFocusCellForSelection(u))}}}),e.addEventListener("mouseleave",()=>{});let s=d=>{d.button===0&&n.update(()=>{var u=E.$getSelection();const f=d.target;if(f instanceof Node){if(E.DEPRECATED_$isGridSelection(u)&&u.gridKey===i.tableNodeKey&&r.contains(f))return i.clearHighlight();u=E.$getNearestNodeFromDOMNode(f),u!==null&&le.$findMatchingParent(u,E.DEPRECATED_$isGridNode)&&(o=!0)}})};window.addEventListener("mousedown",s),i.listenersToRemove.add(()=>window.removeEventListener("mousedown",s));let a=d=>{var u;(u=o)&&(u=d.target,u=u!==null&&u.nodeName==="SPAN",u=!u),u&&(d.preventDefault(),d.stopPropagation()),o=!1};window.addEventListener("mouseup",a),i.listenersToRemove.add(()=>window.removeEventListener("mouseup",a)),e.addEventListener("mouseup",a),i.listenersToRemove.add(()=>e.removeEventListener("mouseup",a)),i.listenersToRemove.add(n.registerCommand(E.KEY_ARROW_DOWN_COMMAND,d=>{var u=E.$getSelection();if(!Et(u,t))return!1;if(E.$isRangeSelection(u)){if(u.isCollapsed()){var f=le.$findMatchingParent(u.anchor.getNode(),m=>H(m));if(!H(f))return!1;var h=t.getCordsFromCellNode(f,i.grid);if(u=le.$findMatchingParent(u.anchor.getNode(),m=>E.$isElementNode(m)),u==null)throw Error("Expected BlockNode Parent");if((f=f.getLastChild())&&u.isParentOf(f)||u===f||d.shiftKey)return d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),d.shiftKey?(i.setAnchorCellForSelection(t.getCellFromCordsOrThrow(h.x,h.y,i.grid)),bt(i,t,h.x,h.y,"down")):ur(i,t,h.x,h.y,"down")}}else if(E.DEPRECATED_$isGridSelection(u)&&d.shiftKey)return h=u.focus.getNode(),H(h)?(h=t.getCordsFromCellNode(h,i.grid),d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),bt(i,t,h.x,h.y,"down")):!1;return!1},E.COMMAND_PRIORITY_HIGH)),i.listenersToRemove.add(n.registerCommand(E.KEY_ARROW_UP_COMMAND,d=>{var u=E.$getSelection();if(!Et(u,t))return!1;if(E.$isRangeSelection(u)){if(u.isCollapsed()){var f=le.$findMatchingParent(u.anchor.getNode(),m=>H(m));if(!H(f))return!1;var h=t.getCordsFromCellNode(f,i.grid);if(u=le.$findMatchingParent(u.anchor.getNode(),m=>E.$isElementNode(m)),u==null)throw Error("Expected BlockNode Parent");if((f=f.getLastChild())&&u.isParentOf(f)||u===f||d.shiftKey)return d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),d.shiftKey?(i.setAnchorCellForSelection(t.getCellFromCordsOrThrow(h.x,h.y,i.grid)),bt(i,t,h.x,h.y,"up")):ur(i,t,h.x,h.y,"up")}}else if(E.DEPRECATED_$isGridSelection(u)&&d.shiftKey)return h=u.focus.getNode(),H(h)?(h=t.getCordsFromCellNode(h,i.grid),d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),bt(i,t,h.x,h.y,"up")):!1;return!1},E.COMMAND_PRIORITY_HIGH)),i.listenersToRemove.add(n.registerCommand(E.KEY_ARROW_LEFT_COMMAND,d=>{var u=E.$getSelection();if(!Et(u,t))return!1;if(E.$isRangeSelection(u)){if(u.isCollapsed()){var f=le.$findMatchingParent(u.anchor.getNode(),h=>H(h));if(!H(f))return!1;if(f=t.getCordsFromCellNode(f,i.grid),le.$findMatchingParent(u.anchor.getNode(),h=>E.$isElementNode(h))==null)throw Error("Expected BlockNode Parent");if(u.anchor.offset===0||d.shiftKey)return d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),d.shiftKey?(i.setAnchorCellForSelection(t.getCellFromCordsOrThrow(f.x,f.y,i.grid)),bt(i,t,f.x,f.y,"backward")):ur(i,t,f.x,f.y,"backward")}}else if(E.DEPRECATED_$isGridSelection(u)&&d.shiftKey)return u=u.focus.getNode(),H(u)?(u=t.getCordsFromCellNode(u,i.grid),d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),bt(i,t,u.x,u.y,"backward")):!1;return!1},E.COMMAND_PRIORITY_HIGH)),i.listenersToRemove.add(n.registerCommand(E.KEY_ARROW_RIGHT_COMMAND,d=>{var u=E.$getSelection();if(!Et(u,t))return!1;if(E.$isRangeSelection(u)){if(u.isCollapsed()){var f=le.$findMatchingParent(u.anchor.getNode(),h=>H(h));if(!H(f))return!1;if(f=t.getCordsFromCellNode(f,i.grid),le.$findMatchingParent(u.anchor.getNode(),h=>E.$isElementNode(h))==null)throw Error("Expected BlockNode Parent");if(u.anchor.offset===u.anchor.getNode().getTextContentSize()||d.shiftKey)return d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),d.shiftKey?(i.setAnchorCellForSelection(t.getCellFromCordsOrThrow(f.x,f.y,i.grid)),bt(i,t,f.x,f.y,"forward")):ur(i,t,f.x,f.y,"forward")}}else if(E.DEPRECATED_$isGridSelection(u)&&d.shiftKey)return u=u.focus.getNode(),H(u)?(u=t.getCordsFromCellNode(u,i.grid),d.preventDefault(),d.stopImmediatePropagation(),d.stopPropagation(),bt(i,t,u.x,u.y,"forward")):!1;return!1},E.COMMAND_PRIORITY_HIGH));let c=d=>()=>{var u=E.$getSelection();if(!Et(u,t))return!1;if(E.DEPRECATED_$isGridSelection(u))return i.clearText(),!0;if(E.$isRangeSelection(u)){const m=le.$findMatchingParent(u.anchor.getNode(),N=>H(N));if(!H(m))return!1;var f=u.anchor.getNode(),h=u.focus.getNode();if(f=t.isParentOf(f),h=t.isParentOf(h),f&&!h||h&&!f)return i.clearText(),!0;if(f=(h=le.$findMatchingParent(u.anchor.getNode(),N=>E.$isElementNode(N)))&&le.$findMatchingParent(h,N=>E.$isElementNode(N)&&H(N.getParent())),!E.$isElementNode(f)||!E.$isElementNode(h))return!1;if(d===E.DELETE_LINE_COMMAND&&f.getPreviousSibling()===null)return!0;if((d===E.DELETE_CHARACTER_COMMAND||d===E.DELETE_WORD_COMMAND)&&u.isCollapsed()&&u.anchor.offset===0&&h!==f){u=h.getChildren();const N=E.$createParagraphNode();return u.forEach(y=>N.append(y)),h.replace(N),h.getWritable().__parent=m.getKey(),!0}}return!1};[E.DELETE_WORD_COMMAND,E.DELETE_LINE_COMMAND,E.DELETE_CHARACTER_COMMAND].forEach(d=>{i.listenersToRemove.add(n.registerCommand(d,c(d),E.COMMAND_PRIORITY_CRITICAL))});let g=d=>{const u=E.$getSelection();return Et(u,t)?E.DEPRECATED_$isGridSelection(u)?(d.preventDefault(),d.stopPropagation(),i.clearText(),!0):(E.$isRangeSelection(u)&&(d=le.$findMatchingParent(u.anchor.getNode(),f=>H(f)),H(d)),!1):!1};return i.listenersToRemove.add(n.registerCommand(E.KEY_BACKSPACE_COMMAND,g,E.COMMAND_PRIORITY_CRITICAL)),i.listenersToRemove.add(n.registerCommand(E.KEY_DELETE_COMMAND,g,E.COMMAND_PRIORITY_CRITICAL)),i.listenersToRemove.add(n.registerCommand(E.FORMAT_TEXT_COMMAND,d=>{let u=E.$getSelection();return Et(u,t)?E.DEPRECATED_$isGridSelection(u)?(i.formatCells(d),!0):(E.$isRangeSelection(u)&&(d=le.$findMatchingParent(u.anchor.getNode(),f=>H(f)),H(d)),!1):!1},E.COMMAND_PRIORITY_CRITICAL)),i.listenersToRemove.add(n.registerCommand(E.CONTROLLED_TEXT_INSERTION_COMMAND,()=>{var d=E.$getSelection();return Et(d,t)&&(E.DEPRECATED_$isGridSelection(d)?i.clearHighlight():E.$isRangeSelection(d)&&(d=le.$findMatchingParent(d.anchor.getNode(),u=>H(u)),H(d))),!1},E.COMMAND_PRIORITY_CRITICAL)),i.listenersToRemove.add(n.registerCommand(E.KEY_TAB_COMMAND,d=>{var u=E.$getSelection();if(!Et(u,t))return!1;if(E.$isRangeSelection(u)){let f=le.$findMatchingParent(u.anchor.getNode(),h=>H(h));if(!H(f))return!1;if(u.isCollapsed())return u=t.getCordsFromCellNode(f,i.grid),d.preventDefault(),ur(i,t,u.x,u.y,d.shiftKey?"backward":"forward"),!0}return!1},E.COMMAND_PRIORITY_HIGH)),i.listenersToRemove.add(n.registerCommand(E.FOCUS_COMMAND,()=>t.isSelected(),E.COMMAND_PRIORITY_HIGH)),i.listenersToRemove.add(n.registerCommand(E.SELECTION_CHANGE_COMMAND,()=>{let d=E.$getSelection();var u=E.$getPreviousSelection();if(d&&E.$isRangeSelection(d)&&!d.isCollapsed()){var f=d.anchor.getNode(),h=d.focus.getNode();f=t.isParentOf(f);var m=t.isParentOf(h);if(h=f&&!m||m&&!f,f=f&&m&&!t.isSelected(),h)return u=d.isBackward(),f=E.$createRangeSelection(),h=t.getKey(),f.anchor.set(d.anchor.key,d.anchor.offset,d.anchor.type),f.focus.set(h,u?0:t.getChildrenSize(),"element"),l=!0,E.$setSelection(f),Sa(n,i),!0;if(f&&({grid:f}=i,d.getNodes().filter(H).length===f.rows*f.columns)){f=E.DEPRECATED_$createGridSelection(),h=t.getKey(),m=t.getFirstChildOrThrow().getFirstChild();let N=t.getLastChildOrThrow().getLastChild();if(m!=null&&N!=null)return f.set(h,m.getKey(),N.getKey()),E.$setSelection(f),i.updateTableGridSelection(f),!0}}return d&&!d.is(u)&&(E.DEPRECATED_$isGridSelection(d)||E.DEPRECATED_$isGridSelection(u))&&i.gridSelection&&!i.gridSelection.is(u)?(E.DEPRECATED_$isGridSelection(d)&&d.gridKey===i.tableNodeKey?i.updateTableGridSelection(d):!E.DEPRECATED_$isGridSelection(d)&&E.DEPRECATED_$isGridSelection(u)&&u.gridKey===i.tableNodeKey&&i.updateTableGridSelection(null),!1):(i.hasHijackedSelectionStyles&&!t.isSelected()?(sm(n,i),l=!1):!i.hasHijackedSelectionStyles&&t.isSelected()&&Sa(n,i),!1)},E.COMMAND_PRIORITY_CRITICAL)),i};Y.getCellFromTarget=Ci;Y.getTableSelectionFromTableElement=function(t){return t.__lexicalTableSelection};const cm=Y;var He=cm;const dm={dependencies:[jt.HorizontalRuleNode],export:t=>jt.$isHorizontalRuleNode(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,r)=>{const i=jt.$createHorizontalRuleNode();r||t.getNextSibling()?t.replace(i):t.insertBefore(i),i.selectNext()},type:"element"},gm={dependencies:[Ut],export:(t,e,n)=>Nd(t)?`![${t.getAltText()}](${t.getSrc()})`:null,importRegExp:/!(?:\[([^[]*)\])(?:\(([^(]+)\))/,regExp:/!(?:\[([^[]*)\])(?:\(([^(]+)\))$/,replace:(t,e)=>{const[,n,r]=e,i=ro({altText:n,maxWidth:800,src:r});t.replace(i)},trigger:")",type:"text-match"},Vd=/^(?:\|)(.+)(?:\|)\s?$/,fm={dependencies:[He.TableNode,He.TableRowNode,He.TableCellNode],export:(t,e)=>{if(!He.$isTableNode(t))return null;const n=[];for(const r of t.getChildren()){const i=[];if(He.$isTableRowNode(r))for(const o of r.getChildren())C.$isElementNode(o)&&i.push(e(o));n.push(`| ${i.join(" | ")} |`)}return n.join(` -`)},regExp:Vd,replace:(t,e,n)=>{const r=$a(n[0]);if(!r)return;const i=[r];let o=t.getPreviousSibling(),l=r.length;for(;o&&!(!C.$isParagraphNode(o)||o.getChildrenSize()!==1);){const c=o.getFirstChild();if(!C.$isTextNode(c))break;const g=$a(c.getTextContent());if(!g)break;l=Math.max(l,g.length),i.unshift(g);const d=o.getPreviousSibling();o.remove(),o=d}const s=He.$createTableNode();for(const c of i){const g=He.$createTableRowNode();s.append(g);for(let d=0;d{const e=He.$createTableCellNode(He.TableCellHeaderStates.NO_STATUS),n=C.$createParagraphNode();return t!=null&&n.append(C.$createTextNode(t.trim())),e.append(n),e},$a=t=>{const e=t.match(Vd);return!e||!e[1]?null:e[1].split("|").map(n=>Xd(n))},ol=[fm,dm,gm,Kr.CHECK_LIST,...Kr.TRANSFORMERS];function pm(){const[t]=X.useLexicalComposerContext(),e=$.useCallback(()=>t.update(()=>{const n=C.$getRoot(),r=n.getFirstChild();if(he.$isCodeNode(r)&&r.getLanguage()==="markdown")Kr.$convertFromMarkdownString(r.getTextContent(),ol);else{const i=Kr.$convertToMarkdownString(ol);n.clear().append(he.$createCodeNode("markdown").append(C.$createTextNode(i)))}n.selectEnd()}),[t]);return p.jsx(Va,{appearance:"outline",icon:p.jsx(Rg,{}),onClick:e})}var Yl={},mm=C;function _m(t){let e=document.createElement("input");e.type="file",e.accept=".lexical",e.addEventListener("change",n=>{if(n=n.target,n.files){n=n.files[0];let r=new FileReader;r.readAsText(n,"UTF-8"),r.onload=i=>{i.target&&t(i.target.result)}}}),e.click()}Yl.exportFile=function(t,e=Object.freeze({})){var n=new Date;t={editorState:t.getEditorState(),lastSaved:n.getTime(),source:e.source||"Lexical",version:"0.10.0"};{e=`${e.fileName||n.toISOString()}.lexical`,n=document.createElement("a");let r=document.body;r!==null&&(r.appendChild(n),n.style.display="none",t=JSON.stringify(t),t=new Blob([t],{type:"octet/stream"}),t=window.URL.createObjectURL(t),n.href=t,n.download=e,n.click(),window.URL.revokeObjectURL(t),n.remove())}};Yl.importFile=function(t){_m(e=>{e=JSON.parse(e),e=t.parseEditorState(JSON.stringify(e.editorState)),t.setEditorState(e),t.dispatchCommand(mm.CLEAR_HISTORY_COMMAND,void 0)})};const Cm=Yl;var Ra=Cm;function xm(){const[t]=X.useLexicalComposerContext();return p.jsxs(p.Fragment,{children:[p.jsx(Un,{appearance:"outline",icon:p.jsx(Ag,{}),onClick:()=>Ra.importFile(t)}),p.jsx(Un,{appearance:"outline",icon:p.jsx(Og,{}),onClick:()=>Ra.exportFile(t,{fileName:`Bunlog ${new Date().toISOString()}`,source:"Bunlog"})})]})}const Nm=it({box:{...uu,columnGap:"3px",position:"absolute",...P.padding("10px"),bottom:0,left:0}});function Em({anchor:t}){const e=Nm(),[n]=X.useLexicalComposerContext(),[r,i]=$.useState(()=>n.isEditable()),[o,l]=$.useState(!0);return $.useEffect(()=>V.mergeRegister(n.registerEditableListener(s=>i(s))),[n]),$.useEffect(()=>n.registerUpdateListener(({dirtyElements:s,prevEditorState:a,tags:c})=>{!r&&s.size>0&&!c.has("historic")&&!c.has("collaboration")&&console.debug(n.getEditorState()),n.getEditorState().read(()=>{const g=C.$getRoot().getChildren();g.length>1?l(!1):C.$isParagraphNode(g[0])?l(g[0].getChildren().length===0):l(!1)})}),[n,r]),p.jsx(Wr,{mountNode:t,children:p.jsxs("div",{className:e.box,children:[p.jsx(xm,{}),p.jsx(Pp,{}),p.jsx(pm,{})]})})}var Jl={},Xt=ce,Tm=X,ym=V,Rt=C,vm=$;function Zd(t,e){for(let n=0;nr.getLatest())}function Sm(t,e,n){vm.useEffect(()=>{if(!t.hasNodes([Xt.AutoLinkNode]))throw Error("Minified Lexical error #77; visit https://lexical.dev/docs/error?code=77 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let r=(i,o)=>{n&&n(i,o)};return ym.mergeRegister(t.registerNodeTransform(Rt.TextNode,i=>{var o=i.getParentOrThrow(),l=i.getPreviousSibling();if(Xt.$isAutoLinkNode(o))$o(o,e,r);else if(!Xt.$isLinkNode(o)){if(i.isSimpleText()&&(en.test(i.getTextContent()[0])||!Xt.$isAutoLinkNode(l))){l=o=i.getTextContent();let f=0,h=i;for(var s;(s=Zd(l,e))&&s!==null;){let m=s.index,N=s.length,y=m+N;var a=f+m,c=f+y,g=o,d=i;if((0n){return n=>{let r=t.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(n)}}};const $m=Jl;var Rm=$m;const Am=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,Om=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,wm=[t=>{const e=Am.exec(t);if(!e)return null;const n=e[0];return{index:e.index,length:n.length,text:n,url:n.startsWith("http")?n:`https://${n}`}},t=>{const e=Om.exec(t);return e&&{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}}];function Dm(){return p.jsx(Rm.AutoLinkPlugin,{matchers:wm})}function Aa({filter:t,newTab:e=!0}){const[n]=X.useLexicalComposerContext();return $.useEffect(()=>{function r(i){const o=i,l=Lm(o,n);if(!l)return;const s=l.getAttribute("href");if(l.getAttribute("contenteditable")==="false"||!s)return;const a=n.getEditorState().read(C.$getSelection);if(C.$isRangeSelection(a)&&!a.isCollapsed())return;let c;if(n.update(()=>{const g=C.$getNearestNodeFromDOMNode(l);ce.$isLinkNode(g)&&(c=g)}),!(!c||t&&!t(o,c)))try{if(s){const g=o.type==="auxclick"&&o.button===1;window.open(s,e||o.metaKey||o.ctrlKey||g?"_blank":"_self"),o.preventDefault()}}catch{}}return n.registerRootListener((i,o)=>{o&&(o.removeEventListener("click",r),o.removeEventListener("auxclick",r)),i&&(i.addEventListener("click",r),i.addEventListener("auxclick",r))})},[n,t,e]),null}function Oa(t){return t.nodeName.toLowerCase()==="a"}function Lm(t,e){return e.getEditorState().read(()=>{const n=t.target;return Oa(n)?n:n.parentNode&&Oa(n.parentNode)?n.parentNode:null})}const Mm=it({green:{color:an.colorPaletteLightGreenForeground3}});function bm({editor:t,getCodeDOMNode:e}){const[n,r]=$.useState(!1),{run:i}=Xa(()=>{r(!1)},{wait:1e3});async function o(){const s=e();if(!s)return;let a="";t.update(()=>{const c=C.$getNearestNodeFromDOMNode(s);he.$isCodeNode(c)&&(a=c.getTextContent());const g=C.$getSelection();C.$setSelection(g)});try{await navigator.clipboard.writeText(a),r(!0),i()}catch(c){console.error("Failed to copy: ",c)}}const l=Mm();return p.jsx(Un,{size:"small",appearance:"subtle",onClick:o,icon:n?p.jsx(wg,{className:l.green}):p.jsx(Dg,{})})}const km=8,Im=it({container:{height:"35.8px",fontSize:"10px",color:"rgba(0, 0, 0, 0.5)",position:"absolute",display:"flex",alignItems:"center",flexDirection:"row",userSelect:"none"},lang:{marginRight:"4px"}});function Pm(t){const e=t.target;if(e&&e instanceof HTMLElement){const n=e.closest("code.LexEditor_code"),r=!(n||e.closest("div.LexEditor_CodeMenu"));return{codeDOMNode:n,isOutside:r}}else return{codeDOMNode:null,isOutside:!0}}function Fm({anchor:t=document.body}){const[e]=X.useLexicalComposerContext(),[n,r]=$.useState(!1),[i,o]=$.useState(!1),[l,s]=$.useState(""),[a,c]=$.useState({right:"0",top:"0"}),g=$.useRef(new Set),d=$.useRef(null),{run:u,cancel:f}=Xa(N=>{const{codeDOMNode:y,isOutside:_}=Pm(N);if(_){r(!1);return}if(!y)return;d.current=y;let x=null,v="";if(e.update(()=>{const S=C.$getNearestNodeFromDOMNode(y);he.$isCodeNode(S)&&(x=S,v=x.getLanguage()||"")}),x){const{y:S,right:A}=t.getBoundingClientRect(),{y:w,right:B}=y.getBoundingClientRect();s(v),r(!0),c({right:`${A-B+km}px`,top:`${w-S}px`})}},{wait:100,maxWait:1e3});$.useEffect(()=>{if(i)return document.addEventListener("mousemove",u),()=>{r(!1),f(),document.removeEventListener("mousemove",u)}},[i,u]),e.registerMutationListener(he.CodeNode,N=>{e.getEditorState().read(()=>{for(const[y,_]of N)switch(_){case"created":g.current.add(y),o(g.current.size>0);break;case"destroyed":g.current.delete(y),o(g.current.size>0);break}})});const h=he.getLanguageFriendlyName(l),m=Im();return p.jsx(Wr,{mountNode:t,children:n&&p.jsxs("div",{className:gt(m.container,"LexEditor_CodeMenu"),style:a,children:[p.jsx("div",{className:m.lang,children:h}),p.jsx(bm,{editor:e,getCodeDOMNode:()=>d.current})]})})}function Bm(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>he.registerCodeHighlighting(t),[t]),null}class mn extends C.ElementNode{constructor(e,n){super(n),this.open=e,this.open=e}static getType(){return"collapsible-container"}static clone(e){return new mn(e.open,e.__key)}createDOM(e){const n=document.createElement("details");return n.classList.add("LexEditor_Collapsible"),n.open=this.open,n}updateDOM(e,n){return e.open!==this.open&&(n.open=this.open),!1}static importDOM(){return{}}static importJSON(e){return eg()}exportJSON(){return{...super.exportJSON(),type:"collapsible-container",version:1}}setOpen(e){const n=this.getWritable();n.open=e}getOpen(){return this.open}toggleOpen(){this.setOpen(!this.getOpen())}}function eg(){return new mn(!0)}function Qt(t){return t instanceof mn}class _n extends C.ElementNode{static getType(){return"collapsible-content"}static clone(e){return new _n(e.__key)}createDOM(e){const n=document.createElement("div");return n.classList.add("LexEditor_CollapsibleContent"),n}updateDOM(e,n){return!1}static importDOM(){return{}}static importJSON(e){return tg()}isShadowRoot(){return!0}exportJSON(){return{...super.exportJSON(),type:"collapsible-content",version:1}}}function tg(){return new _n}function ng(t){return t instanceof _n}class Cn extends C.ElementNode{static getType(){return"collapsible-title"}static clone(e){return new Cn(e.__key)}createDOM(e,n){const r=document.createElement("summary");return r.classList.add("LexEditor_CollapsibleTitle"),r}updateDOM(e,n){return!1}static importDOM(){return{}}static importJSON(e){return rg()}exportJSON(){return{...super.exportJSON(),type:"collapsible-title",version:1}}collapseAtStart(e){return this.getParentOrThrow().insertBefore(this),!0}insertNewAfter(e,n=!0){const r=this.getParentOrThrow();if(!Qt(r))throw new Error("CollapsibleTitleNode expects to be child of CollapsibleContainerNode");if(r.getOpen()){const i=this.getNextSibling();if(!ng(i))throw new Error("CollapsibleTitleNode expects to have CollapsibleContentNode sibling");const o=i.getFirstChild();if(C.$isElementNode(o))return o;{const l=C.$createParagraphNode();return i.append(l),l}}else{const i=C.$createParagraphNode();return r.insertAfter(i,n),i}}}function rg(){return new Cn}function wa(t){return t instanceof Cn}const ig=C.createCommand(),jm=C.createCommand();function zm(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>{if(!t.hasNodes([mn,Cn,_n]))throw new Error("CollapsiblePlugin: CollapsibleContainerNode, CollapsibleTitleNode, or CollapsibleContentNode not registered on editor");return V.mergeRegister(t.registerNodeTransform(_n,e=>{const n=e.getParent();if(!Qt(n)){const r=e.getChildren();for(const i of r)e.insertBefore(i);e.remove()}}),t.registerNodeTransform(Cn,e=>{const n=e.getParent();Qt(n)||e.replace(C.$createParagraphNode().append(...e.getChildren()))}),t.registerNodeTransform(mn,e=>{const n=e.getChildren();if(n.length!==2||!wa(n[0])||!ng(n[1])){for(const r of n)e.insertBefore(r);e.remove()}}),t.registerCommand(C.DELETE_CHARACTER_COMMAND,()=>{const e=C.$getSelection();if(!C.$isRangeSelection(e)||!e.isCollapsed()||e.anchor.offset!==0)return!1;const r=e.anchor.getNode().getTopLevelElement();if(!r)return!1;const i=r.getPreviousSibling();return!Qt(i)||i.getOpen()?!1:(i.setOpen(!0),!0)},C.COMMAND_PRIORITY_LOW),t.registerCommand(C.KEY_ARROW_DOWN_COMMAND,()=>{const e=C.$getSelection();if(!C.$isRangeSelection(e)||!e.isCollapsed())return!1;const n=V.$findMatchingParent(e.anchor.getNode(),Qt);if(!n)return!1;const r=n.getParent();return r&&r.getLastChild()===n&&r.append(C.$createParagraphNode()),!1},C.COMMAND_PRIORITY_LOW),t.registerCommand(C.INSERT_PARAGRAPH_COMMAND,()=>{const e=t._window?.event;if(e&&(e.ctrlKey||e.metaKey)&&e.key==="Enter"){const n=C.$getPreviousSelection();if(C.$isRangeSelection(n)&&n.isCollapsed()){const r=V.$findMatchingParent(n.anchor.getNode(),i=>C.$isElementNode(i)&&!i.isInline());if(wa(r)){const i=r.getParent();if(Qt(i))return i.toggleOpen(),C.$setSelection(n.clone()),!0}}}return!1},C.COMMAND_PRIORITY_LOW),t.registerCommand(ig,()=>(t.update(()=>{const e=C.$getSelection();if(!C.$isRangeSelection(e))return;const n=rg(),r=tg().append(C.$createParagraphNode()),i=eg().append(n,r);e.insertNodes([i]),n.selectStart()}),!0),C.COMMAND_PRIORITY_EDITOR),t.registerCommand(jm,e=>(t.update(()=>{const n=C.$getNodeByKey(e);Qt(n)&&n.toggleOpen()}),!0),C.COMMAND_PRIORITY_EDITOR))},[t]),null}function Ro(t){return t instanceof HTMLElement}class og{constructor(e,n){this.x=e,this.y=n}equals({x:e,y:n}){return this.x===e&&this.y===n}calcDeltaXTo({x:e}){return this.x-e}calcDeltaYTo({y:e}){return this.y-e}calcHorizontalDistanceTo(e){return Math.abs(this.calcDeltaXTo(e))}calcVerticalDistance(e){return Math.abs(this.calcDeltaYTo(e))}calcDistanceTo(e){return Math.sqrt(Math.pow(this.calcDeltaXTo(e),2)+Math.pow(this.calcDeltaYTo(e),2))}}function Km(t){return t instanceof og}class tn{_left;_top;_right;_bottom;constructor(e,n,r,i){const[o,l]=n<=i?[n,i]:[i,n],[s,a]=e<=r?[e,r]:[r,e];this._top=o,this._right=a,this._left=s,this._bottom=l}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:e,left:n,bottom:r,right:i}){return e===this._top&&r===this._bottom&&n===this._left&&i===this._right}contains(e){if(Km(e)){const{x:n,y:r}=e,i=rthis._bottom,l=nthis._right;return{reason:{isOnBottomSide:o,isOnLeftSide:l,isOnRightSide:s,isOnTopSide:i},result:!i&&!o&&!l&&!s}}else{const{top:n,left:r,bottom:i,right:o}=e;return n>=this._top&&n<=this._bottom&&i>=this._top&&i<=this._bottom&&r>=this._left&&r<=this._right&&o>=this._left&&o<=this._right}}intersectsWith(e){const{left:n,top:r,width:i,height:o}=e,{left:l,top:s,width:a,height:c}=this,g=n+i>=l+a?n+i:l+a,d=r+o>=s+c?r+o:s+c,u=n<=l?n:l,f=r<=s?r:s;return g-u<=i+a&&d-f<=o+c}generateNewRect({left:e=this.left,top:n=this.top,right:r=this.right,bottom:i=this.bottom}){return new tn(e,n,r,i)}static fromLTRB(e,n,r,i){return new tn(e,n,r,i)}static fromLWTH(e,n,r,i){return new tn(e,r,e+n,r+i)}static fromPoints(e,n){const{y:r,x:i}=e,{y:o,x:l}=n;return tn.fromLTRB(i,r,l,o)}static fromDOM(e){const{top:n,width:r,left:i,height:o}=e.getBoundingClientRect();return tn.fromLWTH(i,r,n,o)}}let Ei=1/0;function Hm(t){return t===0?1/0:Ei>=0&&EiC.$getRoot().getChildrenKeys())}const Da=0;function Ao(t,e,n){const r=t.getBoundingClientRect(),i=Wm(e);let o=null;return e.getEditorState().read(()=>{let l=Hm(i.length),s=Da;for(;l>=0&&le.style.transform=n)}const La=28;function Jm(t,e,n,r){const i=window.getComputedStyle(e),{top:o,height:l}=e.getBoundingClientRect(),{top:s,width:a}=r.getBoundingClientRect();let c=o;n-o>l/2?c+=l+parseFloat(i.marginBottom):c-=parseFloat(i.marginTop);const g=c-s-2,d=La-ll;t.style.transform=`translate(${d}px, ${g}px)`,t.style.width=`${a-(La-ll)*2}px`,t.style.opacity=".4"}function Vm(t){t&&(t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)")}const Ma="application/x-lexical-drag-block";function Xm({editor:t,anchor:e}){const n=e.parentElement,r=$.useRef(null),i=$.useRef(null),[o,l]=$.useState(null);$.useEffect(()=>{function g(u){const f=u.target;if(!Ro(f)){l(null);return}if(Um(f))return;const h=Ao(e,t,u);l(h)}function d(){l(null)}return n?.addEventListener("mousemove",g),n?.addEventListener("mouseleave",d),()=>{n?.removeEventListener("mousemove",g),n?.removeEventListener("mouseleave",d)}},[n,e,t]),$.useEffect(()=>{r.current&&Gm(o,r.current,e)},[e,o]),$.useEffect(()=>{function g(u){const[f]=rt.eventFiles(u);if(f)return!1;const{pageY:h,target:m}=u;if(!Ro(m))return!1;const N=Ao(e,t,u),y=i.current;return!N||!y?!1:(Jm(y,N,h,e),u.preventDefault(),!0)}function d(u){const[f]=rt.eventFiles(u);if(f)return!1;const{target:h,dataTransfer:m,pageY:N}=u,y=m?.getData(Ma)||"",_=C.$getNodeByKey(y);if(!_||!Ro(h))return!1;const x=Ao(e,t,u);if(!x)return!1;const v=C.$getNearestNodeFromDOMNode(x);if(!v)return!1;if(v===_)return!0;const{top:S,height:A}=x.getBoundingClientRect();return N-S>A/2?v.insertAfter(_):v.insertBefore(_),l(null),!0}return V.mergeRegister(t.registerCommand(C.DRAGOVER_COMMAND,u=>g(u),C.COMMAND_PRIORITY_LOW),t.registerCommand(C.DROP_COMMAND,u=>d(u),C.COMMAND_PRIORITY_HIGH))},[e,t]);function s(g){const d=g.dataTransfer;if(!d||!o)return;Ym(d,o);let u="";t.update(()=>{const f=C.$getNearestNodeFromDOMNode(o);f&&(u=f.getKey())}),d.setData(Ma,u)}function a(){Vm(i.current)}const c=Zm();return p.jsxs(Wr,{mountNode:e,children:[p.jsx("div",{className:gt("LexEditor_Draggable",c.meun),ref:r,draggable:!0,onDragStart:s,onDragEnd:a,children:p.jsx("div",{className:t._editable?gt(c.icon,"LexEditor_DraggableIcon"):""})}),p.jsx("div",{className:c.line,ref:i})]})}const Zm=it({meun:{...P.borderRadius("4px"),...P.padding("2px","1px"),cursor:"grab",opacity:0,position:"absolute",left:0,top:0,willChange:"transform",":active":{cursor:"grabbing"},":hover":{backgroundColor:"#efefef"}},icon:{width:"16px",height:"16px",opacity:.3},line:{pointerEvents:"none",backgroundColor:"deepskyblue",height:"4px",position:"absolute",left:0,top:0,opacity:0,willChange:"transform"}});function qm({anchor:t=document.body}){const[e]=X.useLexicalComposerContext();return p.jsx(Xm,{anchor:t,editor:e})}function so(t){const e=t.anchor,n=t.focus,r=t.anchor.getNode(),i=t.focus.getNode();return r===i?r:t.isBackward()?Se.$isAtNodeEnd(n)?r:i:Se.$isAtNodeEnd(e)?r:i}const Qm=10,e_=5;function sl(t,e,n,r=Qm,i=e_){const o=n.parentElement;if(!t||!o){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}const l=e.getBoundingClientRect(),s=n.getBoundingClientRect(),a=o.getBoundingClientRect();let c=t.top-l.height-r,g=t.left-i;ca.right&&(g=a.right-l.width-i),c-=s.top,g-=s.left,e.style.opacity="1",e.style.transform=`translate(${g}px, ${c}px)`}function lg(t){const e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,n=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;return t=String(t).trim(),t.match(e)||t.match(n)?t:"https://"}const t_=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function n_(t){return t==="https://"||t_.test(t)}function r_({editor:t,isLink:e,setIsLink:n,anchor:r}){const i=$.useRef(null),o=$.useRef(null),[l,s]=$.useState(""),[a,c]=$.useState(!1),[g,d]=$.useState(),u=$.useCallback(()=>{const h=C.$getSelection();if(C.$isRangeSelection(h)){const x=so(h),v=x.getParent();ce.$isLinkNode(v)?s(v.getURL()):ce.$isLinkNode(x)?s(x.getURL()):s("")}const m=i.current,N=window.getSelection(),y=document.activeElement;if(!m)return;const _=t.getRootElement();if(h&&N&&_&&_.contains(N.anchorNode)&&t.isEditable()){const x=N.getRangeAt(0);let v;if(N.anchorNode===_){let S=_;for(;S.firstElementChild;)S=S.firstElementChild;v=S.getBoundingClientRect()}else v=x.getBoundingClientRect();sl(v,m,r),d(h)}else(!y||y.className!=="link-input")&&(_&&sl(null,m,r),d(void 0),c(!1),s(""));return!0},[r,t]);$.useEffect(()=>{const h=r.parentElement;function m(){t.getEditorState().read(()=>u())}return window.addEventListener("resize",m),h&&h.addEventListener("scroll",m),()=>{window.removeEventListener("resize",m),h&&h.removeEventListener("scroll",m)}},[r.parentElement,t,u]),$.useEffect(()=>V.mergeRegister(t.registerUpdateListener(({editorState:h})=>h.read(()=>u())),t.registerCommand(C.SELECTION_CHANGE_COMMAND,()=>(u(),!0),C.COMMAND_PRIORITY_LOW),t.registerCommand(C.KEY_ESCAPE_COMMAND,()=>e?(n(!1),!0):!1,C.COMMAND_PRIORITY_HIGH)),[t,u,n,e]),$.useEffect(()=>{t.getEditorState().read(()=>u())},[t,u]),$.useEffect(()=>{a&&o.current&&o.current.focus()},[a]);const f=i_();return p.jsx("div",{ref:i,style:{transition:"opacity 0.5s"},className:f.editor,children:a?p.jsx(Gn,{ref:o,className:f.input,value:l,onChange:(h,m)=>s(m.value),onKeyDown:h=>{h.key==="Enter"?(h.preventDefault(),g&&(l&&t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,lg(l)),c(!1))):h.key==="Escape"&&(h.preventDefault(),c(!1))}}):p.jsxs("div",{className:f.link,children:[p.jsx(Lg,{href:l,target:"_blank",rel:"noopener noreferrer",className:f.a,children:l}),p.jsx(Un,{appearance:"subtle",icon:p.jsx(Mg,{}),onClick:()=>c(!0)})]})})}const ba={...P.margin("8px","10px"),...P.padding("4px","12px")},i_=it({editor:{...cu,...rf,position:"absolute",top:0,left:0,maxWidth:"400px",width:"100%",opacity:0,willChange:"transform"},a:{whiteSpace:"nowrap",...P.overflow("hidden"),textOverflow:"ellipsis"},link:{...uu,justifyContent:"space-between",alignItems:"center",width:"calc(100% - 20px)",boxSizing:"border-box",...P.borderRadius(an.borderRadiusMedium),backgroundColor:"#eee",position:"relative",...ba},input:ba});function o_({editor:t,anchor:e}){const[n,r]=$.useState(t),[i,o]=$.useState(!1);return $.useEffect(()=>t.registerCommand(C.SELECTION_CHANGE_COMMAND,(l,s)=>{const a=C.$getSelection();if(C.$isRangeSelection(a)){const c=so(a),g=V.$findMatchingParent(c,ce.$isLinkNode),d=V.$findMatchingParent(c,ce.$isAutoLinkNode);o(!!(g&&!d))}return r(s),!1},C.COMMAND_PRIORITY_CRITICAL),[t]),i&&p.jsx(Wr,{mountNode:e,children:p.jsx(r_,{editor:n,isLink:i,anchor:e,setIsLink:o})})}function l_({anchor:t=document.body}){const[e]=X.useLexicalComposerContext();return p.jsx(o_,{editor:e,anchor:t})}function s_(t,e){const n=t.getRangeAt(0);let r;if(t.anchorNode===e){let i=e;for(;i.firstElementChild;)i=i.firstElementChild;r=i.getBoundingClientRect()}else r=n.getBoundingClientRect();return r}function a_({editor:t,anchor:e,isLink:n,isBold:r,isItalic:i,isUnderline:o,isCode:l,isStrikethrough:s,isSubscript:a,isSuperscript:c}){const g=$.useRef(null),d=$.useCallback(()=>{n?t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,null):t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,"https://")},[t,n]),u=$.useCallback(()=>{const m=C.$getSelection(),N=g.current,y=window.getSelection();if(!N)return;const _=t.getRootElement();if(m&&y&&!y.isCollapsed&&_&&_.contains(y.anchorNode)){const x=s_(y,_);sl(x,N,e)}},[t,e]);$.useEffect(()=>{const m=e.parentElement;function N(){t.getEditorState().read(()=>u())}return window.addEventListener("resize",N),m&&m.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),m&&m.removeEventListener("scroll",N)}},[t,u,e]),$.useEffect(()=>(t.getEditorState().read(()=>u()),V.mergeRegister(t.registerUpdateListener(({editorState:m})=>m.read(()=>u())),t.registerCommand(C.SELECTION_CHANGE_COMMAND,()=>(u(),!1),C.COMMAND_PRIORITY_LOW))),[t,u]);const f=[r&&"bold",i&&"italic",o&&"underline",l&&"code",s&&"strikethrough",a&&"subscript",c&&"superscript",n&&"link"],h=u_();return p.jsxs(Za,{ref:g,className:h.toolbar,style:{transition:"opacity 0.5s"},checkedValues:{opts:f},children:[p.jsx(Le,{name:"opts",value:"bold",appearance:"subtle","aria-label":"Format text as bold",icon:p.jsx(qa,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"bold")}),p.jsx(Le,{name:"opts",value:"italic",appearance:"subtle","aria-label":"Format text as italics",icon:p.jsx(Qa,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"italic")}),p.jsx(Le,{name:"opts",value:"underline",appearance:"subtle","aria-label":"Format text to underlined",icon:p.jsx(eu,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"underline")}),p.jsx(Le,{name:"opts",value:"strikethrough",appearance:"subtle","aria-label":"Format text with a strikethrough",icon:p.jsx(tu,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"strikethrough")}),p.jsx(Le,{name:"opts",value:"subscript",appearance:"subtle","aria-label":"Format Subscript",icon:p.jsx(nu,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"subscript")}),p.jsx(Le,{name:"opts",value:"superscript",appearance:"subtle","aria-label":"Format Superscript",icon:p.jsx(ru,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"superscript")}),p.jsx(Le,{name:"opts",value:"code",appearance:"subtle","aria-label":"Insert code block",icon:p.jsx(Ti,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"code")}),p.jsx(Le,{name:"opts",value:"link",appearance:"subtle","aria-label":"Insert link",icon:p.jsx(iu,{}),onClick:d})]})}const u_=it({toolbar:{...cu,...P.padding("4px"),verticalAlign:"middle",position:"absolute",top:0,left:0,opacity:0,height:"35px",willChange:"transform"}});function c_({editor:t,anchor:e}){const[n,r]=$.useState(!1),[i,o]=$.useState(!1),[l,s]=$.useState(!1),[a,c]=$.useState(!1),[g,d]=$.useState(!1),[u,f]=$.useState(!1),[h,m]=$.useState(!1),[N,y]=$.useState(!1),[_,x]=$.useState(!1),v=$.useCallback(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;const S=C.$getSelection(),A=window.getSelection(),w=t.getRootElement();if(A&&(!C.$isRangeSelection(S)||!w||!w.contains(A.anchorNode))){r(!1);return}if(!C.$isRangeSelection(S))return;const B=so(S);s(S.hasFormat("bold")),c(S.hasFormat("italic")),d(S.hasFormat("underline")),f(S.hasFormat("strikethrough")),m(S.hasFormat("subscript")),y(S.hasFormat("superscript")),x(S.hasFormat("code"));const k=B.getParent();ce.$isLinkNode(k)||ce.$isLinkNode(B)?o(!0):o(!1),!he.$isCodeHighlightNode(S.anchor.getNode())&&S.getTextContent()?r(C.$isTextNode(B)):r(!1)})},[t]);return $.useEffect(()=>(document.addEventListener("selectionchange",v),()=>document.removeEventListener("selectionchange",v)),[v]),$.useEffect(()=>V.mergeRegister(t.registerUpdateListener(()=>v()),t.registerRootListener(()=>{t.getRootElement()||r(!1)})),[t,v]),!n||i?null:p.jsx(Wr,{mountNode:e,children:p.jsx(a_,{editor:t,anchor:e,isLink:i,isBold:l,isItalic:a,isStrikethrough:u,isSubscript:h,isSuperscript:N,isUnderline:g,isCode:_})})}function ka({anchor:t=document.body}){const[e]=X.useLexicalComposerContext();return p.jsx(c_,{editor:e,anchor:t})}function d_(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>t.registerCommand(jt.INSERT_HORIZONTAL_RULE_COMMAND,e=>{const n=C.$getSelection();if(!C.$isRangeSelection(n))return!1;if(n.focus.getNode()){const i=jt.$createHorizontalRuleNode();V.$insertNodeToNearestRoot(i)}return!0},C.COMMAND_PRIORITY_EDITOR),[t]),null}const Vl=C.createCommand("INSERT_IMAGE_COMMAND");function g_({editor:t}){const[e,n]=$.useState("https://source.unsplash.com/random"),[r,i]=$.useState(du.Name);return p.jsxs(ou,{children:[p.jsx(lu,{children:"Insert Image"}),p.jsxs(su,{children:[p.jsx(Or,{label:"Source",required:!0,children:p.jsx(Gn,{placeholder:e,onChange:(o,l)=>n(l.value||"")})}),p.jsx(Or,{label:"Alt Text",required:!0,children:p.jsx(Gn,{placeholder:r,onChange:(o,l)=>i(l.value||"")})})]}),p.jsx(au,{children:p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(Un,{onClick:()=>{t.dispatchCommand(Vl,{altText:r,src:e})},children:"Confirm"})})})]})}function Ia({captionsEnabled:t}){const[e]=X.useLexicalComposerContext();return $.useEffect(()=>{if(!e.hasNodes([Ut]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return V.mergeRegister(e.registerCommand(Vl,n=>{const r=ro(n);return C.$insertNodes([r]),C.$isRootOrShadowRoot(r.getParentOrThrow())&&V.$wrapNodeInElement(r,C.$createParagraphNode).selectEnd(),!0},C.COMMAND_PRIORITY_EDITOR),e.registerCommand(C.DRAGSTART_COMMAND,n=>h_(n),C.COMMAND_PRIORITY_HIGH),e.registerCommand(C.DRAGOVER_COMMAND,n=>p_(n),C.COMMAND_PRIORITY_LOW),e.registerCommand(C.DROP_COMMAND,n=>m_(n,e),C.COMMAND_PRIORITY_HIGH))},[t,e]),null}const f_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",sg=document.createElement("img");sg.src=f_;function h_(t){const e=Xl();if(!e)return!1;const n=t.dataTransfer;return n?(n.setData("text/plain","_"),n.setDragImage(sg,0,0),n.setData("application/x-lexical-drag",JSON.stringify({data:{altText:e.altText,caption:e.caption,height:e.height,key:e.getKey(),maxWidth:e.maxWidth,showCaption:e.showCaption,src:e.src,width:e.width},type:"image"})),!0):!1}function p_(t){return Xl()?(ag(t)||t.preventDefault(),!0):!1}function m_(t,e){const n=Xl();if(!n)return!1;const r=__(t);if(!r)return!1;if(t.preventDefault(),ag(t)){const i=C_(t);n.remove();const o=C.$createRangeSelection();i&&o.applyDOMRange(i),C.$setSelection(o),e.dispatchCommand(Vl,r)}return!0}function Xl(){const t=C.$getSelection();if(!C.$isNodeSelection(t))return null;const n=t.getNodes()[0];return Nd(n)?n:null}function __(t){const e=t.dataTransfer?.getData("application/x-lexical-drag");if(!e)return null;const{type:n,data:r}=JSON.parse(e);return n!=="image"?null:r}function ag(t){const e=t.target;return!!(e&&e instanceof HTMLElement&&!e.closest("code, span.LexEditor_Image")&&e.parentElement&&e.parentElement.closest("div.LexEditor_Content"))}function C_(t){let e;const n=window.getSelection();if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&n)n.collapse(t.rangeParent,t.rangeOffset||0),e=n.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var ug={},wn=ce,x_=X,N_=V,Dn=C,E_=$;ug.LinkPlugin=function({validateUrl:t}){let[e]=x_.useLexicalComposerContext();return E_.useEffect(()=>{if(!e.hasNodes([wn.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return N_.mergeRegister(e.registerCommand(wn.TOGGLE_LINK_COMMAND,n=>{if(n===null)return wn.toggleLink(n),!0;if(typeof n=="string")return t===void 0||t(n)?(wn.toggleLink(n),!0):!1;let{url:r,target:i,rel:o,title:l}=n;return wn.toggleLink(r,{rel:o,target:i,title:l}),!0},Dn.COMMAND_PRIORITY_LOW),t!==void 0?e.registerCommand(Dn.PASTE_COMMAND,n=>{let r=Dn.$getSelection();if(!Dn.$isRangeSelection(r)||r.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let i=n.clipboardData.getData("text");return t(i)?r.getNodes().some(o=>Dn.$isElementNode(o))?!1:(e.dispatchCommand(wn.TOGGLE_LINK_COMMAND,i),n.preventDefault(),!0):!1},Dn.COMMAND_PRIORITY_LOW):()=>{})},[e,t]),null};const T_=ug;var y_=T_;function Pa(){return p.jsx(y_.LinkPlugin,{validateUrl:n_})}function v_(t){const e=t.getNodes();return e.length===0?new Set([t.anchor.getNode().getParentOrThrow(),t.focus.getNode().getParentOrThrow()]):new Set(e.map(n=>C.$isElementNode(n)?n:n.getParentOrThrow()))}function S_(t){const e=C.$getSelection();if(!C.$isRangeSelection(e))return!1;const n=v_(e);let r=0;for(const i of n)if(fe.$isListNode(i))r=Math.max(fe.$getListDepth(i)+1,r);else if(fe.$isListItemNode(i)){const o=i.getParent();if(!fe.$isListNode(o))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");r=Math.max(fe.$getListDepth(o)+1,r)}return r<=t}function $_({maxDepth:t}){const[e]=X.useLexicalComposerContext();return $.useEffect(()=>e.registerCommand(C.INDENT_CONTENT_COMMAND,()=>!S_(t??7),C.COMMAND_PRIORITY_CRITICAL),[e,t]),null}var Zl={},cg=Kr,R_=X,Oo=jt,A_=$;let dg=[{dependencies:[Oo.HorizontalRuleNode],export:t=>Oo.$isHorizontalRuleNode(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,r)=>{e=Oo.$createHorizontalRuleNode(),r||t.getNextSibling()!=null?t.replace(e):t.insertBefore(e),e.selectNext()},type:"element"},...cg.TRANSFORMERS];Zl.DEFAULT_TRANSFORMERS=dg;Zl.MarkdownShortcutPlugin=function({transformers:t=dg}){let[e]=R_.useLexicalComposerContext();return A_.useEffect(()=>cg.registerMarkdownShortcuts(e,t),[e,t]),null};const O_=Zl;var w_=O_;function D_(){return p.jsx(w_.MarkdownShortcutPlugin,{transformers:ol})}const L_=100;let gg=0,Fa=!1;function M_(){window.addEventListener("keydown",t=>{t.keyCode===9&&(gg=t.timeStamp)},!0)}function b_(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>(Fa||(M_(),Fa=!0),t.registerCommand(C.FOCUS_COMMAND,e=>{const n=C.$getSelection();return C.$isRangeSelection(n)&&gg+L_>e.timeStamp&&C.$setSelection(n.clone()),!1},C.COMMAND_PRIORITY_LOW)),[t]),null}function fg(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}const k_=new Map,yC=new Map,hg='{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}';function I_(t){return t?`{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":${t},"type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}`:hg}function Pn(t){return{colSpan:1,id:fg(),json:hg,type:t,width:null}}function Hi(){return{cells:[],height:null,id:fg()}}function P_(t){const e=t.querySelectorAll("tr");if(!e||e.length===0)return null;const n=[];for(let r=0;r({conversion:P_,priority:0})}}exportDOM(){return{element:F_(this.rows)}}createDOM(){const e=document.createElement("div");return e.style.display="contents",e}updateDOM(){return!1}mergeRows(e,n,r){const o=this.getWritable().rows,l=Math.min(o.length,n+r.length);for(let s=n;sJa(()=>import("./Component-HpG_cdPN.js"),__vite__mapDeps([5,1,2,3,4])));function j_(t,e,...n){if(!t)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+e)}const mg=C.createCommand("INSERT_NEW_TABLE_COMMAND"),_g=$.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function z_({children:t}){const[e,n]=$.useState({cellEditorConfig:null,cellEditorPlugins:null});return p.jsx(_g.Provider,{value:$.useMemo(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,i)=>n({cellEditorConfig:r,cellEditorPlugins:i})}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}function K_({editor:t}){const[e,n]=$.useState("5"),[r,i]=$.useState("5");return p.jsxs(ou,{children:[p.jsx(lu,{children:"Insert Table"}),p.jsxs(su,{children:[p.jsx(Or,{label:"Rows",required:!0,children:p.jsx(Gn,{placeholder:e,onChange:(o,l)=>l&&n(l.value)})}),p.jsx(Or,{label:"Cols",required:!0,children:p.jsx(Gn,{placeholder:r,onChange:(o,l)=>l&&i(l.value)})})]}),p.jsx(au,{children:p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(Un,{onClick:()=>{t.dispatchCommand(mg,{columns:r,rows:e})},children:"Confirm"})})})]})}function H_(t,e,n=!0){const r=[];for(let i=0;i(n.hasNodes([rr])||j_(!1,"TablePlugin: TableNode is not registered on editor"),r.set(t,e),n.registerCommand(mg,({columns:i,rows:o,includeHeaders:l})=>{const s=C.$getSelection();if(!C.$isRangeSelection(s))return!0;const a=s.focus,c=a.getNode();if(c){const g=H_(Number(o),Number(i),l);if(C.$isRootOrShadowRoot(c)){const u=c.getChildAtIndex(a.offset);u?u.insertBefore(g):c.append(g),g.insertBefore(C.$createParagraphNode())}else c.getTopLevelElementOrThrow().insertAfter(g);g.insertAfter(C.$createParagraphNode());const d=C.$createNodeSelection();d.add(g.getKey()),C.$setSelection(d)}return!0},C.COMMAND_PRIORITY_EDITOR)),[r,t,e,n]),null}var ql={},U_=C;class Cg extends U_.DecoratorNode{constructor(e,n){super(n),this.__format=e||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){this.getWritable().__format=e}}ql.$isDecoratorBlockNode=function(t){return t instanceof Cg};ql.DecoratorBlockNode=Cg;const G_=ql;var Y_=G_;const J_="documentMode"in document?document.documentMode:null,kt=/Mac|iPod|iPhone|iPad/.test(navigator.platform);"InputEvent"in window&&!J_&&"getTargetRanges"in new window.InputEvent("input");const al={bullet:"Bulleted List",check:"Check List",code:"Code Block",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",paragraph:"Normal",quote:"Quote"};function V_({editor:t,blockType:e,disabled:n=!1}){function r(){e!=="paragraph"&&t.update(()=>{const g=C.$getSelection();(C.$isRangeSelection(g)||C.DEPRECATED_$isGridSelection(g))&&Se.$setBlocksType(g,()=>C.$createParagraphNode())})}function i(g){e!==g&&t.update(()=>{const d=C.$getSelection();(C.$isRangeSelection(d)||C.DEPRECATED_$isGridSelection(d))&&Se.$setBlocksType(d,()=>rt.$createHeadingNode(g))})}function o(){e!=="bullet"?t.dispatchCommand(fe.INSERT_UNORDERED_LIST_COMMAND,void 0):t.dispatchCommand(fe.REMOVE_LIST_COMMAND,void 0)}function l(){e!=="check"?t.dispatchCommand(fe.INSERT_CHECK_LIST_COMMAND,void 0):t.dispatchCommand(fe.REMOVE_LIST_COMMAND,void 0)}function s(){e!=="number"?t.dispatchCommand(fe.INSERT_ORDERED_LIST_COMMAND,void 0):t.dispatchCommand(fe.REMOVE_LIST_COMMAND,void 0)}function a(){e!=="quote"&&t.update(()=>{const g=C.$getSelection();(C.$isRangeSelection(g)||C.DEPRECATED_$isGridSelection(g))&&Se.$setBlocksType(g,()=>rt.$createQuoteNode())})}function c(){e!=="code"&&t.update(()=>{const g=C.$getSelection();if(C.$isRangeSelection(g)||C.DEPRECATED_$isGridSelection(g))if(g.isCollapsed())Se.$setBlocksType(g,()=>he.$createCodeNode());else{const d=g.getTextContent(),u=he.$createCodeNode();g.insertNodes([u]),g.insertRawText(d)}})}return p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:n,"aria-label":"Formatting options for text style",children:al[e],icon:(()=>{switch(e){case"paragraph":return p.jsx(cs,{});case"h1":return p.jsx(us,{});case"h2":return p.jsx(as,{});case"h3":return p.jsx(ss,{});case"bullet":return p.jsx(ls,{});case"check":return p.jsx(os,{});case"number":return p.jsx(is,{});case"quote":return p.jsx(rs,{});case"code":return p.jsx(Ti,{});default:return p.jsx(bg,{})}})()})}),p.jsx(_r,{children:p.jsxs(Cr,{children:[p.jsx(ue,{icon:p.jsx(cs,{}),onClick:r,children:"Normal"}),p.jsx(ue,{icon:p.jsx(us,{}),onClick:()=>i("h1"),children:"Heading 1"}),p.jsx(ue,{icon:p.jsx(as,{}),onClick:()=>i("h2"),children:"Heading 2"}),p.jsx(ue,{icon:p.jsx(ss,{}),onClick:()=>i("h3"),children:"Heading 3"}),p.jsx(ue,{icon:p.jsx(ls,{}),onClick:o,children:"Bullet List"}),p.jsx(ue,{icon:p.jsx(is,{}),onClick:s,children:"Numbered List"}),p.jsx(ue,{icon:p.jsx(os,{}),onClick:l,children:"Check List"}),p.jsx(ue,{icon:p.jsx(rs,{}),onClick:a,children:"Quote"}),p.jsx(ue,{icon:p.jsx(Ti,{}),onClick:c,children:"Code Block"})]})})]})}const X_=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],cr=214,Ba=150;function Z_({color:t,onChange:e}){const[n,r]=$.useState(Ln("hex",t)),[i,o]=$.useState(t),l=$.useRef(null),s=$.useMemo(()=>({x:n.hsv.s/100*cr,y:(100-n.hsv.v)/100*Ba}),[n.hsv.s,n.hsv.v]),a=$.useMemo(()=>({x:n.hsv.h/360*cr}),[n.hsv]);function c(u){if(o(u),/^#[0-9A-Fa-f]{6}$/i.test(u)){const f=Ln("hex",u);r(f)}}function g({x:u,y:f}){const h={...n.hsv,s:u/cr*100,v:100-f/Ba*100},m=Ln("hsv",h);r(m),o(m.hex)}function d({x:u}){const f={...n.hsv,h:u/cr*360},h=Ln("hsv",f);r(h),o(h.hex)}return $.useEffect(()=>{l.current!==null&&e&&(e(n.hex),o(n.hex))},[n,e]),$.useEffect(()=>{if(t===void 0)return;const u=Ln("hex",t);r(u),o(u.hex)},[t]),p.jsxs("div",{style:{width:cr},ref:l,children:[p.jsx(Or,{label:"Hex",style:{paddingBottom:an.spacingVerticalS},children:p.jsx(Gn,{onChange:(u,f)=>c(f.value),value:i})}),p.jsx("div",{className:"color-picker-basic-color",children:X_.map(u=>p.jsx("button",{className:u===n.hex?" active":"",style:{backgroundColor:u},onClick:()=>{o(u),r(Ln("hex",u))}},u))}),p.jsx(ja,{className:"color-picker-saturation",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`},onChange:g,children:p.jsx("div",{className:"color-picker-saturation_cursor",style:{backgroundColor:n.hex,left:s.x,top:s.y}})}),p.jsx(ja,{className:"color-picker-hue",onChange:d,children:p.jsx("div",{className:"color-picker-hue_cursor",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`,left:a.x}})}),p.jsx("div",{className:"color-picker-color",style:{backgroundColor:n.hex}})]})}function ja({className:t,style:e,onChange:n,children:r}){const i=$.useRef(null),o=s=>{if(i.current){const{current:a}=i,{width:c,height:g,left:d,top:u}=a.getBoundingClientRect(),f=za(s.clientX-d,c,0),h=za(s.clientY-u,g,0);n({x:f,y:h})}};function l(s){if(s.button!==0)return;o(s);function a(g){o(g)}function c(g){document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",c,!1),o(g)}document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",c,!1)}return p.jsx("div",{ref:i,className:t,style:e,onMouseDown:l,children:r})}function za(t,e,n){return t>e?e:tn?e+e:"#").join(""),t;if(t.length===7||t.length===9)return t}else{const e=document.createElement("canvas").getContext("2d");if(!e)throw new Error("2d context not supported or canvas already initialized");return e.fillStyle=t,e.fillStyle}return"#000000"}function Ha(t){const e=(t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(n,r,i,o)=>"#"+r+r+i+i+o+o).substring(1).match(/.{2}/g)||[]).map(n=>parseInt(n,16));return{b:e[2],g:e[1],r:e[0]}}function wo({r:t,g:e,b:n}){t/=255,e/=255,n/=255;const r=Math.max(t,e,n),i=r-Math.min(t,e,n),o=i?(r===t?(e-n)/i+(er.toString(16).padStart(2,"0")).join("")}function Ln(t,e){let n=Ka("#121212"),r=Ha(n),i=wo(r);return t==="hex"?(n=Ka(e),r=Ha(n),i=wo(r)):t==="rgb"?(r=e,n=Wa(r),i=wo(r)):t==="hsv"&&(i=e,r=q_(i),n=Wa(r)),{hex:n,hsv:i,rgb:r}}function Ua({disabled:t,ariaLabel:e,color:n,onChange:r,icon:i}){return p.jsxs(kg,{trapFocus:!0,withArrow:!0,children:[p.jsx(Ig,{children:p.jsx(yt,{disabled:t,icon:i,title:e,"aria-label":e})}),p.jsx(Pg,{children:p.jsx(Z_,{color:n,onChange:r})})]})}const Q_=[["Arial","Arial"],["Courier New","Courier New"],["Georgia","Georgia"],["Times New Roman","Times New Roman"],["Trebuchet MS","Trebuchet MS"],["Verdana","Verdana"]],eC=[["10px","10px"],["11px","11px"],["12px","12px"],["13px","13px"],["14px","14px"],["15px","15px"],["16px","16px"],["17px","17px"],["18px","18px"],["19px","19px"],["20px","20px"]];function Ga({editor:t,value:e,style:n,disabled:r=!1}){const i=$.useCallback(l=>{t.update(()=>{const s=C.$getSelection();C.$isRangeSelection(s)&&Se.$patchStyleText(s,{[n]:l})})},[t,n]),o=n==="font-family"?"Formatting options for font family":"Formatting options for font size";return p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:r,"aria-label":o,icon:n==="font-family"?p.jsx(Fg,{}):p.jsx(Bg,{}),children:e})}),p.jsx(_r,{children:p.jsx(Cr,{children:(n==="font-family"?Q_:eC).map(([l,s],a)=>p.jsx(ue,{children:s,onClick:()=>i(l)},a))})})]})}const tC=it({box:{columnGap:"1px",backgroundColor:"#fff",borderTopLeftRadius:an.borderRadiusLarge,borderTopRightRadius:an.borderRadiusLarge}}),nC=(()=>{const t=[];for(const[e,n]of Object.entries(he.CODE_LANGUAGE_FRIENDLY_NAME_MAP))t.push([e,n]);return t})();function rC(){const[t]=X.useLexicalComposerContext(),[e,n]=$.useState(t),[r,i]=$.useState("paragraph"),[o,l]=$.useState(null),[s,a]=$.useState("15px"),[c,g]=$.useState("#000"),[d,u]=$.useState("#fff"),[f,h]=$.useState("Arial"),[m,N]=$.useState(!1),[y,_]=$.useState(!1),[x,v]=$.useState(!1),[S,A]=$.useState(""),[w,B]=$.useState(()=>t.isEditable()),[k,K]=$.useState([]),Z=$.useCallback(()=>{const I=C.$getSelection();if(C.$isRangeSelection(I)){const G=I.anchor.getNode();let de=G.getKey()==="root"?G:V.$findMatchingParent(G,De=>{const Te=De.getParent();return!!Te&&C.$isRootOrShadowRoot(Te)});de||(de=G.getTopLevelElementOrThrow());const ge=de.getKey(),Dt=e.getElementByKey(ge),oe=[];I.hasFormat("bold")&&oe.push("bold"),I.hasFormat("italic")&&oe.push("italic"),I.hasFormat("underline")&&oe.push("underline"),I.hasFormat("strikethrough")&&oe.push("strikethrough"),I.hasFormat("subscript")&&oe.push("subscript"),I.hasFormat("superscript")&&oe.push("superscript"),I.hasFormat("code")&&oe.push("code");const lt=so(I),st=lt.getParent();if(ce.$isLinkNode(st)||ce.$isLinkNode(lt)?(oe.push("link"),N(!0)):N(!1),K(oe),Dt)if(l(ge),fe.$isListNode(de)){const De=V.$getNearestNodeOfType(G,fe.ListNode),Te=De?De.getListType():de.getListType();i(Te)}else{const De=rt.$isHeadingNode(de)?de.getTag():de.getType();if(De in al&&i(De),he.$isCodeNode(de)){const Te=de.getLanguage();A(Te?he.CODE_LANGUAGE_MAP[Te]||Te:"");return}}a(Se.$getSelectionStyleValueForProperty(I,"font-size","15px")),g(Se.$getSelectionStyleValueForProperty(I,"color","#000")),u(Se.$getSelectionStyleValueForProperty(I,"background-color","#fff")),h(Se.$getSelectionStyleValueForProperty(I,"font-family","Arial"))}},[e]);$.useEffect(()=>t.registerCommand(C.SELECTION_CHANGE_COMMAND,(I,G)=>(Z(),n(G),!1),C.COMMAND_PRIORITY_CRITICAL),[t,Z]),$.useEffect(()=>V.mergeRegister(t.registerEditableListener(I=>B(I)),e.registerUpdateListener(({editorState:I})=>I.read(()=>Z())),e.registerCommand(C.CAN_UNDO_COMMAND,I=>(_(I),!1),C.COMMAND_PRIORITY_CRITICAL),e.registerCommand(C.CAN_REDO_COMMAND,I=>(v(I),!1),C.COMMAND_PRIORITY_CRITICAL)),[e,t,Z]);const ie=$.useCallback(I=>{e.update(()=>{const G=C.$getSelection();C.$isRangeSelection(G)&&Se.$patchStyleText(G,I)})},[e]),ot=$.useCallback(()=>{e.update(()=>{const I=C.$getSelection();C.$isRangeSelection(I)&&(Se.$selectAll(I),I.getNodes().forEach(G=>{C.$isTextNode(G)&&(G.setFormat(0),G.setStyle(""),V.$getNearestBlockElementAncestorOrThrow(G).setFormat("")),Y_.$isDecoratorBlockNode(G)&&G.setFormat("")}))})},[e]),Tn=$.useCallback(I=>ie({color:I}),[ie]),yn=$.useCallback(I=>ie({"background-color":I}),[ie]),vn=$.useCallback(()=>{m?t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,null):t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,lg("https://"))},[t,m]),xt=$.useCallback(I=>{e.update(()=>{if(o!==null){const G=C.$getNodeByKey(o);he.$isCodeNode(G)&&G.setLanguage(I)}})},[e,o]),ae=tC();return p.jsxs(Za,{checkedValues:{opts:k},className:gt("LexEditor_Toolbar",ae.box),children:[p.jsx(yt,{disabled:!y||!w,title:kt?"Undo (⌘Z)":"Undo (Ctrl+Z)","aria-label":"Undo",icon:p.jsx(jg,{}),onClick:()=>e.dispatchCommand(C.UNDO_COMMAND,void 0)}),p.jsx(yt,{disabled:!x||!w,title:kt?"Redo (⌘Y)":"Redo (Ctrl+Y)","aria-label":"Redo",icon:p.jsx(zg,{}),onClick:()=>e.dispatchCommand(C.REDO_COMMAND,void 0)}),p.jsx(sr,{}),r in al&&e===t&&p.jsxs(p.Fragment,{children:[p.jsx(V_,{disabled:!w,blockType:r,editor:t}),p.jsx(sr,{})]}),r==="code"?p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:!w,title:"Select language","aria-label":"Select language",icon:p.jsx(Kg,{}),children:he.getLanguageFriendlyName(S)})}),p.jsx(_r,{children:p.jsx(Cr,{children:nC.map(([I,G],de)=>p.jsx(ue,{onClick:()=>xt(I),children:G},de))})})]}):p.jsxs(p.Fragment,{children:[p.jsx(Ga,{disabled:!w,style:"font-family",value:f,editor:t}),p.jsx(Ga,{disabled:!w,style:"font-size",value:s,editor:t}),p.jsx(sr,{}),p.jsx(Le,{name:"opts",value:"bold",appearance:"subtle",disabled:!w,title:kt?"Bold (⌘B)":"Bold (Ctrl+B)","aria-label":`Format text as bold. Shortcut: ${kt?"⌘B":"Ctrl+B"}`,icon:p.jsx(qa,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"bold")}),p.jsx(Le,{name:"opts",value:"italic",appearance:"subtle",disabled:!w,title:kt?"Italic (⌘I)":"Italic (Ctrl+I)","aria-label":`Format text as italics. Shortcut: ${kt?"⌘I":"Ctrl+I"}`,icon:p.jsx(Qa,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"italic")}),p.jsx(Le,{name:"opts",value:"underline",appearance:"subtle",disabled:!w,title:kt?"Underline (⌘U)":"Underline (Ctrl+U)","aria-label":`Format text to underlined. Shortcut: ${kt?"⌘U":"Ctrl+U"}`,icon:p.jsx(eu,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"underline")}),p.jsx(Le,{name:"opts",value:"strikethrough",appearance:"subtle",disabled:!w,title:"Strikethrough","aria-label":"Format text with a strikethrough",icon:p.jsx(tu,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"strikethrough")}),p.jsx(Le,{name:"opts",value:"subscript",appearance:"subtle",disabled:!w,title:"Subscript","aria-label":"Format text with a subscript",icon:p.jsx(nu,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"subscript")}),p.jsx(Le,{name:"opts",value:"superscript",appearance:"subtle",disabled:!w,title:"Superscript","aria-label":"Format text with a superscript",icon:p.jsx(ru,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"superscript")}),p.jsx(Le,{name:"opts",value:"code",appearance:"subtle",disabled:!w,title:"Insert code block","aria-label":"Insert code block",icon:p.jsx(Ti,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"code")}),p.jsx(Le,{name:"opts",value:"link",appearance:"subtle",disabled:!w,title:"Insert link","aria-label":"Insert link",icon:p.jsx(iu,{}),onClick:vn}),p.jsx(Ua,{disabled:!w,ariaLabel:"Formatting text color",color:c,icon:p.jsx(Hg,{}),onChange:Tn}),p.jsx(Ua,{disabled:!w,ariaLabel:"Formatting background color",color:d,icon:p.jsx(Wg,{}),onChange:yn}),p.jsx(yt,{disabled:!w,title:"Clear text formatting","aria-label":"Clear all text formatting",icon:p.jsx(Ug,{}),onClick:ot}),p.jsx(sr,{}),p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:!w,title:"Insert","aria-label":"Insert specialized editor node",icon:p.jsx(Gg,{}),children:"Insert"})}),p.jsx(_r,{children:p.jsxs(Cr,{children:[p.jsx(ue,{icon:p.jsx(Yg,{}),onClick:()=>e.dispatchCommand(jt.INSERT_HORIZONTAL_RULE_COMMAND,void 0),children:"Horizontal Rule"}),p.jsxs(ds,{children:[p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(ue,{icon:p.jsx(Jg,{}),children:"Image"})}),p.jsx(gs,{children:p.jsx(g_,{editor:e})})]}),p.jsxs(ds,{children:[p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(ue,{icon:p.jsx(Vg,{}),children:"Table"})}),p.jsx(gs,{children:p.jsx(K_,{editor:e})})]}),p.jsx(ue,{icon:p.jsx(Xg,{}),onClick:()=>t.dispatchCommand(ig,void 0),children:"Collapsible"})]})})]})]}),p.jsx(sr,{}),p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:!w,title:"Align","aria-label":"Formatting options for text alignment",icon:p.jsx(fs,{}),children:"Align"})}),p.jsx(_r,{children:p.jsxs(Cr,{children:[p.jsx(ue,{icon:p.jsx(fs,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"left"),children:"Left Align"}),p.jsx(ue,{icon:p.jsx(Zg,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"center"),children:"Center Align"}),p.jsx(ue,{icon:p.jsx(qg,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"right"),children:"Right Align"}),p.jsx(ue,{icon:p.jsx(Qg,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"justify"),children:"Justify Align"}),p.jsx(ef,{}),p.jsx(ue,{icon:p.jsx(tf,{}),onClick:()=>e.dispatchCommand(C.OUTDENT_CONTENT_COMMAND,void 0),children:"Outdent"}),p.jsx(ue,{icon:p.jsx(nf,{}),onClick:()=>e.dispatchCommand(C.INDENT_CONTENT_COMMAND,void 0),children:"Indent"})]})})]})]})}const iC=it({ltr:{textAlign:"left"},rtl:{textAlign:"right"},paragraph:{...P.margin(0),position:"relative"},quote:{...P.margin(0),marginLeft:"20px",marginBottom:"10px",fontSize:"15px",color:"rgb(101, 103, 107)",borderLeftColor:"rgb(206, 208, 212)",borderLeftWidth:"4px",borderLeftStyle:"solid",paddingLeft:"16px"},h1:{fontSize:"24px",color:"rgb(5, 5, 5)",fontWeight:400,...P.margin(0)},h2:{fontSize:"15px",color:"rgb(101, 103, 107)",fontWeight:700,...P.margin(0),textTransform:"uppercase"},h3:{fontSize:"12px",...P.margin(0),textTransform:"uppercase"},textBold:{fontWeight:"bold"},textItalic:{fontStyle:"italic"},textSubscript:{fontSize:"0.8em",verticalAlign:"sub !important"},textSuperscript:{fontSize:"0.8em",verticalAlign:"super"},textCode:{backgroundColor:"rgb(240, 242, 245)",...P.padding("1px","0.25rem"),fontFamily:"Menlo, Consolas, Monaco, monospace",fontSize:"94%"},code:{backgroundColor:"rgb(240, 242, 245)",fontFamily:"Menlo, Consolas, Monaco, monospace",display:"block",...P.padding("8px","8px","8px","52px"),lineHeight:1.53,fontSize:"13px",...P.margin(0),marginTop:"8px",marginBottom:"8px",tabSize:2,overflowX:"auto",position:"relative",":before":{content:"attr(data-gutter)",position:"absolute",backgroundColor:"#eee",left:0,top:0,...P.borderRight("1px","solid","#ccc"),...P.padding("8px"),color:"#777",whiteSpace:"pre-wrap",textAlign:"right",minWidth:"25px"}},table:{borderCollapse:"collapse",borderSpacing:0,maxWidth:"100%",overflowY:"scroll",tableLayout:"fixed",width:"calc(100% - 25px)",...P.margin("30px",0)},tableSelected:{...P.outline("2px","solid","rgb(60, 132, 244)")},tableCell:{...P.border("1px","solid","#bbb"),minWidth:"75px",verticalAlign:"top",textAlign:"start",...P.padding("6px","8px"),position:"relative",cursor:"default",...P.outline("none")},tableCellSortedIndicator:{display:"block",opacity:.5,position:"absolute",bottom:0,left:0,width:"100%",height:"4px",backgroundColor:"#999"},tableCellResizer:{position:"absolute",right:"-4px",height:"100%",width:"8px",cursor:"ew-resize",zIndex:10,top:0},tableCellHeader:{backgroundColor:"#f2f3f5",textAlign:"start"},tableCellSelected:{backgroundColor:"#c9dbf0"},tableCellPrimarySelected:{...P.border("2px","solid","rgb(60, 132, 244)"),display:"block",height:"calc(100% - 2px)",position:"absolute",width:"calc(100% - 2px)",left:"-1px",top:"-1px",zIndex:2},tableCellEditing:{boxShadow:"0 0 5px rgba(0, 0, 0, 0.4)",...P.borderRadius("3px")},tableAddColumns:{position:"absolute",top:0,width:"20px",backgroundColor:"#eee",height:"100%",right:0,...P.border(0),cursor:"pointer",":after":{backgroundSize:"contain",backgroundRepeat:"no-repeat",display:"block",content:'" "',position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:.4},":hover":{backgroundColor:"#c9dbf0"}},tableAddRows:{position:"absolute",bottom:"-25px",width:"calc(100% - 25px)",backgroundColor:"#eee",height:"20px",left:0,...P.border(0),cursor:"pointer",":after":{backgroundSize:"contain",backgroundRepeat:"no-repeat",display:"block",content:'" "',position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:.4},":hover":{backgroundColor:"#c9dbf0"}},tableCellResizeRuler:{display:"block",position:"absolute",width:"1px",backgroundColor:"rgb(60, 132, 244)",height:"100%",top:0},tableCellActionButtonContainer:{display:"block",right:"5px",top:"2px",position:"absolute",zIndex:4},tableCellActionButton:{backgroundColor:"#eee",display:"block",...P.border(0),...P.borderRadius("20px"),width:"20px",height:"20px",color:"#222",cursor:"pointer",":hover":{backgroundColor:"#ddd"}},ol1:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStylePosition:"inside"},ol2:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"upper-alpha",listStylePosition:"inside"},ol3:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"lower-alpha",listStylePosition:"inside"},ol4:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"upper-roman",listStylePosition:"inside"},ol5:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"lower-roman",listStylePosition:"inside"},ul:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStylePosition:"inside"},listItem:{...P.margin(0,"8px")},tokenComment:{color:"slategray"},tokenPunctuation:{color:"#999"},tokenProperty:{color:"#905"},tokenSelector:{color:"#690"},tokenOperator:{color:"#9a6e3a"},tokenAttr:{color:"#07a"},tokenVariable:{color:"#e90"},tokenFunction:{color:"#dd4a68"},embedBlock:{userSelect:"none"},embedBlockFocus:{...P.outline("2px solid rgb(60, 132, 244)")}});function xg(){const t=iC();return{blockCursor:"LexEditor_blockCursor",code:gt(t.code,"LexEditor_code"),codeHighlight:{atrule:t.tokenAttr,attr:t.tokenAttr,boolean:t.tokenProperty,builtin:t.tokenSelector,cdata:t.tokenComment,char:t.tokenSelector,class:t.tokenFunction,"class-name":t.tokenFunction,comment:t.tokenComment,constant:t.tokenProperty,deleted:t.tokenProperty,doctype:t.tokenComment,entity:t.tokenOperator,function:t.tokenFunction,important:t.tokenVariable,inserted:t.tokenSelector,namespace:t.tokenVariable,number:t.tokenProperty,operator:t.tokenOperator,prolog:t.tokenComment,property:t.tokenProperty,punctuation:t.tokenPunctuation,regex:t.tokenVariable,selector:t.tokenSelector,string:t.tokenSelector,symbol:t.tokenProperty,tag:t.tokenProperty,url:t.tokenOperator,variable:t.tokenVariable},embedBlock:{base:t.embedBlock,focus:t.embedBlockFocus},heading:{h1:t.h1,h2:t.h2,h3:t.h3},image:"LexEditor_Image",link:"LexEditor_link",list:{listitem:t.listItem,listitemChecked:"LexEditor_listItemChecked",listitemUnchecked:"LexEditor_listItemUnchecked",nested:{listitem:"LexEditor_nestedListItem"},olDepth:[t.ol1,t.ol2,t.ol3,t.ol4,t.ol5],ul:t.ul},ltr:t.ltr,mark:"LexEditor_mark",markOverlap:"LexEditor_markOverlap",paragraph:t.paragraph,quote:t.quote,rtl:t.rtl,table:t.table,tableAddColumns:gt(t.tableAddColumns,"LexEditor_tableAddColumns"),tableAddRows:gt(t.tableAddRows,"LexEditor_tableAddRows"),tableCell:t.tableCell,tableCellActionButton:t.tableCellActionButton,tableCellActionButtonContainer:t.tableCellActionButtonContainer,tableCellEditing:t.tableCellEditing,tableCellHeader:t.tableCellHeader,tableCellPrimarySelected:t.tableCellPrimarySelected,tableCellResizer:t.tableCellResizer,tableCellSelected:t.tableCellSelected,tableCellSortedIndicator:t.tableCellSortedIndicator,tableResizeRuler:t.tableCellResizeRuler,tableSelected:t.tableSelected,text:{bold:t.textBold,code:t.textCode,italic:t.textItalic,strikethrough:"LexEditor_textStrikethrough",subscript:t.textSubscript,superscript:t.textSuperscript,underline:"LexEditor_textUnderline",underlineStrikethrough:"LexEditor_textUnderlineStrikethrough"}}}var Ng={},oC=X,Ar=$,lC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Ar.useLayoutEffect:Ar.useEffect;Ng.ContentEditable=function({ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:n,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwns:a,ariaRequired:c,autoCapitalize:g,className:d,id:u,role:f="textbox",spellCheck:h=!0,style:m,tabIndex:N,"data-testid":y}){let[_]=oC.useLexicalComposerContext(),[x,v]=Ar.useState(!1),S=Ar.useCallback(A=>{_.setRootElement(A)},[_]);return lC(()=>(v(_.isEditable()),_.registerEditableListener(A=>{v(A)})),[_]),Ar.createElement("div",{"aria-activedescendant":x?t:void 0,"aria-autocomplete":x?e:"none","aria-controls":x?n:void 0,"aria-describedby":r,"aria-expanded":x&&f==="combobox"?!!i:void 0,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":x?a:void 0,"aria-required":c,autoCapitalize:g,className:d,contentEditable:x,"data-testid":y,id:u,ref:S,role:x?f:void 0,spellCheck:h,style:m,tabIndex:N})};const sC=Ng;var aC=sC;const uC=it({root:{...P.border(0),fontSize:"15px",display:"block",position:"relative",tabSize:1,...P.outline(0),...P.padding("8px","28px"),minHeight:"calc(100% - 16px)"},table:{minHeight:"20px",...P.border(0),resize:"none",cursor:"text",display:"block",position:"relative",tabSize:1,...P.outline(0),...P.padding(0),userSelect:"text",fontSize:"15px",whiteSpace:"pre-wrap",wordBreak:"break-word",zIndex:3},display:{...P.padding(0)}});function Ya({className:t,table:e}){const n=uC(),{Display:r}=vc();return p.jsx(aC.ContentEditable,{className:gt("LexEditor_Content",t||e?n.table:n.root,!e&&r&&n.display)})}const cC=it({box:{fontSize:"15px",color:"#999",...P.overflow("hidden"),position:"absolute",textOverflow:"ellipsis",top:"8px",left:"28px",right:"28px",userSelect:"none",whiteSpace:"nowrap",display:"inline-block",pointerEvents:"none"}});function dC({children:t,className:e}){const n=cC();return p.jsx("div",{className:e||n.box,children:t})}const gC=it({shell:{lineHeight:"1.7"},container:{position:"relative"},noTreeView:{borderBottomLeftRadius:an.borderRadiusLarge,borderBottomRightRadius:an.borderRadiusLarge},scroller:{minHeight:"150px",...P.overflow("auto"),resize:"vertical"}});function fC(){of(X.useLexicalComposerContext()[0]);const{Namespace:t,OnError:e,Placeholder:n,Display:r,Plugin:{Actions:i,AutoFocus:o,AutoLink:l,CheckList:s,ClickableLink:a,CodeActionMenu:c,CodeHighlight:g,Collapsible:d,DraggableBlock:u,FloatingLinkEditor:f,FloatingTextFormatToolbar:h,HorizontalRule:m,Images:N,Link:y,ListMaxIndentLevel:_,List:x,MarkdownShortcut:v,TabFocus:S,TabIndentation:A,Table:w,Toolbar:B}}=vc(),k=p.jsx(dC,{children:n||"Let's say something awesome...."}),[K,Z]=$.useState(),ie=gC();return p.jsxs("div",{className:gt("LexEditor_Shell",ie.shell),children:[B&&p.jsx(rC,{}),p.jsxs("div",{className:gt(...r?[]:[ie.container,ie.noTreeView,ie.scroller]),ref:ot=>ot&&Z(ot),children:[o&&p.jsx(Fs.AutoFocusPlugin,{}),l&&p.jsx(Dm,{}),s&&p.jsx(vh.CheckListPlugin,{}),a&&p.jsx(Aa,{}),g&&p.jsx(Bm,{}),d&&p.jsx(zm,{}),m&&p.jsx(d_,{}),N&&p.jsx(Ia,{}),y&&p.jsx(Pa,{}),_&&p.jsx($_,{maxDepth:_}),x&&p.jsx(kh.ListPlugin,{}),v&&p.jsx(D_,{}),p.jsx(la.RichTextPlugin,{contentEditable:p.jsx(Ya,{}),placeholder:!r&&k,ErrorBoundary:qs}),S&&p.jsx(b_,{}),A&&p.jsx(Ep.TabIndentationPlugin,{}),w&&p.jsxs(W_,{cellEditorConfig:{namespace:t,nodes:[...Ip],onError:e,theme:xg()},children:[p.jsx(Fs.AutoFocusPlugin,{}),p.jsx(Aa,{}),p.jsx(ka,{}),p.jsx(Ia,{captionsEnabled:!1}),p.jsx(Pa,{}),p.jsx(la.RichTextPlugin,{contentEditable:p.jsx(Ya,{table:!0}),placeholder:null,ErrorBoundary:qs})]}),K&&p.jsxs(p.Fragment,{children:[i&&p.jsx(Em,{anchor:K}),c&&p.jsx(Fm,{anchor:K}),u&&p.jsx(qm,{anchor:K}),f&&p.jsx(l_,{anchor:K}),h&&p.jsx(ka,{anchor:K})]})]})]})}var En={},$t=C,di=V;class ei extends $t.ElementNode{static getType(){return"mark"}static clone(e){return new ei(Array.from(e.__ids),e.__key)}static importDOM(){return null}static importJSON(e){let n=Wi(e.ids);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(e,n){super(n),this.__ids=e||[]}createDOM(e){let n=document.createElement("mark");return di.addClassNamesToElement(n,e.theme.mark),1{throw s},State:i,Placeholder:o,Display:l}){return n=l?!1:n,p.jsx(qf.LexicalComposer,{initialConfig:{editorState:i,namespace:t,nodes:[...CC],onError:r,theme:xg(),editable:n},children:p.jsx(th,{Namespace:t,Plugin:l?Qf:e,Editable:n,OnError:r,State:i,Placeholder:o,Display:l,children:p.jsx(z_,{children:p.jsx(fC,{})})})})}const vC=Object.freeze(Object.defineProperty({__proto__:null,default:xC},Symbol.toStringTag,{value:"Module"}));export{Nd as $,_g as C,kt as I,X as L,dC as P,rr as T,C as a,V as b,Fs as c,Pa as d,la as e,Ya as f,qs as g,k_ as h,Jh as i,yC as j,qh as k,F_ as l,Hi as m,fg as n,Pn as o,I_ as p,vC as q,Zp as u}; +`)},regExp:Vd,replace:(t,e,n)=>{const r=$a(n[0]);if(!r)return;const i=[r];let o=t.getPreviousSibling(),l=r.length;for(;o&&!(!C.$isParagraphNode(o)||o.getChildrenSize()!==1);){const c=o.getFirstChild();if(!C.$isTextNode(c))break;const g=$a(c.getTextContent());if(!g)break;l=Math.max(l,g.length),i.unshift(g);const d=o.getPreviousSibling();o.remove(),o=d}const s=He.$createTableNode();for(const c of i){const g=He.$createTableRowNode();s.append(g);for(let d=0;d{const e=He.$createTableCellNode(He.TableCellHeaderStates.NO_STATUS),n=C.$createParagraphNode();return t!=null&&n.append(C.$createTextNode(t.trim())),e.append(n),e},$a=t=>{const e=t.match(Vd);return!e||!e[1]?null:e[1].split("|").map(n=>Xd(n))},ol=[fm,dm,gm,Kr.CHECK_LIST,...Kr.TRANSFORMERS];function pm(){const[t]=X.useLexicalComposerContext(),e=$.useCallback(()=>t.update(()=>{const n=C.$getRoot(),r=n.getFirstChild();if(he.$isCodeNode(r)&&r.getLanguage()==="markdown")Kr.$convertFromMarkdownString(r.getTextContent(),ol);else{const i=Kr.$convertToMarkdownString(ol);n.clear().append(he.$createCodeNode("markdown").append(C.$createTextNode(i)))}n.selectEnd()}),[t]);return p.jsx(Va,{appearance:"outline",icon:p.jsx(Rg,{}),onClick:e})}var Yl={},mm=C;function _m(t){let e=document.createElement("input");e.type="file",e.accept=".lexical",e.addEventListener("change",n=>{if(n=n.target,n.files){n=n.files[0];let r=new FileReader;r.readAsText(n,"UTF-8"),r.onload=i=>{i.target&&t(i.target.result)}}}),e.click()}Yl.exportFile=function(t,e=Object.freeze({})){var n=new Date;t={editorState:t.getEditorState(),lastSaved:n.getTime(),source:e.source||"Lexical",version:"0.10.0"};{e=`${e.fileName||n.toISOString()}.lexical`,n=document.createElement("a");let r=document.body;r!==null&&(r.appendChild(n),n.style.display="none",t=JSON.stringify(t),t=new Blob([t],{type:"octet/stream"}),t=window.URL.createObjectURL(t),n.href=t,n.download=e,n.click(),window.URL.revokeObjectURL(t),n.remove())}};Yl.importFile=function(t){_m(e=>{e=JSON.parse(e),e=t.parseEditorState(JSON.stringify(e.editorState)),t.setEditorState(e),t.dispatchCommand(mm.CLEAR_HISTORY_COMMAND,void 0)})};const Cm=Yl;var Ra=Cm;function xm(){const[t]=X.useLexicalComposerContext();return p.jsxs(p.Fragment,{children:[p.jsx(Un,{appearance:"outline",icon:p.jsx(Ag,{}),onClick:()=>Ra.importFile(t)}),p.jsx(Un,{appearance:"outline",icon:p.jsx(Og,{}),onClick:()=>Ra.exportFile(t,{fileName:`Bunlog ${new Date().toISOString()}`,source:"Bunlog"})})]})}const Nm=it({box:{...uu,columnGap:"3px",position:"absolute",...P.padding("10px"),bottom:0,left:0}});function Em({anchor:t}){const e=Nm(),[n]=X.useLexicalComposerContext(),[r,i]=$.useState(()=>n.isEditable()),[o,l]=$.useState(!0);return $.useEffect(()=>V.mergeRegister(n.registerEditableListener(s=>i(s))),[n]),$.useEffect(()=>n.registerUpdateListener(({dirtyElements:s,prevEditorState:a,tags:c})=>{!r&&s.size>0&&!c.has("historic")&&!c.has("collaboration")&&console.debug(n.getEditorState()),n.getEditorState().read(()=>{const g=C.$getRoot().getChildren();g.length>1?l(!1):C.$isParagraphNode(g[0])?l(g[0].getChildren().length===0):l(!1)})}),[n,r]),p.jsx(Wr,{mountNode:t,children:p.jsxs("div",{className:e.box,children:[p.jsx(xm,{}),p.jsx(Pp,{}),p.jsx(pm,{})]})})}var Jl={},Xt=ce,Tm=X,ym=V,Rt=C,vm=$;function Zd(t,e){for(let n=0;nr.getLatest())}function Sm(t,e,n){vm.useEffect(()=>{if(!t.hasNodes([Xt.AutoLinkNode]))throw Error("Minified Lexical error #77; visit https://lexical.dev/docs/error?code=77 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");let r=(i,o)=>{n&&n(i,o)};return ym.mergeRegister(t.registerNodeTransform(Rt.TextNode,i=>{var o=i.getParentOrThrow(),l=i.getPreviousSibling();if(Xt.$isAutoLinkNode(o))$o(o,e,r);else if(!Xt.$isLinkNode(o)){if(i.isSimpleText()&&(en.test(i.getTextContent()[0])||!Xt.$isAutoLinkNode(l))){l=o=i.getTextContent();let f=0,h=i;for(var s;(s=Zd(l,e))&&s!==null;){let m=s.index,N=s.length,y=m+N;var a=f+m,c=f+y,g=o,d=i;if((0n){return n=>{let r=t.exec(n);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(n)}}};const $m=Jl;var Rm=$m;const Am=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,Om=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,wm=[t=>{const e=Am.exec(t);if(!e)return null;const n=e[0];return{index:e.index,length:n.length,text:n,url:n.startsWith("http")?n:`https://${n}`}},t=>{const e=Om.exec(t);return e&&{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}}];function Dm(){return p.jsx(Rm.AutoLinkPlugin,{matchers:wm})}function Aa({filter:t,newTab:e=!0}){const[n]=X.useLexicalComposerContext();return $.useEffect(()=>{function r(i){const o=i,l=Lm(o,n);if(!l)return;const s=l.getAttribute("href");if(l.getAttribute("contenteditable")==="false"||!s)return;const a=n.getEditorState().read(C.$getSelection);if(C.$isRangeSelection(a)&&!a.isCollapsed())return;let c;if(n.update(()=>{const g=C.$getNearestNodeFromDOMNode(l);ce.$isLinkNode(g)&&(c=g)}),!(!c||t&&!t(o,c)))try{if(s){const g=o.type==="auxclick"&&o.button===1;window.open(s,e||o.metaKey||o.ctrlKey||g?"_blank":"_self"),o.preventDefault()}}catch{}}return n.registerRootListener((i,o)=>{o&&(o.removeEventListener("click",r),o.removeEventListener("auxclick",r)),i&&(i.addEventListener("click",r),i.addEventListener("auxclick",r))})},[n,t,e]),null}function Oa(t){return t.nodeName.toLowerCase()==="a"}function Lm(t,e){return e.getEditorState().read(()=>{const n=t.target;return Oa(n)?n:n.parentNode&&Oa(n.parentNode)?n.parentNode:null})}const Mm=it({green:{color:an.colorPaletteLightGreenForeground3}});function bm({editor:t,getCodeDOMNode:e}){const[n,r]=$.useState(!1),{run:i}=Xa(()=>{r(!1)},{wait:1e3});async function o(){const s=e();if(!s)return;let a="";t.update(()=>{const c=C.$getNearestNodeFromDOMNode(s);he.$isCodeNode(c)&&(a=c.getTextContent());const g=C.$getSelection();C.$setSelection(g)});try{await navigator.clipboard.writeText(a),r(!0),i()}catch(c){console.error("Failed to copy: ",c)}}const l=Mm();return p.jsx(Un,{size:"small",appearance:"subtle",onClick:o,icon:n?p.jsx(wg,{className:l.green}):p.jsx(Dg,{})})}const km=8,Im=it({container:{height:"35.8px",fontSize:"10px",color:"rgba(0, 0, 0, 0.5)",position:"absolute",display:"flex",alignItems:"center",flexDirection:"row",userSelect:"none"},lang:{marginRight:"4px"}});function Pm(t){const e=t.target;if(e&&e instanceof HTMLElement){const n=e.closest("code.LexEditor_code"),r=!(n||e.closest("div.LexEditor_CodeMenu"));return{codeDOMNode:n,isOutside:r}}else return{codeDOMNode:null,isOutside:!0}}function Fm({anchor:t=document.body}){const[e]=X.useLexicalComposerContext(),[n,r]=$.useState(!1),[i,o]=$.useState(!1),[l,s]=$.useState(""),[a,c]=$.useState({right:"0",top:"0"}),g=$.useRef(new Set),d=$.useRef(null),{run:u,cancel:f}=Xa(N=>{const{codeDOMNode:y,isOutside:_}=Pm(N);if(_){r(!1);return}if(!y)return;d.current=y;let x=null,v="";if(e.update(()=>{const S=C.$getNearestNodeFromDOMNode(y);he.$isCodeNode(S)&&(x=S,v=x.getLanguage()||"")}),x){const{y:S,right:A}=t.getBoundingClientRect(),{y:w,right:B}=y.getBoundingClientRect();s(v),r(!0),c({right:`${A-B+km}px`,top:`${w-S}px`})}},{wait:100,maxWait:1e3});$.useEffect(()=>{if(i)return document.addEventListener("mousemove",u),()=>{r(!1),f(),document.removeEventListener("mousemove",u)}},[i,u]),e.registerMutationListener(he.CodeNode,N=>{e.getEditorState().read(()=>{for(const[y,_]of N)switch(_){case"created":g.current.add(y),o(g.current.size>0);break;case"destroyed":g.current.delete(y),o(g.current.size>0);break}})});const h=he.getLanguageFriendlyName(l),m=Im();return p.jsx(Wr,{mountNode:t,children:n&&p.jsxs("div",{className:gt(m.container,"LexEditor_CodeMenu"),style:a,children:[p.jsx("div",{className:m.lang,children:h}),p.jsx(bm,{editor:e,getCodeDOMNode:()=>d.current})]})})}function Bm(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>he.registerCodeHighlighting(t),[t]),null}class mn extends C.ElementNode{constructor(e,n){super(n),this.open=e,this.open=e}static getType(){return"collapsible-container"}static clone(e){return new mn(e.open,e.__key)}createDOM(e){const n=document.createElement("details");return n.classList.add("LexEditor_Collapsible"),n.open=this.open,n}updateDOM(e,n){return e.open!==this.open&&(n.open=this.open),!1}static importDOM(){return{}}static importJSON(e){return eg()}exportJSON(){return{...super.exportJSON(),type:"collapsible-container",version:1}}setOpen(e){const n=this.getWritable();n.open=e}getOpen(){return this.open}toggleOpen(){this.setOpen(!this.getOpen())}}function eg(){return new mn(!0)}function Qt(t){return t instanceof mn}class _n extends C.ElementNode{static getType(){return"collapsible-content"}static clone(e){return new _n(e.__key)}createDOM(e){const n=document.createElement("div");return n.classList.add("LexEditor_CollapsibleContent"),n}updateDOM(e,n){return!1}static importDOM(){return{}}static importJSON(e){return tg()}isShadowRoot(){return!0}exportJSON(){return{...super.exportJSON(),type:"collapsible-content",version:1}}}function tg(){return new _n}function ng(t){return t instanceof _n}class Cn extends C.ElementNode{static getType(){return"collapsible-title"}static clone(e){return new Cn(e.__key)}createDOM(e,n){const r=document.createElement("summary");return r.classList.add("LexEditor_CollapsibleTitle"),r}updateDOM(e,n){return!1}static importDOM(){return{}}static importJSON(e){return rg()}exportJSON(){return{...super.exportJSON(),type:"collapsible-title",version:1}}collapseAtStart(e){return this.getParentOrThrow().insertBefore(this),!0}insertNewAfter(e,n=!0){const r=this.getParentOrThrow();if(!Qt(r))throw new Error("CollapsibleTitleNode expects to be child of CollapsibleContainerNode");if(r.getOpen()){const i=this.getNextSibling();if(!ng(i))throw new Error("CollapsibleTitleNode expects to have CollapsibleContentNode sibling");const o=i.getFirstChild();if(C.$isElementNode(o))return o;{const l=C.$createParagraphNode();return i.append(l),l}}else{const i=C.$createParagraphNode();return r.insertAfter(i,n),i}}}function rg(){return new Cn}function wa(t){return t instanceof Cn}const ig=C.createCommand(),jm=C.createCommand();function zm(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>{if(!t.hasNodes([mn,Cn,_n]))throw new Error("CollapsiblePlugin: CollapsibleContainerNode, CollapsibleTitleNode, or CollapsibleContentNode not registered on editor");return V.mergeRegister(t.registerNodeTransform(_n,e=>{const n=e.getParent();if(!Qt(n)){const r=e.getChildren();for(const i of r)e.insertBefore(i);e.remove()}}),t.registerNodeTransform(Cn,e=>{const n=e.getParent();Qt(n)||e.replace(C.$createParagraphNode().append(...e.getChildren()))}),t.registerNodeTransform(mn,e=>{const n=e.getChildren();if(n.length!==2||!wa(n[0])||!ng(n[1])){for(const r of n)e.insertBefore(r);e.remove()}}),t.registerCommand(C.DELETE_CHARACTER_COMMAND,()=>{const e=C.$getSelection();if(!C.$isRangeSelection(e)||!e.isCollapsed()||e.anchor.offset!==0)return!1;const r=e.anchor.getNode().getTopLevelElement();if(!r)return!1;const i=r.getPreviousSibling();return!Qt(i)||i.getOpen()?!1:(i.setOpen(!0),!0)},C.COMMAND_PRIORITY_LOW),t.registerCommand(C.KEY_ARROW_DOWN_COMMAND,()=>{const e=C.$getSelection();if(!C.$isRangeSelection(e)||!e.isCollapsed())return!1;const n=V.$findMatchingParent(e.anchor.getNode(),Qt);if(!n)return!1;const r=n.getParent();return r&&r.getLastChild()===n&&r.append(C.$createParagraphNode()),!1},C.COMMAND_PRIORITY_LOW),t.registerCommand(C.INSERT_PARAGRAPH_COMMAND,()=>{const e=t._window?.event;if(e&&(e.ctrlKey||e.metaKey)&&e.key==="Enter"){const n=C.$getPreviousSelection();if(C.$isRangeSelection(n)&&n.isCollapsed()){const r=V.$findMatchingParent(n.anchor.getNode(),i=>C.$isElementNode(i)&&!i.isInline());if(wa(r)){const i=r.getParent();if(Qt(i))return i.toggleOpen(),C.$setSelection(n.clone()),!0}}}return!1},C.COMMAND_PRIORITY_LOW),t.registerCommand(ig,()=>(t.update(()=>{const e=C.$getSelection();if(!C.$isRangeSelection(e))return;const n=rg(),r=tg().append(C.$createParagraphNode()),i=eg().append(n,r);e.insertNodes([i]),n.selectStart()}),!0),C.COMMAND_PRIORITY_EDITOR),t.registerCommand(jm,e=>(t.update(()=>{const n=C.$getNodeByKey(e);Qt(n)&&n.toggleOpen()}),!0),C.COMMAND_PRIORITY_EDITOR))},[t]),null}function Ro(t){return t instanceof HTMLElement}class og{constructor(e,n){this.x=e,this.y=n}equals({x:e,y:n}){return this.x===e&&this.y===n}calcDeltaXTo({x:e}){return this.x-e}calcDeltaYTo({y:e}){return this.y-e}calcHorizontalDistanceTo(e){return Math.abs(this.calcDeltaXTo(e))}calcVerticalDistance(e){return Math.abs(this.calcDeltaYTo(e))}calcDistanceTo(e){return Math.sqrt(Math.pow(this.calcDeltaXTo(e),2)+Math.pow(this.calcDeltaYTo(e),2))}}function Km(t){return t instanceof og}class tn{_left;_top;_right;_bottom;constructor(e,n,r,i){const[o,l]=n<=i?[n,i]:[i,n],[s,a]=e<=r?[e,r]:[r,e];this._top=o,this._right=a,this._left=s,this._bottom=l}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:e,left:n,bottom:r,right:i}){return e===this._top&&r===this._bottom&&n===this._left&&i===this._right}contains(e){if(Km(e)){const{x:n,y:r}=e,i=rthis._bottom,l=nthis._right;return{reason:{isOnBottomSide:o,isOnLeftSide:l,isOnRightSide:s,isOnTopSide:i},result:!i&&!o&&!l&&!s}}else{const{top:n,left:r,bottom:i,right:o}=e;return n>=this._top&&n<=this._bottom&&i>=this._top&&i<=this._bottom&&r>=this._left&&r<=this._right&&o>=this._left&&o<=this._right}}intersectsWith(e){const{left:n,top:r,width:i,height:o}=e,{left:l,top:s,width:a,height:c}=this,g=n+i>=l+a?n+i:l+a,d=r+o>=s+c?r+o:s+c,u=n<=l?n:l,f=r<=s?r:s;return g-u<=i+a&&d-f<=o+c}generateNewRect({left:e=this.left,top:n=this.top,right:r=this.right,bottom:i=this.bottom}){return new tn(e,n,r,i)}static fromLTRB(e,n,r,i){return new tn(e,n,r,i)}static fromLWTH(e,n,r,i){return new tn(e,r,e+n,r+i)}static fromPoints(e,n){const{y:r,x:i}=e,{y:o,x:l}=n;return tn.fromLTRB(i,r,l,o)}static fromDOM(e){const{top:n,width:r,left:i,height:o}=e.getBoundingClientRect();return tn.fromLWTH(i,r,n,o)}}let Ei=1/0;function Hm(t){return t===0?1/0:Ei>=0&&EiC.$getRoot().getChildrenKeys())}const Da=0;function Ao(t,e,n){const r=t.getBoundingClientRect(),i=Wm(e);let o=null;return e.getEditorState().read(()=>{let l=Hm(i.length),s=Da;for(;l>=0&&le.style.transform=n)}const La=28;function Jm(t,e,n,r){const i=window.getComputedStyle(e),{top:o,height:l}=e.getBoundingClientRect(),{top:s,width:a}=r.getBoundingClientRect();let c=o;n-o>l/2?c+=l+parseFloat(i.marginBottom):c-=parseFloat(i.marginTop);const g=c-s-2,d=La-ll;t.style.transform=`translate(${d}px, ${g}px)`,t.style.width=`${a-(La-ll)*2}px`,t.style.opacity=".4"}function Vm(t){t&&(t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)")}const Ma="application/x-lexical-drag-block";function Xm({editor:t,anchor:e}){const n=e.parentElement,r=$.useRef(null),i=$.useRef(null),[o,l]=$.useState(null);$.useEffect(()=>{function g(u){const f=u.target;if(!Ro(f)){l(null);return}if(Um(f))return;const h=Ao(e,t,u);l(h)}function d(){l(null)}return n?.addEventListener("mousemove",g),n?.addEventListener("mouseleave",d),()=>{n?.removeEventListener("mousemove",g),n?.removeEventListener("mouseleave",d)}},[n,e,t]),$.useEffect(()=>{r.current&&Gm(o,r.current,e)},[e,o]),$.useEffect(()=>{function g(u){const[f]=rt.eventFiles(u);if(f)return!1;const{pageY:h,target:m}=u;if(!Ro(m))return!1;const N=Ao(e,t,u),y=i.current;return!N||!y?!1:(Jm(y,N,h,e),u.preventDefault(),!0)}function d(u){const[f]=rt.eventFiles(u);if(f)return!1;const{target:h,dataTransfer:m,pageY:N}=u,y=m?.getData(Ma)||"",_=C.$getNodeByKey(y);if(!_||!Ro(h))return!1;const x=Ao(e,t,u);if(!x)return!1;const v=C.$getNearestNodeFromDOMNode(x);if(!v)return!1;if(v===_)return!0;const{top:S,height:A}=x.getBoundingClientRect();return N-S>A/2?v.insertAfter(_):v.insertBefore(_),l(null),!0}return V.mergeRegister(t.registerCommand(C.DRAGOVER_COMMAND,u=>g(u),C.COMMAND_PRIORITY_LOW),t.registerCommand(C.DROP_COMMAND,u=>d(u),C.COMMAND_PRIORITY_HIGH))},[e,t]);function s(g){const d=g.dataTransfer;if(!d||!o)return;Ym(d,o);let u="";t.update(()=>{const f=C.$getNearestNodeFromDOMNode(o);f&&(u=f.getKey())}),d.setData(Ma,u)}function a(){Vm(i.current)}const c=Zm();return p.jsxs(Wr,{mountNode:e,children:[p.jsx("div",{className:gt("LexEditor_Draggable",c.meun),ref:r,draggable:!0,onDragStart:s,onDragEnd:a,children:p.jsx("div",{className:t._editable?gt(c.icon,"LexEditor_DraggableIcon"):""})}),p.jsx("div",{className:c.line,ref:i})]})}const Zm=it({meun:{...P.borderRadius("4px"),...P.padding("2px","1px"),cursor:"grab",opacity:0,position:"absolute",left:0,top:0,willChange:"transform",":active":{cursor:"grabbing"},":hover":{backgroundColor:"#efefef"}},icon:{width:"16px",height:"16px",opacity:.3},line:{pointerEvents:"none",backgroundColor:"deepskyblue",height:"4px",position:"absolute",left:0,top:0,opacity:0,willChange:"transform"}});function qm({anchor:t=document.body}){const[e]=X.useLexicalComposerContext();return p.jsx(Xm,{anchor:t,editor:e})}function so(t){const e=t.anchor,n=t.focus,r=t.anchor.getNode(),i=t.focus.getNode();return r===i?r:t.isBackward()?Se.$isAtNodeEnd(n)?r:i:Se.$isAtNodeEnd(e)?r:i}const Qm=10,e_=5;function sl(t,e,n,r=Qm,i=e_){const o=n.parentElement;if(!t||!o){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}const l=e.getBoundingClientRect(),s=n.getBoundingClientRect(),a=o.getBoundingClientRect();let c=t.top-l.height-r,g=t.left-i;ca.right&&(g=a.right-l.width-i),c-=s.top,g-=s.left,e.style.opacity="1",e.style.transform=`translate(${g}px, ${c}px)`}function lg(t){const e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,n=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;return t=String(t).trim(),t.match(e)||t.match(n)?t:"https://"}const t_=new RegExp(/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/);function n_(t){return t==="https://"||t_.test(t)}function r_({editor:t,isLink:e,setIsLink:n,anchor:r}){const i=$.useRef(null),o=$.useRef(null),[l,s]=$.useState(""),[a,c]=$.useState(!1),[g,d]=$.useState(),u=$.useCallback(()=>{const h=C.$getSelection();if(C.$isRangeSelection(h)){const x=so(h),v=x.getParent();ce.$isLinkNode(v)?s(v.getURL()):ce.$isLinkNode(x)?s(x.getURL()):s("")}const m=i.current,N=window.getSelection(),y=document.activeElement;if(!m)return;const _=t.getRootElement();if(h&&N&&_&&_.contains(N.anchorNode)&&t.isEditable()){const x=N.getRangeAt(0);let v;if(N.anchorNode===_){let S=_;for(;S.firstElementChild;)S=S.firstElementChild;v=S.getBoundingClientRect()}else v=x.getBoundingClientRect();sl(v,m,r),d(h)}else(!y||y.className!=="link-input")&&(_&&sl(null,m,r),d(void 0),c(!1),s(""));return!0},[r,t]);$.useEffect(()=>{const h=r.parentElement;function m(){t.getEditorState().read(()=>u())}return window.addEventListener("resize",m),h&&h.addEventListener("scroll",m),()=>{window.removeEventListener("resize",m),h&&h.removeEventListener("scroll",m)}},[r.parentElement,t,u]),$.useEffect(()=>V.mergeRegister(t.registerUpdateListener(({editorState:h})=>h.read(()=>u())),t.registerCommand(C.SELECTION_CHANGE_COMMAND,()=>(u(),!0),C.COMMAND_PRIORITY_LOW),t.registerCommand(C.KEY_ESCAPE_COMMAND,()=>e?(n(!1),!0):!1,C.COMMAND_PRIORITY_HIGH)),[t,u,n,e]),$.useEffect(()=>{t.getEditorState().read(()=>u())},[t,u]),$.useEffect(()=>{a&&o.current&&o.current.focus()},[a]);const f=i_();return p.jsx("div",{ref:i,style:{transition:"opacity 0.5s"},className:f.editor,children:a?p.jsx(Gn,{ref:o,className:f.input,value:l,onChange:(h,m)=>s(m.value),onKeyDown:h=>{h.key==="Enter"?(h.preventDefault(),g&&(l&&t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,lg(l)),c(!1))):h.key==="Escape"&&(h.preventDefault(),c(!1))}}):p.jsxs("div",{className:f.link,children:[p.jsx(Lg,{href:l,target:"_blank",rel:"noopener noreferrer",className:f.a,children:l}),p.jsx(Un,{appearance:"subtle",icon:p.jsx(Mg,{}),onClick:()=>c(!0)})]})})}const ba={...P.margin("8px","10px"),...P.padding("4px","12px")},i_=it({editor:{...cu,...rf,position:"absolute",top:0,left:0,maxWidth:"400px",width:"100%",opacity:0,willChange:"transform"},a:{whiteSpace:"nowrap",...P.overflow("hidden"),textOverflow:"ellipsis"},link:{...uu,justifyContent:"space-between",alignItems:"center",width:"calc(100% - 20px)",boxSizing:"border-box",...P.borderRadius(an.borderRadiusMedium),backgroundColor:"#eee",position:"relative",...ba},input:ba});function o_({editor:t,anchor:e}){const[n,r]=$.useState(t),[i,o]=$.useState(!1);return $.useEffect(()=>t.registerCommand(C.SELECTION_CHANGE_COMMAND,(l,s)=>{const a=C.$getSelection();if(C.$isRangeSelection(a)){const c=so(a),g=V.$findMatchingParent(c,ce.$isLinkNode),d=V.$findMatchingParent(c,ce.$isAutoLinkNode);o(!!(g&&!d))}return r(s),!1},C.COMMAND_PRIORITY_CRITICAL),[t]),i&&p.jsx(Wr,{mountNode:e,children:p.jsx(r_,{editor:n,isLink:i,anchor:e,setIsLink:o})})}function l_({anchor:t=document.body}){const[e]=X.useLexicalComposerContext();return p.jsx(o_,{editor:e,anchor:t})}function s_(t,e){const n=t.getRangeAt(0);let r;if(t.anchorNode===e){let i=e;for(;i.firstElementChild;)i=i.firstElementChild;r=i.getBoundingClientRect()}else r=n.getBoundingClientRect();return r}function a_({editor:t,anchor:e,isLink:n,isBold:r,isItalic:i,isUnderline:o,isCode:l,isStrikethrough:s,isSubscript:a,isSuperscript:c}){const g=$.useRef(null),d=$.useCallback(()=>{n?t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,null):t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,"https://")},[t,n]),u=$.useCallback(()=>{const m=C.$getSelection(),N=g.current,y=window.getSelection();if(!N)return;const _=t.getRootElement();if(m&&y&&!y.isCollapsed&&_&&_.contains(y.anchorNode)){const x=s_(y,_);sl(x,N,e)}},[t,e]);$.useEffect(()=>{const m=e.parentElement;function N(){t.getEditorState().read(()=>u())}return window.addEventListener("resize",N),m&&m.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),m&&m.removeEventListener("scroll",N)}},[t,u,e]),$.useEffect(()=>(t.getEditorState().read(()=>u()),V.mergeRegister(t.registerUpdateListener(({editorState:m})=>m.read(()=>u())),t.registerCommand(C.SELECTION_CHANGE_COMMAND,()=>(u(),!1),C.COMMAND_PRIORITY_LOW))),[t,u]);const f=[r&&"bold",i&&"italic",o&&"underline",l&&"code",s&&"strikethrough",a&&"subscript",c&&"superscript",n&&"link"],h=u_();return p.jsxs(Za,{ref:g,className:h.toolbar,style:{transition:"opacity 0.5s"},checkedValues:{opts:f},children:[p.jsx(Le,{name:"opts",value:"bold",appearance:"subtle","aria-label":"Format text as bold",icon:p.jsx(qa,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"bold")}),p.jsx(Le,{name:"opts",value:"italic",appearance:"subtle","aria-label":"Format text as italics",icon:p.jsx(Qa,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"italic")}),p.jsx(Le,{name:"opts",value:"underline",appearance:"subtle","aria-label":"Format text to underlined",icon:p.jsx(eu,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"underline")}),p.jsx(Le,{name:"opts",value:"strikethrough",appearance:"subtle","aria-label":"Format text with a strikethrough",icon:p.jsx(tu,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"strikethrough")}),p.jsx(Le,{name:"opts",value:"subscript",appearance:"subtle","aria-label":"Format Subscript",icon:p.jsx(nu,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"subscript")}),p.jsx(Le,{name:"opts",value:"superscript",appearance:"subtle","aria-label":"Format Superscript",icon:p.jsx(ru,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"superscript")}),p.jsx(Le,{name:"opts",value:"code",appearance:"subtle","aria-label":"Insert code block",icon:p.jsx(Ti,{}),onClick:()=>t.dispatchCommand(C.FORMAT_TEXT_COMMAND,"code")}),p.jsx(Le,{name:"opts",value:"link",appearance:"subtle","aria-label":"Insert link",icon:p.jsx(iu,{}),onClick:d})]})}const u_=it({toolbar:{...cu,...P.padding("4px"),verticalAlign:"middle",position:"absolute",top:0,left:0,opacity:0,height:"35px",willChange:"transform"}});function c_({editor:t,anchor:e}){const[n,r]=$.useState(!1),[i,o]=$.useState(!1),[l,s]=$.useState(!1),[a,c]=$.useState(!1),[g,d]=$.useState(!1),[u,f]=$.useState(!1),[h,m]=$.useState(!1),[N,y]=$.useState(!1),[_,x]=$.useState(!1),v=$.useCallback(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;const S=C.$getSelection(),A=window.getSelection(),w=t.getRootElement();if(A&&(!C.$isRangeSelection(S)||!w||!w.contains(A.anchorNode))){r(!1);return}if(!C.$isRangeSelection(S))return;const B=so(S);s(S.hasFormat("bold")),c(S.hasFormat("italic")),d(S.hasFormat("underline")),f(S.hasFormat("strikethrough")),m(S.hasFormat("subscript")),y(S.hasFormat("superscript")),x(S.hasFormat("code"));const k=B.getParent();ce.$isLinkNode(k)||ce.$isLinkNode(B)?o(!0):o(!1),!he.$isCodeHighlightNode(S.anchor.getNode())&&S.getTextContent()?r(C.$isTextNode(B)):r(!1)})},[t]);return $.useEffect(()=>(document.addEventListener("selectionchange",v),()=>document.removeEventListener("selectionchange",v)),[v]),$.useEffect(()=>V.mergeRegister(t.registerUpdateListener(()=>v()),t.registerRootListener(()=>{t.getRootElement()||r(!1)})),[t,v]),!n||i?null:p.jsx(Wr,{mountNode:e,children:p.jsx(a_,{editor:t,anchor:e,isLink:i,isBold:l,isItalic:a,isStrikethrough:u,isSubscript:h,isSuperscript:N,isUnderline:g,isCode:_})})}function ka({anchor:t=document.body}){const[e]=X.useLexicalComposerContext();return p.jsx(c_,{editor:e,anchor:t})}function d_(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>t.registerCommand(jt.INSERT_HORIZONTAL_RULE_COMMAND,e=>{const n=C.$getSelection();if(!C.$isRangeSelection(n))return!1;if(n.focus.getNode()){const i=jt.$createHorizontalRuleNode();V.$insertNodeToNearestRoot(i)}return!0},C.COMMAND_PRIORITY_EDITOR),[t]),null}const Vl=C.createCommand("INSERT_IMAGE_COMMAND");function g_({editor:t}){const[e,n]=$.useState("https://source.unsplash.com/random"),[r,i]=$.useState(du.Name);return p.jsxs(ou,{children:[p.jsx(lu,{children:"Insert Image"}),p.jsxs(su,{children:[p.jsx(Or,{label:"Source",required:!0,children:p.jsx(Gn,{placeholder:e,onChange:(o,l)=>n(l.value||"")})}),p.jsx(Or,{label:"Alt Text",required:!0,children:p.jsx(Gn,{placeholder:r,onChange:(o,l)=>i(l.value||"")})})]}),p.jsx(au,{children:p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(Un,{onClick:()=>{t.dispatchCommand(Vl,{altText:r,src:e})},children:"Confirm"})})})]})}function Ia({captionsEnabled:t}){const[e]=X.useLexicalComposerContext();return $.useEffect(()=>{if(!e.hasNodes([Ut]))throw new Error("ImagesPlugin: ImageNode not registered on editor");return V.mergeRegister(e.registerCommand(Vl,n=>{const r=ro(n);return C.$insertNodes([r]),C.$isRootOrShadowRoot(r.getParentOrThrow())&&V.$wrapNodeInElement(r,C.$createParagraphNode).selectEnd(),!0},C.COMMAND_PRIORITY_EDITOR),e.registerCommand(C.DRAGSTART_COMMAND,n=>h_(n),C.COMMAND_PRIORITY_HIGH),e.registerCommand(C.DRAGOVER_COMMAND,n=>p_(n),C.COMMAND_PRIORITY_LOW),e.registerCommand(C.DROP_COMMAND,n=>m_(n,e),C.COMMAND_PRIORITY_HIGH))},[t,e]),null}const f_="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",sg=document.createElement("img");sg.src=f_;function h_(t){const e=Xl();if(!e)return!1;const n=t.dataTransfer;return n?(n.setData("text/plain","_"),n.setDragImage(sg,0,0),n.setData("application/x-lexical-drag",JSON.stringify({data:{altText:e.altText,caption:e.caption,height:e.height,key:e.getKey(),maxWidth:e.maxWidth,showCaption:e.showCaption,src:e.src,width:e.width},type:"image"})),!0):!1}function p_(t){return Xl()?(ag(t)||t.preventDefault(),!0):!1}function m_(t,e){const n=Xl();if(!n)return!1;const r=__(t);if(!r)return!1;if(t.preventDefault(),ag(t)){const i=C_(t);n.remove();const o=C.$createRangeSelection();i&&o.applyDOMRange(i),C.$setSelection(o),e.dispatchCommand(Vl,r)}return!0}function Xl(){const t=C.$getSelection();if(!C.$isNodeSelection(t))return null;const n=t.getNodes()[0];return Nd(n)?n:null}function __(t){const e=t.dataTransfer?.getData("application/x-lexical-drag");if(!e)return null;const{type:n,data:r}=JSON.parse(e);return n!=="image"?null:r}function ag(t){const e=t.target;return!!(e&&e instanceof HTMLElement&&!e.closest("code, span.LexEditor_Image")&&e.parentElement&&e.parentElement.closest("div.LexEditor_Content"))}function C_(t){let e;const n=window.getSelection();if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&n)n.collapse(t.rangeParent,t.rangeOffset||0),e=n.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var ug={},wn=ce,x_=X,N_=V,Dn=C,E_=$;ug.LinkPlugin=function({validateUrl:t}){let[e]=x_.useLexicalComposerContext();return E_.useEffect(()=>{if(!e.hasNodes([wn.LinkNode]))throw Error("LinkPlugin: LinkNode not registered on editor");return N_.mergeRegister(e.registerCommand(wn.TOGGLE_LINK_COMMAND,n=>{if(n===null)return wn.toggleLink(n),!0;if(typeof n=="string")return t===void 0||t(n)?(wn.toggleLink(n),!0):!1;let{url:r,target:i,rel:o,title:l}=n;return wn.toggleLink(r,{rel:o,target:i,title:l}),!0},Dn.COMMAND_PRIORITY_LOW),t!==void 0?e.registerCommand(Dn.PASTE_COMMAND,n=>{let r=Dn.$getSelection();if(!Dn.$isRangeSelection(r)||r.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let i=n.clipboardData.getData("text");return t(i)?r.getNodes().some(o=>Dn.$isElementNode(o))?!1:(e.dispatchCommand(wn.TOGGLE_LINK_COMMAND,i),n.preventDefault(),!0):!1},Dn.COMMAND_PRIORITY_LOW):()=>{})},[e,t]),null};const T_=ug;var y_=T_;function Pa(){return p.jsx(y_.LinkPlugin,{validateUrl:n_})}function v_(t){const e=t.getNodes();return e.length===0?new Set([t.anchor.getNode().getParentOrThrow(),t.focus.getNode().getParentOrThrow()]):new Set(e.map(n=>C.$isElementNode(n)?n:n.getParentOrThrow()))}function S_(t){const e=C.$getSelection();if(!C.$isRangeSelection(e))return!1;const n=v_(e);let r=0;for(const i of n)if(fe.$isListNode(i))r=Math.max(fe.$getListDepth(i)+1,r);else if(fe.$isListItemNode(i)){const o=i.getParent();if(!fe.$isListNode(o))throw new Error("ListMaxIndentLevelPlugin: A ListItemNode must have a ListNode for a parent.");r=Math.max(fe.$getListDepth(o)+1,r)}return r<=t}function $_({maxDepth:t}){const[e]=X.useLexicalComposerContext();return $.useEffect(()=>e.registerCommand(C.INDENT_CONTENT_COMMAND,()=>!S_(t??7),C.COMMAND_PRIORITY_CRITICAL),[e,t]),null}var Zl={},cg=Kr,R_=X,Oo=jt,A_=$;let dg=[{dependencies:[Oo.HorizontalRuleNode],export:t=>Oo.$isHorizontalRuleNode(t)?"***":null,regExp:/^(---|\*\*\*|___)\s?$/,replace:(t,e,n,r)=>{e=Oo.$createHorizontalRuleNode(),r||t.getNextSibling()!=null?t.replace(e):t.insertBefore(e),e.selectNext()},type:"element"},...cg.TRANSFORMERS];Zl.DEFAULT_TRANSFORMERS=dg;Zl.MarkdownShortcutPlugin=function({transformers:t=dg}){let[e]=R_.useLexicalComposerContext();return A_.useEffect(()=>cg.registerMarkdownShortcuts(e,t),[e,t]),null};const O_=Zl;var w_=O_;function D_(){return p.jsx(w_.MarkdownShortcutPlugin,{transformers:ol})}const L_=100;let gg=0,Fa=!1;function M_(){window.addEventListener("keydown",t=>{t.keyCode===9&&(gg=t.timeStamp)},!0)}function b_(){const[t]=X.useLexicalComposerContext();return $.useEffect(()=>(Fa||(M_(),Fa=!0),t.registerCommand(C.FOCUS_COMMAND,e=>{const n=C.$getSelection();return C.$isRangeSelection(n)&&gg+L_>e.timeStamp&&C.$setSelection(n.clone()),!1},C.COMMAND_PRIORITY_LOW)),[t]),null}function fg(){return Math.random().toString(36).replace(/[^a-z]+/g,"").substring(0,5)}const k_=new Map,yC=new Map,hg='{"root":{"children":[{"children":[],"direction":null,"format":"","indent":0,"type":"paragraph","version":1}],"direction":null,"format":"","indent":0,"type":"root","version":1}}';function I_(t){return t?`{"root":{"children":[{"children":[{"detail":0,"format":0,"mode":"normal","style":"","text":${t},"type":"text","version":1}],"direction":"ltr","format":"","indent":0,"type":"paragraph","version":1}],"direction":"ltr","format":"","indent":0,"type":"root","version":1}}`:hg}function Pn(t){return{colSpan:1,id:fg(),json:hg,type:t,width:null}}function Hi(){return{cells:[],height:null,id:fg()}}function P_(t){const e=t.querySelectorAll("tr");if(!e||e.length===0)return null;const n=[];for(let r=0;r({conversion:P_,priority:0})}}exportDOM(){return{element:F_(this.rows)}}createDOM(){const e=document.createElement("div");return e.style.display="contents",e}updateDOM(){return!1}mergeRows(e,n,r){const o=this.getWritable().rows,l=Math.min(o.length,n+r.length);for(let s=n;sJa(()=>import("./Component-n2P2KSDI.js"),__vite__mapDeps([5,1,2,3,4])));function j_(t,e,...n){if(!t)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+e)}const mg=C.createCommand("INSERT_NEW_TABLE_COMMAND"),_g=$.createContext({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function z_({children:t}){const[e,n]=$.useState({cellEditorConfig:null,cellEditorPlugins:null});return p.jsx(_g.Provider,{value:$.useMemo(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,i)=>n({cellEditorConfig:r,cellEditorPlugins:i})}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}function K_({editor:t}){const[e,n]=$.useState("5"),[r,i]=$.useState("5");return p.jsxs(ou,{children:[p.jsx(lu,{children:"Insert Table"}),p.jsxs(su,{children:[p.jsx(Or,{label:"Rows",required:!0,children:p.jsx(Gn,{placeholder:e,onChange:(o,l)=>l&&n(l.value)})}),p.jsx(Or,{label:"Cols",required:!0,children:p.jsx(Gn,{placeholder:r,onChange:(o,l)=>l&&i(l.value)})})]}),p.jsx(au,{children:p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(Un,{onClick:()=>{t.dispatchCommand(mg,{columns:r,rows:e})},children:"Confirm"})})})]})}function H_(t,e,n=!0){const r=[];for(let i=0;i(n.hasNodes([rr])||j_(!1,"TablePlugin: TableNode is not registered on editor"),r.set(t,e),n.registerCommand(mg,({columns:i,rows:o,includeHeaders:l})=>{const s=C.$getSelection();if(!C.$isRangeSelection(s))return!0;const a=s.focus,c=a.getNode();if(c){const g=H_(Number(o),Number(i),l);if(C.$isRootOrShadowRoot(c)){const u=c.getChildAtIndex(a.offset);u?u.insertBefore(g):c.append(g),g.insertBefore(C.$createParagraphNode())}else c.getTopLevelElementOrThrow().insertAfter(g);g.insertAfter(C.$createParagraphNode());const d=C.$createNodeSelection();d.add(g.getKey()),C.$setSelection(d)}return!0},C.COMMAND_PRIORITY_EDITOR)),[r,t,e,n]),null}var ql={},U_=C;class Cg extends U_.DecoratorNode{constructor(e,n){super(n),this.__format=e||""}exportJSON(){return{format:this.__format||"",type:"decorator-block",version:1}}createDOM(){return document.createElement("div")}updateDOM(){return!1}setFormat(e){this.getWritable().__format=e}}ql.$isDecoratorBlockNode=function(t){return t instanceof Cg};ql.DecoratorBlockNode=Cg;const G_=ql;var Y_=G_;const J_="documentMode"in document?document.documentMode:null,kt=/Mac|iPod|iPhone|iPad/.test(navigator.platform);"InputEvent"in window&&!J_&&"getTargetRanges"in new window.InputEvent("input");const al={bullet:"Bulleted List",check:"Check List",code:"Code Block",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",h4:"Heading 4",h5:"Heading 5",h6:"Heading 6",number:"Numbered List",paragraph:"Normal",quote:"Quote"};function V_({editor:t,blockType:e,disabled:n=!1}){function r(){e!=="paragraph"&&t.update(()=>{const g=C.$getSelection();(C.$isRangeSelection(g)||C.DEPRECATED_$isGridSelection(g))&&Se.$setBlocksType(g,()=>C.$createParagraphNode())})}function i(g){e!==g&&t.update(()=>{const d=C.$getSelection();(C.$isRangeSelection(d)||C.DEPRECATED_$isGridSelection(d))&&Se.$setBlocksType(d,()=>rt.$createHeadingNode(g))})}function o(){e!=="bullet"?t.dispatchCommand(fe.INSERT_UNORDERED_LIST_COMMAND,void 0):t.dispatchCommand(fe.REMOVE_LIST_COMMAND,void 0)}function l(){e!=="check"?t.dispatchCommand(fe.INSERT_CHECK_LIST_COMMAND,void 0):t.dispatchCommand(fe.REMOVE_LIST_COMMAND,void 0)}function s(){e!=="number"?t.dispatchCommand(fe.INSERT_ORDERED_LIST_COMMAND,void 0):t.dispatchCommand(fe.REMOVE_LIST_COMMAND,void 0)}function a(){e!=="quote"&&t.update(()=>{const g=C.$getSelection();(C.$isRangeSelection(g)||C.DEPRECATED_$isGridSelection(g))&&Se.$setBlocksType(g,()=>rt.$createQuoteNode())})}function c(){e!=="code"&&t.update(()=>{const g=C.$getSelection();if(C.$isRangeSelection(g)||C.DEPRECATED_$isGridSelection(g))if(g.isCollapsed())Se.$setBlocksType(g,()=>he.$createCodeNode());else{const d=g.getTextContent(),u=he.$createCodeNode();g.insertNodes([u]),g.insertRawText(d)}})}return p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:n,"aria-label":"Formatting options for text style",children:al[e],icon:(()=>{switch(e){case"paragraph":return p.jsx(cs,{});case"h1":return p.jsx(us,{});case"h2":return p.jsx(as,{});case"h3":return p.jsx(ss,{});case"bullet":return p.jsx(ls,{});case"check":return p.jsx(os,{});case"number":return p.jsx(is,{});case"quote":return p.jsx(rs,{});case"code":return p.jsx(Ti,{});default:return p.jsx(bg,{})}})()})}),p.jsx(_r,{children:p.jsxs(Cr,{children:[p.jsx(ue,{icon:p.jsx(cs,{}),onClick:r,children:"Normal"}),p.jsx(ue,{icon:p.jsx(us,{}),onClick:()=>i("h1"),children:"Heading 1"}),p.jsx(ue,{icon:p.jsx(as,{}),onClick:()=>i("h2"),children:"Heading 2"}),p.jsx(ue,{icon:p.jsx(ss,{}),onClick:()=>i("h3"),children:"Heading 3"}),p.jsx(ue,{icon:p.jsx(ls,{}),onClick:o,children:"Bullet List"}),p.jsx(ue,{icon:p.jsx(is,{}),onClick:s,children:"Numbered List"}),p.jsx(ue,{icon:p.jsx(os,{}),onClick:l,children:"Check List"}),p.jsx(ue,{icon:p.jsx(rs,{}),onClick:a,children:"Quote"}),p.jsx(ue,{icon:p.jsx(Ti,{}),onClick:c,children:"Code Block"})]})})]})}const X_=["#d0021b","#f5a623","#f8e71c","#8b572a","#7ed321","#417505","#bd10e0","#9013fe","#4a90e2","#50e3c2","#b8e986","#000000","#4a4a4a","#9b9b9b","#ffffff"],cr=214,Ba=150;function Z_({color:t,onChange:e}){const[n,r]=$.useState(Ln("hex",t)),[i,o]=$.useState(t),l=$.useRef(null),s=$.useMemo(()=>({x:n.hsv.s/100*cr,y:(100-n.hsv.v)/100*Ba}),[n.hsv.s,n.hsv.v]),a=$.useMemo(()=>({x:n.hsv.h/360*cr}),[n.hsv]);function c(u){if(o(u),/^#[0-9A-Fa-f]{6}$/i.test(u)){const f=Ln("hex",u);r(f)}}function g({x:u,y:f}){const h={...n.hsv,s:u/cr*100,v:100-f/Ba*100},m=Ln("hsv",h);r(m),o(m.hex)}function d({x:u}){const f={...n.hsv,h:u/cr*360},h=Ln("hsv",f);r(h),o(h.hex)}return $.useEffect(()=>{l.current!==null&&e&&(e(n.hex),o(n.hex))},[n,e]),$.useEffect(()=>{if(t===void 0)return;const u=Ln("hex",t);r(u),o(u.hex)},[t]),p.jsxs("div",{style:{width:cr},ref:l,children:[p.jsx(Or,{label:"Hex",style:{paddingBottom:an.spacingVerticalS},children:p.jsx(Gn,{onChange:(u,f)=>c(f.value),value:i})}),p.jsx("div",{className:"color-picker-basic-color",children:X_.map(u=>p.jsx("button",{className:u===n.hex?" active":"",style:{backgroundColor:u},onClick:()=>{o(u),r(Ln("hex",u))}},u))}),p.jsx(ja,{className:"color-picker-saturation",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`},onChange:g,children:p.jsx("div",{className:"color-picker-saturation_cursor",style:{backgroundColor:n.hex,left:s.x,top:s.y}})}),p.jsx(ja,{className:"color-picker-hue",onChange:d,children:p.jsx("div",{className:"color-picker-hue_cursor",style:{backgroundColor:`hsl(${n.hsv.h}, 100%, 50%)`,left:a.x}})}),p.jsx("div",{className:"color-picker-color",style:{backgroundColor:n.hex}})]})}function ja({className:t,style:e,onChange:n,children:r}){const i=$.useRef(null),o=s=>{if(i.current){const{current:a}=i,{width:c,height:g,left:d,top:u}=a.getBoundingClientRect(),f=za(s.clientX-d,c,0),h=za(s.clientY-u,g,0);n({x:f,y:h})}};function l(s){if(s.button!==0)return;o(s);function a(g){o(g)}function c(g){document.removeEventListener("mousemove",a,!1),document.removeEventListener("mouseup",c,!1),o(g)}document.addEventListener("mousemove",a,!1),document.addEventListener("mouseup",c,!1)}return p.jsx("div",{ref:i,className:t,style:e,onMouseDown:l,children:r})}function za(t,e,n){return t>e?e:tn?e+e:"#").join(""),t;if(t.length===7||t.length===9)return t}else{const e=document.createElement("canvas").getContext("2d");if(!e)throw new Error("2d context not supported or canvas already initialized");return e.fillStyle=t,e.fillStyle}return"#000000"}function Ha(t){const e=(t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,(n,r,i,o)=>"#"+r+r+i+i+o+o).substring(1).match(/.{2}/g)||[]).map(n=>parseInt(n,16));return{b:e[2],g:e[1],r:e[0]}}function wo({r:t,g:e,b:n}){t/=255,e/=255,n/=255;const r=Math.max(t,e,n),i=r-Math.min(t,e,n),o=i?(r===t?(e-n)/i+(er.toString(16).padStart(2,"0")).join("")}function Ln(t,e){let n=Ka("#121212"),r=Ha(n),i=wo(r);return t==="hex"?(n=Ka(e),r=Ha(n),i=wo(r)):t==="rgb"?(r=e,n=Wa(r),i=wo(r)):t==="hsv"&&(i=e,r=q_(i),n=Wa(r)),{hex:n,hsv:i,rgb:r}}function Ua({disabled:t,ariaLabel:e,color:n,onChange:r,icon:i}){return p.jsxs(kg,{trapFocus:!0,withArrow:!0,children:[p.jsx(Ig,{children:p.jsx(yt,{disabled:t,icon:i,title:e,"aria-label":e})}),p.jsx(Pg,{children:p.jsx(Z_,{color:n,onChange:r})})]})}const Q_=[["Arial","Arial"],["Courier New","Courier New"],["Georgia","Georgia"],["Times New Roman","Times New Roman"],["Trebuchet MS","Trebuchet MS"],["Verdana","Verdana"]],eC=[["10px","10px"],["11px","11px"],["12px","12px"],["13px","13px"],["14px","14px"],["15px","15px"],["16px","16px"],["17px","17px"],["18px","18px"],["19px","19px"],["20px","20px"]];function Ga({editor:t,value:e,style:n,disabled:r=!1}){const i=$.useCallback(l=>{t.update(()=>{const s=C.$getSelection();C.$isRangeSelection(s)&&Se.$patchStyleText(s,{[n]:l})})},[t,n]),o=n==="font-family"?"Formatting options for font family":"Formatting options for font size";return p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:r,"aria-label":o,icon:n==="font-family"?p.jsx(Fg,{}):p.jsx(Bg,{}),children:e})}),p.jsx(_r,{children:p.jsx(Cr,{children:(n==="font-family"?Q_:eC).map(([l,s],a)=>p.jsx(ue,{children:s,onClick:()=>i(l)},a))})})]})}const tC=it({box:{columnGap:"1px",backgroundColor:"#fff",borderTopLeftRadius:an.borderRadiusLarge,borderTopRightRadius:an.borderRadiusLarge}}),nC=(()=>{const t=[];for(const[e,n]of Object.entries(he.CODE_LANGUAGE_FRIENDLY_NAME_MAP))t.push([e,n]);return t})();function rC(){const[t]=X.useLexicalComposerContext(),[e,n]=$.useState(t),[r,i]=$.useState("paragraph"),[o,l]=$.useState(null),[s,a]=$.useState("15px"),[c,g]=$.useState("#000"),[d,u]=$.useState("#fff"),[f,h]=$.useState("Arial"),[m,N]=$.useState(!1),[y,_]=$.useState(!1),[x,v]=$.useState(!1),[S,A]=$.useState(""),[w,B]=$.useState(()=>t.isEditable()),[k,K]=$.useState([]),Z=$.useCallback(()=>{const I=C.$getSelection();if(C.$isRangeSelection(I)){const G=I.anchor.getNode();let de=G.getKey()==="root"?G:V.$findMatchingParent(G,De=>{const Te=De.getParent();return!!Te&&C.$isRootOrShadowRoot(Te)});de||(de=G.getTopLevelElementOrThrow());const ge=de.getKey(),Dt=e.getElementByKey(ge),oe=[];I.hasFormat("bold")&&oe.push("bold"),I.hasFormat("italic")&&oe.push("italic"),I.hasFormat("underline")&&oe.push("underline"),I.hasFormat("strikethrough")&&oe.push("strikethrough"),I.hasFormat("subscript")&&oe.push("subscript"),I.hasFormat("superscript")&&oe.push("superscript"),I.hasFormat("code")&&oe.push("code");const lt=so(I),st=lt.getParent();if(ce.$isLinkNode(st)||ce.$isLinkNode(lt)?(oe.push("link"),N(!0)):N(!1),K(oe),Dt)if(l(ge),fe.$isListNode(de)){const De=V.$getNearestNodeOfType(G,fe.ListNode),Te=De?De.getListType():de.getListType();i(Te)}else{const De=rt.$isHeadingNode(de)?de.getTag():de.getType();if(De in al&&i(De),he.$isCodeNode(de)){const Te=de.getLanguage();A(Te?he.CODE_LANGUAGE_MAP[Te]||Te:"");return}}a(Se.$getSelectionStyleValueForProperty(I,"font-size","15px")),g(Se.$getSelectionStyleValueForProperty(I,"color","#000")),u(Se.$getSelectionStyleValueForProperty(I,"background-color","#fff")),h(Se.$getSelectionStyleValueForProperty(I,"font-family","Arial"))}},[e]);$.useEffect(()=>t.registerCommand(C.SELECTION_CHANGE_COMMAND,(I,G)=>(Z(),n(G),!1),C.COMMAND_PRIORITY_CRITICAL),[t,Z]),$.useEffect(()=>V.mergeRegister(t.registerEditableListener(I=>B(I)),e.registerUpdateListener(({editorState:I})=>I.read(()=>Z())),e.registerCommand(C.CAN_UNDO_COMMAND,I=>(_(I),!1),C.COMMAND_PRIORITY_CRITICAL),e.registerCommand(C.CAN_REDO_COMMAND,I=>(v(I),!1),C.COMMAND_PRIORITY_CRITICAL)),[e,t,Z]);const ie=$.useCallback(I=>{e.update(()=>{const G=C.$getSelection();C.$isRangeSelection(G)&&Se.$patchStyleText(G,I)})},[e]),ot=$.useCallback(()=>{e.update(()=>{const I=C.$getSelection();C.$isRangeSelection(I)&&(Se.$selectAll(I),I.getNodes().forEach(G=>{C.$isTextNode(G)&&(G.setFormat(0),G.setStyle(""),V.$getNearestBlockElementAncestorOrThrow(G).setFormat("")),Y_.$isDecoratorBlockNode(G)&&G.setFormat("")}))})},[e]),Tn=$.useCallback(I=>ie({color:I}),[ie]),yn=$.useCallback(I=>ie({"background-color":I}),[ie]),vn=$.useCallback(()=>{m?t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,null):t.dispatchCommand(ce.TOGGLE_LINK_COMMAND,lg("https://"))},[t,m]),xt=$.useCallback(I=>{e.update(()=>{if(o!==null){const G=C.$getNodeByKey(o);he.$isCodeNode(G)&&G.setLanguage(I)}})},[e,o]),ae=tC();return p.jsxs(Za,{checkedValues:{opts:k},className:gt("LexEditor_Toolbar",ae.box),children:[p.jsx(yt,{disabled:!y||!w,title:kt?"Undo (⌘Z)":"Undo (Ctrl+Z)","aria-label":"Undo",icon:p.jsx(jg,{}),onClick:()=>e.dispatchCommand(C.UNDO_COMMAND,void 0)}),p.jsx(yt,{disabled:!x||!w,title:kt?"Redo (⌘Y)":"Redo (Ctrl+Y)","aria-label":"Redo",icon:p.jsx(zg,{}),onClick:()=>e.dispatchCommand(C.REDO_COMMAND,void 0)}),p.jsx(sr,{}),r in al&&e===t&&p.jsxs(p.Fragment,{children:[p.jsx(V_,{disabled:!w,blockType:r,editor:t}),p.jsx(sr,{})]}),r==="code"?p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:!w,title:"Select language","aria-label":"Select language",icon:p.jsx(Kg,{}),children:he.getLanguageFriendlyName(S)})}),p.jsx(_r,{children:p.jsx(Cr,{children:nC.map(([I,G],de)=>p.jsx(ue,{onClick:()=>xt(I),children:G},de))})})]}):p.jsxs(p.Fragment,{children:[p.jsx(Ga,{disabled:!w,style:"font-family",value:f,editor:t}),p.jsx(Ga,{disabled:!w,style:"font-size",value:s,editor:t}),p.jsx(sr,{}),p.jsx(Le,{name:"opts",value:"bold",appearance:"subtle",disabled:!w,title:kt?"Bold (⌘B)":"Bold (Ctrl+B)","aria-label":`Format text as bold. Shortcut: ${kt?"⌘B":"Ctrl+B"}`,icon:p.jsx(qa,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"bold")}),p.jsx(Le,{name:"opts",value:"italic",appearance:"subtle",disabled:!w,title:kt?"Italic (⌘I)":"Italic (Ctrl+I)","aria-label":`Format text as italics. Shortcut: ${kt?"⌘I":"Ctrl+I"}`,icon:p.jsx(Qa,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"italic")}),p.jsx(Le,{name:"opts",value:"underline",appearance:"subtle",disabled:!w,title:kt?"Underline (⌘U)":"Underline (Ctrl+U)","aria-label":`Format text to underlined. Shortcut: ${kt?"⌘U":"Ctrl+U"}`,icon:p.jsx(eu,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"underline")}),p.jsx(Le,{name:"opts",value:"strikethrough",appearance:"subtle",disabled:!w,title:"Strikethrough","aria-label":"Format text with a strikethrough",icon:p.jsx(tu,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"strikethrough")}),p.jsx(Le,{name:"opts",value:"subscript",appearance:"subtle",disabled:!w,title:"Subscript","aria-label":"Format text with a subscript",icon:p.jsx(nu,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"subscript")}),p.jsx(Le,{name:"opts",value:"superscript",appearance:"subtle",disabled:!w,title:"Superscript","aria-label":"Format text with a superscript",icon:p.jsx(ru,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"superscript")}),p.jsx(Le,{name:"opts",value:"code",appearance:"subtle",disabled:!w,title:"Insert code block","aria-label":"Insert code block",icon:p.jsx(Ti,{}),onClick:()=>e.dispatchCommand(C.FORMAT_TEXT_COMMAND,"code")}),p.jsx(Le,{name:"opts",value:"link",appearance:"subtle",disabled:!w,title:"Insert link","aria-label":"Insert link",icon:p.jsx(iu,{}),onClick:vn}),p.jsx(Ua,{disabled:!w,ariaLabel:"Formatting text color",color:c,icon:p.jsx(Hg,{}),onChange:Tn}),p.jsx(Ua,{disabled:!w,ariaLabel:"Formatting background color",color:d,icon:p.jsx(Wg,{}),onChange:yn}),p.jsx(yt,{disabled:!w,title:"Clear text formatting","aria-label":"Clear all text formatting",icon:p.jsx(Ug,{}),onClick:ot}),p.jsx(sr,{}),p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:!w,title:"Insert","aria-label":"Insert specialized editor node",icon:p.jsx(Gg,{}),children:"Insert"})}),p.jsx(_r,{children:p.jsxs(Cr,{children:[p.jsx(ue,{icon:p.jsx(Yg,{}),onClick:()=>e.dispatchCommand(jt.INSERT_HORIZONTAL_RULE_COMMAND,void 0),children:"Horizontal Rule"}),p.jsxs(ds,{children:[p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(ue,{icon:p.jsx(Jg,{}),children:"Image"})}),p.jsx(gs,{children:p.jsx(g_,{editor:e})})]}),p.jsxs(ds,{children:[p.jsx(yi,{disableButtonEnhancement:!0,children:p.jsx(ue,{icon:p.jsx(Vg,{}),children:"Table"})}),p.jsx(gs,{children:p.jsx(K_,{editor:e})})]}),p.jsx(ue,{icon:p.jsx(Xg,{}),onClick:()=>t.dispatchCommand(ig,void 0),children:"Collapsible"})]})})]})]}),p.jsx(sr,{}),p.jsxs(pr,{children:[p.jsx(mr,{children:p.jsx(yt,{disabled:!w,title:"Align","aria-label":"Formatting options for text alignment",icon:p.jsx(fs,{}),children:"Align"})}),p.jsx(_r,{children:p.jsxs(Cr,{children:[p.jsx(ue,{icon:p.jsx(fs,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"left"),children:"Left Align"}),p.jsx(ue,{icon:p.jsx(Zg,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"center"),children:"Center Align"}),p.jsx(ue,{icon:p.jsx(qg,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"right"),children:"Right Align"}),p.jsx(ue,{icon:p.jsx(Qg,{}),onClick:()=>e.dispatchCommand(C.FORMAT_ELEMENT_COMMAND,"justify"),children:"Justify Align"}),p.jsx(ef,{}),p.jsx(ue,{icon:p.jsx(tf,{}),onClick:()=>e.dispatchCommand(C.OUTDENT_CONTENT_COMMAND,void 0),children:"Outdent"}),p.jsx(ue,{icon:p.jsx(nf,{}),onClick:()=>e.dispatchCommand(C.INDENT_CONTENT_COMMAND,void 0),children:"Indent"})]})})]})]})}const iC=it({ltr:{textAlign:"left"},rtl:{textAlign:"right"},paragraph:{...P.margin(0),position:"relative"},quote:{...P.margin(0),marginLeft:"20px",marginBottom:"10px",fontSize:"15px",color:"rgb(101, 103, 107)",borderLeftColor:"rgb(206, 208, 212)",borderLeftWidth:"4px",borderLeftStyle:"solid",paddingLeft:"16px"},h1:{fontSize:"24px",color:"rgb(5, 5, 5)",fontWeight:400,...P.margin(0)},h2:{fontSize:"15px",color:"rgb(101, 103, 107)",fontWeight:700,...P.margin(0),textTransform:"uppercase"},h3:{fontSize:"12px",...P.margin(0),textTransform:"uppercase"},textBold:{fontWeight:"bold"},textItalic:{fontStyle:"italic"},textSubscript:{fontSize:"0.8em",verticalAlign:"sub !important"},textSuperscript:{fontSize:"0.8em",verticalAlign:"super"},textCode:{backgroundColor:"rgb(240, 242, 245)",...P.padding("1px","0.25rem"),fontFamily:"Menlo, Consolas, Monaco, monospace",fontSize:"94%"},code:{backgroundColor:"rgb(240, 242, 245)",fontFamily:"Menlo, Consolas, Monaco, monospace",display:"block",...P.padding("8px","8px","8px","52px"),lineHeight:1.53,fontSize:"13px",...P.margin(0),marginTop:"8px",marginBottom:"8px",tabSize:2,overflowX:"auto",position:"relative",":before":{content:"attr(data-gutter)",position:"absolute",backgroundColor:"#eee",left:0,top:0,...P.borderRight("1px","solid","#ccc"),...P.padding("8px"),color:"#777",whiteSpace:"pre-wrap",textAlign:"right",minWidth:"25px"}},table:{borderCollapse:"collapse",borderSpacing:0,maxWidth:"100%",overflowY:"scroll",tableLayout:"fixed",width:"calc(100% - 25px)",...P.margin("30px",0)},tableSelected:{...P.outline("2px","solid","rgb(60, 132, 244)")},tableCell:{...P.border("1px","solid","#bbb"),minWidth:"75px",verticalAlign:"top",textAlign:"start",...P.padding("6px","8px"),position:"relative",cursor:"default",...P.outline("none")},tableCellSortedIndicator:{display:"block",opacity:.5,position:"absolute",bottom:0,left:0,width:"100%",height:"4px",backgroundColor:"#999"},tableCellResizer:{position:"absolute",right:"-4px",height:"100%",width:"8px",cursor:"ew-resize",zIndex:10,top:0},tableCellHeader:{backgroundColor:"#f2f3f5",textAlign:"start"},tableCellSelected:{backgroundColor:"#c9dbf0"},tableCellPrimarySelected:{...P.border("2px","solid","rgb(60, 132, 244)"),display:"block",height:"calc(100% - 2px)",position:"absolute",width:"calc(100% - 2px)",left:"-1px",top:"-1px",zIndex:2},tableCellEditing:{boxShadow:"0 0 5px rgba(0, 0, 0, 0.4)",...P.borderRadius("3px")},tableAddColumns:{position:"absolute",top:0,width:"20px",backgroundColor:"#eee",height:"100%",right:0,...P.border(0),cursor:"pointer",":after":{backgroundSize:"contain",backgroundRepeat:"no-repeat",display:"block",content:'" "',position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:.4},":hover":{backgroundColor:"#c9dbf0"}},tableAddRows:{position:"absolute",bottom:"-25px",width:"calc(100% - 25px)",backgroundColor:"#eee",height:"20px",left:0,...P.border(0),cursor:"pointer",":after":{backgroundSize:"contain",backgroundRepeat:"no-repeat",display:"block",content:'" "',position:"absolute",top:0,left:0,width:"100%",height:"100%",opacity:.4},":hover":{backgroundColor:"#c9dbf0"}},tableCellResizeRuler:{display:"block",position:"absolute",width:"1px",backgroundColor:"rgb(60, 132, 244)",height:"100%",top:0},tableCellActionButtonContainer:{display:"block",right:"5px",top:"2px",position:"absolute",zIndex:4},tableCellActionButton:{backgroundColor:"#eee",display:"block",...P.border(0),...P.borderRadius("20px"),width:"20px",height:"20px",color:"#222",cursor:"pointer",":hover":{backgroundColor:"#ddd"}},ol1:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStylePosition:"inside"},ol2:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"upper-alpha",listStylePosition:"inside"},ol3:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"lower-alpha",listStylePosition:"inside"},ol4:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"upper-roman",listStylePosition:"inside"},ol5:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStyleType:"lower-roman",listStylePosition:"inside"},ul:{...P.padding(0),...P.margin(0),marginLeft:"16px",listStylePosition:"inside"},listItem:{...P.margin(0,"8px")},tokenComment:{color:"slategray"},tokenPunctuation:{color:"#999"},tokenProperty:{color:"#905"},tokenSelector:{color:"#690"},tokenOperator:{color:"#9a6e3a"},tokenAttr:{color:"#07a"},tokenVariable:{color:"#e90"},tokenFunction:{color:"#dd4a68"},embedBlock:{userSelect:"none"},embedBlockFocus:{...P.outline("2px solid rgb(60, 132, 244)")}});function xg(){const t=iC();return{blockCursor:"LexEditor_blockCursor",code:gt(t.code,"LexEditor_code"),codeHighlight:{atrule:t.tokenAttr,attr:t.tokenAttr,boolean:t.tokenProperty,builtin:t.tokenSelector,cdata:t.tokenComment,char:t.tokenSelector,class:t.tokenFunction,"class-name":t.tokenFunction,comment:t.tokenComment,constant:t.tokenProperty,deleted:t.tokenProperty,doctype:t.tokenComment,entity:t.tokenOperator,function:t.tokenFunction,important:t.tokenVariable,inserted:t.tokenSelector,namespace:t.tokenVariable,number:t.tokenProperty,operator:t.tokenOperator,prolog:t.tokenComment,property:t.tokenProperty,punctuation:t.tokenPunctuation,regex:t.tokenVariable,selector:t.tokenSelector,string:t.tokenSelector,symbol:t.tokenProperty,tag:t.tokenProperty,url:t.tokenOperator,variable:t.tokenVariable},embedBlock:{base:t.embedBlock,focus:t.embedBlockFocus},heading:{h1:t.h1,h2:t.h2,h3:t.h3},image:"LexEditor_Image",link:"LexEditor_link",list:{listitem:t.listItem,listitemChecked:"LexEditor_listItemChecked",listitemUnchecked:"LexEditor_listItemUnchecked",nested:{listitem:"LexEditor_nestedListItem"},olDepth:[t.ol1,t.ol2,t.ol3,t.ol4,t.ol5],ul:t.ul},ltr:t.ltr,mark:"LexEditor_mark",markOverlap:"LexEditor_markOverlap",paragraph:t.paragraph,quote:t.quote,rtl:t.rtl,table:t.table,tableAddColumns:gt(t.tableAddColumns,"LexEditor_tableAddColumns"),tableAddRows:gt(t.tableAddRows,"LexEditor_tableAddRows"),tableCell:t.tableCell,tableCellActionButton:t.tableCellActionButton,tableCellActionButtonContainer:t.tableCellActionButtonContainer,tableCellEditing:t.tableCellEditing,tableCellHeader:t.tableCellHeader,tableCellPrimarySelected:t.tableCellPrimarySelected,tableCellResizer:t.tableCellResizer,tableCellSelected:t.tableCellSelected,tableCellSortedIndicator:t.tableCellSortedIndicator,tableResizeRuler:t.tableCellResizeRuler,tableSelected:t.tableSelected,text:{bold:t.textBold,code:t.textCode,italic:t.textItalic,strikethrough:"LexEditor_textStrikethrough",subscript:t.textSubscript,superscript:t.textSuperscript,underline:"LexEditor_textUnderline",underlineStrikethrough:"LexEditor_textUnderlineStrikethrough"}}}var Ng={},oC=X,Ar=$,lC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Ar.useLayoutEffect:Ar.useEffect;Ng.ContentEditable=function({ariaActiveDescendant:t,ariaAutoComplete:e,ariaControls:n,ariaDescribedBy:r,ariaExpanded:i,ariaLabel:o,ariaLabelledBy:l,ariaMultiline:s,ariaOwns:a,ariaRequired:c,autoCapitalize:g,className:d,id:u,role:f="textbox",spellCheck:h=!0,style:m,tabIndex:N,"data-testid":y}){let[_]=oC.useLexicalComposerContext(),[x,v]=Ar.useState(!1),S=Ar.useCallback(A=>{_.setRootElement(A)},[_]);return lC(()=>(v(_.isEditable()),_.registerEditableListener(A=>{v(A)})),[_]),Ar.createElement("div",{"aria-activedescendant":x?t:void 0,"aria-autocomplete":x?e:"none","aria-controls":x?n:void 0,"aria-describedby":r,"aria-expanded":x&&f==="combobox"?!!i:void 0,"aria-label":o,"aria-labelledby":l,"aria-multiline":s,"aria-owns":x?a:void 0,"aria-required":c,autoCapitalize:g,className:d,contentEditable:x,"data-testid":y,id:u,ref:S,role:x?f:void 0,spellCheck:h,style:m,tabIndex:N})};const sC=Ng;var aC=sC;const uC=it({root:{...P.border(0),fontSize:"15px",display:"block",position:"relative",tabSize:1,...P.outline(0),...P.padding("8px","28px"),minHeight:"calc(100% - 16px)"},table:{minHeight:"20px",...P.border(0),resize:"none",cursor:"text",display:"block",position:"relative",tabSize:1,...P.outline(0),...P.padding(0),userSelect:"text",fontSize:"15px",whiteSpace:"pre-wrap",wordBreak:"break-word",zIndex:3},display:{...P.padding(0)}});function Ya({className:t,table:e}){const n=uC(),{Display:r}=vc();return p.jsx(aC.ContentEditable,{className:gt("LexEditor_Content",t||e?n.table:n.root,!e&&r&&n.display)})}const cC=it({box:{fontSize:"15px",color:"#999",...P.overflow("hidden"),position:"absolute",textOverflow:"ellipsis",top:"8px",left:"28px",right:"28px",userSelect:"none",whiteSpace:"nowrap",display:"inline-block",pointerEvents:"none"}});function dC({children:t,className:e}){const n=cC();return p.jsx("div",{className:e||n.box,children:t})}const gC=it({shell:{lineHeight:"1.7"},container:{position:"relative"},noTreeView:{borderBottomLeftRadius:an.borderRadiusLarge,borderBottomRightRadius:an.borderRadiusLarge},scroller:{minHeight:"150px",...P.overflow("auto"),resize:"vertical"}});function fC(){of(X.useLexicalComposerContext()[0]);const{Namespace:t,OnError:e,Placeholder:n,Display:r,Plugin:{Actions:i,AutoFocus:o,AutoLink:l,CheckList:s,ClickableLink:a,CodeActionMenu:c,CodeHighlight:g,Collapsible:d,DraggableBlock:u,FloatingLinkEditor:f,FloatingTextFormatToolbar:h,HorizontalRule:m,Images:N,Link:y,ListMaxIndentLevel:_,List:x,MarkdownShortcut:v,TabFocus:S,TabIndentation:A,Table:w,Toolbar:B}}=vc(),k=p.jsx(dC,{children:n||"Let's say something awesome...."}),[K,Z]=$.useState(),ie=gC();return p.jsxs("div",{className:gt("LexEditor_Shell",ie.shell),children:[B&&p.jsx(rC,{}),p.jsxs("div",{className:gt(...r?[]:[ie.container,ie.noTreeView,ie.scroller]),ref:ot=>ot&&Z(ot),children:[o&&p.jsx(Fs.AutoFocusPlugin,{}),l&&p.jsx(Dm,{}),s&&p.jsx(vh.CheckListPlugin,{}),a&&p.jsx(Aa,{}),g&&p.jsx(Bm,{}),d&&p.jsx(zm,{}),m&&p.jsx(d_,{}),N&&p.jsx(Ia,{}),y&&p.jsx(Pa,{}),_&&p.jsx($_,{maxDepth:_}),x&&p.jsx(kh.ListPlugin,{}),v&&p.jsx(D_,{}),p.jsx(la.RichTextPlugin,{contentEditable:p.jsx(Ya,{}),placeholder:!r&&k,ErrorBoundary:qs}),S&&p.jsx(b_,{}),A&&p.jsx(Ep.TabIndentationPlugin,{}),w&&p.jsxs(W_,{cellEditorConfig:{namespace:t,nodes:[...Ip],onError:e,theme:xg()},children:[p.jsx(Fs.AutoFocusPlugin,{}),p.jsx(Aa,{}),p.jsx(ka,{}),p.jsx(Ia,{captionsEnabled:!1}),p.jsx(Pa,{}),p.jsx(la.RichTextPlugin,{contentEditable:p.jsx(Ya,{table:!0}),placeholder:null,ErrorBoundary:qs})]}),K&&p.jsxs(p.Fragment,{children:[i&&p.jsx(Em,{anchor:K}),c&&p.jsx(Fm,{anchor:K}),u&&p.jsx(qm,{anchor:K}),f&&p.jsx(l_,{anchor:K}),h&&p.jsx(ka,{anchor:K})]})]})]})}var En={},$t=C,di=V;class ei extends $t.ElementNode{static getType(){return"mark"}static clone(e){return new ei(Array.from(e.__ids),e.__key)}static importDOM(){return null}static importJSON(e){let n=Wi(e.ids);return n.setFormat(e.format),n.setIndent(e.indent),n.setDirection(e.direction),n}exportJSON(){return{...super.exportJSON(),ids:this.getIDs(),type:"mark",version:1}}constructor(e,n){super(n),this.__ids=e||[]}createDOM(e){let n=document.createElement("mark");return di.addClassNamesToElement(n,e.theme.mark),1{throw s},State:i,Placeholder:o,Display:l}){return n=l?!1:n,p.jsx(qf.LexicalComposer,{initialConfig:{editorState:i,namespace:t,nodes:[...CC],onError:r,theme:xg(),editable:n},children:p.jsx(th,{Namespace:t,Plugin:l?Qf:e,Editable:n,OnError:r,State:i,Placeholder:o,Display:l,children:p.jsx(z_,{children:p.jsx(fC,{})})})})}const vC=Object.freeze(Object.defineProperty({__proto__:null,default:xC},Symbol.toStringTag,{value:"Module"}));export{Nd as $,_g as C,kt as I,X as L,dC as P,rr as T,C as a,V as b,Fs as c,Pa as d,la as e,Ya as f,qs as g,k_ as h,Jh as i,yC as j,qh as k,F_ as l,Hi as m,fg as n,Pn as o,I_ as p,vC as q,Zp as u}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/Component-3Xt-99h9.js","assets/vendor--JR89aB4.js","assets/LexicalNestedComposer-bPIc0uls.js","assets/index-3wZvIsDj.js","assets/index-mRiAC1cH.css","assets/Component-HpG_cdPN.js"] + __vite__mapDeps.viteFileDeps = ["assets/Component-_hAU7BS-.js","assets/vendor--JR89aB4.js","assets/LexicalNestedComposer-rgrcCsEX.js","assets/index-no0JSIPh.js","assets/index-mRiAC1cH.css","assets/Component-n2P2KSDI.js"] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) } diff --git a/assets/index-mYNP8E8_.js b/assets/index-mYNP8E8_.js deleted file mode 100644 index e452122..0000000 --- a/assets/index-mYNP8E8_.js +++ /dev/null @@ -1 +0,0 @@ -import{m as w,j as e,T as f,b,F as B,B as i,r as S,ai as Me,a6 as h,a7 as C,a8 as g,o as k,I as M,aF as K,aG as F,t as E,x as $,aH as Re,ad as he,ae as xe,af as pe,ag as L,ah as je,L as Ce,aI as ge,aJ as _,ac as W,D as J,n as V,g as Z,h as ee,i as ne,k as re,ab as Ge,K as se,aC as fe,ak as be,al as ye,ap as Pe,N as ve,z as Le,aK as qe,aL as ze,c as _e,l as Xe,aM as Qe,a2 as Ve,a0 as Ye,a1 as Ke,a3 as We,a4 as Je,a9 as Ae,aN as Ze,as as en}from"./vendor--JR89aB4.js";import{L as x,a as H,e as A,A as m,F as R,f as G,c as Q,H as q,C as nn,G as rn,M as Fe}from"./index-3wZvIsDj.js";import{O as sn,a as tn,H as an}from"./Columns-WM0v5PCO.js";import{a as on,b as cn,i as Ne,L as ln}from"./Lazy-S42ziN8Y.js";var dn="[object Symbol]";function un(n){return typeof n=="symbol"||on(n)&&cn(n)==dn}var mn=/\s/;function hn(n){for(var r=n.length;r--&&mn.test(n.charAt(r)););return r}var xn=/^\s+/;function pn(n){return n&&n.slice(0,hn(n)+1).replace(xn,"")}var we=NaN,jn=/^[-+]0x[0-9a-f]+$/i,Cn=/^0b[01]+$/i,gn=/^0o[0-7]+$/i,fn=parseInt;function bn(n){if(typeof n=="number")return n;if(un(n))return we;if(Ne(n)){var r=typeof n.valueOf=="function"?n.valueOf():n;n=Ne(r)?r+"":r}if(typeof n!="string")return n===0?n:+n;n=pn(n);var s=Cn.test(n);return s||gn.test(n)?fn(n.slice(2),s?2:8):jn.test(n)?we:+n}var Se=1/0,yn=17976931348623157e292;function Pn(n){if(!n)return n===0?n:0;if(n=bn(n),n===Se||n===-Se){var r=n<0?-1:1;return r*yn}return n===n?n:0}function An(n){var r=Pn(n),s=r%1;return r===r?s?r-s:r:0}function He(n){return typeof n=="number"&&n==An(n)}const Nn=w({body:{...H,alignItems:"flex-start"}}),wn=new x("Admin","Order","Detail","Action");function Sn({OrderId:n,Status:r,Refresh:s}){const t=Nn(),{dispatch:a,dispatchToast:o}=A(wn),{run:c}=m.Order.Post.useAccept({manual:!0,onError(l,u){a({Message:"Failed Accept Order",Request:u,Error:l})},onSuccess(){o(e.jsx(f,{children:e.jsx(b,{children:"Order Accepted"})}),{intent:"success"}),s()}});switch(r){case"Processing":case"Shipping":case"Finished":case"Cancelled":case"Returning":return null}return e.jsx(B,{label:"Action",size:"large",children:e.jsx("div",{className:t.body,children:r==="Pending"&&e.jsx(i,{appearance:"subtle",onClick:()=>c(n),children:"Accept Order"})})})}const Dn=w({body:{...R,justifyContent:"space-between"}}),En=new x("Admin","Order","Detail","Append");function Tn({OrderId:n,Refresh:r}){const s=Dn(),[t,a]=S.useState(),{dispatch:o,dispatchToast:c}=A(En),{run:l}=m.Order.Post.useAppend({manual:!0,onError(p,d){o({Message:"Failed Append Comment",Request:d,Error:p})},onSuccess(){c(e.jsx(f,{children:e.jsx(b,{children:"Comment Appended"})}),{intent:"success"}),r()}}),{run:u}=m.Order.Post.useClose({manual:!0,onError(p,d){o({Message:"Failed Close Order",Request:d,Error:p})},onSuccess(){c(e.jsx(f,{children:e.jsx(b,{children:"Order Closed"})}),{intent:"success"}),r()}});return e.jsxs(e.Fragment,{children:[e.jsx(B,{label:"Append",size:"large",children:e.jsx(Me,{value:t,onChange:(p,d)=>a(d.value),maxLength:1e3})}),e.jsxs("div",{className:s.body,children:[e.jsx(i,{onClick:()=>u(n,t),children:"Force Close with Reason"}),e.jsx(i,{appearance:"primary",onClick:()=>l(n,t),children:"Add Comment"})]})]})}const De=w({ten:{flexBasis:"10%",flexGrow:0}}),In=[h({columnId:"Product",renderHeaderCell(){return e.jsx(C,{children:"Name"})},renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Type",renderHeaderCell(){return e.jsx(C,{children:"Type"})},renderCell(n){return e.jsx(g,{children:Object.entries(n.Type).reduce((r,s)=>`${r} ${s[0]} : ${s[1]} ;`,"")})}}),h({columnId:"Quantity",renderHeaderCell(){return e.jsx(C,{className:De().ten,children:"Quantity"})},renderCell(n){return e.jsx(g,{className:De().ten,children:n.Quantity})}})];function $n({Items:n}){return e.jsx(G,{Items:n,Columns:In})}const kn=new x("Admin","Order","Detail","Shipment");function Rn({OrderId:n,TrackingNumber:r,Refresh:s}){const[t,{setTrue:a,setFalse:o}]=k(),[c,l]=S.useState(r),{dispatch:u,dispatchToast:p}=A(kn),{run:d}=m.Order.Post.useShip({manual:!0,onError(j,y){u({Message:"Failed Update Tracking Number",Request:y,Error:j})},onSuccess(){p(e.jsx(f,{children:e.jsx(b,{children:"Tracking Number Updated"})}),{intent:"success"}),o(),s()}});return e.jsx(B,{label:"Shipment",size:"large",children:e.jsx(M,{value:c,disabled:!t,appearance:"underline",onChange:(j,y)=>l(y.value),placeholder:"Fill in this field to ship the order.",contentAfter:t?e.jsx(i,{appearance:"subtle",icon:e.jsx(K,{}),onClick:()=>d(n,c)}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:a})})})}const Gn=w({body:{...H,rowGap:E.spacingVerticalXL}}),te=new x("Admin","Order","Detail");function vn({OrderId:n}){const r=Gn(),[s,{setTrue:t,setFalse:a}]=k(),{Nav:o,Paths:c}=Q(),l=parseInt(c.at(2)),{data:u,run:p}=$(()=>m.Order.Get.Detail(n,te),{manual:!0,onError:te.error}),{data:d,run:j}=$(()=>m.Order.Get.Order(n),{onError(N){o("Admin","Order"),te.error(N)},manual:!0});function y(){j(),p()}return S.useEffect(()=>{l===n?(y(),t()):a()},[l]),e.jsxs(e.Fragment,{children:[e.jsx(i,{appearance:"subtle",icon:e.jsx(Re,{}),onClick:()=>o("Admin","Order",n)}),e.jsxs(he,{open:s,position:"end",size:"medium",modalType:"alert",children:[e.jsx(xe,{children:e.jsx(pe,{action:e.jsx(i,{appearance:"subtle",icon:e.jsx(L,{}),onClick:()=>o("Admin","Order")}),children:"Order Detail"})}),e.jsxs(je,{className:r.body,children:[e.jsx(sn,{OrderId:n,Order:d,Admin:!0}),e.jsx(B,{label:"Required Products",size:"large",children:e.jsx($n,{Items:u?.ShopCart})}),e.jsx(Rn,{OrderId:n,TrackingNumber:d?.TrackingNumber,Refresh:y}),e.jsx(tn,{Comments:u?.Comments}),e.jsx(Tn,{OrderId:n,Refresh:y}),e.jsx(Sn,{OrderId:n,Status:d?.Status,Refresh:y})]})]})]})}const Y=w({two:{flexBasis:"2.5%",flexGrow:0},twoc:{flexBasis:"2.5%",flexGrow:0,justifyContent:"center"},ten:{flexBasis:"10%",flexGrow:0}}),le=new x("Admin","Order"),Vn=[...an(le).slice(0,-1),h({columnId:"User",renderHeaderCell:()=>e.jsx(C,{className:Y().ten,children:"User"}),renderCell(n){return e.jsx(g,{className:Y().ten,children:n.User})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:Y().two,children:"Action"}),renderCell(n){return e.jsx(g,{className:Y().twoc,children:e.jsx(vn,{OrderId:n.Id})})}})];function Fn(){const{data:n}=$(()=>m.Order.Get.List(le),{onError:le.error});return e.jsx(G,{Items:n,Columns:Vn})}const Hn=w({body:{...R,alignItems:"center"},input:{flexGrow:1}}),ae=new x("Admin","Product","Detail","Category");function On({ProdId:n}){const[r,s]=S.useState(""),[t,{setTrue:a,setFalse:o}]=k();$(()=>m.Product.Get.Category(n),{onSuccess(P){P&&s(P)},onError:ae.error});const{dispatch:c,dispatchToast:l}=A(ae),{run:u}=m.Product.Patch.useCategory({manual:!0,onError(P,I){c({Message:"Failed Update Category",Request:I,Error:P})},onSuccess(){l(e.jsx(f,{children:e.jsx(b,{children:"Category Updated"})}),{intent:"success"}),o()}}),{run:p}=m.Product.Delete.useCategory({manual:!0,onError(P,I){c({Message:"Failed Detach Category",Request:I,Error:P})},onSuccess(){l(e.jsx(f,{children:e.jsx(b,{children:"Category Detached"})}),{intent:"success"}),o()}}),{data:d}=$(()=>q.Gallery.Get.Categories(),{onSuccess(P){y(P)},onError:ae.error}),[j,y]=S.useState(d),[N,D]=S.useState(""),T=Hn();return e.jsxs("div",{className:T.body,children:[e.jsx(Ce,{size:"large",disabled:!t,children:"Category"}),e.jsxs(ge,{className:T.input,size:"large",disabled:!t,freeform:!0,placeholder:r||"Pending",appearance:"underline",onChange:P=>{const I=P.target.value.trim(),v=d?.filter(Be=>Be.toLowerCase().indexOf(I.toLowerCase())===0);y(v),I&&v&&v.length<1?D(I):D("")},onOptionSelect:(P,I)=>{const v=I.optionText;s(v),v&&d?.includes(v)?D(""):D(v)},children:[N&&e.jsxs(_,{text:N,children:['Create New "',N,'"']},N),j?.map(P=>e.jsx(_,{children:P},P)),j?.length===d?.length?e.jsx(_,{text:"",children:"Pending"},""):null]}),t?e.jsx(i,{appearance:"subtle",icon:e.jsx(K,{}),onClick:()=>{r?u(n,r):p(n)}}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:a})]})}const Un=new x("Admin","Product","Detail","Combo","Delete");function Bn({ComboId:n,Refresh:r}){const{dispatch:s,dispatchToast:t}=A(Un),{run:a}=m.Product.Delete.useCombo({manual:!0,onError(o,c){s({Message:"Failed Delete Combo",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Combo Deleted"})}),{intent:"success"}),r()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(W,{}),onClick:()=>a(n)})}const Mn=[h({columnId:"Variant",renderHeaderCell:()=>e.jsx(C,{children:"Variant"}),renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Type",renderHeaderCell:()=>e.jsx(C,{children:"Type"}),renderCell(n){return e.jsx(g,{children:e.jsx(ge,{defaultValue:n.Current,defaultSelectedOptions:[n.Current],onOptionSelect:(r,s)=>n.Update(s.optionValue),children:n.Types.map((r,s)=>e.jsx(_,{children:r},s))})})}})],Ln=w({body:{...R,justifyContent:"flex-end",alignItems:"center",columnGap:E.spacingVerticalM,marginTop:E.spacingHorizontalM}}),oe=new x("Admin","Product","Detail","Combo","Detail");function qn({Id:n,ProdId:r,Combo:s,Stock:t,Refresh:a}){const[o,{toggle:c}]=k(),[l,u]=S.useState(s),[p,d]=S.useState(t),{data:j}=$(()=>m.Product.Get.Variants(r,oe),{onError:oe.error}),{dispatch:y,dispatchToast:N}=A(oe),{run:D}=m.Product.Patch.useCombo({manual:!0,onError(T,P){y({Message:"Failed Update Combo",Request:P,Error:T})},onSuccess(){N(e.jsx(f,{children:e.jsx(b,{children:"Combo Updated"})}),{intent:"success"}),a(),c()}});return e.jsxs(J,{open:o,onOpenChange:c,children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(ne,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(L,{})})}),children:"Combo Detail"}),e.jsxs(re,{children:[e.jsx(G,{Items:j?.map(T=>({Current:l[T.Name],Update(P){l[T.Name]=P,u({...l})},...T})),Columns:Mn}),e.jsxs("div",{className:Ln().body,children:[e.jsx(Ce,{children:"Stock"}),e.jsx(Ge,{value:p,min:0,onChange:(T,P)=>{if(P.value)d(P.value);else if(P.displayValue){const I=parseInt(P.displayValue);He(I)&&d(I)}}}),e.jsx(i,{appearance:"primary",onClick:()=>D(n,l,p),children:"Submit"})]})]})]})})]})}const zn=[h({columnId:"Variant",renderHeaderCell:()=>e.jsx(C,{children:"Variant"}),renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Type",renderHeaderCell:()=>e.jsx(C,{children:"Type"}),renderCell(n){return e.jsx(g,{children:e.jsx(ge,{onOptionSelect:(r,s)=>n.Update(s.optionValue),children:n.Types.map((r,s)=>e.jsx(_,{children:r},s))})})}})],_n=w({body:{...R,justifyContent:"flex-end",alignItems:"center",columnGap:E.spacingVerticalM,marginTop:E.spacingHorizontalM}}),ce=new x("Admin","Product","Detail","Combo","NewCombo");function Xn({ProdId:n,Refresh:r}){const[s,{toggle:t}]=k(),[a,o]=S.useState({}),[c,l]=S.useState(1),{data:u}=$(()=>m.Product.Get.Variants(n,ce),{onSuccess(y){for(const N of y)a[N.Name]="";o({...a})},onError:ce.error}),{dispatch:p,dispatchToast:d}=A(ce),{run:j}=m.Product.Post.useCombo({manual:!0,onError(y,N){p({Message:"Failed Create Combo",Request:N,Error:y})},onSuccess(){d(e.jsx(f,{children:e.jsx(b,{children:"Combo Created"})}),{intent:"success"}),r(),t()}});return e.jsxs(J,{open:s,onOpenChange:t,children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"primary",icon:e.jsx(se,{}),children:"New Combo"})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(ne,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(L,{})})}),children:"New Combo"}),e.jsxs(re,{children:[e.jsx(G,{Items:u?.map(y=>({Update(N){a[y.Name]=N,o({...a})},...y})),Columns:zn}),e.jsxs("div",{className:_n().body,children:[e.jsx(Ce,{children:"Stock"}),e.jsx(Ge,{value:c,min:0,onChange:(y,N)=>{if(N.value)l(N.value);else if(N.displayValue){const D=parseInt(N.displayValue);He(D)&&l(D)}}}),e.jsx(i,{appearance:"primary",onClick:()=>j(n,a,c),children:"Create"})]})]})]})})]})}const O=w({body:{...R,justifyContent:"space-between"},four:{flexBasis:"4%",flexGrow:0},seven:{flexBasis:"7%",flexGrow:0},five:{flexBasis:"5%",flexGrow:0}}),Ee=new x("Admin","Product","Detail","Combo"),Qn=[h({columnId:"Id",renderHeaderCell:()=>e.jsx(C,{className:O().four,children:"Id"}),renderCell(n){return e.jsx(g,{className:O().four,children:n.Id})}}),h({columnId:"Combo",renderHeaderCell:()=>e.jsx(C,{children:"Combo"}),renderCell(n){return e.jsx(g,{children:Object.entries(n.Combo).reduce((r,s)=>`${r} ${s[0]} : ${s[1]} ;`,"")})}}),h({columnId:"Stock",renderHeaderCell:()=>e.jsx(C,{className:O().five,children:"Stock"}),renderCell(n){return e.jsx(g,{className:O().five,children:n.Stock})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:O().seven,children:"Action"}),renderCell(n){return e.jsxs(g,{className:O().seven,children:[e.jsx(qn,{...n}),e.jsx(Bn,{ComboId:n.Id,Refresh:n.Refresh})]})}})];function Yn({ProdId:n}){const{data:r,run:s}=$(()=>q.Product.Get.Combo(n,Ee),{onError:Ee.error});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:O().body,children:[e.jsx(fe,{children:"Combo"}),e.jsx(Xn,{ProdId:n,Refresh:s})]}),e.jsx(G,{Items:r?.map(t=>({ProdId:n,Refresh:s,...t})),Columns:Qn})]})}const Kn=new x("Admin","Product","Detail","Delete"),Wn=w({root:{...H,rowGap:E.spacingHorizontalS}});function Jn({ProdId:n}){const{Nav:r}=Q(),{dispatch:s,dispatchToast:t}=A(Kn),{run:a,loading:o}=m.Product.Delete.useProduct({manual:!0,onError(l,u){s({Message:"Failed Delete Product",Request:u,Error:l})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Product Deleted"})}),{intent:"success"}),r("/Admin")}}),c=Wn();return e.jsx("div",{children:e.jsxs(be,{withArrow:!0,children:[e.jsx(ye,{disableButtonEnhancement:!0,children:e.jsx(i,{children:"Delete Product"})}),e.jsxs(Pe,{className:c.root,children:["Are You Sure?",e.jsx(i,{disabled:o,appearance:"primary",onClick:()=>a(n),children:"Yes"})]})]})})}const Zn=w({btn:{...R,columnGap:E.spacingVerticalS},drawer:{width:"1100px"}}),er=new x("Admin","Product","Lexical");function nr({ProdId:n}){const r=Zn(),[s,{toggle:t,setTrue:a}]=k(),{data:o,run:c}=$(()=>q.Product.Get.Lexical(n)),{dispatch:l,dispatchToast:u}=A(er),{run:p}=m.Product.Post.useLexical({manual:!0,onError(d,j){l({Message:"Failed Update Description",Request:j,Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Description Updated"})}),{intent:"success"}),c(),t()}});return e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsx(i,{onClick:()=>a(),children:"Open Description Editor"})}),e.jsxs(he,{open:s,onOpenChange:t,position:"start",size:"large",modalType:"alert",className:r.drawer,children:[e.jsx(xe,{children:e.jsx(pe,{action:e.jsxs("div",{className:r.btn,children:[e.jsx(i,{appearance:"primary",onClick:()=>p(n),children:"Save"}),e.jsx(i,{onClick:()=>t(),children:"Cancel"})]}),children:"Edit Product Description"})}),e.jsx(je,{children:e.jsx(ln,{State:o?.Description})})]})]})}const Te=new x("Admin","Product","Detail","Name");function rr({ProdId:n}){const[r,s]=S.useState(""),[t,{setTrue:a,setFalse:o}]=k(),{Nav:c}=Q();$(()=>m.Product.Get.Name(n),{onSuccess(d){s(d)},onError(d){c("Admin"),Te.error(d)}});const{dispatch:l,dispatchToast:u}=A(Te),{run:p}=m.Product.Patch.useName({manual:!0,onError(d,j){l({Message:"Failed Update Name",Request:j,Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Name Updated"})}),{intent:"success"}),o()}});return e.jsx(M,{size:"large",value:r,disabled:!t,appearance:"underline",onChange:(d,j)=>s(j.value),contentBefore:e.jsx(ve,{children:"Name"}),contentAfter:t?e.jsx(i,{appearance:"subtle",icon:e.jsx(K,{}),onClick:()=>p(n,r)}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:a})})}const sr=new x("Admin","Product","Detail","Photo","Edit","Caption");function tr({Id:n,Caption:r}){const[s,t]=S.useState(r||""),{dispatch:a,dispatchToast:o}=A(sr),{run:c}=m.Product.Patch.useCaption({manual:!0,onError(l,u){a({Message:"Failed Update Caption",Request:u,Error:l})},onSuccess(){o(e.jsx(f,{children:e.jsx(b,{children:"Caption Updated"})}),{intent:"success"})}});return e.jsxs(e.Fragment,{children:[e.jsx(B,{label:"Caption",children:e.jsx(M,{value:s,placeholder:"Write some infomation here?",onChange:(l,u)=>t(u.value)})}),e.jsx(i,{onClick:()=>c(n,s),children:"Save Caption"})]})}const ar=new x("Admin","Product","Detail","Photo","Edit","Delete");function or({Id:n,ProductId:r}){const{dispatch:s,dispatchToast:t}=A(ar),{run:a}=m.Product.Delete.usePhoto({manual:!0,onError(o,c){s({Message:"Failed Delete Photo",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Photo Deleted"})}),{intent:"success"})}});return e.jsx(i,{appearance:"primary",onClick:()=>a(r,n),children:"Delete"})}const Ie=new x("Admin","Product","Detail","Photo","Edit","Replace");function cr({Id:n}){const{dispatch:r,dispatchToast:s}=A(Ie),{run:t}=m.Product.Patch.usePhoto(Ie,{manual:!0,onBefore([a,o]){s(e.jsx(f,{children:e.jsxs(b,{children:["Uploading Photo ",o.name," for Product ",a," to replace ",n]})}),{intent:"info"})},onError(a,o){r({Message:"Failed Update Photo",Request:o,Error:a})},onSuccess(){s(e.jsx(f,{children:e.jsx(b,{children:"Photo Updated"})}),{intent:"success"})}});return e.jsx(i,{onClick:()=>{const a=document.createElement("input");a.type="file",a.accept="image/*",a.onchange=()=>{a.files&&t(n,a.files[0])},a.click()},children:"Replace"})}const lr=w({box:{...R,columnGap:E.spacingHorizontalL},img:{...nn,aspectRatio:"1",width:"50%"},cap:{...H,flexGrow:1,rowGap:E.spacingVerticalL}}),ir=new x("Admin","Product","Detail","Photo","Edit");function dr(n){const{Id:r,Cover:s}=n,t=lr();return e.jsxs(J,{children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(ne,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(L,{})})}),children:"Image Detail"}),e.jsxs(re,{className:t.box,children:[e.jsx(rn,{shape:"rounded",className:t.img,Guid:s,Log:ir}),e.jsxs("div",{className:t.cap,children:[e.jsx(tr,{...n}),e.jsx(cr,{Id:r}),e.jsx(or,{...n})]})]})]})})]})}const ie=w({f11:{flexBasis:"11%",flexGrow:0},box:{...R,justifyContent:"space-between"}}),X=new x("Admin","Product","Detail","Photo"),ur=[Fe(70,X),h({columnId:"Caption",renderHeaderCell:()=>e.jsx(C,{children:"Caption"}),renderCell(n){return e.jsx(g,{children:n.Caption||"No Caption"})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:ie().f11,children:"Action"}),renderCell(n){const{dispatch:r}=A(X),{run:s}=m.Product.Post.useMovePhoto({manual:!0,onError(t,a){r({Message:"Failed Update Order",Request:a,Error:t})},onSuccess:mr});return e.jsxs(g,{className:ie().f11,children:[e.jsx(i,{appearance:"subtle",icon:e.jsx(qe,{}),onClick:()=>s(n.Id,!0)}),e.jsx(i,{appearance:"subtle",icon:e.jsx(ze,{}),onClick:()=>s(n.Id,!1)}),e.jsx(dr,{...n})]})}})];let mr=()=>{};function hr({ProdId:n}){const r=Le(async()=>{const[o]=await q.Product.Get.PhotoList(n,X);return o.map(l=>({Id:l.PhotoId,Cover:l.ObjectId,Caption:l.Caption,ProductId:l.ProductId}))}),{dispatch:s,dispatchToast:t}=A(X),{run:a}=m.Product.Post.usePhoto(X,{manual:!0,onBefore([o,c]){t(e.jsx(f,{children:e.jsxs(b,{children:["Uploading Photo ",c.name," for Product ",o]})}),{intent:"info"})},onError(o,c){s({Message:"Failed Upload Photo",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Photo Uploaded"})}),{intent:"success"})}});return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:ie().box,children:[e.jsx(fe,{children:"Photos"}),e.jsx(i,{appearance:"primary",icon:e.jsx(se,{}),onClick:()=>{const o=document.createElement("input");o.type="file",o.accept="image/*",o.onchange=()=>{o.files&&a(n,o.files[0])},o.click()},children:"New Image"})]}),e.jsx(G,{Items:r,Columns:ur})]})}const xr=new x("Admin","Product","Detail","Variant","Delete");function pr({VariantId:n,Refresh:r}){const{dispatch:s,dispatchToast:t}=A(xr),{run:a}=m.Product.Delete.useVariant({manual:!0,onError(o,c){s({Message:"Failed Delete Variant",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"Variant Deleted"})}),{intent:"success"}),r()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(W,{}),onClick:()=>a(n)})}const jr=new x("Admin","Product","Detail","Variant","Edit","TypeDelete");function Cr({VariantId:n,Type:r,Refresh:s}){const{dispatch:t,dispatchToast:a}=A(jr),{run:o}=m.Product.Delete.useType({manual:!0,onError(c,l){t({Message:"Failed Delete Type",Request:l,Error:c})},onSuccess(){a(e.jsx(f,{children:e.jsx(b,{children:"Type Deleted"})}),{intent:"success"}),s()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(W,{}),onClick:()=>o(n,r)})}const gr=new x("Admin","Product","Detail","Variant","Edit","Name");function fr({Id:n,Name:r}){const[s,t]=S.useState(r),[a,{setTrue:o,setFalse:c}]=k(),{dispatch:l,dispatchToast:u}=A(gr),{run:p}=m.Product.Patch.useVariantName({manual:!0,onError(d,j){l({Message:"Failed Update Variant Name",Request:j[0],Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Variant Name Updated"})}),{intent:"success"}),c()}});return e.jsx(M,{size:"large",value:s,disabled:!a,appearance:"underline",onChange:(d,j)=>t(j.value),contentBefore:e.jsx(ve,{children:"Name"}),contentAfter:a?e.jsx(i,{appearance:"subtle",icon:e.jsx(K,{}),onClick:()=>p(n,s)}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{}),onClick:o})})}const br=w({body:{...H,rowGap:E.spacingVerticalM}}),yr=new x("Admin","Product","Detail","Variant","Edit","Type");function Oe({VariantId:n,Type:r,Refresh:s,New:t}){const a=br(),[o,{toggle:c}]=k(),[l,u]=S.useState(r||""),{dispatch:p,dispatchToast:d}=A(yr),j={manual:!0,onError(D,T){p({Message:`Failed ${t?"Create":"Update"} Type ${l}`,Request:T,Error:D})},onSuccess(D){d(e.jsxs(f,{children:[e.jsxs(b,{children:["Type ",t?"Created":"Updated"]}),e.jsxs(_e,{children:[D," ",l]})]}),{intent:"success"}),s(),u(""),c()}},{run:y}=m.Product.Post.useType(j),{run:N}=m.Product.Patch.useType(j);return e.jsxs(be,{withArrow:!0,open:o,onOpenChange:c,children:[e.jsx(ye,{disableButtonEnhancement:!0,children:t?e.jsx(i,{icon:e.jsx(se,{}),appearance:"primary",children:"New Type"}):e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsxs(Pe,{className:a.body,children:[e.jsx(B,{label:"Type Name",children:e.jsx(M,{value:l,onChange:(D,T)=>u(T.value)})}),e.jsx(i,{onClick:()=>t?y(n,l):N(n,r,l),children:"Submit"})]})]})}const de=w({body:{...H,rowGap:E.spacingVerticalM},twelve:{flexBasis:"12%",flexGrow:0}}),Pr=[h({columnId:"Name",renderHeaderCell:()=>e.jsx(C,{children:"Name"}),renderCell(n){return e.jsx(g,{children:n.Name})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:de().twelve,children:"Action"}),renderCell(n){return e.jsxs(g,{className:de().twelve,children:[e.jsx(Oe,{VariantId:n.VariantId,Type:n.Name,Refresh:n.Refresh}),e.jsx(Cr,{VariantId:n.VariantId,Type:n.Name,Refresh:n.Refresh})]})}})];function Ar({Variant:n,Refresh:r}){return e.jsxs(J,{children:[e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(F,{})})}),e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsx(ne,{action:e.jsx(V,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"subtle",icon:e.jsx(L,{})})}),children:"Variant Detail"}),e.jsxs(re,{className:de().body,children:[e.jsx(fr,{Id:n.Id,Name:n.Name}),e.jsx(G,{Items:n.Types.map((s,t)=>({Id:t,Name:s,VariantId:n.Id,Refresh:r})),Columns:Pr})]}),e.jsx(Xe,{children:e.jsx(Oe,{VariantId:n.Id,Refresh:r,New:!0})})]})})]})}const Nr=w({body:{...H,rowGap:E.spacingVerticalM}}),wr=new x("Admin","Product","Detail","Variant","New");function Sr({ProdId:n,Refresh:r}){const s=Nr(),[t,{toggle:a}]=k(),[o,c]=S.useState(""),{dispatch:l,dispatchToast:u}=A(wr),{run:p}=m.Product.Post.useVariant({manual:!0,onError(d,j){l({Message:"Failed Create Variant",Request:j,Error:d})},onSuccess(){u(e.jsx(f,{children:e.jsx(b,{children:"Variant Created"})}),{intent:"success"}),r(),c(""),a()}});return e.jsxs(be,{withArrow:!0,open:t,onOpenChange:a,children:[e.jsx(ye,{disableButtonEnhancement:!0,children:e.jsx(i,{appearance:"primary",icon:e.jsx(se,{}),children:"New Variant"})}),e.jsxs(Pe,{className:s.body,children:[e.jsx(B,{required:!0,label:"Variant Name",children:e.jsx(M,{value:o,onChange:(d,j)=>c(j.value)})}),e.jsx(i,{onClick:()=>p(n,o),children:"Add"})]})]})}const U=w({body:{...R,justifyContent:"space-between"},four:{flexBasis:"4%",flexGrow:0},seven:{flexBasis:"7%",flexGrow:0},twelve:{flexBasis:"12%",flexGrow:0}}),$e=new x("Admin","Product","Detail","Variant"),Dr=[h({columnId:"Id",renderHeaderCell:()=>e.jsx(C,{className:U().four,children:"Id"}),renderCell(n){return e.jsx(g,{className:U().four,children:n.Id})}}),h({columnId:"Name",renderHeaderCell:()=>e.jsx(C,{className:U().twelve,children:"Name"}),renderCell(n){return e.jsx(g,{className:U().twelve,children:n.Name})}}),h({columnId:"Type",renderHeaderCell:()=>e.jsx(C,{children:"Type"}),renderCell(n){return e.jsx(g,{children:n.Types.reduce((r,s)=>`${r} ${s} ;`,"")})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:U().seven,children:"Action"}),renderCell(n){return e.jsxs(g,{className:U().seven,children:[e.jsx(Ar,{Variant:n,Refresh:ue}),e.jsx(pr,{VariantId:n.Id,Refresh:ue})]})}})];let ue;function Er({ProdId:n}){const r=U(),{data:s,run:t}=$(()=>m.Product.Get.Variants(n,$e),{onError:$e.error});return ue=t,e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:r.body,children:[e.jsx(fe,{children:"Variant"}),e.jsx(Sr,{ProdId:n,Refresh:t})]}),e.jsx(G,{Items:s,Columns:Dr})]})}const Tr=w({body:{...H,rowGap:E.spacingVerticalXL,paddingBottom:E.spacingVerticalXXXL}});function Ir({ProdId:n}){const r=Tr(),[s,{setFalse:t,setTrue:a}]=k(),{Nav:o,Paths:c}=Q(),l=parseInt(c.at(1));return S.useEffect(()=>{l===n?a():t()},[c]),e.jsxs(e.Fragment,{children:[e.jsx(i,{appearance:"subtle",icon:e.jsx(Re,{}),onClick:()=>{o("Admin",n),a()}}),e.jsxs(he,{open:s,position:"end",size:"large",modalType:"alert",children:[e.jsx(xe,{children:e.jsx(pe,{action:e.jsx(i,{appearance:"subtle",icon:e.jsx(L,{}),onClick:()=>{o("Admin"),t()}}),children:"Product Detail"})}),e.jsxs(je,{className:r.body,children:[e.jsx(rr,{ProdId:n}),e.jsx(On,{ProdId:n}),e.jsx(hr,{ProdId:n}),e.jsx(Er,{ProdId:n}),e.jsx(Yn,{ProdId:n}),e.jsx(nr,{ProdId:n}),e.jsx(Jn,{ProdId:n})]})]})]})}const z=new x("Admin","Product","Row");function $r({item:n}){const[r,s]=S.useState(()=>({Id:n,Cover:"",Name:"Loading..."})),[t,{setTrue:a}]=k(),o=q.Product.Get;return Qe(async()=>{const c=await o.Product(n).catch(z.error);if(!c)return z.warn(`Product ${n} Not Found`),a();let l={...r,Name:c.Name,Category:c.Category||"Pending"};s(l);const[u,p]=await o.PhotoList(n,z);p||z.warn(`Product ${n} has no photo`),s(l={...l,Cover:p});const d=await m.Product.Get.Count(n).catch(z.error);d&&s({...l,...d})},[]),t?null:e.jsx(Ve,{children:({renderCell:c})=>c(r)},n)}const ke=w({two:{flexBasis:"2.5%",flexGrow:0},twoc:{flexBasis:"2.5%",flexGrow:0,justifyContent:"center"}}),Ue=new x("Admin","Product"),kr=[Fe(50,Ue),h({columnId:"Product",renderHeaderCell:()=>e.jsx(C,{children:"Product"}),renderCell(n){return e.jsx(g,{children:e.jsx(Ae,{children:n.Name})})}}),h({columnId:"Category",renderHeaderCell:()=>e.jsx(C,{children:"Category"}),renderCell(n){return e.jsx(g,{children:e.jsx(Ae,{children:n.Category})})}}),h({columnId:"Variant",renderHeaderCell:()=>e.jsx(C,{children:"Variant"}),renderCell(n){return e.jsx(g,{children:n.Variant})}}),h({columnId:"Combo",renderHeaderCell:()=>e.jsx(C,{children:"Combo"}),renderCell(n){return e.jsx(g,{children:n.Combo})}}),h({columnId:"Stock",renderHeaderCell:()=>e.jsx(C,{children:"Stock"}),renderCell(n){return e.jsx(g,{children:n.Stock})}}),h({columnId:"Action",renderHeaderCell:()=>e.jsx(C,{className:ke().two,children:"Detail"}),renderCell(n){return e.jsx(g,{className:ke().twoc,children:e.jsx(Ir,{ProdId:n.Id})})}})];function Rr(){const n=m.Product.Get.useList(Ue);return e.jsxs(Ye,{items:n?n.reverse():[],columns:kr,children:[e.jsx(Ke,{children:e.jsx(Ve,{children:({renderHeaderCell:r})=>r()})}),e.jsx(We,{children:r=>e.jsx($r,{...r})}),!n&&e.jsx(Je,{size:48})]})}const Gr=new x("Admin","User","Delete");function vr({UserId:n,Refresh:r}){const{dispatch:s,dispatchToast:t}=A(Gr),{run:a}=m.User.Delete.useUser({manual:!0,onError(o,c){s({Message:"Failed Delete User",Request:c,Error:o})},onSuccess(){t(e.jsx(f,{children:e.jsx(b,{children:"User Deleted"})}),{intent:"success"}),r()}});return e.jsx(i,{appearance:"subtle",icon:e.jsx(W,{}),onClick:()=>a(n)})}const Vr=new x("Admin","User","Grant");function Fr({UserId:n,Admin:r,Refresh:s}){const{dispatch:t,dispatchToast:a}=A(Vr),{run:o}=m.User.Post.useAdmin({manual:!0,onError(l,u){t({Message:"Failed Grant Admin",Request:u,Error:l})},onSuccess(){a(e.jsx(f,{children:e.jsx(b,{children:"Admin Granted"})}),{intent:"success"}),s()}}),{run:c}=m.User.Delete.useAdmin({manual:!0,onError(l,u){t({Message:"Failed Revoke Admin",Request:u,Error:l})},onSuccess(){a(e.jsx(f,{children:e.jsx(b,{children:"Admin Revoked"})}),{intent:"success"}),s()}});return e.jsx(Ze,{checked:r,onChange:(l,u)=>{u.checked?o(n):c(n)}})}const Hr=new x("Admin","User"),Or=[h({columnId:"Id",renderHeaderCell:()=>"Id",renderCell(n){return n.Id}}),h({columnId:"Name",renderHeaderCell:()=>"Real Name",renderCell(n){return n.Name}}),h({columnId:"Email",renderHeaderCell:()=>"E-Mail",renderCell(n){return n.EMail}}),h({columnId:"Admin",renderHeaderCell:()=>"Admin",renderCell(n){return e.jsx(Fr,{UserId:n.Id,Admin:n.Admin,Refresh:me})}}),h({columnId:"Delete",renderHeaderCell:()=>"Delete",renderCell(n){return e.jsx(vr,{UserId:n.Id,Refresh:me})}})].map(({renderHeaderCell:n,renderCell:r,...s})=>({...s,renderHeaderCell:()=>e.jsx(C,{children:n()}),renderCell:t=>e.jsx(g,{children:r(t)})}));let me;function Ur(){const{data:n,run:r}=$(()=>m.User.Get.List(),{onError:Hr.error});return me=r,e.jsx(G,{Items:n,Columns:Or})}const Br=new x("Admin");function _r(){const{Paths:n,Nav:r}=Q(),s=n.at(1),t=S.useMemo(()=>{switch(s){case"Order":return e.jsx(Fn,{});case"User":return e.jsx(Ur,{});default:return e.jsx(Rr,{})}},[s]),a=q.User.Get.useMe(Br);return a?a.Admin?t:r("/"):e.jsx(en,{size:"huge",label:"Authenticating..."})}export{_r as default}; diff --git a/assets/index-no0JSIPh.js b/assets/index-no0JSIPh.js new file mode 100644 index 0000000..5c4a80a --- /dev/null +++ b/assets/index-no0JSIPh.js @@ -0,0 +1,11 @@ +import{r as x,u as jt,j as n,d as w,t as p,s as B,m as P,a as Xt,T as _,b as W,c as st,e as tt,f as bt,D as vt,g as Et,h as Tt,i as qt,k as Lt,F as S,I as F,L as H,l as St,n as ht,B as b,S as mt,o as $,A as q,X as Yt,P as Jt,p as ft,H as X,q as Nt,v as It,M as Ot,w as At,x as h,y as k,z as Gt,C as Kt,E as U,G as ot,J as Zt,K as te,N as ee,O as se,Q as ne,R as re,U as ae,V as oe,W as ie,Y as ce,Z as ue,_ as de,$ as V,a0 as le,a1 as he,a2 as wt,a3 as me,a4 as pe,a5 as kt,a6 as Y,a7 as ge,a8 as J,a9 as xe,aa as fe,ab as we,ac as ye,ad as Pe,ae as Ce,af as je,ag as be,ah as ve,ai as Ee,aj as Te,ak as Le,al as Se,am as Ne,an as Ie,ao as Oe,ap as Ae,aq as Ge,ar as ke,as as K,at as nt,au as $e,av as Ue,aw as Me,ax as Re,ay as De}from"./vendor--JR89aB4.js";function it(o){return`/${o.filter(s=>s).map(s=>s.toString().replace(/^\/+/,"")).join("/")}`}const $t=x.createContext({});function R(){return x.useContext($t)}function Be({children:o}){const[t,s]=x.useState(()=>({Paths:location.pathname.split("/").filter(c=>c),Search:new URLSearchParams(location.search),Put:e,Nav:(...c)=>a(it(c)),Rep:(...c)=>i(it(c)),Reload:(...c)=>u(c)}));function e(c){history.replaceState(null,"",`${location.pathname}${c.size?"?":""}${c.toString()}`),t.Search=new URLSearchParams(c),s({...t})}function r(c){t.Paths=c.split("/").filter(d=>d),t.Search=new URLSearchParams(location.search),s({...t})}function a(c){history.pushState(null,"",c),r(c)}function i(c){history.replaceState(null,"",c),r(c)}function u(c){history.replaceState(null,"","/Reload"),r("/Reload"),setTimeout(()=>{const d=c.length?it(c):location.pathname;history.pushState(null,"",d),r(d)},100)}return jt(()=>{location.pathname==="/"&&location.search.startsWith("?/")&&i(location.search.substring(2)),addEventListener("click",c=>{const d=c.target?.closest("a");if(d){if(d.origin!==location.origin){d.target="_blank";return}c.preventDefault(),a(d.pathname)}}),addEventListener("popstate",c=>{c.preventDefault(),r(location.pathname)})}),n.jsx($t.Provider,{value:t,children:o})}class A{namespace;info;error;warn;debug;throw;constructor(...t){this.namespace=t.join(" > "),this.error=console.error.bind(this,this.baseColor(101,"error"),` + `),this.warn=console.warn.bind(this,this.baseColor(103,"warn"),` + `),this.info=console.info.bind(this,this.baseColor(104,"info"),` + `),this.debug=console.debug.bind(this,this.baseColor(102,"debug"),` + `),this.throw=console.log.bind(this,this.baseColor(105,"throw"),"↓ The Following Error is Thrown ↓")}With(...t){return new A(this.namespace,...t)}baseColor(t,s){return`\x1B[${t};30;1m ${s.toUpperCase()} \x1B[0m\x1B[100;97m ${w().format("YY-M-D H:m:s")} \x1B[1m\x1B[40;97m ${this.namespace} `}}const O={display:"flex"},Ve={flexDirection:"column"},M={...O,...Ve},Js={...O,backgroundColor:p.colorNeutralBackground1,boxShadow:p.shadow4,...B.borderRadius(p.borderRadiusMedium)},He={whiteSpace:"pre-line"},pt=60,gt="1636px",Fe={objectFit:"cover",objectPosition:"center"},ze=P({pre:He});function Q(o){const t=ze(),{dispatchToast:s}=Xt();return{dispatch:e=>{const r=e.Error.message,a=r.indexOf("Exception:");let i=r;a!==-1&&(i=r.substring(a+10)),s(n.jsxs(_,{children:[n.jsx(W,{children:"Internal Error"}),n.jsx(st,{subtitle:n.jsxs(tt,{className:t.pre,children:[i,n.jsx("br",{}),"More Info, See Console"]}),children:n.jsx(tt,{className:t.pre,children:e.Message})})]}),{intent:"error",timeout:1e4}),o.error(e)},dispatchToast:s}}const _e=P({box:{...M,rowGap:p.spacingVerticalM},one:{...O,columnGap:p.spacingVerticalXXXL}}),yt=new A("Setting");function Ut({Open:o,Toggle:t,New:s}){const e=_e(),r=bt().instance.getActiveAccount(),[a,i]=x.useState(),[u,c]=x.useState(),[d,l]=x.useState(),m=v.User.Get.useMe(yt);x.useEffect(()=>{if(s||!m)return;const{Name:f,Phone:g,Address:Qt}=m;i(f),c(g),l(Qt)},[m]);const{dispatch:y,dispatchToast:E}=Q(yt),{run:T}=v.User.Post.useUpdate({manual:!0,onError(f,[g]){y({Message:`Failed ${s?"Create":"Update"} Info`,Error:f,Request:g})},onSuccess(f,[g]){E(n.jsxs(_,{children:[n.jsxs(W,{children:["Info ",s?"Created":"Updated"]}),n.jsxs(st,{children:[g.Name,n.jsx("br",{}),g.Phone,n.jsx("br",{}),g.Address]})]}),{intent:"success"}),s&&(D.next(!1),D.complete(),D.closed=!0),t()}});return n.jsx(vt,{open:o,onOpenChange:t,modalType:s?"alert":"modal",children:n.jsx(Et,{children:n.jsxs(Tt,{children:[n.jsx(qt,{children:s?"Welcome! Fill in your info to get started.":"Personal Information"}),n.jsxs(Lt,{className:e.box,children:[n.jsxs("div",{className:e.one,children:[n.jsx(S,{label:"Name",size:"large",required:!0,children:n.jsx(F,{size:"medium",value:a,maxLength:20,onChange:(f,g)=>i(g.value)})}),n.jsx(S,{label:"Phone",size:"large",required:!0,children:n.jsx(F,{size:"medium",value:u,maxLength:20,onChange:(f,g)=>c(g.value)})})]}),n.jsx(S,{label:"E-Mail",size:"large",children:n.jsx(H,{children:r?.username})}),n.jsx(S,{label:"Address",size:"large",required:!0,children:n.jsx(F,{size:"medium",value:d,maxLength:100,minLength:20,onChange:(f,g)=>l(g.value)})})]}),n.jsxs(St,{children:[!s&&n.jsx(ht,{disableButtonEnhancement:!0,children:n.jsx(b,{appearance:"secondary",children:"Cancel"})}),n.jsx(b,{appearance:"primary",onClick:()=>T({EMail:r?.username,Name:a,Address:d,Phone:u}),children:"Submit"})]})]})})})}const D=new mt;function We(){const[o,{toggle:t}]=$();return jt(()=>D.subscribe(s=>s&&t())),n.jsx(q,{children:n.jsx(Ut,{Open:o,Toggle:t,New:!0})})}const rt={Name:"AwaiShop"};class Qe{constructor(t,s){this.DB=t,this.Name=s,this.Sto=t.table(s),this.Trim()}Sto;async Get(t,s){const e=await this.Sto.get(t);return e?s&&await Promise.resolve(s(e))||typeof e.Exp=="number"&&e.Exptypeof t.Exp=="number"&&t.Exp{const s=setInterval(()=>{this.Hub.state===X.Connected&&(clearInterval(s),t())},100)}))}static async Invoke(t,...s){return await this.EnsureConnected(),this.Hub.invoke(t,...s)}static EnsureLogin(){if(!I.getActiveAccount())throw new Rt}static EnsureTrue(t){if(!t)throw new Xe}static Index(t,s){return`${s}_${t}`}static async UpdateCache(t,s,e,r){const a=this.Index(s,e),i=await L.Get(a);if(!i)return;const u=t(i);i.QueryExp?await L.Set(a,{...u,QueryExp:w().add(1,"m").unix()},w().add(1,"w")):await L.Set(a,u,r||null)}static async GetVersionCache(t,s){const e=this.Index(t,s),r=await L.Get(e);if(r&&r.QueryExp>w().unix())return r;const a=await Promise.resolve(this.Invoke(s,t,r?.Version));if(a===!0)return L.Set(e,{...r,QueryExp:w().add(1,"m").unix()},w().add(1,"w")),r;if(!a)throw L.Sto.delete(e),new Dt;return await L.Set(e,{...a,QueryExp:w().add(1,"m").unix()},w().add(1,"w")),a}static async GetTimeCache(t,s,e,...r){return await L.GetOrSet(this.Index(t,s),async()=>await this.Invoke(s,...r),e(w()))}static async HandleFileStream(t,s,e){const a=Math.ceil(t.size/30720);let i=0;for(;i{l.onload=()=>y(new Uint8Array(l.result)),l.onerror=()=>E(l.error),l.readAsArrayBuffer(d)});s.next(m),e?.debug(`Sent chunk ${i+1}/${a}`),i++}s.complete()}}class G extends Bt{static Log=["|","ShopNet"];static Hub=new Nt().withUrl("https://awaishop.aloen.to:3389/Hub",{skipNegotiation:!0,transport:It.WebSockets,logMessageContent:!1,async accessTokenFactory(){const t=await Mt();return t||""}}).withAutomaticReconnect().withStatefulReconnect().withHubProtocol(new Ot).configureLogging(At.Information).build()}G.Hub.on("OnNewUser",()=>{D.next(!0),console.debug("OnNewUser")});class qe extends G{static Categories(){return this.GetTimeCache("","GalleryGetCategories",t=>t.add(1,"m"))}static async Products(t){return await this.GetTimeCache(t,"GalleryGetProducts",e=>e.add(1,"m"),t)}}const Ye={Get:qe};class Je extends G{static async Get(t){if(!/^[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}$/i.test(t))throw new Error(`Invalid ObjectId ${t}`);return await this.EnsureConnected(),this.Hub.stream("ObjectStorageGet",t)}static GetBySlice(t,s){const e=[];return L.GetOrSet(t,()=>new Promise((r,a)=>{this.Get(t).then(i=>i.subscribe({error(u){a(u)},next(u){e.push(u),s.debug("Received Slice",t,e.length)},complete(){r(e)}}))}))}}class Ke extends G{static useDelete(t){return h(async s=>{this.EnsureLogin();const e=await this.Invoke("OrderDeleteCancel",s);return this.EnsureTrue(e),e},t)}}class j extends G{static product="ProductEntity";static Product(t){return this.GetVersionCache(t,this.product)}static ProductUpdate(t,s){return this.UpdateCache(s,t,this.product)}static Lexical(t){return this.GetVersionCache(t,"LexicalEntity")}static photo="PhotoEntity";static Photo(t){return this.GetVersionCache(t,this.photo)}static PhotoUpdate(t,s){return this.UpdateCache(s,t,this.photo)}static Type(t){return this.GetVersionCache(t,"TypeEntity")}static Variant(t){return this.GetVersionCache(t,"VariantEntity")}}class N extends j{static Log=[...super.Log,"Product","Get"];static async Basic(t,s){const e=s.With(...this.Log,"Basic"),r=await this.Product(t);if(!r)throw new Error(`Product ${t} Not Found`);const[a,i]=await this.PhotoList(t,s);return i?{Name:r.Name,Cover:i}:(e.warn(`Product ${t} has no photo`),{Name:r.Name,Cover:""})}static Limit(t){return this.Invoke("ProdGetLimit",t)}static async Combo(t,s){const e=s.With(...this.Log,"Combo"),r=await this.ComboList(t),a=[];for(const i of r){const u={};for(const c of i.Types){const d=await this.Type(c);if(!d){e.error(`[Mismatch] Type ${c} not found. Combo ${i.ComboId} : Product ${t}`);continue}const l=await this.Variant(d.VariantId);if(!l){e.error(`[Mismatch] Variant ${d.VariantId} not found. Combo ${i.ComboId} : Type ${c} : Product ${t}`);continue}u[l.Name]=d.Name}a.push({Id:i.ComboId,Stock:i.Stock,Combo:u})}return a}static ComboList(t){return this.GetTimeCache(t,"ProductGetComboList",s=>s.add(1,"m"),t)}static photoList="ProductGetPhotoList";static async PhotoList(t,s){const e=s.With(...this.Log,"PhotoList"),r=await this.GetTimeCache(t,this.photoList,u=>u.add(1,"m"),t).catch(e.error);let a=[],i="";for(const u of r||[]){const c=await this.Photo(u).catch(e.error);c?(a.push(c),c.Cover&&(i=c.ObjectId)):e.warn(`Photo ${u} not found in Product ${t}`)}return a=a.sort((u,c)=>u.Order-c.Order),!i&&a.length>0?(e.warn(`Product ${t} has no cover photo, using first photo instead`),[a,a[0].ObjectId]):[a,i]}static PhotoListUpdate(t,s){return this.UpdateCache(s,t,this.photoList,w().add(1,"m"))}}class Ze extends G{static Order(t){return this.EnsureLogin(),this.GetVersionCache(t,"OrderEntity")}static Comment(t){return this.EnsureLogin(),this.GetVersionCache(t,"CommentEntity")}}class ts extends Ze{static Log=[...super.Log,"Order","Get"];static async List(t){this.EnsureLogin();const s=t.With(...this.Log,"List"),e=await this.GetTimeCache("","OrderGetList",a=>a.add(1,"m")),r=[];for(const a of e){const i=await this.Order(a.OrderId);if(!i){s.warn(`[Mismatch] Order ${a.OrderId} not found`);continue}const u=[];for(const c of a.Products){const d=await j.Product(c);if(!d){s.warn(`[Mismatch] Product ${c} not found`);continue}u.push(d.Name)}r.push({Id:a.OrderId,Items:u,Quantity:a.Quantity,Status:i.Status,TrackNumber:i.TrackingNumber,OrderDate:i.CreateAt})}return r.sort((a,i)=>i.OrderDate.getTime()-a.OrderDate.getTime())}static async Detail(t,s){this.EnsureLogin();const e=s.With(...this.Log,"Detail"),r=await this.GetTimeCache(t,"OrderGetDetail",c=>c.add(1,"m"),t),a=[];let i=0;for(const c of r.Items){const d={};let l=0;for(const T of c.Types){const f=await j.Type(T);if(!f){e.warn(`[Mismatch] Type ${T} not found. Order : ${t}`);continue}const g=await j.Variant(f.VariantId);if(!g){e.warn(`[Mismatch] Variant ${f.VariantId} not found. Type : ${T}, Order : ${t}`);continue}d[g.Name]=f.Name,l=g.ProductId}const m=await j.Product(l);if(!m){e.warn(`[Mismatch] Product ${l} not found. Order : ${t}`);continue}const[y,E]=await N.PhotoList(l,e);E||e.warn(`Product ${l} has no photo`),a.push({Id:i++,ProdId:l,Cover:E||"",Name:m.Name,Type:d,Quantity:c.Quantity})}const u=[];for(const c of r.Comments){const d=await this.Comment(c);if(!d){e.warn(`[Mismatch] Comment ${c} not found. Order : ${t}`);continue}u.push({Content:d.Content,Time:d.CreateAt,User:d.Name||"You"})}return{ShopCart:a,Comments:u.sort((c,d)=>c.Time.getTime()-d.Time.getTime())}}}class es extends G{static useNew(t){return h((s,e)=>{this.EnsureLogin();const r=s.map(a=>({ProdId:a.ProdId,Type:Object.values(a.Type),Quantity:a.Quantity}));return this.Invoke("OrderPostNew",r,e)},t)}static useAppend(t){return h(async(s,e)=>{this.EnsureLogin();const r=await this.Invoke("OrderPostAppend",s,e);return this.EnsureTrue(r),r},t)}static useCancel(t){return h(async(s,e)=>{this.EnsureLogin();const r=await this.Invoke("OrderPostCancel",s,e);return this.EnsureTrue(r),r},t)}static useReceived(t){return h(async s=>{this.EnsureLogin();const e=await this.Invoke("OrderPostReceived",s);return this.EnsureTrue(e),e},t)}}const ss={Get:ts,Post:es,Delete:Ke},ns={Get:N};class Vt extends G{static Log=[...super.Log,"User","Get"];static me="UserGetMe";static useMe(t){const s=k(()=>t.With(...this.Log,"Me")),{dispatch:e}=Q(s);return Gt(async()=>{try{return this.EnsureLogin(),await this.GetVersionCache(0,this.me)}catch(a){if(a instanceof Dt)return;a instanceof Rt?s.info(a):e({Message:"Failed to Get Your Info",Error:a,Request:""})}})}static MeUpdate(t){return this.UpdateCache(t,0,this.me)}}class rs extends G{static useUpdate(t){return h(async s=>{this.EnsureLogin();const e=await this.Invoke("UserPostUpdate",s);return this.EnsureTrue(e),Vt.MeUpdate(r=>({...r,...s})),e},t)}}const as={Get:Vt,Post:rs},v={Gallery:Ye,Product:ns,User:as,Order:ss,Storage:Je},Ht=x.createContext({});function z(){return x.useContext(Ht)}const ut=new A("ShopCart","Context");function os({children:o}){const[t,s]=x.useState([]);h(async()=>{const a=await ct.toArray(),i=[];for(const u of a){const c=await v.Product.Get.Basic(u.ProdId,ut);i.push({...u,...c})}s(i)},{onError:ut.error});async function e(a){for(let i=0;i({Id:i.Id,ProdId:i.ProdId,Type:i.Type,Quantity:i.Quantity})))}async function r(a,i,u){const c=await v.Product.Get.Basic(a,ut);t.push({...c,Id:t.length,ProdId:a,Type:i,Quantity:u}),e(t)}return n.jsx(Ht.Provider,{value:{List:t,Add:r,Update:e},children:o})}const is=P({box:{width:"-webkit-fill-available",marginTop:p.spacingVerticalXXXL,...B.padding(p.spacingVerticalXXXL,0),backgroundColor:p.colorNeutralBackgroundInverted},main:{...O,maxWidth:gt,...B.margin(0,"auto")},logo:{width:"150px",filter:"invert(96%)"},otc:{color:"white"}});function cs(){const o=is();return n.jsx("footer",{className:o.box,children:n.jsx("div",{className:o.main,children:n.jsx("img",{src:"/safari-pinned-tab.svg",className:o.logo})})})}const us=P({box:{...O,flexGrow:1,height:"inherit",marginLeft:p.spacingHorizontalS,alignItems:"center"},div:{color:p.colorNeutralForegroundDisabled},link:{textDecorationLine:"unset !important"}});function ds(){const o=us(),{Paths:t}=R(),s=t.at(0),e=t.at(1)||"Product";return s==="Admin"&&n.jsxs("div",{className:o.box,children:[n.jsx(tt,{size:600,font:"monospace",className:o.div,children:"|"}),n.jsxs(Kt,{selectedValue:e,children:[n.jsx(U,{appearance:"subtle",href:"/Admin",className:o.link,children:n.jsx(ot,{value:"Product",children:"Product List"})}),n.jsx(U,{appearance:"subtle",href:"/Admin/Order",className:o.link,children:n.jsx(ot,{value:"Order",children:"Order List"})}),n.jsx(U,{appearance:"subtle",href:"/Admin/User",className:o.link,children:n.jsx(ot,{value:"User",children:"User List"})})]})]})}class C extends Bt{static Log=["|","AdminNet"];static Hub=new Nt().withUrl("https://awaishop.aloen.to:3389/AdminHub",{skipNegotiation:!0,transport:It.WebSockets,logMessageContent:!1,async accessTokenFactory(){const t=await Mt();if(t)return t;throw new Error("Please Login First")}}).withAutomaticReconnect().withStatefulReconnect().withHubProtocol(new Ot).configureLogging(At.Information).build();static Index(t,s){return`${s}_Admin_${t}`}}class et extends C{static User(t){return this.EnsureLogin(),this.GetVersionCache(t,"UserEntity")}}class Z extends C{static Order(t){return this.EnsureLogin(),this.GetVersionCache(t,"OrderEntity")}static Comment(t){return this.EnsureLogin(),this.GetVersionCache(t,"CommentEntity")}}class ls extends C{static async Export(t){this.EnsureLogin(),await this.EnsureConnected();const s=[];return new Promise((e,r)=>{this.Hub.stream("ExportOrder").subscribe({error(a){t.error(a),r(a)},next(a){s.push(a),t.debug("Received Slice",s.length)},complete(){t.debug("Received All Slices",s.length),e(URL.createObjectURL(new Blob(s)))}})})}}class hs extends C{static Log=[...super.Log,"Order","Get"];static Count(){return this.EnsureLogin(),this.GetTimeCache("","OrderGetCount",t=>t.add(1,"m"))}static async List(t,s){this.EnsureLogin();const e=s.With(...this.Log,"List"),r=await this.GetTimeCache(t,"OrderGetList",i=>i.add(1,"m"),t),a=[];for(const i of r){const u=await Z.Order(i.OrderId);if(!u){e.warn(`[Mismatch] Order ${i.OrderId} not found`);continue}const c=[];for(const l of i.Products){const m=await j.Product(l);if(!m){e.warn(`[Mismatch] Product ${l} not found`);continue}c.push(m.Name)}const d=await et.User(u.UserId);if(!d){e.error(`[Mismatch] User ${u.UserId} not found`);continue}a.push({Id:i.OrderId,Items:c,Quantity:i.Quantity,Status:u.Status,TrackNumber:u.TrackingNumber,OrderDate:u.CreateAt,User:d.Name})}return a}static async Detail(t,s){this.EnsureLogin();const e=s.With(...this.Log,"Detail"),r=await this.GetTimeCache(t,"OrderGetDetail",c=>c.add(1,"m"),t),a=[];let i=0;for(const c of r.Items){const d={};let l=0;for(const T of c.Types){const f=await j.Type(T);if(!f){e.warn(`[Mismatch] Type ${T} not found. Order : ${t}`);continue}const g=await j.Variant(f.VariantId);if(!g){e.warn(`[Mismatch] Variant ${f.VariantId} not found. Type : ${T}, Order : ${t}`);continue}d[g.Name]=f.Name,l=g.ProductId}const m=await j.Product(l);if(!m){e.warn(`[Mismatch] Product ${l} not found. Order : ${t}`);continue}const[y,E]=await N.PhotoList(l,e);E||e.warn(`Product ${l} has no photo`),a.push({Id:i++,ProdId:l,Cover:E||"",Name:m.Name,Type:d,Quantity:c.Quantity})}const u=[];for(const c of r.Comments){const d=await Z.Comment(c);if(!d){e.warn(`[Mismatch] Comment ${c} not found. Order : ${t}`);continue}let l="Client";if(d.UserId){const m=await et.User(d.UserId);m?l=m.Name:e.warn(`[Mismatch] User ${d.UserId} not found. Order : ${t}`)}u.push({Content:d.Content,Time:d.CreateAt,User:l})}return{ShopCart:a,Comments:u.sort((c,d)=>c.Time.getTime()-d.Time.getTime())}}static Order=Z.Order;static Export=ls.Export}class ms extends C{static useAppend(t){return h(async(s,e)=>{const r=await this.Invoke("OrderPostAppend",s,e);return this.EnsureTrue(r),r},t)}static useClose(t){return h(async(s,e)=>{const r=await this.Invoke("OrderPostClose",s,e);return this.EnsureTrue(r),r},t)}static useShip(t){return h(async(s,e)=>{const r=await this.Invoke("OrderPostShip",s,e);return this.EnsureTrue(r),r},t)}static useAccept(t){return h(async s=>{const e=await this.Invoke("OrderPostAccept",s);return this.EnsureTrue(e),e},t)}}const ps={Get:hs,Post:ms};class xt extends C{static Log=[...super.Log,"Product","Get"];static list="ProductGetList";static useList(t){const s=k(()=>t.With(...this.Log,"List"));return Gt(()=>this.GetTimeCache("",this.list,r=>r.add(1,"m")).catch(s.error))}static ListUpdate(t){return this.UpdateCache(t,"",this.list,w().add(1,"m"))}static Count(t){return this.GetTimeCache(t,"ProductGetCount",s=>s.add(1,"m"),t)}static async Name(t){const s=await N.Product(t);if(!s)throw new Error(`Product ${t} Not Found`);return s.Name}static async Category(t){const s=await N.Product(t);if(!s)throw new Error(`Product ${t} Not Found`);return s.Category}static async Variants(t,s){const e=s.With(...this.Log,"Variants"),r=await this.GetTimeCache(t,"ProductGetVariants",i=>i.add(1,"m"),t),a=[];for(const i of r){const u=await N.Variant(i.VariantId);if(!u){e.warn(`Variant ${i} Not Found. Product : ${t}`);continue}const c=[];for(const d of i.Types){const l=await N.Type(d);if(!l){e.warn(`Type ${d} Not Found. Variant : ${i.VariantId}, Product : ${t}`);continue}c.push(l.Name)}a.push({Id:i.VariantId,Name:u.Name,Types:c})}return a}}class gs extends C{static usePhoto(t){return h(async(s,e)=>{const r=await this.Invoke("ProductDeletePhoto",e);return this.EnsureTrue(r),N.PhotoListUpdate(s,a=>a.filter(i=>i!==e)),r},t)}static useVariant(t){return h(async s=>{const e=await this.Invoke("ProductDeleteVariant",s);return this.EnsureTrue(e),e},t)}static useType(t){return h(async(s,e)=>{const r=await this.Invoke("ProductDeleteType",s,e);return this.EnsureTrue(r),r},t)}static useCombo(t){return h(async s=>{const e=await this.Invoke("ProductDeleteCombo",s);return this.EnsureTrue(e),e},t)}static useProduct(t){return h(async s=>{const e=await this.Invoke("ProductDeleteProduct",s);return this.EnsureTrue(e),xt.ListUpdate(r=>r.filter(a=>a!==s)),e},t)}static useCategory(t){return h(async s=>{const e=await this.Invoke("ProductDetachCategory",s);return this.EnsureTrue(e),j.ProductUpdate(s,r=>(r.Category=void 0,r)),e},t)}}class xs extends C{static Log=[...super.Log,"Product","Patch"];static useName(t){return h(async(s,e)=>{const r=await this.Invoke("ProductPatchName",s,e);return this.EnsureTrue(r),r},t)}static useCategory(t){return h(async(s,e)=>{const r=await this.Invoke("ProductPatchCategory",s,e);return this.EnsureTrue(r),r},t)}static usePhoto(t,s){const e=k(()=>t.With(...this.Log,"Photo"));return h(async(r,a)=>{if(!a.type.startsWith("image/"))throw new TypeError("File is not an image");if(a.size>10*1024*1024)throw new RangeError("File is too large, max 10MB");await this.EnsureConnected();const i=new mt,u=this.Hub.invoke("ProductPatchPhoto",r,i);return await this.HandleFileStream(a,i,e),this.EnsureTrue(await u),!0},s)}static useCaption(t){return h(async(s,e)=>{const r=await this.Invoke("ProductPatchCaption",s,e);return this.EnsureTrue(r),j.PhotoUpdate(s,a=>(a.Caption=e,a)),r},t)}static useVariantName(t){return h(async(s,e)=>{const r=await this.Invoke("ProductPatchVariantName",s,e);return this.EnsureTrue(r),r},t)}static useType(t){return h(async(s,e,r)=>{const a=await this.Invoke("ProductPatchType",s,e,r);return this.EnsureTrue(a),a},t)}static useCombo(t){return h(async(s,e,r)=>{const a=await this.Invoke("ProductPatchCombo",s,e,r);return this.EnsureTrue(a),a},t)}}let Ft;function Ks(o){Ft=o}class fs extends C{static Log=[...super.Log,"Product","Post"];static useCreate(t){return h(async s=>{const e=await this.Invoke("ProductPostCreate",s);return xt.ListUpdate(r=>[e,...r]),e},t)}static useMovePhoto(t){return h(async(s,e)=>{const r=await this.Invoke("ProductPostMovePhoto",s,e);return this.EnsureTrue(r),r},t)}static usePhoto(t,s){const e=k(()=>t.With(...this.Log,"Photo"));return h(async(r,a)=>{if(!a.type.startsWith("image/"))throw new TypeError("File is not an image");if(a.size>10*1024*1024)throw new RangeError("File is too large, max 10MB");const i=new mt,u=this.Invoke("ProductPostPhoto",r,i);await this.HandleFileStream(a,i,e);const c=await u;return N.PhotoListUpdate(r,d=>[...d,c]),c},s)}static useVariant(t){return h((s,e)=>this.Invoke("ProductPostVariant",s,e),t)}static useType(t){return h((s,e)=>this.Invoke("ProductPostType",s,e),t)}static useCombo(t){return h((s,e,r)=>this.Invoke("ProductPostCombo",s,e,r),t)}static useLexical(t){return h(async s=>{const e=Ft?.getEditorState();let r;e&&!e.isEmpty()&&(r=JSON.stringify(e.toJSON()));const a=await this.Invoke("ProductPostDescription",s,r);return this.EnsureTrue(a),a},t)}}const ws={Get:xt,Post:fs,Patch:xs,Delete:gs};class ys extends C{static useUser(t){return h(async s=>{const e=await this.Invoke("UserDeleteUser",s);return this.EnsureTrue(e),e},t)}static useAdmin(t){return h(async s=>{const e=await this.Invoke("UserDeleteAdmin",s);return this.EnsureTrue(e),e},t)}}class Ps extends C{static async OrderUser(t){const s=await Z.Order(t);if(!s)throw new Error(`Order ${t} not found`);const e=await et.User(s.UserId);if(!e)throw new Error(`User ${s.UserId} not found in order ${t}`);return e}static async List(){const t=await this.GetTimeCache("","UserGetList",e=>e.add(1,"m")),s=[];for(const e of t){const r=await et.User(e);if(!r){console.warn(`User ${e} not found`);continue}s.push({Id:e,Name:r.Name,EMail:r.EMail,Admin:r.Admin})}return s}}class Cs extends C{static useAdmin(t){return h(async s=>{const e=await this.Invoke("UserPostAdmin",s);return this.EnsureTrue(e),e},t)}}const js={Get:Ps,Post:Cs,Delete:ys},zt={Product:ws,Order:ps,User:js},Pt=new A("Admin","Order","ExportButton");function bs(){const{Paths:o}=R(),t=o.at(0),s=o.at(1),{dispatch:e,dispatchToast:r}=Q(Pt),{run:a,loading:i}=h(()=>zt.Order.Get.Export(Pt),{manual:!0,onError(u,c){e({Message:"Failed Export Orders",Request:c,Error:u})},onSuccess(u){r(n.jsx(_,{children:n.jsx(W,{children:"Orders Exported"})}),{intent:"success"});const c=document.createElement("a");c.href=u,c.download=`AllOrders_${new Date().toISOString()}.xlsx`,c.click()}});return t==="Admin"&&s==="Order"&&n.jsx(b,{appearance:"subtle",icon:n.jsx(Zt,{}),onClick:a,disabled:i,children:"Export Orders"})}const vs=P({body:M}),Es=new A("Admin","Product","AddButton");function Ts(){const{Nav:o,Paths:t}=R(),s=t.at(0),e=t.at(1),r=vs(),[a,i]=x.useState(""),{dispatch:u,dispatchToast:c}=Q(Es),{run:d,loading:l}=zt.Product.Post.useCreate({manual:!0,onError(m,y){u({Message:`Failed Create ${a}`,Request:y,Error:m})},onSuccess(m){c(n.jsxs(_,{children:[n.jsx(W,{children:"New Product Created"}),n.jsxs(st,{children:[m," ",a]})]}),{intent:"success"}),o("Admin",m),i("")}});return s==="Admin"&&!e&&n.jsxs(vt,{children:[n.jsx(ht,{disableButtonEnhancement:!0,children:n.jsx(b,{appearance:"primary",icon:n.jsx(te,{}),children:"New Product"})}),n.jsx(Et,{children:n.jsxs(Tt,{children:[n.jsx(Lt,{className:r.body,children:n.jsx(F,{required:!0,size:"large",value:a,maxLength:15,appearance:"underline",onChange:(m,y)=>i(y.value),contentBefore:n.jsx(ee,{children:"Give A Name"})})}),n.jsxs(St,{children:[n.jsx(ht,{disableButtonEnhancement:!0,children:n.jsx(b,{appearance:"secondary",children:"Cancel"})}),n.jsx(b,{disabled:l,appearance:"primary",onClick:()=>d(a),children:"Create"})]})]})})]})}function Ls(){const{Paths:o,Search:t,Put:s}=R(),e=o.at(0),r=o.at(1);return e==="Admin"&&r==="User"&&n.jsxs(n.Fragment,{children:[n.jsx(F,{placeholder:"Search by E-Mail",contentBefore:n.jsx(se,{}),appearance:"underline",onChange:(a,i)=>{i.value?t.set("search",i.value):t.delete("search"),s(t)}}),n.jsx(ne,{label:"Only Admin",checked:t.get("admin")==="",onChange:(a,i)=>{i.checked?t.set("admin",""):t.delete("admin"),s(t)}})]})}const Ss=new A("Avatar","Menu");function Ns(){const[o,{toggle:t}]=$(),[s,{toggle:e}]=$(),{instance:r}=bt(),[a,{set:i}]=$(!0);x.useEffect(()=>{D.subscribe(l=>i(!l))},[]);const u=v.User.Get.useMe(Ss),c=r.getActiveAccount(),d=c?.name||c?.username;return n.jsxs(n.Fragment,{children:[n.jsxs(re,{open:o,onOpenChange:t,children:[n.jsx(ae,{children:n.jsx(oe,{size:36,active:o?"active":"unset",name:d})}),n.jsx(ie,{children:n.jsxs(ce,{children:[n.jsx(q,{children:n.jsxs(ue,{children:["Hi ",d]})}),n.jsx(de,{children:n.jsx(V,{onClick:()=>r.loginRedirect(),children:"Login"})}),n.jsxs(q,{children:[n.jsx(U,{appearance:"subtle",href:"/History",children:n.jsx(V,{children:"History"})}),u?.Admin&&n.jsx(U,{appearance:"subtle",href:"/Admin",children:n.jsx(V,{children:"Admin"})}),n.jsx(V,{onClick:e,children:"Setting"}),n.jsx(V,{onClick:()=>r.logoutRedirect(),children:"Logout"})]})]})})]}),a&&n.jsx(q,{children:n.jsx(Ut,{Open:s,Toggle:e})})]})}function _t({Items:o,Columns:t,NoHeader:s}){return n.jsxs(le,{items:o||[],columns:t,getRowId:e=>e.Id,children:[!s&&n.jsx(he,{children:n.jsx(wt,{children:({renderHeaderCell:e})=>e()})}),n.jsx(me,{children:({item:e,rowId:r})=>n.jsx(wt,{children:({renderCell:a})=>a(e)},r)}),!o&&n.jsx(pe,{size:48})]})}function Is({Guid:o,Log:t,...s}){const e=k(()=>t.With("GuidImage")),{data:r,run:a}=h(v.Storage.GetBySlice.bind(v.Storage),{manual:!0,onError:e.error});return x.useEffect(()=>{o&&a(o,e)},[o]),n.jsx(kt,{...s,src:r?URL.createObjectURL(new Blob(r)):"https://placehold.co/400?text=Loading..."})}const Ct=P({unset:{flexBasis:"unset",flexGrow:0},img:{...Fe,aspectRatio:"1",marginTop:p.spacingVerticalXS,marginBottom:p.spacingVerticalXS}});function Os(o,t){const s={width:`${o}px`};return Y({columnId:"Cover",renderHeaderCell:()=>{const e=Ct();return n.jsx(ge,{className:e.unset,children:n.jsx("div",{style:s})})},renderCell(e){const r=Ct();return n.jsx(J,{className:r.unset,children:n.jsx(Is,{className:r.img,style:s,Guid:e.Cover,Log:t})})}})}function As(o){const{List:t}=z(),{data:s}=h(()=>v.Product.Get.Limit(o)),e=s||3;let r=0;for(const a of t)if(a.ProdId===o&&(r+=a.Quantity),r>=e)return[!0,e];return[!1,e]}const dt=P({prod:{...M,alignItems:"flex-start",justifyContent:"center"},qua:{flexBasis:"12%",flexGrow:0},act:{flexBasis:"7%",flexGrow:0}}),Gs=[Y({columnId:"Product",renderCell(o){return n.jsxs(J,{className:dt().prod,children:[n.jsx(U,{href:`/Product/${o.ProdId}`,appearance:"subtle",children:n.jsx(xe,{children:o.Name})}),n.jsx(fe,{children:Object.values(o.Type).reduce((t,s)=>`${t} ${s},`,"")})]})}}),Y({columnId:"Quantity",renderCell(o){const{List:t,Update:s}=z(),[e,r]=As(o.ProdId);return n.jsx(J,{className:dt().qua,children:n.jsx(we,{min:1,max:r,value:o.Quantity,onChange:(a,i)=>{e&&i.value>=o.Quantity||(o.Quantity=i.value,s(t))}})})}}),Y({columnId:"Action",renderCell(o){const{List:t,Update:s}=z();return n.jsx(J,{className:dt().act,children:n.jsx(b,{appearance:"subtle",icon:n.jsx(ye,{}),onClick:()=>s(t.filter(e=>e.Id!==o.Id))})})}})];function Wt(o){return[Os(44,o),...Gs]}const ks=P({person:O,inf:{...M,flexBasis:"50%",rowGap:p.spacingVerticalM}});function $s({Log:o}){const t=ks(),s=k(()=>o.With("PersonaInfo")),e=v.User.Get.useMe(s);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:t.person,children:[n.jsx("div",{className:t.inf,children:n.jsx(S,{label:"Name",size:"large",children:n.jsx(H,{children:e?.Name})})}),n.jsx("div",{className:t.inf,children:n.jsx(S,{label:"Phone",size:"large",children:n.jsx(H,{children:e?.Phone})})})]}),n.jsx(S,{label:"E-Mail",size:"large",children:n.jsx(H,{children:e?.EMail})}),n.jsx(S,{label:"Address",size:"large",children:n.jsx(H,{children:e?.Address})})]})}const Us=P({body:{...M,rowGap:p.spacingVerticalXL},sub:{width:"fit-content",alignSelf:"flex-end"}}),lt=new A("TopNavBar","ShopCart","Confirm");function Ms(){const[o,t]=x.useState(),[s,{toggle:e}]=$(),{List:r,Update:a}=z(),{Nav:i}=R(),u=Us(),{dispatch:c,dispatchToast:d}=Q(lt),{run:l}=v.Order.Post.useNew({manual:!0,onError(m,y){c({Message:"Failed Create Order",Request:y,Error:m})},onSuccess(m){d(n.jsxs(_,{children:[n.jsx(W,{children:"Order Placed"}),n.jsxs(st,{children:["Order Id: ",m]})]}),{intent:"success"}),a([]),e(),i("History",m)}});return n.jsxs(n.Fragment,{children:[n.jsx(b,{appearance:"primary",onClick:e,disabled:!r.length,children:"Checkout"}),n.jsxs(Pe,{open:s,onOpenChange:e,position:"end",size:"medium",modalType:"alert",children:[n.jsx(Ce,{children:n.jsx(je,{action:n.jsx(b,{appearance:"subtle",icon:n.jsx(be,{}),onClick:e}),children:"Confirm Order"})}),n.jsx(ve,{children:n.jsxs("div",{className:u.body,children:[n.jsx($s,{Log:lt}),n.jsx(_t,{Items:r,Columns:k(()=>Wt(lt)),NoHeader:!0}),n.jsx(S,{label:"Comment",size:"large",children:n.jsx(Ee,{value:o,onChange:(m,y)=>t(y.value),maxLength:1e3})}),n.jsx(b,{appearance:"primary",className:u.sub,disabled:!r.length,onClick:()=>l(r,o),children:"Submit"})]})})]})]})}const Rs=P({conf:{...O,width:"100%",alignItems:"center",justifyContent:"space-between",marginTop:p.spacingVerticalS,columnGap:p.spacingHorizontalL},tooltip:{backgroundColor:p.colorBrandBackground,color:p.colorNeutralForegroundInverted,...B.borderRadius(p.borderRadiusCircular)}}),Ds=new A("TopNavBar","ShopCart");function Bs(){const[o,{toggle:t}]=$(),[s,{toggle:e}]=$(),r=Rs(),{List:a}=z();return Te(()=>{if(o)return;e();const i=setTimeout(e,2e3);return()=>clearTimeout(i)},[a]),n.jsxs(Le,{withArrow:!0,open:o,onOpenChange:t,children:[n.jsx(Se,{disableButtonEnhancement:!0,children:n.jsx(Ne,{visible:s,withArrow:!0,content:{children:"↑",className:r.tooltip},relationship:"inaccessible",children:n.jsx(Ie,{icon:n.jsx(Oe,{}),appearance:"subtle",size:"large",checked:o})})}),n.jsxs(Ae,{children:[n.jsx(_t,{Items:a,Columns:k(()=>Wt(Ds)),NoHeader:!0}),n.jsxs("div",{className:r.conf,children:[a.map(i=>i.Quantity).reduce((i,u)=>i+u,0)," items in shopping cart",n.jsx(Ms,{})]})]})]})}const Vs=P({navBox:{position:"fixed",top:0,width:"100%",height:`${pt}px`,...B.padding(0,p.spacingHorizontalXXXL),backgroundColor:"#fff",boxSizing:"border-box",boxShadow:p.shadow4},navBar:{...O,maxWidth:gt,height:"100%",...B.margin(0,"auto"),alignItems:"center",justifyContent:"space-between"},logoBox:{...O,columnGap:p.spacingHorizontalL,alignItems:"center"},logoText:{color:p.colorBrandForeground2}});function Hs(){const o=Vs();return n.jsx(Ge,{children:n.jsx("header",{className:o.navBox,children:n.jsxs("nav",{className:o.navBar,children:[n.jsxs(U,{className:o.logoBox,href:"/",appearance:"subtle",children:[n.jsx(kt,{src:"/Awai.png",height:pt}),n.jsx(tt,{size:600,font:"monospace",className:o.logoText,children:rt.Name})]}),n.jsx(ds,{}),n.jsxs("div",{className:o.logoBox,children:[n.jsx(Ts,{}),n.jsx(Ls,{}),n.jsx(bs,{}),n.jsx(Bs,{}),n.jsx(Ns,{})]})]})})})}function Fs(){const{Rep:o}=R();return setTimeout(()=>o("/"),3e3),n.jsxs(n.Fragment,{children:[n.jsxs(ke,{children:[n.jsxs("title",{children:["Redirect - Not Found - ",rt.Name]}),n.jsx("meta",{name:"robots",content:"noindex, nofollow"})]}),n.jsx(K,{size:"huge",label:"Redirecting..."})]})}const zs=P({body:{...M,minWidth:"375px",position:"absolute",marginTop:`${pt}px`,width:"100%",minHeight:"-webkit-fill-available",justifyContent:"space-between",backgroundColor:p.colorNeutralBackground2},content:{...M,maxWidth:gt,width:"-webkit-fill-available",marginLeft:"auto",marginRight:"auto",paddingLeft:p.spacingHorizontalM,paddingRight:p.spacingHorizontalM,paddingTop:p.spacingVerticalXXXL}});function _s(){const o=zs(),{Paths:t}=R(),s=t.at(0),e=x.useMemo(()=>{switch(s){case"Product":return n.jsx(Ws,{});case"Admin":return n.jsx(Qs,{});case"History":return n.jsx(Xs,{});case"Login":return n.jsx(K,{size:"huge",label:"Login Redirecting..."});case"Reload":return n.jsx(K,{size:"huge",label:"Reloading..."});case"":case void 0:return n.jsx(qs,{});default:return n.jsx(Fs,{})}},[s]);return n.jsxs(n.Fragment,{children:[n.jsx(Hs,{}),n.jsxs("div",{className:o.body,children:[n.jsx("main",{className:o.content,children:n.jsx(x.Suspense,{fallback:n.jsx(K,{}),children:e})}),n.jsx(cs,{})]}),n.jsx(We,{})]})}const Ws=x.lazy(()=>nt(()=>import("./index-DkQbb1fo.js"),__vite__mapDeps([0,1,2,3]))),Qs=x.lazy(()=>nt(()=>import("./index-cu2bTZMb.js"),__vite__mapDeps([4,1,5,2]))),Xs=x.lazy(()=>nt(()=>import("./index-Tn4RgmZa.js"),__vite__mapDeps([6,1,5]))),qs=x.lazy(()=>nt(()=>import("./index-0za8jBCT.js"),__vite__mapDeps([7,1])));$e.createRoot(document.getElementById(rt.Name)).render(n.jsx(Ue,{theme:Me,children:n.jsx(Be,{children:n.jsx(Re,{instance:I,children:n.jsxs(os,{children:[n.jsx(De,{pauseOnHover:!0}),n.jsx(_s,{})]})})})}));export{zt as A,Js as B,Fe as C,rt as D,O as F,Is as G,v as H,A as L,Os as M,Ks as S,M as a,As as b,R as c,Ve as d,Q as e,_t as f,z as u}; +function __vite__mapDeps(indexes) { + if (!__vite__mapDeps.viteFileDeps) { + __vite__mapDeps.viteFileDeps = ["assets/index-DkQbb1fo.js","assets/vendor--JR89aB4.js","assets/Lazy-oj3UQ1nd.js","assets/index-scunr7sf.css","assets/index-cu2bTZMb.js","assets/Columns-YyE5CF5f.js","assets/index-Tn4RgmZa.js","assets/index-0za8jBCT.js"] + } + return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) +} diff --git a/index.html b/index.html index aff331e..e805833 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ AwaiShop - +