1import{j as s,aR as uo,T as vt,E as bt,J as K,G as it,i as Ee,H as wt,z as fo,F as po,aM as mo,ao as Ft,ap as ht,aS as go,U as fn,aT as xo,V as pn,aU as bo,au as vo,_ as J,O as mn,r as V,B as gn,X as ke,y as wo,aV as xn,ar as yo,aW as Co,aX as jo,aY as So,aZ as ko,a_ as Mo,a$ as Ro,b0 as Io,b1 as _o,b2 as Lo,b3 as Eo,v as q,al as To,W as zt,b as bn,ah as Ao,Y as Oo,l as Ho,b4 as Po}from"./vendor-mantine-OJ-YIunY.js";import{h as tt,c as B,b6 as Ke,b7 as zo,i as ae,b8 as Do,b9 as qe,z as No,b0 as vn,at as wn,u as et,_ as $o,ba as Bo,am as yn,bb as Cn,bc as Uo,bd as Ge,T as qt,a as Fo,d as Je,be as Vo}from"./index-Dq6GAC6u.js";import{r as E,k as Te,R as jn,a as Sn,h as kn}from"./vendor-react-BAvqh2QG.js";import{b as Mn,a as Nt,r as ne}from"./IndexedDBAdapter-BzMALek2.js";import{E as Xe,u as yt,S as dt,a as Wo,T as Rn,F as ye,c as Wt,P as Jt,k as Ko,d as In,i as qo,p as _n,N as Go,e as Ln,f as Jo,h as Xo,j as En,l as Yo}from"./useRichTextEditor-7mAbuOum.js";import{I as Qo}from"./IconSettings-CbJIjTtj.js";import"./vendor-mui-icons-sMoFEJyB.js";import"./vendor-animation-BSyd9MIw.js";const Zo=[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M8 12l8 0",key:"svg-1"}],["path",{d:"M6 18l12 0",key:"svg-2"}]],ts=tt("outline","align-center","AlignCenter",Zo);const es=[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l16 0",key:"svg-1"}],["path",{d:"M4 18l12 0",key:"svg-2"}]],ns=tt("outline","align-justified","AlignJustified",es);const os=[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M4 12l10 0",key:"svg-1"}],["path",{d:"M4 18l14 0",key:"svg-2"}]],Tn=tt("outline","align-left","AlignLeft",os);const ss=[["path",{d:"M4 6l16 0",key:"svg-0"}],["path",{d:"M10 12l10 0",key:"svg-1"}],["path",{d:"M6 18l14 0",key:"svg-2"}]],is=tt("outline","align-right","AlignRight",ss);const ls=[["path",{d:"M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z",key:"svg-0"}],["path",{d:"M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z",key:"svg-1"}],["path",{d:"M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208",key:"svg-2"}]],rs=tt("outline","bucket-droplet","BucketDroplet",ls);const as=[["path",{d:"M19 18v-8l-2 2",key:"svg-0"}],["path",{d:"M4 6v12",key:"svg-1"}],["path",{d:"M12 6v12",key:"svg-2"}],["path",{d:"M11 18h2",key:"svg-3"}],["path",{d:"M3 18h2",key:"svg-4"}],["path",{d:"M4 12h8",key:"svg-5"}],["path",{d:"M3 6h2",key:"svg-6"}],["path",{d:"M11 6h2",key:"svg-7"}]],cs=tt("outline","h-1","H1",as);const ds=[["path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0",key:"svg-0"}],["path",{d:"M4 6v12",key:"svg-1"}],["path",{d:"M12 6v12",key:"svg-2"}],["path",{d:"M11 18h2",key:"svg-3"}],["path",{d:"M3 18h2",key:"svg-4"}],["path",{d:"M4 12h8",key:"svg-5"}],["path",{d:"M3 6h2",key:"svg-6"}],["path",{d:"M11 6h2",key:"svg-7"}]],hs=tt("outline","h-2","H2",ds);const us=[["path",{d:"M19 14a2 2 0 1 0 -2 -2",key:"svg-0"}],["path",{d:"M17 16a2 2 0 1 0 2 -2",key:"svg-1"}],["path",{d:"M4 6v12",key:"svg-2"}],["path",{d:"M12 6v12",key:"svg-3"}],["path",{d:"M11 18h2",key:"svg-4"}],["path",{d:"M3 18h2",key:"svg-5"}],["path",{d:"M4 12h8",key:"svg-6"}],["path",{d:"M3 6h2",key:"svg-7"}],["path",{d:"M11 6h2",key:"svg-8"}]],fs=tt("outline","h-3","H3",us);const ps=[["path",{d:"M7 12h10",key:"svg-0"}],["path",{d:"M7 5v14",key:"svg-1"}],["path",{d:"M17 5v14",key:"svg-2"}],["path",{d:"M15 19h4",key:"svg-3"}],["path",{d:"M15 5h4",key:"svg-4"}],["path",{d:"M5 19h4",key:"svg-5"}],["path",{d:"M5 5h4",key:"svg-6"}]],ms=tt("outline","heading","Heading",ps);const gs=[["path",{d:"M7 20v-12a4 4 0 0 1 4 -4h2a4 4 0 0 1 4 4v12",key:"svg-0"}],["path",{d:"M7 13l10 0",key:"svg-1"}]],xs=tt("outline","letter-a","LetterA",gs);const bs=[["path",{d:"M3 7v-2h13v2",key:"svg-0"}],["path",{d:"M10 5v14",key:"svg-1"}],["path",{d:"M12 19h-4",key:"svg-2"}],["path",{d:"M15 13v-1h6v1",key:"svg-3"}],["path",{d:"M18 12v7",key:"svg-4"}],["path",{d:"M17 19h2",key:"svg-5"}]],vs=tt("outline","text-size","TextSize",bs),de={size:380,position:"left",background:{color:"#00000000"}},Ae=E.createContext({data:de,merge:()=>{}}),ws={...de,background:{color:"#00000026"}},ys=t=>{const e=B.c(12),{children:n}=t,o=Te(Cs);let i;if(e[0]===Symbol.for("react.memo_cache_sentinel")){t:{const w=localStorage.getItem("rulesLayout");if(!w){i=null;break t}const C=JSON.parse(w),y=C.background.opacity!==void 0;if(!y&&C.background.color.length===7){const j={size:C.size,position:C.position,background:{color:Ke("#000000").setAlpha(0).toHex8String()}};localStorage.setItem("rulesLayout",JSON.stringify(j)),i=j;break t}if(y){const j={size:C.size,position:C.position,background:{color:Ke(C.background.color??"#000000").setAlpha(C.background.opacity??0).toHex8String()}};localStorage.setItem("rulesLayout",JSON.stringify(j)),i=j;break t}i=C}e[0]=i}else i=e[0];const r=i,[l,a]=E.useState(r??de),[c,d]=E.useState(!1);let h,u;e[1]!==o||e[2]!==c?(h=()=>
1{if(!c&&!r){const w=o!=null?ws:de;a(w)}},u=[o,c,r],e[1]=o,e[2]=c,e[3]=h,e[4]=u):(h=e[3],u=e[4]),E.useEffect(h,u);let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=w=>{a(C=>{const y=zo(C,w);return localStorage.setItem("rulesLayout",JSON.stringify(y)),y})},e[5]=f):f=e[5];const p=f;let m;e[6]===Symbol.for("react.memo_cache_sentinel")?(m=w=>{d(!0),p(w)},e[6]=m):m=e[6];const g=m;let x;e[7]!==l?(x={data:l,merge:g},e[7]=l,e[8]=x):x=e[8];const b=x;let v;return e[9]!==n||e[10]!==b?(v=s.jsx(Ae.Provider,{value:b,children:n}),e[9]=n,e[10]=b,e[11]=v):v=e[11],v};function Cs(t){return t.aucSettings.settings.background}const js=t=>{const e=B.c(8),{currentRuleContent:n}=t,o=Te(Ss);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={...Do()},e[0]=i):i=e[0];const{mutate:r}=ae(i);let l;e[1]!==r?(l=h=>{if(!qe.getState().broadcasting.broadcastingData.rules)return;const u=JSON.stringify(h);r({body:{data:{text:u}}})},e[1]=r,e[2]=l):l=e[2];const a=l;let c,d;e[3]!==a||e[4]!==n||e[5]!==o?(c=()=>{if(o){const h=u=>{u.dataType==="rules"&&n&&a(n)};return n&&qe.getState().broadcasting.broadcastingData.rules&&a(n),o.on("updatesRequested",h),()=>{o.off("updatesRequested",h)}}},d=[o,n,a],e[3]=a,e[4]=n,e[5]=o,e[6]=c,e[7]=d):(c=e[6],d=e[7]),E.useEffect(c,d)};function Ss(t){return t.broadcasting.socket}const ks="_selectInput_1lnuu_1",Ms="_editInput_1lnuu_6",Rs="_option_1lnuu_10",Is="_deleteButton_1lnuu_14",_s="_optionLabel_1lnuu_18",Ls="_footer_1lnuu_29",Es="_newOptionInput_1lnuu_34",Ts="_addButton_1lnuu_38",mt={selectInput:ks,editInput:Ms,option:Rs,deleteButton:Is,optionLabel:_s,footer:Ls,newOptionInput:Es,addButton:Ts};function As(t){const e=B.c(19),{selectedValue:n,option:o,size:i,canDelete:r,onDelete:l}=t;let a;e[0]!==l||e[1]!==o.value?(a=m=>{m.stopPropagation(),l(o.value)},e[0]=l,e[1]=o.value,e[2]=a):a=e[2];const c=a;let d;e[3]!==o.value||e[4]!==n?(d=n===o.value&&s.jsx(uo,{color:"var(--mantine-color-dimmed)",size:12}),e[3]=o.value,e[4]=n,e[5]=d):d=e[5];let h;e[6]!==o.label||e[7]!==i?(h=s.jsx(vt,{size:i,truncate:!0,className:mt.optionLabel,children:o.label}),e[6]=o.label,e[7]=i,e[8]=h):h=e[8];let u;e[9]!==r||e[10]!==c?(u=r&&s.jsx(K,{size:"sm",variant:"subtle",color:"red",onClick:c,className:mt.deleteButton,children:s.jsx(No,{})}),e[9]=r,e[10]=c,e[11]=u):u=e[11];let f;e[12]!==d||e[13]!==h||e[14]!==u?(f=s.jsxs(it,{justify:"space-between",wrap:"nowrap",gap:"xs",children:[d,h,u]}),e[12]=d,e[13]=h,e[14]=u,e[15]=f):f=e[15];let p;return e[16]!==o.value||e[17]!==f?(p=s.jsx(bt.Option,{value:o.value,className:mt.option,children:f}),e[16]=o.value,e[17]=f,e[18]=p):p=e[18],p}function Os(t){const e=B.c(30),{value:n,onChange:o,onConfirm:i,onCancel:r,size:l,label:a}=t,c=E.useRef(null);let d,h;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{c.current?.focus()},h=[],e[0]=d,e[1]=h):(d=e[0],h=e[1]),E.useEffect(d,h);let u;e[2]!==r||e[3]!==i?(u=R=>{R.key==="Enter"?i():R.key==="Escape"&&r()},e[2]=r,e[3]=i,e[4]=u):u=e[4];const f=u;let p;e[5]!==a||e[6]!==l?(p=a&&s.jsx(vt,{size:l,fw:500,mb:4,children:a}),e[5]=a,e[6]=l,e[7]=p):p=e[7];let m;e[8]!==o?(m=R=>o(R.currentTarget.value),e[8]=o,e[9]=m):m=e[9];let g;e[10]!==f||e[11]!==l||e[12]!==m||e[13]!==n?(g=s.jsx(Ee,{ref:c,value:n,onChange:m,onKeyDown:f,size:l,className:mt.editInput,flex:1}),e[10]=f,e[11]=l,e[12]=m,e[13]=n,e[14]=g):g=e[14];const x=`input-${l}`;let b;e[15]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(vn,{}),e[15]=b):b=e[15];let v;e[16]!==i||e[17]!==x?(v=s.jsx(K,{size:x,variant:"filled",color:"green",onClick:i,children:b}),e[16]=i,e[17]=x,e[18]=v):v=e[18];const w=`input-${l}`;let C;e[19]===Symbol.for("react.memo_cache_sentinel")?(C=s.jsx(wn,{}),e[19]=C):C=e[19];let y;e[20]!==r||e[21]!==w?(y=s.jsx(K,{size:w,variant:"filled",color:"gray",onClick:r,children:C}),e[20]=r,e[21]=w,e[22]=y):y=e[22];let j;e[23]!==y||e[24]!==g||e[25]!==v?(j=s.jsxs(it,{gap:"xs",wrap:"nowrap",children:[g,v,y]}),e[23]=y,e[24]=g,e[25]=v,e[26]=j):j=e[26];let S;return e[27]!==j||e[28]!==p?(S=s.jsxs(wt,{w:"100%",children:[p,j]}),e[27]=j,e[28]=p,e[29]=S):S=e[29],S}function Hs(t){const e=B.c(31),{isAdding:n,value:o,onChange:i,onStartAdd:r,onConfirm:l,onCancel:a}=t,{t:c}=et(),d=E.useRef(null);let h,u;e[0]!==n?(h=()=>{n&&d.current?.focus()},u=[n],e[0]=n,e[1]=h,e[2]=u):(h=e[1],u=e[2]),E.useEffect(h,u);let f;e[3]!==a||e[4]!==l?(f=j=>{j.key==="Enter"?(j.preventDefault(),l()):j.key==="Escape"&&a()},e[3]=a,e[4]=l,e[5]=f):f=e[5];const p=f;if(!n){let j;e[6]!==c?(j=c("editableSelect.addOption"),e[6]=c,e[7]=j):j=e[7];let S;e[8]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx($o,{}),e[8]=S):S=e[8];let R;return e[9]!==r||e[10]!==j?(R=s.jsx(K,{size:"input-sm",variant:"light",onClick:r,className:mt.addButton,title:j,children:S}),e[9]=r,e[10]=j,e[11]=R):R=e[11],R}let m;e[12]!==i?(m=j=>
1i(j.currentTarget.value),e[12]=i,e[13]=m):m=e[13];let g;e[14]!==c?(g=c("editableSelect.newOptionPlaceholder"),e[14]=c,e[15]=g):g=e[15];let x;e[16]!==p||e[17]!==m||e[18]!==g||e[19]!==o?(x=s.jsx(Ee,{ref:d,value:o,onChange:m,onKeyDown:p,size:"sm",placeholder:g,className:mt.newOptionInput}),e[16]=p,e[17]=m,e[18]=g,e[19]=o,e[20]=x):x=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(vn,{}),e[21]=b):b=e[21];let v;e[22]!==l?(v=s.jsx(K,{size:"input-sm",variant:"filled",color:"green",onClick:l,children:b}),e[22]=l,e[23]=v):v=e[23];let w;e[24]===Symbol.for("react.memo_cache_sentinel")?(w=s.jsx(wn,{}),e[24]=w):w=e[24];let C;e[25]!==a?(C=s.jsx(K,{size:"input-sm",variant:"filled",color:"gray",onClick:a,children:w}),e[25]=a,e[26]=C):C=e[26];let y;return e[27]!==C||e[28]!==x||e[29]!==v?(y=s.jsxs(it,{gap:"xs",wrap:"nowrap",children:[x,v,C]}),e[27]=C,e[28]=x,e[29]=v,e[30]=y):y=e[30],y}function Ps(t){const e=B.c(88),{value:n,onChange:o,options:i,onOptionRename:r,onOptionAdd:l,onOptionDelete:a,label:c,placeholder:d,size:h,dropdownRef:u,disabled:f}=t,p=h===void 0?"md":h,m=f===void 0?!1:f,{t:g}=et(),[x,b]=E.useState(!1),[v,w]=E.useState(""),[C,y]=E.useState(!1),[j,S]=E.useState(""),R=fo({onDropdownClose:()=>{R.resetSelectedOption(),y(!1),S("")}});let L;if(e[0]!==i||e[1]!==n){let $;e[3]!==n?($=xt=>xt.value===n,e[3]=n,e[4]=$):$=e[4],L=i.find($),e[0]=i,e[1]=n,e[2]=L}else L=e[2];const k=L,A=i.length>1;let _;e[5]!==k?(_=()=>{k&&(w(k.label),b(!0))},e[5]=k,e[6]=_):_=e[6];const N=_;let H;e[7]===Symbol.for("react.memo_cache_sentinel")?(H=()=>{b(!1),w("")},e[7]=H):H=e[7];const I=H;let T;e[8]!==v||e[9]!==r||e[10]!==k||e[11]!==n?(T=()=>{const $=v.trim();if(!$||!k){I();return}r(n,$),b(!1),w("")},e[8]=v,e[9]=r,e[10]=k,e[11]=n,e[12]=T):T=e[12];const D=T;let z;e[13]!==A||e[14]!==o||e[15]!==a||e[16]!==i||e[17]!==n?(z=$=>{if(A&&(a($),n===$)){const xt=i.find(ho=>ho.value!==$);xt&&o(xt.value)}},e[13]=A,e[14]=o,e[15]=a,e[16]=i,e[17]=n,e[18]=z):z=e[18];const U=z;let pt;e[19]===Symbol.for("react.memo_cache_sentinel")?(pt=()=>{y(!0)},e[19]=pt):pt=e[19];const ao=pt;let Yt;e[20]===Symbol.for("react.memo_cache_sentinel")?(Yt=()=>{y(!1),S("")},e[20]=Yt):Yt=e[20];const co=Yt;let Qt;e[21]!==R||e[22]!==j||e[23]!==l?(Qt=()=>{const $=j.trim();l($),y(!1),S(""),R.closeDropdown()},e[21]=R,e[22]=j,e[23]=l,e[24]=Qt):Qt=e[24];const be=Qt;if(x){let $;return e[25]!==v||e[26]!==D||e[27]!==c||e[28]!==p?($=s.jsx(Os,{value:v,onChange:w,onConfirm:D,onCancel:I,size:p,label:c}),e[25]=v,e[26]=D,e[27]=c,e[28]=p,e[29]=$):$=e[29],$}let St;e[30]!==R||e[31]!==o?(St=$=>{o($),R.closeDropdown()},e[30]=R,e[31]=o,e[32]=St):St=e[32];let kt;e[33]!==c||e[34]!==p?(kt=c&&s.jsx(vt,{size:p,fw:500,mb:4,children:c}),e[33]=c,e[34]=p,e[35]=kt):kt=e[35];let Zt;e[36]===Symbol.for("react.memo_cache_sentinel")?(Zt=s.jsx(bt.Chevron,{}),e[36]=Zt):Zt=e[36];let Mt;e[37]!==R?(Mt=()=>R.toggleDropdown(),e[37]=R,e[38]=Mt):Mt=e[38];let Rt;e[39]!==d||e[40]!==k?.label||e[41]!==g?(Rt=k?.label||s.jsx(vt,{c:"dimmed",children:d??g("editableSelect.placeholder")}),e[39]=d,e[40]=k?.label,e[41]=g,e[42]=Rt):Rt=e[42];let It;e[43]!==m||e[44]!==p||e[45]!==Mt||e[46]!==Rt?(It=s.jsx(po,{component:"button",type:"button",pointer:!0,rightSection:Zt,rightSectionPointerEvents:"none",onClick:Mt,size:p,disabled:m,className:mt.selectInput,children:Rt}),e[43]=m,e[44]=p,e[45]=Mt,e[46]=Rt,e[47]=It):It=e[47];const ve=`input-${p}`,we=m||!k;let _t;e[48]!==g?(_t=g("editableSelect.editOption"),e[48]=g,e[49]=_t):_t=e[49];let te;e[50]===Symbol.for("react.memo_cache_sentinel")?(te=s.jsx(Bo,{}),e[50]=te):te=e[50];let Lt;e[51]!==N||e[52]!==ve||e[53]!==we||e[54]!==_t?(Lt=s.jsx(K,{size:ve,variant:"subtle",onClick:N,disabled:we,title:_t,children:te}),e[51]=N,e[52]=ve,e[53]=we,e[54]=_t,e[55]=Lt):Lt=e[55];let Et;e[56]!==It||e[57]!==Lt?(Et=s.jsxs(it,{gap:4,wrap:"nowrap",children:[It,Lt]}),e[56]=It,e[57]=Lt,e[58]=Et):Et=e[58];let Tt;e[59]!==kt||e[60]!==Et?(Tt=s.jsx(bt.Target,{children:s.jsxs(wt,{w:"100%",children:[kt,Et]})}),e[59]=kt,e[60]=Et,e[61]=Tt):Tt=e[61];let At;if(e[62]!==A||e[63]!==U||e[64]!==i||e[65]!==p||e[66]!==n){let $;e[68]!==A||e[69]!==U||e[70]!==p||e[71]!==n?($=xt=>s.jsx(As,{selectedValue:n,option:xt,size:p,canDelete:A,onDelete:U},xt.value),e[68]=A,e[69]=U,e[70]=p,e[71]=n,e[72]=$):$=e[72],At=i.map($),e[62]=A,e[63]=U,e[64]=i,e[65]=p,e[66]=n,e[67]=At}else At=e[67];let Ot;e[73]!==At?(Ot=s.jsx(bt.Options,{children:At}),e[73]=At,e[74]=Ot):Ot=e[74];let Ht;e[75]!==be||e[76]!==C||e[77]!==j?(Ht=s.jsx(bt.Footer,{className:mt.footer,children:s.jsx(Hs,{isAdding:C,value:j,onChange:S,onStartAdd:ao,onConfirm:be,onCancel:co})}
1),e[75]=be,e[76]=C,e[77]=j,e[78]=Ht):Ht=e[78];let Pt;e[79]!==u||e[80]!==Ot||e[81]!==Ht?(Pt=s.jsxs(bt.Dropdown,{ref:u,children:[Ot,Ht]}),e[79]=u,e[80]=Ot,e[81]=Ht,e[82]=Pt):Pt=e[82];let ee;return e[83]!==R||e[84]!==St||e[85]!==Tt||e[86]!==Pt?(ee=s.jsxs(bt,{store:R,onOptionSubmit:St,children:[Tt,Pt]}),e[83]=R,e[84]=St,e[85]=Tt,e[86]=Pt,e[87]=ee):ee=e[87],ee}var Ct={root:"m_dd3f7539",Typography:"m_f2016866",content:"m_c2204cc2",linkEditorDropdown:"m_8a991b4f",control:"m_c2207da6",controlIcon:"m_9cdfeb3f",controlsGroup:"m_2ab47ef2",linkEditor:"m_b67b711e",linkEditorInput:"m_296cf94c",linkEditorExternalControl:"m_cfef614",linkEditorSave:"m_3b28e7bb",toolbar:"m_4574a3c4",taskList:"m_8b44009a"};const zs={linkControlLabel:"Link",colorPickerControlLabel:"Text color",highlightControlLabel:"Highlight text",colorControlLabel:t=>`Set text color ${t}`,boldControlLabel:"Bold",italicControlLabel:"Italic",underlineControlLabel:"Underline",strikeControlLabel:"Strikethrough",clearFormattingControlLabel:"Clear formatting",unlinkControlLabel:"Remove link",bulletListControlLabel:"Bullet list",orderedListControlLabel:"Ordered list",sourceCodeControlLabel:"Switch between text/source code",h1ControlLabel:"Heading 1",h2ControlLabel:"Heading 2",h3ControlLabel:"Heading 3",h4ControlLabel:"Heading 4",h5ControlLabel:"Heading 5",h6ControlLabel:"Heading 6",blockquoteControlLabel:"Blockquote",alignLeftControlLabel:"Align text: left",alignCenterControlLabel:"Align text: center",alignRightControlLabel:"Align text: right",alignJustifyControlLabel:"Align text: justify",codeControlLabel:"Code",codeBlockControlLabel:"Code block",subscriptControlLabel:"Subscript",superscriptControlLabel:"Superscript",unsetColorControlLabel:"Unset color",hrControlLabel:"Horizontal line",undoControlLabel:"Undo",redoControlLabel:"Redo",tasksControlLabel:"Task list",tasksSinkLabel:"Decrease task level",tasksLiftLabel:"Increase task level",linkEditorInputLabel:"Enter URL",linkEditorInputPlaceholder:"https://example.com/",linkEditorExternalLink:"Open link in a new tab",linkEditorInternalLink:"Open link in the same tab",linkEditorSave:"Save",colorPickerCancel:"Cancel",colorPickerClear:"Clear color",colorPickerColorPicker:"Color picker",colorPickerPalette:"Color palette",colorPickerSave:"Save",colorPickerColorLabel:t=>`Set text color ${t}`},[Ds,F]=mo("RichTextEditor component was not found in tree"),Oe=Ft(t=>{const{classNames:e,className:n,style:o,styles:i,vars:r,...l}=ht("RichTextEditorContent",null,t),a=F();return a.withTypographyStyles?s.jsx(go,{...a.getStyles("Typography",{className:n,style:o,styles:i,classNames:e}),unstyled:a.unstyled,children:s.jsx(wt,{component:Xe,editor:a.editor,...a.getStyles("content",{classNames:e,styles:i}),...l})}):s.jsx(wt,{component:Xe,editor:a.editor,...a.getStyles("content",{classNames:e,styles:i,className:n,style:o}),...l})});Oe.classes=Ct;Oe.displayName="@mantine/tiptap/RichTextEditorContent";const Ns={interactive:!0},jt=Ft(t=>{const{classNames:e,className:n,style:o,styles:i,vars:r,interactive:l,active:a,onMouseDown:c,disabled:d,...h}=ht("RichTextEditorControl",Ns,t),u=F();return s.jsx(fn,{...h,...u.getStyles("control",{className:n,style:o,classNames:e,styles:i}),disabled:d,"data-rich-text-editor-control":!0,tabIndex:l?0:-1,"data-interactive":l||void 0,"data-disabled":d||void 0,"data-active":a||void 0,"aria-pressed":a&&l||void 0,"aria-hidden":!l||void 0,unstyled:u.unstyled,variant:u.variant||"default",onMouseDown:f=>{f.preventDefault(),c?.(f)}})});jt.classes=Ct;jt.displayName="@mantine/tiptap/RichTextEditorControl";function He({className:t,icon:e,...n}){const o=F();return s.jsx(jt,{...n,children:s.jsx(e,{...o.getStyles("controlIcon")})})}He.displayName="@mantine/tiptap/RichTextEditorControlBase";function P({label:t,isActive:e,operation:n,icon:o,isDisabled:i}){const r=l=>{const{editor:a,labels:c}=F(),d=c[t],h=yt({editor:a??null,selector:p=>{const m=p.editor&&!p.editor.isDestroyed?p.editor:null;return{active:m&&e?.name?m.isActive(e.name,e.attributes):!1,disabled:m?i?.(m)??!1:!0}}}),u=h?.active??!1,f=h?.disabled??!0;return s.jsx(He,{"aria-label":d,title:d,active:u,icon:l.icon||o,disabled:f,...l,onClick:()=>{!a||a.isDestroyed||a.chain().focus()[n.name](n.attributes).run()}})};return r.displayName=`@mantine/tiptap/${t}`,r}function O(t){return s.jsx("svg",{...t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})}function $s(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M7 5h6a3.5 3.5 0 0 1 0 7h-6z"}),s.jsx("path",{d:"M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7"})]})}function Bs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M11 5l6 0"}),s.jsx("path",{d:"M7 19l6 0"}),s.jsx("path",{d:"M14 5l-4 14"})]})}function Us(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M7 5v5a5 5 0 0 0 10 0v-5"}),s.jsx("path",{d:"M5 19h14"})]})}function Fs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M5 12l14 0"}),s.jsx("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})]})}function Vs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M17 15l4 4m0 -4l-4 4"}),s.jsx("path",{d:"M7 6v-1h11v1"}),s.jsx("path",{d:"M7 19l4 0"}),s.jsx("path",{d:"M13 5l-4 14"})]})}function Ws(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M19 18v-8l-2 2"}),s.jsx("path",{d:"M4 6v12"}),s.jsx("path",{d:"M12 6v12"}),s.jsx("path",{d:"M11 18h2"}),s.jsx("path",{d:"M3 18h2"}),s.jsx("path",{d:"M4 12h8"}),s.jsx("path",{d:"M3 6h2"}),s.jsx("path",{d:"M11 6h2"})]})}function Ks(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M17 12a2 2 0 1 1 4 0c0 .591 -.417 1.318 -.816 1.858l-3.184 4.143l4 0"}),s.jsx("path",{d:"M4 6v12"}),s.jsx("path",{d:"M12 6v12"}),s.jsx("path",{d:"M11 18h2"}),s.jsx("path",{d:"M3 18h2"}),s.jsx("path",{d:"M4 12h8"}),s.jsx("path",{d:"M3 6h2"}),s.jsx("path",{d:"M11 6h2"})]})}function qs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M19 14a2 2 0 1 0 -2 -2"}),s.jsx("path",{d:"M17 16a2 2 0 1 0 2 -2"}),s.jsx("path",{d:"M4 6v12"}),s.jsx("path",{d:"M12 6v12"}),s.jsx("path",{d:"M11 18h2"}),s.jsx("path",{d:"M3 18h2"}),s.jsx("path",{d:"M4 12h8"}),s.jsx("path",{d:"M3 6h2"}),s.jsx("path",{d:"M11 6h2"})]})}function Gs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M20 18v-8l-4 6h5"}),s.jsx("path",{d:"M4 6v12"}),s.jsx("path",{d:"M12 6v12"}),s.jsx("path",{d:"M11 18h2"}),s.jsx("path",{d:"M3 18h2"}),s.jsx("path",{d:"M4 12h8"}),s.jsx("path",{d:"M3 6h2"}),s.jsx("path",{d:"M11 6h2"})]})}function Js(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M17 18h2a2 2 0 1 0 0 -4h-2v-4h4"}),s.jsx("path",{d:"M4 6v12"}),s.jsx("path",{d:"M12 6v12"}),s.jsx("path",{d:"M11 18h2"}),s.jsx("path",{d:"M3 18h2"}),s.jsx("path",{d:"M4 12h8"}),s.jsx("path",{d:"M3 6h2"}),s.jsx("path",{d:"M11 6h2"})]})}function Xs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M19 14a2 2 0 1 0 0 4a2 2 0 0 0 0 -4z"}),s.jsx("path",{d:"M21 12a2 2 0 1 0 -4 0v4"}),s.jsx("path",{d:"M4 6v12"}),s.jsx("path",{d:"M12 6v12"}),s.jsx("path",{d:"M11 18h2"}),s.jsx("path",{d:"M3 18h2"}),s.jsx("path",{d:"M4 12h8"}),s.jsx("path",{d:"M3 6h2"}),s.jsx("path",{d:"M11 6h2"})]})}function Ys(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M9 6l11 0"}),s.jsx("path",{d:"M9 12l11 0"}),s.jsx("path",{d:"M9 18l11 0"}),s.jsx("path",{d:"M5 6l0 .01"}),s.jsx("path",{d:"M5 12l0 .01"}),s.jsx("path",{d:"M5 18l0 .01"})]})}function Qs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M11 6h9"}),s.jsx("path",{d:"M11 12h9"}),s.jsx("path",{d:"M12 18h8"}),s.jsx("path",{d:"M4 16a2 2 0 1 1 4 0c0 .591 -.5 1 -1 1.5l-3 2.5h4"}),s.jsx("path",{d:"M6 10v-6l-2 2"})]})}function Zs(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M17 22v-2"}),s.jsx("path",{d:"M9 15l6 -6"}),s.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),s.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"}),s.jsx("path",{d:"M20 17h2"}),s.jsx("path",{d:"M2 7h2"}),s.jsx("path",{d:"M7 2v2"})]})}function ti(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M6 15h15"}),s.jsx("path",{d:"M21 19h-15"}),s.jsx("path",{d:"M15 11h6"}),s.jsx("path",{d:"M21 7h-6"}),s.jsx("path",{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"}),s.jsx("path",{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"})]})}function ei(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M4 6l16 0"}),s.jsx("path",{d:"M4 12l10 0"}),s.jsx("path",{d:"M4 18l14 0"})]})}function ni(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M4 6l16 0"}),s.jsx("path",{d:"M10 12l10 0"}),s.jsx("path",{d:"M6 18l14 0"})]})}function oi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M4 6l16 0"}),s.jsx("path",{d:"M8 12l8 0"}),s.jsx("path",{d:"M6 18l12 0"})]})}function si(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M4 6l16 0"}),s.jsx("path",{d:"M4 12l16 0"}),s.jsx("path",{d:"M4 18l12 0"})]})}function ii(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),s.jsx("path",{d:"M21 20h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function li(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M5 7l8 10m-8 0l8 -10"}),s.jsx("path",{d:"M21 11h-4l3.5 -4a1.73 1.73 0 0 0 -3.5 -2"})]})}function An(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M7 8l-4 4l4 4"}),s.jsx("path",{d:"M17 8l4 4l-4 4"}),s.jsx("path",{d:"M14 4l-4 16"})]})}function ri(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M3 19h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),s.jsx("path",{d:"M12.5 5.5l4 4"}),s.jsx("path",{d:"M4.5 13.5l4 4"}),s.jsx("path",{d:"M21 15v4h-8l4 -4z"})]})}function ai(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M5 12h2"}),s.jsx("path",{d:"M17 12h2"}),s.jsx("path",{d:"M11 12h2"})]})}function On(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M20.042 16.045a9 9 0 0 0 -12.087 -12.087m-2.318 1.677a9 9 0 1 0 12.725 12.73"}),s.jsx("path",{d:"M3 3l18 18"})]})}function ci(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M11 7l6 6"}),s.jsx("path",{d:"M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z"})]})}function di(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M18 6l-12 12"}),s.jsx("path",{d:"M6 6l12 12"})]})}function hi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25"}),s.jsx("path",{d:"M8.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),s.jsx("path",{d:"M12.5 7.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"}),s.jsx("path",{d:"M16.5 10.5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"})]})}function ui(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M5 12l5 5l10 -10"})]})}function fi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M9 15l6 -6"}),s.jsx("path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464"}),s.jsx("path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463"})]})}function pi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6"}),s.jsx("path",{d:"M11 13l9 -9"}),s.jsx("path",{d:"M15 4h5v5"})]})}function mi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M9 14l-4 -4l4 -4"}),s.jsx("path",{d:"M5 10h11a4 4 0 1 1 0 8h-1"})]})}function gi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M15 14l4 -4l-4 -4"}),s.jsx("path",{d:"M19 10h-11a4 4 0 1 0 0 8h1"})]})}function xi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M3.5 5.5l1.5 1.5l2.5 -2.5"}),s.jsx("path",{d:"M3.5 11.5l1.5 1.5l2.5 -2.5"}),s.jsx("path",{d:"M3.5 17.5l1.5 1.5l2.5 -2.5"}),s.jsx("path",{d:"M11 6l9 0"}),s.jsx("path",{d:"M11 12l9 0"}),s.jsx("path",{d:"M11 18l9 0"})]})}function bi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M20 6l-11 0"}),s.jsx("path",{d:"M20 12l-7 0"}),s.jsx("path",{d:"M20 18l-11 0"}),s.jsx("path",{d:"M4 8l4 4l-4 4"})]})}function vi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:"M20 6l-7 0"}),s.jsx("path",{d:"M20 12l-9 0"}),s.jsx("path",{d:"M20 18l-7 0"}),s.jsx("path",{d:"M8 8l-4 4l4 4"})]})}function wi(t){return s.jsxs(O,{...t,children:[s.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),s.jsx("path",{d:`M19 3v16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7.914 2 a1 1 0 0 1 .293-.707l3.914-3.914A1 1 0 0 1 9.914 3H18 3 a1 1 0 0 1 1 1Z`}),s.jsx("path",{d:"M10 11l-2 2 2 2"}),s.jsx("path",{d:"M14 11l2 2-2 2"})]})}const yi=P({label:"boldControlLabel",icon:t=>s.jsx($s,{...t}),isActive:{name:"bold"},operation:{name:"toggleBold"}}
3),Ci=P({label:"italicControlLabel",icon:t=>s.jsx(Bs,{...t}),isActive:{name:"italic"},operation:{name:"toggleItalic"}}),ji=P({label:"underlineControlLabel",icon:t=>s.jsx(Us,{...t}),isActive:{name:"underline"},operation:{name:"toggleUnderline"}}),Si=P({label:"strikeControlLabel",icon:t=>s.jsx(Fs,{...t}),isActive:{name:"strike"},operation:{name:"toggleStrike"}}),ki=P({label:"clearFormattingControlLabel",icon:t=>s.jsx(Vs,{...t}),operation:{name:"unsetAllMarks"}}),Mi=P({label:"unlinkControlLabel",icon:t=>s.jsx(Zs,{...t}),operation:{name:"unsetLink"}}),Ri=P({label:"bulletListControlLabel",icon:t=>s.jsx(Ys,{...t}),isActive:{name:"bulletList"},operation:{name:"toggleBulletList"}}),Ii=P({label:"orderedListControlLabel",icon:t=>s.jsx(Qs,{...t}),isActive:{name:"orderedList"},operation:{name:"toggleOrderedList"}}),_i=P({label:"h1ControlLabel",icon:t=>s.jsx(Ws,{...t}),isActive:{name:"heading",attributes:{level:1}},operation:{name:"toggleHeading",attributes:{level:1}}}),Li=P({label:"h2ControlLabel",icon:t=>s.jsx(Ks,{...t}),isActive:{name:"heading",attributes:{level:2}},operation:{name:"toggleHeading",attributes:{level:2}}}),Ei=P({label:"h3ControlLabel",icon:t=>s.jsx(qs,{...t}),isActive:{name:"heading",attributes:{level:3}},operation:{name:"toggleHeading",attributes:{level:3}}}),Ti=P({label:"h4ControlLabel",icon:t=>s.jsx(Gs,{...t}),isActive:{name:"heading",attributes:{level:4}},operation:{name:"toggleHeading",attributes:{level:4}}}),Ai=P({label:"h5ControlLabel",icon:t=>s.jsx(Js,{...t}),isActive:{name:"heading",attributes:{level:5}},operation:{name:"toggleHeading",attributes:{level:5}}}),Oi=P({label:"h6ControlLabel",icon:t=>s.jsx(Xs,{...t}),isActive:{name:"heading",attributes:{level:6}},operation:{name:"toggleHeading",attributes:{level:6}}}),Hi=P({label:"blockquoteControlLabel",icon:t=>s.jsx(ti,{...t}),isActive:{name:"blockquote"},operation:{name:"toggleBlockquote"}}),Pi=P({label:"alignLeftControlLabel",icon:t=>s.jsx(ei,{...t}),operation:{name:"setTextAlign",attributes:"left"}}),zi=P({label:"alignRightControlLabel",icon:t=>s.jsx(ni,{...t}),operation:{name:"setTextAlign",attributes:"right"}}),Di=P({label:"alignCenterControlLabel",icon:t=>s.jsx(oi,{...t}),operation:{name:"setTextAlign",attributes:"center"}}),Ni=P({label:"alignJustifyControlLabel",icon:t=>s.jsx(si,{...t}),operation:{name:"setTextAlign",attributes:"justify"}}),$i=P({label:"subscriptControlLabel",icon:t=>s.jsx(ii,{...t}),isActive:{name:"subscript"},operation:{name:"toggleSubscript"}}),Bi=P({label:"superscriptControlLabel",icon:t=>s.jsx(li,{...t}),isActive:{name:"superscript"},operation:{name:"toggleSuperscript"}}),Ui=P({label:"codeControlLabel",icon:t=>s.jsx(An,{...t}),isActive:{name:"code"},operation:{name:"toggleCode"}}),Fi=P({label:"codeBlockControlLabel",icon:t=>s.jsx(An,{...t}),isActive:{name:"codeBlock"},operation:{name:"toggleCodeBlock"}}),Vi=P({label:"highlightControlLabel",icon:t=>s.jsx(ri,{...t}),isActive:{name:"highlight"},operation:{name:"toggleHighlight"}}),Wi=P({label:"hrControlLabel",icon:t=>s.jsx(ai,{...t}),operation:{name:"setHorizontalRule"}}),Ki=P({label:"unsetColorControlLabel",icon:t=>s.jsx(On,{...t}),operation:{name:"unsetColor"}}),qi=P({label:"undoControlLabel",icon:t=>s.jsx(mi,{...t}),isDisabled:t=>!t?.can().undo(),operation:{name:"undo"}}),Gi=P({label:"redoControlLabel",icon:t=>s.jsx(gi,{...t}),isDisabled:t=>!t?.can().redo(),operation:{name:"redo"}}),Ji=P({label:"tasksControlLabel",icon:t=>s.jsx(xi,{...t}),isActive:{name:"taskList"},operation:{name:"toggleTaskList"}}),Xi=P({label:"tasksSinkLabel",icon:t=>s.jsx(bi,{...t}),operation:{name:"sinkListItem",attributes:"taskItem"},isDisabled:t=>!t?.can().sinkListItem("taskItem")}),Yi=P({label:"tasksLiftLabel",icon:t=>s.jsx(vi,{...t}),operation:{name:"liftListItem",attributes:"taskItem"},isDisabled:t=>!t?.can().liftListItem("taskItem")}),Qi=t=>s.jsx(fi,{...t}),Pe=Ft(t=>{const e=ht("RichTextEditorLinkControl",null,t),{classNames:n,className:o,style:i,styles:r,vars:l,icon:a,popoverProps:c,disableTooltips:d,initialExternal:h,...u}=e,f=F(),p={classNames:n,styles:r},[m,g]=xo(""),[x,b]=E.useState(h),[v,{open:w,close:C}]=pn(!1),y=()=>{w();const _=f.editor?.getAttributes("link");g(_?.href||""),b(_?.href?_?.target==="_blank":h)},j=()=>{C(),g(""),b(h)},S=()=>{j(),m===""?f.editor?.chain().focus().extendMarkRange("link").unsetLink().run():f.editor?.chain().focus().extendMarkRange("link").setLink({href:m,target:x?"_blank":null}).run()},R=_=>{_.key==="Enter"&&(_.preventDefault(),S())};bo("edit-link",y,!1);const L=yt({editor:f.editor??null,selector:_=>_.editor&&!_.editor.isDestroyed?_.editor.isActive("link"):!1}),{resolvedClassNames:k,resolvedStyles:A}=vo({classNames:n,styles:r,props:e});return s.jsxs(J,{trapFocus:!0,shadow:"md",withinPortal:!0,opened:v,onChange:_=>!_&&j(),offset:-44,zIndex:1e4,...c,children:[s.jsx(J.Target,{children:s.jsx(He,{icon:a||Qi,...u,"aria-label":f.labels.linkControlLabel,title:f.labels.linkControlLabel,onClick:y,active:L??!1,classNames:k,styles:A,className:o,style:i,variant:f.variant})}),s.jsx(J.Dropdown,{...f.getStyles("linkEditorDropdown",p),children:s.jsxs("div",{...f.getStyles("linkEditor",p),children:[s.jsx(Ee,{placeholder:f.labels.linkEditorInputPlaceholder,"aria-label":f.labels.linkEditorInputLabel,type:"url",value:m,onChange:g,classNames:{input:f.getStyles("linkEditorInput",p).className}
3,onKeyDown:R,rightSection:s.jsx(mn,{label:x?f.labels.linkEditorExternalLink:f.labels.linkEditorInternalLink,events:{hover:!0,focus:!0,touch:!0},withinPortal:!0,withArrow:!0,disabled:d,zIndex:1e4,children:s.jsx(fn,{onClick:()=>b(_=>!_),"data-active":x||void 0,...f.getStyles("linkEditorExternalControl",p),children:s.jsx(pi,{style:{width:V(14),height:V(14)}})})})}),s.jsx(gn,{variant:"default",onClick:S,...f.getStyles("linkEditorSave",p),children:f.labels.linkEditorSave})]})})]})});Pe.classes=Ct;Pe.displayName="@mantine/tiptap/RichTextEditorLinkControl";function Hn(t){const{popoverProps:e,colors:n,colorPickerProps:o,...i}=ht("RichTextEditorColorPickerControl",null,t),{editor:r,labels:l,getStyles:a,variant:c}=F(),[d,{toggle:h,close:u}]=pn(!1),[f,p]=E.useState("palette"),m=r?.getAttributes("textStyle").color||"var(--mantine-color-text)",g=(v,w=!0)=>{r?.chain()?.focus().setColor(v).run(),w&&u()},x=()=>{r?.chain()?.focus().unsetColor().run(),u()},b=n.map((v,w)=>s.jsx(ke,{component:"button",color:v,onClick:()=>g(v),size:26,radius:"xs",style:{cursor:"pointer"},title:l.colorPickerColorLabel(v),"aria-label":l.colorPickerColorLabel(v)},w));return s.jsxs(J,{opened:d,withinPortal:!0,trapFocus:!0,onChange:v=>!v&&u(),...e,children:[s.jsx(J.Target,{children:s.jsx(jt,{...i,variant:c,"aria-label":l.colorPickerControlLabel,title:l.colorPickerControlLabel,onClick:h,children:s.jsx(ke,{color:m,size:14})})}),s.jsxs(J.Dropdown,{...a("linkEditorDropdown"),children:[f==="palette"&&s.jsx(wo,{cols:7,spacing:2,children:b}),f==="colorPicker"&&s.jsx(xn,{defaultValue:m,onChange:v=>g(v,!1),...o}),s.jsx(mn.Group,{closeDelay:200,children:s.jsxs(it,{justify:"flex-end",gap:"xs",mt:"sm",children:[f==="palette"&&s.jsx(K,{variant:"default",onClick:u,title:l.colorPickerCancel,"aria-label":l.colorPickerCancel,children:s.jsx(di,{style:{width:V(16),height:V(16)}})}),s.jsx(K,{variant:"default",onClick:x,title:l.colorPickerClear,"aria-label":l.colorPickerClear,children:s.jsx(On,{style:{width:V(16),height:V(16)}})}),f==="palette"?s.jsx(K,{variant:"default",onClick:()=>p("colorPicker"),title:l.colorPickerColorPicker,"aria-label":l.colorPickerColorPicker,children:s.jsx(ci,{style:{width:V(16),height:V(16)}})}):s.jsx(K,{variant:"default",onClick:()=>p("palette"),"aria-label":l.colorPickerPalette,title:l.colorPickerPalette,children:s.jsx(hi,{style:{width:V(16),height:V(16)}})}),f==="colorPicker"&&s.jsx(K,{variant:"default",onClick:u,title:l.colorPickerSave,"aria-label":l.colorPickerSave,children:s.jsx(ui,{style:{width:V(16),height:V(16)}})})]})})]})]})}Hn.displayName="@mantine/tiptap/ColorPickerControl";function Pn(t){const{color:e,...n}=ht("RichTextEditorColorControl",null,t),{editor:o,labels:i,variant:r}=F(),l=o?.getAttributes("textStyle").color||null,a=i.colorControlLabel(e);return s.jsx(jt,{...n,variant:r,active:l===e,"aria-label":a,title:a,onClick:()=>o?.chain()?.focus().setColor(e).run(),children:s.jsx(ke,{color:e,size:14})})}Pn.displayName="@mantine/tiptap/RichTextEditorColorControl";const Zi={};function zn(t){const{...e}=ht("RichTextEditorSourceCodeControl",Zi,t),{editor:n,labels:o,variant:i,onSourceCodeTextSwitch:r}=F(),[l,a]=E.useState(!1),c=()=>{l?n?.commands.setContent(n.getText(),{emitUpdate:!0}):n?.commands.setContent(`<textarea>${n.getHTML()}</textarea>`);const d=!l;a(d),r?.(d)};return s.jsx(jt,{...e,variant:i,active:l,"aria-label":o.sourceCodeControlLabel,title:o.sourceCodeControlLabel,onClick:()=>c(),children:s.jsx(wi,{style:{width:V(16),height:V(16)}})})}zn.displayName="@mantine/tiptap/RichTextEditorSourceCodeControl";const ze=Ft(t=>{const{classNames:e,className:n,style:o,styles:i,vars:r,variant:l,...a}=ht("RichTextEditorControlsGroup",null,t),c=F();return s.jsx(wt,{variant:l||c.variant,...c.getStyles("controlsGroup",{className:n,style:o,styles:i,classNames:e}),...a})});ze.classes=Ct;ze.displayName="@mantine/tiptap/RichTextEditorControlsGroup";const De=Ft(t=>{const{classNames:e,className:n,style:o,styles:i,vars:r,sticky:l,stickyOffset:a,mod:c,variant:d,...h}=ht("RichTextEditorToolbar",null,t),u=F();return s.jsx(wt,{mod:[{sticky:l},c],variant:d||u.variant,...u.getStyles("toolbar",{className:n,style:o,styles:i,classNames:e}),...h,__vars:{"--rte-sticky-offset":V(a)}})});De.classes=Ct;De.displayName="@mantine/tiptap/RichTextEditorToolbar";const tl={withCodeHighlightStyles:!0,withTypographyStyles:!0,variant:"default"},M=Ft(t=>{const e=ht("RichTextEditor",tl,t),{classNames:n,className:o,style:i,styles:r,unstyled:l,vars:a,editor:c,withCodeHighlightStyles:d,withTypographyStyles:h,onSourceCodeTextSwitch:u,labels:f,children:p,variant:m,attributes:g,...x}=e,b=yo({name:"RichTextEditor",classes:Ct,props:e,className:o,style:i,classNames:n,styles:r,unstyled:l,attributes:g,vars:a});return s.jsx(Ds,{value:{editor:c,getStyles:b,labels:E.useMemo(()=>({...zs,...f}),[f]),withCodeHighlightStyles:d,withTypographyStyles:h,onSourceCodeTextSwitch:u,unstyled:l,variant:m},children:s.jsx(wt,{...b("root"),...x,children:p})})});M.classes=Ct;M.displayName="@mantine/tiptap/RichTextEditor";M.Content=Oe;M.Control=jt;M.Toolbar=De;M.ControlsGroup=ze;M.Bold=yi;M.Italic=Ci;M.Strikethrough=Si;M.Underline=ji;M.ClearFormatting=ki;M.H1=_i;M.H2=Li;M.H3=Ei;M.H4=Ti;M.H5=Ai;M.H6=Oi;M.BulletList=Ri;M.OrderedList=Ii;M.Link=Pe;M.Unlink=Mi;M.Blockquote=Hi;M.AlignLeft=Pi;M.AlignRight=zi;M.AlignCenter=Di;M.AlignJustify=Ni;M.Superscript=Bi;M.Subscript=$i;M.Code=Ui;M.CodeBlock=Fi;M.ColorPicker=Hn;M.Color=Pn;M.Highlight=Vi;M.Hr=Wi;M.UnsetColor=Ki;M.Undo=qi;M.Redo=Gi;M.TaskList=Ji;M.TaskListSink=Xi;M.TaskListLift=Yi;M.SourceCode=zn;const Dn=["top","right","bottom","left"],Ye=["start","end"],Qe=Dn.reduce((t,e)=>t.concat(e,e+"-"+Ye[0],e+"-"+Ye[1]),[]),lt=Math.min,W=Math.max,he=Math.round,ot=t=>({x:t,y:t}
3),el={left:"right",right:"left",bottom:"top",top:"bottom"},nl={start:"end",end:"start"};function Me(t,e,n){return W(t,lt(e,n))}function ut(t,e){return typeof t=="function"?t(e):t}function X(t){return t.split("-")[0]}function Y(t){return t.split("-")[1]}function Nn(t){return t==="x"?"y":"x"}function Ne(t){return t==="y"?"height":"width"}const ol=new Set(["top","bottom"]);function nt(t){return ol.has(X(t))?"y":"x"}function $e(t){return Nn(nt(t))}function $n(t,e,n){n===void 0&&(n=!1);const o=Y(t),i=$e(t),r=Ne(i);let l=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(l=fe(l)),[l,fe(l)]}function sl(t){const e=fe(t);return[ue(t),e,ue(e)]}function ue(t){return t.replace(/start|end/g,e=>nl[e])}const Ze=["left","right"],tn=["right","left"],il=["top","bottom"],ll=["bottom","top"];function rl(t,e,n){switch(t){case"top":case"bottom":return n?e?tn:Ze:e?Ze:tn;case"left":case"right":return e?il:ll;default:return[]}}function al(t,e,n,o){const i=Y(t);let r=rl(X(t),n==="start",o);return i&&(r=r.map(l=>l+"-"+i),e&&(r=r.concat(r.map(ue)))),r}function fe(t){return t.replace(/left|right|bottom|top/g,e=>el[e])}function cl(t){return{top:0,right:0,bottom:0,left:0,...t}}function Be(t){return typeof t!="number"?cl(t):{top:t,right:t,bottom:t,left:t}}function $t(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function en(t,e,n){let{reference:o,floating:i}=t;const r=nt(e),l=$e(e),a=Ne(l),c=X(e),d=r==="y",h=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,f=o[a]/2-i[a]/2;let p;switch(c){case"top":p={x:h,y:o.y-i.height};break;case"bottom":p={x:h,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:u};break;case"left":p={x:o.x-i.width,y:u};break;default:p={x:o.x,y:o.y}}switch(Y(e)){case"start":p[l]-=f*(n&&d?-1:1);break;case"end":p[l]+=f*(n&&d?-1:1);break}return p}const dl=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,a=r.filter(Boolean),c=await(l.isRTL==null?void 0:l.isRTL(e));let d=await l.getElementRects({reference:t,floating:e,strategy:i}),{x:h,y:u}=en(d,o,c),f=o,p={},m=0;for(let g=0;g<a.length;g++){const{name:x,fn:b}=a[g],{x:v,y:w,data:C,reset:y}=await b({x:h,y:u,initialPlacement:o,placement:f,strategy:i,middlewareData:p,rects:d,platform:l,elements:{reference:t,floating:e}});h=v??h,u=w??u,p={...p,[x]:{...p[x],...C}},y&&m<=50&&(m++,typeof y=="object"&&(y.placement&&(f=y.placement),y.rects&&(d=y.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:i}):y.rects),{x:h,y:u}=en(d,f,c)),g=-1)}return{x:h,y:u,placement:f,strategy:i,middlewareData:p}};async function Bt(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:l,elements:a,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:f=!1,padding:p=0}=ut(e,t),m=Be(p),x=a[f?u==="floating"?"reference":"floating":u],b=$t(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(x)))==null||n?x:x.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(a.floating)),boundary:d,rootBoundary:h,strategy:c})),v=u==="floating"?{x:o,y:i,width:l.floating.width,height:l.floating.height}:l.reference,w=await(r.getOffsetParent==null?void 0:r.getOffsetParent(a.floating)),C=await(r.isElement==null?void 0:r.isElement(w))?await(r.getScale==null?void 0:r.getScale(w))||{x:1,y:1}:{x:1,y:1},y=$t(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:w,strategy:c}):v);return{top:(b.top-y.top+m.top)/C.y,bottom:(y.bottom-b.bottom+m.bottom)/C.y,left:(b.left-y.left+m.left)/C.x,right:(y.right-b.right+m.right)/C.x}}const hl=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:l,elements:a,middlewareData:c}=e,{element:d,padding:h=0}=ut(t,e)||{};if(d==null)return{};const u=Be(h),f={x:n,y:o},p=$e(i),m=Ne(p),g=await l.getDimensions(d),x=p==="y",b=x?"top":"left",v=x?"bottom":"right",w=x?"clientHeight":"clientWidth",C=r.reference[m]+r.reference[p]-f[p]-r.floating[m],y=f[p]-r.reference[p],j=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let S=j?j[w]:0;(!S||!await(l.isElement==null?void 0:l.isElement(j)))&&(S=a.floating[w]||r.floating[m]);const R=C/2-y/2,L=S/2-g[m]/2-1,k=lt(u[b],L),A=lt(u[v],L),_=k,N=S-g[m]-A,H=S/2-g[m]/2+R,I=Me(_,H,N),T=!c.arrow&&Y(i)!=null&&H!==I&&r.reference[m]/2-(H<_?k:A)-g[m]/2<0,D=T?H<_?H-_:H-N:0;return{[p]:f[p]+D,data:{[p]:I,centerOffset:H-I-D,...T&&{alignmentOffset:D}},reset:T}}});function ul(t,e,n){return(t?[...n.filter(i=>Y(i)===t),...n.filter(i=>Y(i)!==t)]:n.filter(i=>X(i)===i)).filter(i=>t?Y(i)===t||(e?ue(i)!==i:!1):!0)}const fl=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,o,i;const{rects:r,middlewareData:l,placement:a,platform:c,elements:d}=e,{crossAxis:h=!1,alignment:u,allowedPlacements:f=Qe,autoAlignment:p=!0,...m}=ut(t,e),g=u!==void 0||f===Qe?ul(u||null,p,f):f,x=await Bt(e,m),b=((n=l.autoPlacement)==null?void 0:n.index)||0,v=g[b];if(v==null)return{};const w=$n(v,r,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(a!==v)return{reset:{placement:g[0]}};const C=[x[X(v)],x[w[0]],x[w[1]]],y=[...((o=l.autoPlacement)==null?void 0:o.overflows)||[],{placement:v,overflows:C}],j=g[b+1];if(j)return{data:{index:b+1,overflows:y},reset:{placement:j}};const S=y.map(k=>{const A=Y(k.placement);return[k.placement,A&&h?k.overflows.slice(0,2).reduce((_,N)=>
3_+N,0):k.overflows[0],k.overflows]}).sort((k,A)=>k[1]-A[1]),L=((i=S.filter(k=>k[2].slice(0,Y(k[0])?2:3).every(A=>A<=0))[0])==null?void 0:i[0])||S[0][0];return L!==a?{data:{index:b+1,overflows:y},reset:{placement:L}}:{}}}},pl=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:a,platform:c,elements:d}=e,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...x}=ut(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const b=X(i),v=nt(a),w=X(a)===a,C=await(c.isRTL==null?void 0:c.isRTL(d.floating)),y=f||(w||!g?[fe(a)]:sl(a)),j=m!=="none";!f&&j&&y.push(...al(a,g,m,C));const S=[a,...y],R=await Bt(e,x),L=[];let k=((o=r.flip)==null?void 0:o.overflows)||[];if(h&&L.push(R[b]),u){const H=$n(i,l,C);L.push(R[H[0]],R[H[1]])}if(k=[...k,{placement:i,overflows:L}],!L.every(H=>H<=0)){var A,_;const H=(((A=r.flip)==null?void 0:A.index)||0)+1,I=S[H];if(I&&(!(u==="alignment"?v!==nt(I):!1)||k.every(z=>nt(z.placement)===v?z.overflows[0]>0:!0)))return{data:{index:H,overflows:k},reset:{placement:I}};let T=(_=k.filter(D=>D.overflows[0]<=0).sort((D,z)=>D.overflows[1]-z.overflows[1])[0])==null?void 0:_.placement;if(!T)switch(p){case"bestFit":{var N;const D=(N=k.filter(z=>{if(j){const U=nt(z.placement);return U===v||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,pt)=>U+pt,0)]).sort((z,U)=>z[1]-U[1])[0])==null?void 0:N[0];D&&(T=D);break}case"initialPlacement":T=a;break}if(i!==T)return{reset:{placement:T}}}return{}}}};function nn(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function on(t){return Dn.some(e=>t[e]>=0)}const ml=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...i}=ut(t,e);switch(o){case"referenceHidden":{const r=await Bt(e,{...i,elementContext:"reference"}),l=nn(r,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:on(l)}}}case"escaped":{const r=await Bt(e,{...i,altBoundary:!0}),l=nn(r,n.floating);return{data:{escapedOffsets:l,escaped:on(l)}}}default:return{}}}}};function Bn(t){const e=lt(...t.map(r=>r.left)),n=lt(...t.map(r=>r.top)),o=W(...t.map(r=>r.right)),i=W(...t.map(r=>r.bottom));return{x:e,y:n,width:o-e,height:i-n}}function gl(t){const e=t.slice().sort((i,r)=>i.y-r.y),n=[];let o=null;for(let i=0;i<e.length;i++){const r=e[i];!o||r.y-o.y>o.height/2?n.push([r]):n[n.length-1].push(r),o=r}return n.map(i=>$t(Bn(i)))}const xl=function(t){return t===void 0&&(t={}),{name:"inline",options:t,async fn(e){const{placement:n,elements:o,rects:i,platform:r,strategy:l}=e,{padding:a=2,x:c,y:d}=ut(t,e),h=Array.from(await(r.getClientRects==null?void 0:r.getClientRects(o.reference))||[]),u=gl(h),f=$t(Bn(h)),p=Be(a);function m(){if(u.length===2&&u[0].left>u[1].right&&c!=null&&d!=null)return u.find(x=>c>x.left-p.left&&c<x.right+p.right&&d>x.top-p.top&&d<x.bottom+p.bottom)||f;if(u.length>=2){if(nt(n)==="y"){const k=u[0],A=u[u.length-1],_=X(n)==="top",N=k.top,H=A.bottom,I=_?k.left:A.left,T=_?k.right:A.right,D=T-I,z=H-N;return{top:N,bottom:H,left:I,right:T,width:D,height:z,x:I,y:N}}const x=X(n)==="left",b=W(...u.map(k=>k.right)),v=lt(...u.map(k=>k.left)),w=u.filter(k=>x?k.left===v:k.right===b),C=w[0].top,y=w[w.length-1].bottom,j=v,S=b,R=S-j,L=y-C;return{top:C,bottom:y,left:j,right:S,width:R,height:L,x:j,y:C}}return f}const g=await r.getElementRects({reference:{getBoundingClientRect:m},floating:o.floating,strategy:l});return i.reference.x!==g.reference.x||i.reference.y!==g.reference.y||i.reference.width!==g.reference.width||i.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},bl=new Set(["left","top"]);async function vl(t,e){const{placement:n,platform:o,elements:i}=t,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),l=X(n),a=Y(n),c=nt(n)==="y",d=bl.has(l)?-1:1,h=r&&c?-1:1,u=ut(e,t);let{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}
vendor: 8,362 bytes, line 3
3:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof m=="number"&&(p=a==="end"?m*-1:m),c?{x:p*h,y:f*d}:{x:f*d,y:p*h}}const wl=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:l,middlewareData:a}=e,c=await vl(e,t);return l===((n=a.offset)==null?void 0:n.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:i+c.x,y:r+c.y,data:{...c,placement:l}}}}},yl=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:l=!1,limiter:a={fn:x=>{let{x:b,y:v}=x;return{x:b,y:v}}},...c}=ut(t,e),d={x:n,y:o},h=await Bt(e,c),u=nt(X(i)),f=Nn(u);let p=d[f],m=d[u];if(r){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",v=p+h[x],w=p-h[b];p=Me(v,p,w)}if(l){const x=u==="y"?"top":"left",b=u==="y"?"bottom":"right",v=m+h[x],w=m-h[b];m=Me(v,m,w)}const g=a.fn({...e,[f]:p,[u]:m});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[f]:r,[u]:l}}}}}},Cl=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:i,rects:r,platform:l,elements:a}=e,{apply:c=()=>{},...d}=ut(t,e),h=await Bt(e,d),u=X(i),f=Y(i),p=nt(i)==="y",{width:m,height:g}=r.floating;let x,b;u==="top"||u==="bottom"?(x=u,b=f===(await(l.isRTL==null?void 0:l.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,x=f==="end"?"top":"bottom");const v=g-h.top-h.bottom,w=m-h.left-h.right,C=lt(g-h[x],v),y=lt(m-h[b],w),j=!e.middlewareData.shift;let S=C,R=y;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(R=w),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(S=v),j&&!f){const k=W(h.left,0),A=W(h.right,0),_=W(h.top,0),N=W(h.bottom,0);p?R=m-2*(k!==0||A!==0?k+A:W(h.left,h.right)):S=g-2*(_!==0||N!==0?_+N:W(h.top,h.bottom))}await c({...e,availableWidth:R,availableHeight:S});const L=await l.getDimensions(a.floating);return m!==L.width||g!==L.height?{reset:{rects:!0}}:{}}}};function pe(){return typeof window<"u"}function Vt(t){return Un(t)?(t.nodeName||"").toLowerCase():"#document"}function G(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ft(t){var e;return(e=(Un(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Un(t){return pe()?t instanceof Node||t instanceof G(t).Node:!1}function Q(t){return pe()?t instanceof Element||t instanceof G(t).Element:!1}function rt(t){return pe()?t instanceof HTMLElement||t instanceof G(t).HTMLElement:!1}function sn(t){return!pe()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof G(t).ShadowRoot}const jl=new Set(["inline","contents"]);function Xt(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=Z(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!jl.has(i)}const Sl=new Set(["table","td","th"]);function kl(t){return Sl.has(Vt(t))}const Ml=[":popover-open",":modal"];function me(t){return Ml.some(e=>{try{return t.matches(e)}catch{return!1}})}const Rl=["transform","translate","scale","rotate","perspective"],Il=["transform","translate","scale","rotate","perspective","filter"],_l=["paint","layout","strict","content"];function Ue(t){const e=Fe(),n=Q(t)?Z(t):t;return Rl.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||Il.some(o=>(n.willChange||"").includes(o))||_l.some(o=>(n.contain||"").includes(o))}function Ll(t){let e=gt(t);for(;rt(e)&&!Ut(e);){if(Ue(e))return e;if(me(e))return null;e=gt(e)}return null}function Fe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const El=new Set(["html","body","#document"]);function Ut(t){return El.has(Vt(t))}function Z(t){return G(t).getComputedStyle(t)}function ge(t){return Q(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function gt(t){if(Vt(t)==="html")return t;const e=t.assignedSlot||t.parentNode||sn(t)&&t.host||ft(t);return sn(e)?e.host:e}function Fn(t){const e=gt(t);return Ut(e)?t.ownerDocument?t.ownerDocument.body:t.body:rt(e)&&Xt(e)?e:Fn(e)}function Vn(t,e,n){var o;e===void 0&&(e=[]);const i=Fn(t),r=i===((o=t.ownerDocument)==null?void 0:o.body),l=G(i);return r?(Re(l),e.concat(l,l.visualViewport||[],Xt(i)?i:[],[])):e.concat(i,Vn(i,[]))}function Re(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Wn(t){const e=Z(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=rt(t),r=i?t.offsetWidth:n,l=i?t.offsetHeight:o,a=he(n)!==r||he(o)!==l;return a&&(n=r,o=l),{width:n,height:o,$:a}}function Kn(t){return Q(t)?t:t.contextElement}function Dt(t){const e=Kn(t);if(!rt(e))return ot(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=Wn(e);let l=(r?he(n.width):n.width)/o,a=(r?he(n.height):n.height)/i;return(!l||!Number.isFinite(l))&&(l=1),(!a||!Number.isFinite(a))&&(a=1),{x:l,y:a}}const Tl=ot(0);function qn(t){const e=G(t);return!Fe()||!e.visualViewport?Tl:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Al(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==G(t)?!1:e}function Gt(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=Kn(t);let l=ot(1);e&&(o?Q(o)&&(l=Dt(o)):l=Dt(t));const a=Al(r,n,o)?qn(r):ot(0);let c=(i.left+a.x)/l.x,d=(i.top+a.y)/l.y,h=i.width/l.x,u=i.height/l.y;if(r){const f=G(r),p=o&&Q(o)?G(o):o;let m=f,g=Re(m);for(;g&&o&&p!==m;){const x=Dt(g),b=g.getBoundingClientRect(),v=Z(g),w=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*x.x,C=b.top+(g.clientTop+parseFloat(v.paddingTop))*x.y;c*=x.x,d*=x.y,h*=x.x,u*=x.y,c+=w,d+=C,m=G(g),g=Re(m)}}return $t({width:h,height:u,x:c,y:d})}function xe(t,e){const n=ge(t).scrollLeft;return e?e.left+n:Gt(ft(t)).left+n}function Gn(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-xe(t,n),i=n.top+e.scrollTop;return{x:o,y:i}}function Ol(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r=i==="fixed",l=ft(o),a=e?me(e.floating):!1;if(o===l||a&&r)return n;let c={scrollLeft:0,scrollTop:0},d=ot(1);const h=ot(0),u=rt(o);if((u||!u&&!r)&&((Vt(o)!=="body"||Xt(l))&&(c=ge(o)),rt(o))){const p=Gt(o);d=Dt(o),h.x=p.x+o.clientLeft,h.y=p.y+o.clientTop}const f=l&&!u&&!r?Gn(l,c):ot(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+h.x+f.x,y:n.y*d.y-c.scrollTop*d.y+h.y+f.y}}function Hl(t){return Array.from(t.getClientRects())}function Pl(t){const e=ft(t),n=ge(t),o=t.ownerDocument.body,i=W(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=W(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+xe(t);const a=-n.scrollTop;return Z(o).direction==="rtl"&&(l+=W(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:l,y:a}}const ln=25;function zl(t,e){const n=G(t),o=ft(t),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,a=0,c=0;if(i){r=i.width,l=i.height;const h=Fe();(!h||h&&e==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}const d=xe(o);if(d<=0){const h=o.ownerDocument,u=h.body,f=getComputedStyle(u),p=h.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,m=Math.abs(o.clientWidth-u.clientWidth-p);m<=ln&&(r-=m)}else d<=ln&&(r+=d);return{width:r,height:l,x:a,y:c}}const Dl=new Set(["absolute","fixed"]);function Nl(t,e){const n=Gt(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=rt(t)?Dt(t):ot(1),l=t.clientWidth*r.x,a=t.clientHeight*r.y,c=i*r.x,d=o*r.y;return{width:l,height:a,x:c,y:d}}function rn(t,e,n){let o;if(e==="viewport")o=zl(t,n);else if(e==="document")o=Pl(ft(t));else if(Q(e))o=Nl(e,n);else{const i=qn(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return $t(o)}function Jn(t,e){const n=gt(t);return n===e||!Q(n)||Ut(n)?!1:Z(n).position==="fixed"||Jn(n,e)}function $l(t,e){const n=e.get(t);if(n)return n;let o=Vn(t,[]).filter(a=>Q(a)&&Vt(a)!=="body"),i=null;const r=Z(t).position==="fixed";let l=r?gt(t):t;for(;Q(l)&&!Ut(l);){const a=Z(l),c=Ue(l);!c&&a.position==="fixed"&&(i=null),(r?!c&&!i:!c&&a.position==="static"&&!!i&&Dl.has(i.position)||Xt(l)&&!c&&Jn(t,l))?o=o.filter(h=>h!==l):i=a,l=gt(l)}return e.set(t,o),o}function Bl(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const l=[...n==="clippingAncestors"?me(e)?[]:$l(e,this._c):[].concat(n),o],a=l[0],c=l.reduce((d,h)=>{const u=rn(e,h,i);return d.top=W(u.top,d.top),d.right=lt(u.right,d.right),d.bottom=lt(u.bottom,d.bottom),d.left
3=W(u.left,d.left),d},rn(e,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ul(t){const{width:e,height:n}=Wn(t);return{width:e,height:n}}function Fl(t,e,n){const o=rt(e),i=ft(e),r=n==="fixed",l=Gt(t,!0,r,e);let a={scrollLeft:0,scrollTop:0};const c=ot(0);function d(){c.x=xe(i)}if(o||!o&&!r)if((Vt(e)!=="body"||Xt(i))&&(a=ge(e)),o){const p=Gt(e,!0,r,e);c.x=p.x+e.clientLeft,c.y=p.y+e.clientTop}else i&&d();r&&!o&&i&&d();const h=i&&!o&&!r?Gn(i,a):ot(0),u=l.left+a.scrollLeft-c.x-h.x,f=l.top+a.scrollTop-c.y-h.y;return{x:u,y:f,width:l.width,height:l.height}}function Ce(t){return Z(t).position==="static"}function an(t,e){if(!rt(t)||Z(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ft(t)===n&&(n=n.ownerDocument.body),n}function Xn(t,e){const n=G(t);if(me(t))return n;if(!rt(t)){let i=gt(t);for(;i&&!Ut(i);){if(Q(i)&&!Ce(i))return i;i=gt(i)}return n}let o=an(t,e);for(;o&&kl(o)&&Ce(o);)o=an(o,e);return o&&Ut(o)&&Ce(o)&&!Ue(o)?n:o||Ll(t)||n}const Vl=async function(t){const e=this.getOffsetParent||Xn,n=this.getDimensions,o=await n(t.floating);return{reference:Fl(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Wl(t){return Z(t).direction==="rtl"}const Kl={convertOffsetParentRelativeRectToViewportRelativeRect:Ol,getDocumentElement:ft,getClippingRect:Bl,getOffsetParent:Xn,getElementRects:Vl,getClientRects:Hl,getDimensions:Ul,getScale:Dt,isElement:Q,isRTL:Wl},ql=wl,Gl=fl,Jl=yl,Xl=pl,Yl=Cl,Ql=ml,Zl=hl,tr=xl,er=(t,e,n)=>{const o=new Map,i={platform:Kl,...n},r={...i.platform,_c:o};return dl(t,e,{...i,platform:r})};var Ie,_e;if(typeof WeakMap<"u"){let t=new WeakMap;Ie=e=>t.get(e),_e=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Ie=o=>{for(let i=0;i<t.length;i+=2)if(t[i]==o)return t[i+1]},_e=(o,i)=>(n==10&&(n=0),t[n++]=o,t[n++]=i)}var ct=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const o=e%this.width,i=e/this.width|0;let r=o+1,l=i+1;for(let a=1;r<this.width&&this.map[e+a]==n;a++)r++;for(let a=1;l<this.height&&this.map[e+this.width*a]==n;a++)l++;return{left:o,top:i,right:r,bottom:l}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:o,right:i,top:r,bottom:l}=this.findCell(t);return e=="horiz"?(n<0?o==0:i==this.width)?null:this.map[r*this.width+(n<0?o-1:i)]:(n<0?r==0:l==this.height)?null:this.map[o+this.width*(n<0?r-1:l)]}rectBetween(t,e){const{left:n,right:o,top:i,bottom:r}=this.findCell(t),{left:l,right:a,top:c,bottom:d}=this.findCell(e);return{left:Math.min(n,l),top:Math.min(i,c),right:Math.max(o,a),bottom:Math.max(r,d)}}cellsInRect(t){const e=[],n={};for(let o=t.top;o<t.bottom;o++)for(let i=t.left;i<t.right;i++){const r=o*this.width+i,l=this.map[r];n[l]||(n[l]=!0,!(i==t.left&&i&&this.map[r-1]==l||o==t.top&&o&&this.map[r-this.width]==l)&&e.push(l))}return e}positionAt(t,e,n){for(let o=0,i=0;;o++){const r=i+n.child(o).nodeSize;if(o==t){let l=e+t*this.width;const a=(t+1)*this.width;for(;l<a&&this.map[l]<i;)l++;return l==a?r-1:this.map[l]}i=r}}static get(t){return Ie(t)||_e(t,nr(t))}};function nr(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=or(t),n=t.childCount,o=[];let i=0,r=null;const l=[];for(let d=0,h=e*n;d<h;d++)o[d]=0;for(let d=0,h=0;d<n;d++){const u=t.child(d);h++;for(let m=0;;m++){for(;i<o.length&&o[i]!=0;)i++;if(m==u.childCount)break;const g=u.child(m),{colspan:x,rowspan:b,colwidth:v}=g.attrs;for(let w=0;w<b;w++){if(w+d>=n){(r||(r=[])).push({type:"overlong_rowspan",pos:h,n:b-w});break}const C=i+w*e;for(let y=0;y<x;y++){o[C+y]==0?o[C+y]=h:(r||(r=[])).push({type:"collision",row:d,pos:h,n:x-y});const j=v&&v[y];if(j){const S=(C+y)%e*2,R=l[S];R==null||R!=j&&l[S+1]==1?(l[S]=j,l[S+1]=1):R==j&&l[S+1]++}}}i+=x,h+=g.nodeSize}const f=(d+1)*e;let p=0;for(;i<f;)o[i++]==0&&p++;p&&(r||(r=[])).push({type:"missing",row:d,n:p}),h++}(e===0||n===0)&&(r||(r=[])).push({type:"zero_sized"});const a=new ct(e,n,o,r);let c=!1;for(let d=0;!c&&d<l.length;d+=2)l[d]!=null&&l[d+1]<n&&(c=!0);return c&&sr(a,l,t),a}function or(t){let e=-1,n=!1;for(let o=0;o<t.childCount;o++){const i=t.child(o);let r=0;if(n)for(let l=0;l<o;l++){const a=t.child(l);for(let c=0;c<a.childCount;c++){const d=a.child(c);l+d.attrs.rowspan>o&&(r+=d.attrs.colspan)}}for(let l=0;l<i.childCount;l++){const a=i.child(l);r+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=r:e!=r&&(e=Math.max(e,r))}return e}function sr(t,e,n){t.problems||(t.problems=[]);const o={};for(let i=0;i<t.map.length;i++){const r=t.map[i];if(o[r])continue;o[r]=!0;const l=n.nodeAt(r);if(!l)throw new RangeError(`No cell with offset ${r} found`);let a=null;const c=l.attrs;for(let d=0;d<c.colspan;d++){const h=(i+d)%t.width,u=e[h*2];u!=null&&(!c.colwidth||c.colwidth[d]!=u)&&((a||(a=ir(c)))[d]=u)}a&&t.problems.unshift({type:"colwidth mismatch",pos:r,colwidth:a})}}function ir(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Ve(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const o=t.nodes[n],i=o.spec.tableRole;i&&(e[i]=o)}}return e}new Jt("selectingCells");function lr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function Yn(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function rr(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=lr(e.$head)||ar(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function ar(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function cn(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function Qn(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Zn(t,e,n){const o=t.node(-1),i=ct.get(o),r=t.start(-1),l=i.nextCell(t.pos-r,e,n);return l==null?null:t.node(0).resolve(r+l)}function dn(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some(i=>i>0)||(o.colwidth=null)),o}var st=class at extends dt{constructor(e,n=e){const o=e.node(-1),i=ct.get(o),r=e.start(-1),l=i.rectBetween(e.pos-r,n.pos-r),a=e.node(0),c=i.cells
3InRect(l).filter(h=>h!=n.pos-r);c.unshift(n.pos-r);const d=c.map(h=>{const u=o.nodeAt(h);if(!u)throw RangeError(`No cell with offset ${h} found`);const f=r+h+1;return new Wo(a.resolve(f),a.resolve(f+u.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=n}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(cn(o)&&cn(i)&&Qn(o,i)){const r=this.$anchorCell.node(-1)!=o.node(-1);return r&&this.isRowSelection()?at.rowSelection(o,i):r&&this.isColSelection()?at.colSelection(o,i):new at(o,i)}return Rn.between(o,i)}content(){const e=this.$anchorCell.node(-1),n=ct.get(e),o=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),r={},l=[];for(let c=i.top;c<i.bottom;c++){const d=[];for(let h=c*n.width+i.left,u=i.left;u<i.right;u++,h++){const f=n.map[h];if(r[f])continue;r[f]=!0;const p=n.findCell(f);let m=e.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=i.left-p.left,x=p.right-i.right;if(g>0||x>0){let b=m.attrs;if(g>0&&(b=dn(b,0,g)),x>0&&(b=dn(b,b.colspan-x,x)),p.left<i.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(p.top<i.top||p.bottom>i.bottom){const b={...m.attrs,rowspan:Math.min(p.bottom,i.bottom)-Math.max(p.top,i.top)};p.top<i.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}l.push(e.child(c).copy(ye.from(d)))}const a=this.isColSelection()&&this.isRowSelection()?e:l;return new Wt(ye.from(a),1,1)}replace(e,n=Wt.empty){const o=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){const{$from:a,$to:c}=i[l],d=e.mapping.slice(o);e.replace(d.map(a.pos),d.map(c.pos),l?Wt.empty:n)}const r=dt.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);r&&e.setSelection(r)}replaceWith(e,n){this.replace(e,new Wt(ye.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),o=ct.get(n),i=this.$anchorCell.start(-1),r=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let l=0;l<r.length;l++)e(n.nodeAt(r[l]),i+r[l])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),i=ct.get(o),r=e.start(-1),l=i.findCell(e.pos-r),a=i.findCell(n.pos-r),c=e.node(0);return l.top<=a.top?(l.top>0&&(e=c.resolve(r+i.map[l.left])),a.bottom<i.height&&(n=c.resolve(r+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=c.resolve(r+i.map[a.left])),l.bottom<i.height&&(e=c.resolve(r+i.map[i.width*(i.height-1)+l.right-1]))),new at(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=ct.get(e),o=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-o),r=n.colCount(this.$headCell.pos-o);if(Math.min(i,r)>0)return!1;const l=i+this.$anchorCell.nodeAfter.attrs.colspan,a=r+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,a)==n.width}eq(e){return e instanceof at&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),i=ct.get(o),r=e.start(-1),l=i.findCell(e.pos-r),a=i.findCell(n.pos-r),c=e.node(0);return l.left<=a.left?(l.left>0&&(e=c.resolve(r+i.map[l.top*i.width])),a.right<i.width&&(n=c.resolve(r+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=c.resolve(r+i.map[a.top*i.width])),l.right<i.width&&(e=c.resolve(r+i.map[i.width*(l.top+1)-1]))),new at(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new at(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){return new at(e.resolve(n),e.resolve(o))}getBookmark(){return new cr(this.$anchorCell.pos,this.$headCell.pos)}};st.prototype.visible=!1;dt.jsonID("cell",st);var cr=class to{constructor(e,n){this.anchor=e,this.head=n}map(e){return new to(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),o=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&o.index()<o.parent.childCount&&Qn(n,o)?new st(n,o):dt.near(o,1)}};new Jt("fix-tables");function eo(t){const e=t.selection,n=rr(t),o=n.node(-1),i=n.start(-1),r=ct.get(o);return{...e instanceof st?r.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):r.findCell(n.pos-i),tableStart:i,map:r,table:o}}function dr(t){return function(e,n){if(!Yn(e))return!1;if(n){const o=Ve(e.schema),i=eo(e),r=e.tr,l=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=l.map(c=>i.table.nodeAt(c));for(let c=0;c<l.length;c++)a[c].type==o.header_cell&&r.setNodeMarkup(i.tableStart+l[c],o.cell,a[c].attrs);if(r.steps.length==0)for(let c=0;c<l.length;c++)r.setNodeMarkup(i.tableStart+l[c],o.header_cell,a[c].attrs);n(r)}return!0}}function hn(t,e,n){const o=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<o.length;i++){const r=e.table.nodeAt(o[i]);if(r&&r.type!==n.header_cell)return!1}return!0}function We(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?dr(t):function(n,o){if(!Yn(n))return!1;if(o){const i=Ve(n.schema),r=eo(n),l=n.tr,a=hn("row",r,i),c=hn("c
3olumn",r,i),h=(t==="column"?a:t==="row"?c:!1)?1:0,u=t=="column"?{left:0,top:h,right:1,bottom:r.map.height}:t=="row"?{left:h,top:0,right:r.map.width,bottom:1}:r,f=t=="column"?c?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;r.map.cellsInRect(u).forEach(p=>{const m=p+r.tableStart,g=l.doc.nodeAt(m);g&&l.setNodeMarkup(m,f,g.attrs)}),o(l)}return!0}}We("row",{useDeprecatedLogic:!0});We("column",{useDeprecatedLogic:!0});We("cell",{useDeprecatedLogic:!0});function oe(t,e){const n=t.selection;if(!(n instanceof st))return!1;if(e){const o=t.tr,i=Ve(t.schema).cell.createAndFill().content;n.forEachCell((r,l)=>{r.content.eq(i)||o.replace(o.mapping.map(l+1),o.mapping.map(l+r.nodeSize-1),new Wt(i,0,0))}),o.docChanged&&e(o)}return!0}Ko({ArrowLeft:se("horiz",-1),ArrowRight:se("horiz",1),ArrowUp:se("vert",-1),ArrowDown:se("vert",1),"Shift-ArrowLeft":ie("horiz",-1),"Shift-ArrowRight":ie("horiz",1),"Shift-ArrowUp":ie("vert",-1),"Shift-ArrowDown":ie("vert",1),Backspace:oe,"Mod-Backspace":oe,Delete:oe,"Mod-Delete":oe});function ce(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function se(t,e){return(n,o,i)=>{if(!i)return!1;const r=n.selection;if(r instanceof st)return ce(n,o,dt.near(r.$headCell,e));if(t!="horiz"&&!r.empty)return!1;const l=no(i,t,e);if(l==null)return!1;if(t=="horiz")return ce(n,o,dt.near(n.doc.resolve(r.head+e),e));{const a=n.doc.resolve(l),c=Zn(a,t,e);let d;return c?d=dt.near(c,1):e<0?d=dt.near(n.doc.resolve(a.before(-1)),-1):d=dt.near(n.doc.resolve(a.after(-1)),1),ce(n,o,d)}}}function ie(t,e){return(n,o,i)=>{if(!i)return!1;const r=n.selection;let l;if(r instanceof st)l=r;else{const c=no(i,t,e);if(c==null)return!1;l=new st(n.doc.resolve(c))}const a=Zn(l.$headCell,t,e);return a?ce(n,o,new st(l.$anchorCell,a)):!1}}function no(t,e,n){if(!(t.state.selection instanceof Rn))return null;const{$head:o}=t.state.selection;for(let i=o.depth-1;i>=0;i--){const r=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:r.childCount))return null;if(r.type.spec.tableRole=="cell"||r.type.spec.tableRole=="header_cell"){const a=o.before(i),c=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(c)?a:null}}return null}new Jt("tableColumnResizing");function hr(t,e){const n=Math.min(t.top,e.top),o=Math.max(t.bottom,e.bottom),i=Math.min(t.left,e.left),l=Math.max(t.right,e.right)-i,a=o-n,c=i,d=n;return new DOMRect(c,d,l,a)}var ur=class{constructor({editor:t,element:e,view:n,updateDelay:o=250,resizeDelay:i=60,shouldShow:r,appendTo:l,getReferencedVirtualElement:a,options:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:h,state:u,from:f,to:p})=>{const{doc:m,selection:g}=u,{empty:x}=g,b=!m.textBetween(f,p).length&&qo(u.selection),v=this.element.contains(document.activeElement);return!(!(h.hasFocus()||v)||x||b||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:h})=>{var u;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}h?.relatedTarget&&((u=this.element.parentNode)!=null&&u.contains(h.relatedTarget))||h?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(h,u)=>{const f=!u?.selection.eq(h.state.selection),p=!u?.doc.eq(h.state.doc);!f&&!p||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(h,f,p,u)},this.updateDelay))},this.updateHandler=(h,u,f,p)=>{const{composing:m}=h;if(m||!u&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:h})=>{h.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var d;this.editor=t,this.element=e,this.view=n,this.updateDelay=o,this.resizeDelay=i,this.appendTo=l,this.scrollTarget=(d=c?.scrollTarget)!=null?d:window,this.getReferencedVirtualElement=a,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,r&&(this.shouldShow=r),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(n,n.state),this.get
3ShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Xl(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(Jl(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(ql(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(Zl(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Yl(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Gl(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(Ql(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(tr(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}get virtualElement(){var t;const{selection:e}=this.editor.state,n=(t=this.getReferencedVirtualElement)==null?void 0:t.call(this);if(n)return n;const o=_n(this.view,e.from,e.to);let i={getBoundingClientRect:()=>o,getClientRects:()=>[o]};if(e instanceof Go){let r=this.view.nodeDOM(e.from);const l=r.dataset.nodeViewWrapper?r:r.querySelector("[data-node-view-wrapper]");l&&(r=l),r&&(i={getBoundingClientRect:()=>r.getBoundingClientRect(),getClientRects:()=>[r.getBoundingClientRect()]})}if(e instanceof st){const{$anchorCell:r,$headCell:l}=e,a=r?r.pos:l.pos,c=l?l.pos:r.pos,d=this.view.nodeDOM(a),h=this.view.nodeDOM(c);if(!d||!h)return;const u=d===h?d.getBoundingClientRect():hr(d.getBoundingClientRect(),h.getBoundingClientRect());i={getBoundingClientRect:()=>u,getClientRects:()=>[u]}}return i}updatePosition(){const t=this.virtualElement;t&&er(t,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:n,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${e}px`,this.element.style.top=`${n}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const{state:n}=t,o=n.selection.from!==n.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(t,e);return}const i=!e?.selection.eq(t.state.selection),r=!e?.doc.eq(t.state.doc);this.updateHandler(t,i,r,e)}getShouldShow(t){var e;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,r=Math.min(...i.map(c=>c.$from.pos)),l=Math.max(...i.map(c=>c.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:n,oldState:t,from:r,to:l}))||!1}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},oo=t=>new In({key:typeof t.pluginKey=="string"?new Jt(t.pluginKey):t.pluginKey,view:e=>new ur({view:e,...t})});Ln.create({name:"bubbleMenu",addOptions(){return{element:null,pluginKey:"bubbleMenu",updateDelay:void 0,appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[oo({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,options:this.options.options,appendTo:this.options.appendTo,getReferencedVirtualElement:this.options.getReferencedVirtualElement,shouldShow:this.options.shouldShow})]:[]}});var fr=class{constructor({editor:t,element:e,view:n,options:o,appendTo:i,shouldShow:r}){this.preventHide=!1,this.isVisible=!1,this.shouldShow=({view:l,state:a})=>{const{selection:c}=a,{$anchor:d,empty:h}=c,u=d.depth===1,f=d.parent.isTextblock&&!d.parent.type.spec.code&&!d.parent.textContent&&d.parent.childCount===0&&!this.getTextContent(d.parent);return!(!l.hasFocus()||!h||!u||!f||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(l,a,c,d)=>{const{composing:h}=l;if(h||!a&&!c)return;if(!this.getShouldShow(d)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:l})=>{var a;if(this.preventHide){this.preventHide=!1;return}l?.relatedTarget&&((a=this.element.parentNode)!=null&&a.contains(l.relatedTarget))||l?.relatedTarget!==this.editor.view.dom&&this.hide()},this.editor=t,this.element=e,this.view=n,this.appendTo=i,this.floatingUIOptions={...this.floatingUIOptions,...o},this.element.tabIndex=0,r&&(this.shouldShow=r),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.update(n,n.state),this.get
3ShouldShow()&&(this.show(),this.updatePosition())}getTextContent(t){return Jo(t,{textSerializers:Xo(this.editor.schema)})}get middlewares(){const t=[];return this.floatingUIOptions.flip&&t.push(Co(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&t.push(jo(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&t.push(So(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&t.push(ko(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&t.push(Mo(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&t.push(Ro(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&t.push(Io(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&t.push(_o(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),t}getShouldShow(t){var e;const{state:n}=this.view,{selection:o}=n,{ranges:i}=o,r=Math.min(...i.map(c=>c.$from.pos)),l=Math.max(...i.map(c=>c.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:n,oldState:t,from:r,to:l})}updatePosition(){const{selection:t}=this.editor.state,e=_n(this.view,t.from,t.to);Lo({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:i,strategy:r})=>{this.element.style.width="max-content",this.element.style.position=r,this.element.style.left=`${o}px`,this.element.style.top=`${i}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(t,e){const n=!e?.selection.eq(t.state.selection),o=!e?.doc.eq(t.state.doc);this.updateHandler(t,n,o,e)}show(){var t;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(t=e??this.view.dom.parentElement)==null||t.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},so=t=>new In({key:typeof t.pluginKey=="string"?new Jt(t.pluginKey):t.pluginKey,view:e=>new fr({view:e,...t})});Ln.create({name:"floatingMenu",addOptions(){return{element:null,options:{},pluginKey:"floatingMenu",appendTo:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[so({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,options:this.options.options,appendTo:this.options.appendTo,shouldShow:this.options.shouldShow})]:[]}});var pr=jn.forwardRef(({pluginKey:t="bubbleMenu",editor:e,updateDelay:n,resizeDelay:o,appendTo:i,shouldShow:r=null,getReferencedVirtualElement:l,options:a,children:c,...d},h)=>{const u=E.useRef(document.createElement("div"));typeof h=="function"?h(u.current):h&&(h.current=u.current);const{editor:f}=En(),p=e||f,m={updateDelay:n,resizeDelay:o,appendTo:i,pluginKey:t,shouldShow:r,getReferencedVirtualElement:l,options:a},g=E.useRef(m);return g.current=m,E.useEffect(()=>{if(p?.isDestroyed)return;if(!p){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}const x=u.current;x.style.visibility="hidden",x.style.position="absolute";const b=oo({...g.current,editor:p,element:x});p.registerPlugin(b);const v=g.current.pluginKey;return()=>{p.unregisterPlugin(v),window.requestAnimationFrame(()=>{x.parentNode&&x.parentNode.removeChild(x)})}},[p]),Sn.createPortal(s.jsx("div",{...d,children:c}),u.current)});jn.forwardRef(({pluginKey:t="floatingMenu",editor:e,appendTo:n,shouldShow:o=null,options:i,children:r,...l},a)=>{const c=E.useRef(document.createElement("div"));typeof a=="function"?a(c.current):a&&(a.current=c.current);const{editor:d}=En();return E.useEffect(()=>{const h=c.current;if(h.style.visibility="hidden",h.style.position="absolute",e?.isDestroyed||d?.isDestroyed)return;const u=e||d;if(!u){console.warn("FloatingMenu component is not rendered inside of an editor component or does not have editor prop.");return}const f=so({editor:u,element:h,pluginKey:t,appendTo:n,shouldShow:o,options:i});return u.registerPlugin(f),()=>{u.unregisterPlugin(t),window.requestAnimationFrame(()=>{h.parentNode&&h.parentNode.removeChild(h)})}},[e,d,n,t,o,i]),Sn.createPortal(s.jsx("div",{...l,children:r}),c.current)});
3const mr="_trigger_1am9t_1",gr="_sizeLabel_1am9t_9",xr="_dropdown_1am9t_14",br="_menuItem_1am9t_18",le={trigger:mr,sizeLabel:gr,dropdown:xr,menuItem:br},vr=[12,14,16,18,20,24,28,32,36,48,64,72,96],wr=16,yr={1:32,2:24,3:20};function Cr(t){if(!t)return;const e=16;if(t.endsWith("em")){const n=parseFloat(t);return isNaN(n)?void 0:Math.round(n*e)}if(t.endsWith("px")){const n=parseFloat(t);return isNaN(n)?void 0:n}}function jr(){const t=B.c(43),{t:e}=et(),{editor:n}=F();let o;t[0]!==n?(o={editor:n,selector:Sr},t[0]=n,t[1]=o):o=t[1];const i=yt(o),r=i?.headingLevel,l=r?yr[r]:wr;let a;t[2]!==l||t[3]!==n?(a=()=>{n?.chain().focus().setFontSize(`${l}px`).run()},t[2]=l,t[3]=n,t[4]=a):a=t[4];const c=a;let d;t[5]!==l||t[6]!==n||t[7]!==c?(d=z=>{n&&(z===l?c():n.chain().focus().setFontSize(`${z}px`).run())},t[5]=l,t[6]=n,t[7]=c,t[8]=d):d=t[8];const h=d,u=i?.currentSize;let f;t[9]!==u?(f=Cr(u),t[9]=u,t[10]=f):f=t[10];const m=f??l;let g;t[11]===Symbol.for("react.memo_cache_sentinel")?(g={duration:0},t[11]=g):g=t[11];const{scrollIntoView:x,targetRef:b,scrollableRef:v}=Eo(g);let w;t[12]!==x?(w=()=>{x({alignment:"center"})},t[12]=x,t[13]=w):w=t[13];const C=w;let y;t[14]!==e?(y=e("richTextEditor.fontSizeDropdown"),t[14]=e,t[15]=y):y=t[15];let j;t[16]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsx(vs,{size:18}),t[16]=j):j=t[16];let S;t[17]!==m?(S=s.jsx(vt,{size:"xs",component:"span",ml:6,className:le.sizeLabel,children:m}),t[17]=m,t[18]=S):S=t[18];let R;t[19]===Symbol.for("react.memo_cache_sentinel")?(R=s.jsx(yn,{size:12}),t[19]=R):R=t[19];let L;t[20]!==S?(L=s.jsxs(it,{gap:0,wrap:"nowrap",align:"center",children:[j,S,R]}),t[20]=S,t[21]=L):L=t[21];let k;t[22]!==L||t[23]!==y?(k=s.jsx(q.Target,{children:s.jsx(K,{variant:"light",color:"gray",size:"sm",title:y,className:le.trigger,children:L})}),t[22]=L,t[23]=y,t[24]=k):k=t[24];const A=`${l} px`;let _;t[25]!==c||t[26]!==A?(_=s.jsx(q.Item,{onClick:c,children:A},"reset"),t[25]=c,t[26]=A,t[27]=_):_=t[27];let N;t[28]===Symbol.for("react.memo_cache_sentinel")?(N=s.jsx(zt,{}),t[28]=N):N=t[28];let H;t[29]!==m||t[30]!==h||t[31]!==b?(H=vr.map(z=>s.jsx(q.Item,{onClick:()=>h(z),"data-active":m===z||void 0,ref:m===z?b:void 0,className:le.menuItem,children:`${z} px`},z)),t[29]=m,t[30]=h,t[31]=b,t[32]=H):H=t[32];let I;t[33]!==v||t[34]!==_||t[35]!==H?(I=s.jsxs(To.Autosize,{mah:240,scrollbarSize:6,viewportRef:v,children:[_,N,H]}),t[33]=v,t[34]=_,t[35]=H,t[36]=I):I=t[36];let T;t[37]!==C||t[38]!==I?(T=s.jsx(q.Dropdown,{className:le.dropdown,ref:C,children:I}),t[37]=C,t[38]=I,t[39]=T):T=t[39];let D;return t[40]!==k||t[41]!==T?(D=s.jsxs(q,{shadow:"md",withinPortal:!0,children:[k,T]}),t[40]=k,t[41]=T,t[42]=D):D=t[42],D}function Sr(t){const e=t.editor;if(!e)return{currentSize:void 0,headingLevel:void 0};const n=e.getAttributes("textStyle").fontSize;let o;for(let i=1;i<=3;i++)if(e.isActive("heading",{level:i})){o=i;break}return{currentSize:n,headingLevel:o}}const kr="_actionIcon_prcu4_1",Mr="_colorIconWrapper_prcu4_10",Rr="_colorIndicator_prcu4_16",je={actionIcon:kr,colorIconWrapper:Mr,colorIndicator:Rr},io=t=>{const e=B.c(20);let n,o,i,r,l,a;e[0]!==t?({icon:i,title:a,isActive:r,colorIndicator:o,className:n,...l}=t,e[0]=t,e[1]=n,e[2]=o,e[3]=i,e[4]=r,e[5]=l,e[6]=a):(n=e[1],o=e[2],i=e[3],r=e[4],l=e[5],a=e[6]);const c=r?"light":"subtle",d="gray",h=r||void 0,u=`${je.actionIcon} ${n??""}`;let f;e[7]!==o?(f=o&&s.jsx("span",{className:je.colorIndicator,style:{backgroundColor:o}}),e[7]=o,e[8]=f):f=e[8];let p;e[9]!==i||e[10]!==f?(p=s.jsxs("div",{className:je.colorIconWrapper,children:[i,f]}),e[9]=i,e[10]=f,e[11]=p):p=e[11];let m;return e[12]!==l||e[13]!==c||e[14]!==d||e[15]!==h||e[16]!==u||e[17]!==p||e[18]!==a?(m=s.jsx(K,{variant:c,color:d,size:"sm",title:a,"data-active":h,className:u,...l,children:p}),e[12]=l,e[13]=c,e[14]=d,e[15]=h,e[16]=u,e[17]=p,e[18]=a,e[19]=m):m=e[19],m},Ir="_colorPicker_1nb5l_1",_r={colorPicker:Ir};function lo(t){const e=B.c(27),{icon:n,title:o,swatches:i,value:r,onChange:l,colorIndicator:a,isActive:c,position:d,onReset:h}=t,u=a===void 0?r:a,f=d===void 0?"bottom":d,[p,m]=E.useState(!1),{t:g}=et();let x;e[0]!==l?(x=A=>{l(A)},e[0]=l,e[1]=x):x=e[1];const b=x;let v;e[2]!==h?(v=()=>{h?.(),m(!1)},e[2]=h,e[3]=v):v=e[3];const w=v,C=c??p;let y;e[4]===Symbol.for("react.memo_cache_sentinel")?(y=()=>m(Lr),e[4]=y):y=e[4];let j;e[5]!==u||e[6]!==n||e[7]!==C||e[8]!==o?(j=s.jsx(J.Target,{children:s.jsx(io,{icon:n,title:o,colorIndicator:u,isActive:C,onClick:y}
3)}),e[5]=u,e[6]=n,e[7]=C,e[8]=o,e[9]=j):j=e[9];let S;e[10]!==b||e[11]!==i||e[12]!==r?(S=s.jsx(xn,{format:"hex",value:r,onChange:b,swatches:i,className:_r.colorPicker}),e[10]=b,e[11]=i,e[12]=r,e[13]=S):S=e[13];let R;e[14]!==w||e[15]!==h||e[16]!==g||e[17]!==r?(R=h&&s.jsx(gn,{variant:"subtle",color:"gray",size:"sx",onClick:w,disabled:!r,children:g("common.reset")}),e[14]=w,e[15]=h,e[16]=g,e[17]=r,e[18]=R):R=e[18];let L;e[19]!==S||e[20]!==R?(L=s.jsx(J.Dropdown,{children:s.jsxs(bn,{gap:"xs",children:[S,R]})}),e[19]=S,e[20]=R,e[21]=L):L=e[21];let k;return e[22]!==p||e[23]!==f||e[24]!==L||e[25]!==j?(k=s.jsxs(J,{opened:p,onChange:m,position:f,shadow:"md",withinPortal:!1,closeOnClickOutside:!0,withArrow:!0,children:[j,L]}),e[22]=p,e[23]=f,e[24]=L,e[25]=j,e[26]=k):k=e[26],k}function Lr(t){return!t}const Er=["#ffff00","#00ff00","#00ffff","#ff00ff","#ff0000","#0000ff","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"];function Tr(){const t=B.c(14),{t:e}=et(),{editor:n}=F();let o;t[0]!==n?(o={editor:n,selector:Ar},t[0]=n,t[1]=o):o=t[1];const i=yt(o);let r;t[2]!==n?(r=f=>{n&&n.chain().focus().setHighlight({color:f}).run()},t[2]=n,t[3]=r):r=t[3];const l=r,a=i?.highlightColor;let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(rs,{size:16}),t[4]=c):c=t[4];let d;t[5]!==e?(d=e("richTextEditor.highlightColor"),t[5]=e,t[6]=d):d=t[6];let h;t[7]!==n?(h=()=>n?.chain().focus().unsetHighlight().run(),t[7]=n,t[8]=h):h=t[8];let u;return t[9]!==l||t[10]!==a||t[11]!==d||t[12]!==h?(u=s.jsx(lo,{icon:c,title:d,swatches:Er,value:a,onChange:l,position:"top",onReset:h}),t[9]=l,t[10]=a,t[11]=d,t[12]=h,t[13]=u):u=t[13],u}function Ar(t){return{highlightColor:t.editor?.getAttributes("highlight").color}}const Or=["#000000","#434343","#666666","#999999","#ffffff","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#0000ff","#9900ff"],Hr="var(--mantine-color-text)";function Pr(){const t=B.c(15),{t:e}=et(),{editor:n}=F();let o;t[0]!==n?(o={editor:n,selector:zr},t[0]=n,t[1]=o):o=t[1];const i=yt(o);let r;t[2]!==n?(r=p=>{n&&n.chain().focus().setColor(p).run()},t[2]=n,t[3]=r):r=t[3];const l=r;let a;t[4]===Symbol.for("react.memo_cache_sentinel")?(a=s.jsx(xs,{size:16}),t[4]=a):a=t[4];let c;t[5]!==e?(c=e("richTextEditor.textColor"),t[5]=e,t[6]=c):c=t[6];const d=i?.textColor,h=i?.textColor??Hr;let u;t[7]!==n?(u=()=>n?.chain().focus().unsetColor().run(),t[7]=n,t[8]=u):u=t[8];let f;return t[9]!==l||t[10]!==c||t[11]!==d||t[12]!==h||t[13]!==u?(f=s.jsx(lo,{icon:a,title:c,swatches:Or,value:d,onChange:l,colorIndicator:h,onReset:u}),t[9]=l,t[10]=c,t[11]=d,t[12]=h,t[13]=u,t[14]=f):f=t[14],f}function zr(t){return{textColor:t.editor?.getAttributes("textStyle").color}}const Dr="_container_prg4u_1",Nr={container:Dr};function $r(){const t=B.c(8);let e,n,o,i,r,l,a;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs(M.ControlsGroup,{variant:"default",children:[s.jsx(M.Bold,{}),s.jsx(M.Italic,{}),s.jsx(M.Underline,{}),s.jsx(M.Strikethrough,{})]}),n=s.jsx(zt,{orientation:"vertical"}),o=s.jsx(jr,{}),i=s.jsx(zt,{orientation:"vertical"}),r=s.jsx(Pr,{}),l=s.jsx(Tr,{}),a=s.jsx(zt,{orientation:"vertical"}),t[0]=e,t[1]=n,t[2]=o,t[3]=i,t[4]=r,t[5]=l,t[6]=a):(e=t[0],n=t[1],o=t[2],i=t[3],r=t[4],l=t[5],a=t[6]);let c;return t[7]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsxs(it,{gap:"xs",wrap:"nowrap",className:Nr.container,children:[e,n,o,i,r,l,a,s.jsx(M.ControlsGroup,{children:s.jsx(M.ClearFormatting,{})})]}),t[7]=c):c=t[7],c}const Br="_menu_12p02_1",Ur={menu:Br};function Fr(){const t=B.c(9),{editor:e}=F(),{portalRoot:n}=E.useContext(Cn),[o,i]=E.useState(null);if(!e)return null;const r=n??void 0;let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx("div",{className:Ur.menu,ref:i}),t[0]=l):l=t[0];let a;t[1]!==r?(a=s.jsx(Ao,{target:r,children:l}),t[1]=r,t[2]=a):a=t[2];let c;t[3]!==e||t[4]!==o?(c=o&&s.jsx(pr,{editor:e,appendTo:o??void 0,options:{placement:"bottom"},children:s.jsx($r,{})}),t[3]=e,t[4]=o,t[5]=c):c=t[5];let d;return t[6]!==a||t[7]!==c?(d=s.jsxs(s.Fragment,{children:[a,c]}),t[6]=a,t[7]=c,t[8]=d):d=t[8],d}const Vr="_editor_1wii2_1",Wr="_content_1wii2_12",Kr="_control_1wii2_33",Se={editor:Vr,content:Wr,control:Kr},qr="_button_h04gs_1",Gr={button:qr},ro=E.forwardRef(function(e,n){const o=B.c(10),{icon:i,title:r,isActive:l,onClick:a}=e,c="light",d=l?"primary":"gray";let h;o[0]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(yn,{size:12}),o[0]=h):h=o[0];let u;o[1]!==i?(u=s.jsxs(it,{gap:2,wrap:"nowrap",children:[i,h]}),o[1]=i,o[2]=u):u=o[2];let f;return o[3]!==a||o[4]!==n||o[5]!==c||o[6]!==d||o[7]!==u||o[8]!==r?(f=s.jsx(K,{ref:n,variant:c,color:d,size:"md",title:r,onClick:a,className:Gr.button,children:u}),o[3]=a,o[4]=n,o[5]=c,o[6]=d,o[7]=u,o[8]=r,o[9]=f):f=o[9],f}),Jr="_dropdown_1r0qt_1",Xr={dropdown:Jr},Le=[{value:"left",labelKey:"richTextEditor.alignLeft",Icon:Tn},{value:"center",labelKey:"richTextEditor.alignCenter",Icon:ts},{value:"right",labelKey:"richTextEditor.alignRight",Icon:is},{value:"justify",labelKey:"richTextEditor.alignJustify",Icon:ns}],Yr=()=>{const t=B.c(23),{t:e}=et(),{editor:n}=F();let o;t[0]!==n?(o={editor:n,selector:Qr},t[0]=n,t[1]=o):o=t[1];const i=yt(o);let r;t[2]!==n?(r=b=>{n&&n.chain().focus().setTextAlign(b).run()},t[2]=n,t[3]=r):r=t[3];const l=r,a=i?.currentAlignment??"left";let c;t[4]!==a?(c=Le.find(b=>b.value===a)?.Icon??Tn,t[4]=a,t[5]=c):c=t[5];const d=c,h=a!=="left";let u;t[6]!==d?(u=s.jsx(d,{size:16}),t[6]=d,t[7]=u):u=t[7];let f;t[8]!==e?(f=e("richTextEditor.alignmentDropdown"),t[8]=e,t[9]=f):f=t[9];let p;t[10]!==h||t[11]!==u||t[12]!==f?(p=s.jsx(q.Target,{children:s.jsx(ro,{icon:u,title:f,isActive:h})}),t[10]=h,t[11]=u,t[12]=f,t[13]=p):p=t[13];let m;t[14]!==a||t[15]!==l||t[16]!==e?(m=Le.map(b=>s.jsx(q.Item,{onClick:()=>l(b.value),leftSection:s.jsx(b.Icon,{size:16}),"data-active":a===b.value||void 0,children:e(b.labelKey)},b.value)),t[14]=a,t[15]=l,t[16]=e,t[17]=m):m=t[17];let g;t[18]!==m?(g=s.jsx(q.Dropdown,{className:Xr.dropdown,children:m}),t[18]=m,t[19]=g):g=t[19];let x;return t[20]!==p||t[21]!==g?(x=s.jsxs(q,{shadow:"md",withinPortal:!0,children:[p,g]}),t[20]=p,t[21]=g,t[22]=x):x=t[22],x};function Qr(t){return{currentAlignment:Le.find(n=>t.editor?.isActive({textAlign:n.value}))?.value??"left"}}const Zr="_h1_1waja_1",ta="_h2_1waja_6",ea="_h3_1waja_11",na="_paragraph_1waja_16",oa="_dropdown_1waja_21",Kt={h1:Zr,h2:ta,h3:ea,paragraph:na,dropdown:oa},un=[{level:1,labelKey:"richTextEditor.heading1",className:Kt.h1,Icon:cs},{level:2,labelKey:"richTextEditor.heading2",className:Kt.h2,Icon:hs},{level:3,labelKey:"richTextEditor.heading3",className:Kt.h3,Icon:fs},{level:null,labelKey:"richTextEditor.paragraph",className:Kt.paragraph}],sa=()=>{const t=B.c(26),{t:e}=et(),{editor:n}=F();let o;t[0]!==n?(o={editor:n,selector:ia},t[0]=n,t[1]=o):o=t[1];const i=yt(o),r=i?.isHeadingActive??!1,l=i?.activeLevel??null;let a;t[2]!==n?(a=w=>{if(!n)return;const{state:C}=n,{from:y}=C.selection,j=C.doc.resolve(y),S=j.start(),R=j.end(),L=n.chain().focus().setTextSelection({from:S,to:R}).unsetFontSize();w===null?L.setParagraph():L.setHeading({level:w}),L.setTextSelection(S).run()},t[2]=n,t[3]=a):a=t[3];const c=a;let d;t[4]!==l||t[5]!==r?(d=w=>w===null?!r:l===w,t[4]=l,t[5]=r,t[6]=d):d=t[6];const h=d;let u;t[7]!==h?(u=un.find(w=>h(w.level))?.Icon??ms,t[7]=h,t[8]=u):u=t[8];const f=u;let p;t[9]!==f?(p=s.jsx(f,{size:16}),t[9]=f,t[10]=p):p=t[10];let m;t[11]!==e?(m=e("richTextEditor.headingDropdown"),t[11]=e,t[12]=m):m=t[12];let g;t[13]!==r||t[14]!==p||t[15]!==m?(g=s.jsx(q.Target,{children:s.jsx(ro,{icon:p,title:m,isActive:r})}),t[13]=r,t[14]=p,t[15]=m,t[16]=g):g=t[16];let x;t[17]!==c||t[18]!==h||t[19]!==e?(x=un.map(w=>s.jsx(q.Item,{onClick:()=>c(w.level),className:w.className,"data-active":h(w.level)||void 0,children:e(w.labelKey)},w.level??"p")),t[17]=c,t[18]=h,t[19]=e,t[20]=x):x=t[20];let b;t[21]!==x?(b=s.jsx(q.Dropdown,{className:Kt.dropdown,children:x}),t[21]=x,t[22]=b):b=t[22];let v;return t[23]!==g||t[24]!==b?(v=s.jsxs(q,{shadow:"md",children:[g,b]}),t[23]=g,t[24]=b,t[25]=v):v=t[25],v};function ia(t){return{isHeadingActive:t.editor?.isActive("heading")??!1,activeLevel:[1,2,3].find(e=>t.editor?.isActive("heading",{level:e}))??null}}const la=()=>{const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs(M.ControlsGroup,{variant:"default",children:[s.jsx(M.Undo,{}),s.jsx(M.Redo,{})]}),t[0]=e):e=t[0],e},ra=()=>{const t=B.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs(M.ControlsGroup,{children:[s.jsx(M.BulletList,{}),s.jsx(M.OrderedList,{})]}),t[0]=e):e=t[0],e},aa="_toolbar_ffbq5_1",ca={toolbar:aa},da=t=>{const e=B.c(4),{children:n}=t,o=E.useRef(null);let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={shift:{limiter:{fn:a=>(o.current=o.current??{x:a.x,y:a.y},{x:o.current.x,y:o.current.y})}}
3,flip:!1,inline:!1,size:!1},e[0]=i):i=e[0];let r;e[1]===Symbol.for("react.memo_cache_sentinel")?(r=s.jsx(J.Target,{children:s.jsx(io,{icon:s.jsx(Qo,{}),title:"Rules Settings"})}),e[1]=r):r=e[1];let l;return e[2]!==n?(l=s.jsxs(J,{middlewares:i,children:[r,s.jsx(J.Dropdown,{children:n})]}),e[2]=n,e[3]=l):l=e[3],l},ha=t=>{const e=B.c(12),{sticky:n,stickyOffset:o,extraControls:i}=t,r=n===void 0?!1:n;let l,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(la,{}),a=s.jsx(zt,{orientation:"vertical"}),e[0]=l,e[1]=a):(l=e[0],a=e[1]);let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=s.jsx(M.ControlsGroup,{children:s.jsx(sa,{})}),e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=s.jsxs(it,{gap:"xs",children:[l,a,c,s.jsx(M.ControlsGroup,{children:s.jsx(Yr,{})}),s.jsx(zt,{orientation:"vertical"}),s.jsx(ra,{})]}),e[3]=d):d=e[3];let h;e[4]!==i?(h=i&&s.jsx(da,{children:i}),e[4]=i,e[5]=h):h=e[5];let u;e[6]!==h?(u=s.jsxs(it,{justify:"space-between",w:"100%",children:[d,h]}),e[6]=h,e[7]=u):u=e[7];let f;return e[8]!==r||e[9]!==o||e[10]!==u?(f=s.jsx(M.Toolbar,{sticky:r,stickyOffset:o,className:ca.toolbar,children:u}),e[8]=r,e[9]=o,e[10]=u,e[11]=f):f=e[11],f},ua=({content:t,onChange:e,placeholder:n,minHeight:o=200,editable:i=!0,isToolbarVisible:r=!0,stickyToolbar:l=!1,stickyOffset:a,className:c,extraControls:d})=>{"use no memo";const h=Yo({content:t,onChange:e,placeholder:n,editable:i});return s.jsxs(M,{variant:"subtle",editor:h,className:`${Se.editor} ${c??""}`,classNames:{control:Se.control,content:Se.content},children:[r&&s.jsx(ha,{sticky:l,stickyOffset:a,extraControls:d}),i&&s.jsx(Fr,{}),s.jsx(M.Content,{style:{minHeight:o}})]})},fa="_rules_wym1v_1",pa="_editorWrapper_wym1v_9",ma="_active_wym1v_14",ga="_editor_wym1v_9",re={rules:fa,editorWrapper:pa,active:ma,editor:ga},xa=()=>{const t=B.c(33),{t:e}=et(),{data:n,merge:o}=E.useContext(Ae),{size:i,background:r}=n;let l;t[0]!==o?(l=j=>{o({background:{color:j}})},t[0]=o,t[1]=l):l=t[1];const a=l;let c;t[2]!==o?(c=j=>{o({size:j})},t[2]=o,t[3]=c):c=t[3];const d=c;let h;t[4]!==e?(h=e("rules.background"),t[4]=e,t[5]=h):h=t[5];let u;t[6]!==h?(u=s.jsx(vt,{size:"sm",fw:500,mb:4,children:h}),t[6]=h,t[7]=u):u=t[7];let f;t[8]===Symbol.for("react.memo_cache_sentinel")?(f={withinPortal:!1},t[8]=f):f=t[8];let p;t[9]!==r.color||t[10]!==a?(p=s.jsx(Oo,{format:"hexa",value:r.color,onChange:a,withEyeDropper:!0,popoverProps:f}),t[9]=r.color,t[10]=a,t[11]=p):p=t[11];let m;t[12]!==u||t[13]!==p?(m=s.jsxs("div",{children:[u,p]}),t[12]=u,t[13]=p,t[14]=m):m=t[14];let g;t[15]!==e?(g=e("rules.size"),t[15]=e,t[16]=g):g=t[16];let x;t[17]!==g?(x=s.jsx(vt,{size:"sm",fw:500,mb:4,children:g}),t[17]=g,t[18]=x):x=t[18];let b;t[19]!==e?(b=e("common.default"),t[19]=e,t[20]=b):b=t[20];let v;t[21]!==b?(v=[{value:350,label:b}],t[21]=b,t[22]=v):v=t[22];let w;t[23]!==d||t[24]!==i||t[25]!==v?(w=s.jsx(Ho,{value:i,onChange:d,min:200,max:550,step:5,label:ba,marks:v}),t[23]=d,t[24]=i,t[25]=v,t[26]=w):w=t[26];let C;t[27]!==w||t[28]!==x?(C=s.jsxs("div",{children:[x,w]}),t[27]=w,t[28]=x,t[29]=C):C=t[29];let y;return t[30]!==C||t[31]!==m?(y=s.jsxs(bn,{gap:"sm",w:200,children:[m,C]}),t[30]=C,t[31]=m,t[32]=y):y=t[32],y};function ba(t){return`${t}px`}const va=200,wa=550,ya=t=>Math.min(Math.max(t,va),wa),Ca=({onRemoveRule:t,onAddRule:e,onUpdateRule:n,rules:o})=>{const{t:i}=et(),r=kn(),l=Te(I=>I.aucSettings.settings.activeRuleId??o[0]?.id),a=E.useRef(null),[c,d]=E.useState(!1),{data:{size:h,background:u},merge:f}=E.useContext(Ae),{portalRoot:p}=E.useContext(Cn),[m,g]=E.useState(null),[x,b]=E.useState(!1),v=E.useRef({pointerX:0,size:0});Po(()=>{x||d(!1)},null,[m,p]);const w=E.useCallback(I=>o.find(T=>T.id===I),[o]),C=E.useMemo(()=>l?w(l):null,[l,w]),y=E.useMemo(()=>C?JSON.parse(C.data):null,[C]);js({currentRuleContent:y});const[j,S]=E.useState({type:"doc",content:[]});if(C&&l!==a.current)try{S(y),a.current=l}catch(I){console.error("Failed to parse rule content:",I),S({type:"doc",content:[]})}const R=I=>{r(qt({activeRuleId:I}))},{maybeExecute:L}=Uo(I=>{l&&n({id:l,updates:{data:JSON.stringify(I)}})},{wait:750}),k=I=>{l&&n({id:l,updates:{name:I}})},A=I=>{L(I)},_=I=>{I.preventDefault(),I.stopPropagation(),v.current={pointerX:I.clientX,size:h},I.currentTarget.setPointerCapture(I.pointerId),d(!0),b(!0)};E.useEffect(()=>{if(!x)return;const I=U=>{const pt=U.clientX-v.current.pointerX;f({size:ya(v.current.size+pt)})},T=()=>{b(!1)},D=document.body.style.cursor,z=document.body.style.userSelect;return document.body.style.cursor="ew-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",I),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T),()=>{document.body.style.cursor=D,document.body.style.userSelect=z,window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T)}},[x,f]);const N=I=>{const T=Mn(i,o,I);e({name:T.name,data:JSON.stringify(T.content)})},H=I=>
3{if(t(I),I===l){const T=o.filter(D=>D.id!==I);T.length>0?r(qt({activeRuleId:T[0].id})):r(qt({activeRuleId:null}))}};return s.jsxs("div",{className:Ge(re.rules,"relative",{[re.active]:c}),style:{width:h},ref:g,onClick:()=>d(!0),children:[c&&s.jsx("button",{type:"button",className:Ge("absolute -right-2 top-0 z-10 h-full w-4 cursor-ew-resize rounded-sm border-0 bg-transparent p-0","before:absolute before:left-1/2 before:top-0 before:h-full before:w-0.5 before:-translate-x-1/2 before:rounded-full before:bg-yellow-400 before:shadow-[0_0_0_1px_rgba(0,0,0,0.35)]","after:absolute after:left-1/2 after:top-1/2 after:h-12 after:w-1.5 after:-translate-x-1/2 after:-translate-y-1/2 after:rounded-full after:border-x after:border-yellow-200 after:bg-yellow-500/80","hover:before:bg-yellow-300 focus:outline-none focus:ring-2 focus:ring-yellow-300/70",{"before:bg-yellow-300 after:bg-yellow-300":x}),"aria-label":i("rules.resizeHandle"),onPointerDown:_}),c&&l&&s.jsx("div",{children:s.jsx(Ps,{size:"md",value:l,onChange:R,options:o.map(I=>({value:I.id,label:I.name})),onOptionRename:(I,T)=>k(T),onOptionAdd:N,onOptionDelete:H})}),s.jsx("div",{className:`${re.editorWrapper} rounded-md`,style:{backgroundColor:u.color},children:s.jsx(ua,{content:j,onChange:A,isToolbarVisible:c,className:re.editor,extraControls:s.jsx(xa,{})})})]})},ja=()=>localStorage.getItem("rules")!==null;async function Sa(){const t="rules";try{const e=localStorage.getItem(t);if(!e)return console.log("No rules found in localStorage, skipping migration"),null;const n=JSON.parse(e);if(n.length===0)return console.log("No rules to migrate from localStorage"),localStorage.removeItem(t),null;const o=await Nt.getAll();if(o.length>0)return console.log("Rules already exist in IndexedDB, skipping migration"),localStorage.removeItem(t),o[0].id;let i=null;for(const r of n){const l=await Nt.create({name:r.name,data:JSON.stringify(r.content)});i||(i=l.id)}return localStorage.removeItem(t),console.log(`Successfully migrated ${n.length} rules from localStorage to IndexedDB`),i}catch(e){throw console.error("Rules migration error:",e),e}}const Da=()=>{const t=B.c(23),{t:e}=et(),n=kn(),o=Fo(),[i]=E.useState(ka);let r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=["migration"],t[0]=r):r=t[0];let l;t[1]!==n?(l=async()=>{const S=await Sa();return S&&n(qt({activeRuleId:S})),!0},t[1]=n,t[2]=l):l=t[2];let a;t[3]!==i||t[4]!==l?(a={queryKey:r,queryFn:l,enabled:i},t[3]=i,t[4]=l,t[5]=a):a=t[5];const d=!Je(a).isLoading;let h;t[6]!==d?(h={queryKey:ne.all,queryFn:Ma,enabled:d},t[6]=d,t[7]=h):h=t[7];const{data:u,isLoading:f,isFetching:p}=Je(h);let m;t[8]!==u?(m=u===void 0?[]:u,t[8]=u,t[9]=m):m=t[9];const g=m;let x;t[10]!==n||t[11]!==o?(x={mutationFn:Ra,onSuccess:S=>{o.invalidateQueries({queryKey:ne.all}),n(qt({activeRuleId:S.id}))}},t[10]=n,t[11]=o,t[12]=x):x=t[12];const b=ae(x);if(d&&!p&&g.length===0&&!b.isPending){const S=Mn(e);b.mutate({name:S.name,data:JSON.stringify(S.content)})}let v;t[13]!==o?(v={mutationFn:Ia,onSuccess:()=>{o.invalidateQueries({queryKey:ne.all})}},t[13]=o,t[14]=v):v=t[14];const w=ae(v);let C;t[15]!==o?(C={mutationFn:_a,onSuccess:()=>{o.invalidateQueries({queryKey:ne.all})}},t[15]=o,t[16]=C):C=t[16];const y=ae(C);if(f||!d){let S;return t[17]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Vo,{}),t[17]=S):S=t[17],S}let j;return t[18]!==b.mutate||t[19]!==y.mutate||t[20]!==g||t[21]!==w.mutate?(j=s.jsx(ys,{children:s.jsx(Ca,{onRemoveRule:y.mutate,onAddRule:b.mutate,onUpdateRule:w.mutate,rules:g})}),t[18]=b.mutate,t[19]=y.mutate,t[20]=g,t[21]=w.mutate,t[22]=j):j=t[22],j};function ka(){return ja()}function Ma(){return Nt.getAll()}function Ra(t){return Nt.create(t)}function Ia(t){const{id:e,updates:n}=t;return Nt.update(e,n)}function _a(t){return Nt.delete(t)}export{Da as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.