@simoncomputing/mui-bueno-v2 0.25.5 → 0.25.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
  - Minor increment --> singlular/minor changes. Minimal breaking changes.
12
12
  - Patch increment --> singlular/minor changes. Zero breaking changes.
13
13
 
14
+ ## [0.25.6] - 2026-02-13
15
+
16
+ ### Fixed
17
+
18
+ - `DiffCitationTable`
19
+ - Fixed circular JSON structure error caused by 0.25.4 change. Implemented `isEqual` to <b>URL/File Name</b> column and applied `ignoreDiff` to <b>Type</b> column
20
+
14
21
  ## [0.25.5] - 2026-02-13
15
22
 
16
23
  ### Added
@@ -78,8 +78,10 @@ export declare const baseCitationTableColumns: (palette: Palette, condenseTable?
78
78
  key: string;
79
79
  label: string;
80
80
  render: (fileName: string | undefined, citation: Citation) => import("react/jsx-runtime").JSX.Element;
81
+ ignoreDiff: boolean;
81
82
  tableCellSx?: undefined;
82
83
  hideCol?: undefined;
84
+ isEqual?: undefined;
83
85
  } | {
84
86
  fieldName: string;
85
87
  tableCellSx: {
@@ -88,13 +90,17 @@ export declare const baseCitationTableColumns: (palette: Palette, condenseTable?
88
90
  render: (title: string) => string;
89
91
  key?: undefined;
90
92
  label?: undefined;
93
+ ignoreDiff?: undefined;
91
94
  hideCol?: undefined;
95
+ isEqual?: undefined;
92
96
  } | {
93
97
  fieldName: string;
94
98
  key: string;
95
99
  label: string;
96
100
  hideCol: boolean;
97
101
  render: (fileName: string, citation: Citation) => import("react/jsx-runtime").JSX.Element;
102
+ isEqual: (citation1: Citation, citation2: Citation) => boolean;
103
+ ignoreDiff?: undefined;
98
104
  tableCellSx?: undefined;
99
105
  } | {
100
106
  fieldName: string;
@@ -102,12 +108,16 @@ export declare const baseCitationTableColumns: (palette: Palette, condenseTable?
102
108
  key?: undefined;
103
109
  label?: undefined;
104
110
  render?: undefined;
111
+ ignoreDiff?: undefined;
105
112
  tableCellSx?: undefined;
113
+ isEqual?: undefined;
106
114
  } | {
107
115
  fieldName: string;
108
116
  hideCol: boolean;
109
117
  render: (accessedAt: string, citation: Citation) => string | undefined;
110
118
  key?: undefined;
111
119
  label?: undefined;
120
+ ignoreDiff?: undefined;
112
121
  tableCellSx?: undefined;
122
+ isEqual?: undefined;
113
123
  })[];
package/dist/index.cjs.js CHANGED
@@ -401,7 +401,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
401
401
  `,Mce="️",_ce="‍",ab="";let vf=null,xf=null;function Rce(t=[]){const e={};Cr.groups=e;const n=new Cr;vf==null&&(vf=jk(Sce)),xf==null&&(xf=jk(Cce)),Re(n,"'",zp),Re(n,"{",tu),Re(n,"}",nu),Re(n,"[",Op),Re(n,"]",Mp),Re(n,"(",_p),Re(n,")",Rp),Re(n,"<",Ip),Re(n,">",Ap),Re(n,"(",Dp),Re(n,")",Pp),Re(n,"「",Np),Re(n,"」",$p),Re(n,"『",Lp),Re(n,"』",jp),Re(n,"<",Bp),Re(n,">",Fp),Re(n,"&",Vp),Re(n,"*",Hp),Re(n,"@",rs),Re(n,"`",Up),Re(n,"^",qp),Re(n,":",as),Re(n,",",yx),Re(n,"$",Kp),Re(n,".",Bo),Re(n,"=",Yp),Re(n,"!",bx),Re(n,"-",eo),Re(n,"%",ru),Re(n,"|",Gp),Re(n,"+",Jp),Re(n,"#",Xp),Re(n,"?",ou),Re(n,'"',vx),Re(n,"/",Fo),Re(n,";",xx),Re(n,"~",iu),Re(n,"_",Zp),Re(n,"\\",Wp),Re(n,"・",$A);const r=an(n,vi,mx,{[f0]:!0});an(r,vi,r);const o=an(r,bi,PA,{[eu]:!0}),i=an(r,Mc,NA,{[jc]:!0}),s=an(n,bi,Si,{[p0]:!0});an(s,vi,o),an(s,bi,s),an(o,vi,o),an(o,bi,o);const a=an(n,Mc,g0,{[h0]:!0});an(a,bi),an(a,vi,i),an(a,Mc,a),an(i,vi,i),an(i,bi),an(i,Mc,i);const l=Re(n,sb,gx,{[rb]:!0}),u=Re(n,Lk,v0,{[rb]:!0}),f=an(n,ib,v0,{[rb]:!0});Re(n,ab,f),Re(u,sb,l),Re(u,ab,f),an(u,ib,f),Re(f,Lk),Re(f,sb),an(f,ib,f),Re(f,ab,f);const p=an(n,ob,LA,{[DA]:!0});Re(p,"#"),an(p,ob,p),Re(p,Mce,p);const m=Re(p,_ce);Re(m,"#"),an(m,ob,p);const y=[[bi,s],[vi,o]],v=[[bi,null],[Mc,a],[vi,i]];for(let g=0;g<vf.length;g++)Qi(n,vf[g],y0,Si,y);for(let g=0;g<xf.length;g++)Qi(n,xf[g],b0,g0,v);ia(y0,{tld:!0,ascii:!0},e),ia(b0,{utld:!0,alpha:!0},e),Qi(n,"file",Hf,Si,y),Qi(n,"mailto",Hf,Si,y),Qi(n,"http",fl,Si,y),Qi(n,"https",fl,Si,y),Qi(n,"ftp",fl,Si,y),Qi(n,"ftps",fl,Si,y),ia(Hf,{scheme:!0,ascii:!0},e),ia(fl,{slashscheme:!0,ascii:!0},e),t=t.sort((g,x)=>g[0]>x[0]?1:-1);for(let g=0;g<t.length;g++){const x=t[g][0],E=t[g][1]?{[Tce]:!0}:{[Ece]:!0};x.indexOf("-")>=0?E[m0]=!0:bi.test(x)?vi.test(x)?E[eu]=!0:E[p0]=!0:E[f0]=!0,$k(n,x,x,E)}return $k(n,"localhost",ku,{ascii:!0}),n.jd=new Cr(Qp),{start:n,tokens:Object.assign({groups:e},jA)}}function BA(t,e){const n=Ice(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,l=null,u=0,f=null,p=-1,m=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(p=0,m=0,f=a):p>=0&&(p+=n[s].length,m++),u+=n[s].length,i+=n[s].length,s++;i-=p,s-=m,u-=p,o.push({t:f.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function Ice(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Qi(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Cr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Cr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function jk(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Ou={defaultProtocol:"http",events:null,format:Bk,formatHref:Bk,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function wx(t,e=null){let n=Object.assign({},Ou);t&&(n=Object.assign(n,t instanceof wx?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}wx.prototype={o:Ou,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Ou[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function Bk(t){return t}function FA(t,e){this.t="token",this.v=t,this.tk=e}FA.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Ou.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),f=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),f&&Object.assign(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function pm(t,e){class n extends FA{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const Fk=pm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Vk=pm("text"),Ace=pm("nl"),wf=pm("url",{isLink:!0,toHref(t=Ou.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==ku&&t[1].t===as}}),Zr=t=>new Cr(t);function Dce({groups:t}){const e=t.domain.concat([Vp,Hp,rs,Wp,Up,qp,Kp,Yp,eo,mx,ru,Gp,Jp,Xp,Fo,Qp,iu,Zp]),n=[zp,as,yx,Bo,bx,ru,ou,vx,xx,Ip,Ap,tu,nu,Mp,Op,_p,Rp,Dp,Pp,Np,$p,Lp,jp,Bp,Fp],r=[Vp,zp,Hp,Wp,Up,qp,Kp,Yp,eo,tu,nu,ru,Gp,Jp,Xp,ou,Fo,Qp,iu,Zp],o=Zr(),i=Re(o,iu);dt(i,r,i),dt(i,t.domain,i);const s=Zr(),a=Zr(),l=Zr();dt(o,t.domain,s),dt(o,t.scheme,a),dt(o,t.slashscheme,l),dt(s,r,i),dt(s,t.domain,s);const u=Re(s,rs);Re(i,rs,u),Re(a,rs,u),Re(l,rs,u);const f=Re(i,Bo);dt(f,r,i),dt(f,t.domain,i);const p=Zr();dt(u,t.domain,p),dt(p,t.domain,p);const m=Re(p,Bo);dt(m,t.domain,p);const y=Zr(Fk);dt(m,t.tld,y),dt(m,t.utld,y),Re(u,ku,y);const v=Re(p,eo);Re(v,eo,v),dt(v,t.domain,p),dt(y,t.domain,p),Re(y,Bo,m),Re(y,eo,v);const g=Re(y,as);dt(g,t.numeric,Fk);const x=Re(s,eo),S=Re(s,Bo);Re(x,eo,x),dt(x,t.domain,s),dt(S,r,i),dt(S,t.domain,s);const E=Zr(wf);dt(S,t.tld,E),dt(S,t.utld,E),dt(E,t.domain,s),dt(E,r,i),Re(E,Bo,S),Re(E,eo,x),Re(E,rs,u);const T=Re(E,as),C=Zr(wf);dt(T,t.numeric,C);const O=Zr(wf),R=Zr();dt(O,e,O),dt(O,n,R),dt(R,e,O),dt(R,n,R),Re(E,Fo,O),Re(C,Fo,O);const P=Re(a,as),N=Re(l,as),V=Re(N,Fo),M=Re(V,Fo);dt(a,t.domain,s),Re(a,Bo,S),Re(a,eo,x),dt(l,t.domain,s),Re(l,Bo,S),Re(l,eo,x),dt(P,t.domain,O),Re(P,Fo,O),Re(P,ou,O),dt(M,t.domain,O),dt(M,e,O),Re(M,Fo,O);const j=[[tu,nu],[Op,Mp],[_p,Rp],[Ip,Ap],[Dp,Pp],[Np,$p],[Lp,jp],[Bp,Fp]];for(let F=0;F<j.length;F++){const[L,D]=j[F],_=Re(O,L);Re(R,L,_),Re(_,D,O);const I=Zr(wf);dt(_,e,I);const B=Zr();dt(_,n),dt(I,e,I),dt(I,n,B),dt(B,e,I),dt(B,n,B),Re(I,D,O),Re(B,D,O)}return Re(o,ku,E),Re(o,gx,Ace),{start:o,tokens:jA}}function Pce(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,u=null,f=0,p=null,m=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(u=l||a.go(n[o].t));)l=null,a=u,a.accepts()?(m=0,p=a):m>=0&&m++,o++,f++;if(m<0)o-=f,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(lb(Vk,e,s)),s=[]),o-=m,f-=m;const y=p.t,v=n.slice(o-f,o);i.push(lb(y,e,v))}}return s.length>0&&i.push(lb(Vk,e,s)),i}function lb(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const Nce=typeof console<"u"&&console&&console.warn||(()=>{}),$ce="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Wt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Lce(){return Cr.groups={},Wt.scanner=null,Wt.parser=null,Wt.tokenQueue=[],Wt.pluginQueue=[],Wt.customSchemes=[],Wt.initialized=!1,Wt}function zk(t,e=!1){if(Wt.initialized&&Nce(`linkifyjs: already initialized - will not register custom scheme "${t}" ${$ce}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
402
402
  1. Must only contain digits, lowercase ASCII letters or "-"
403
403
  2. Cannot start or end with "-"
404
- 3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function jce(){Wt.scanner=Rce(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Dce(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function Sx(t){return Wt.initialized||jce(),Pce(Wt.parser.start,t,BA(Wt.scanner.start,t))}Sx.scan=BA;function VA(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new wx(n),o=Sx(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const Cx="[\0-   ᠎ -\u2029  ]",Bce=new RegExp(Cx),Fce=new RegExp(`${Cx}$`),Vce=new RegExp(Cx,"g");function zce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Hce(t){return new rn({key:new kn("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=a7(n.doc,[...e]);if(p7(a).forEach(({newRange:u})=>{const f=c7(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(u.from,u.to," "," ");if(!Fce.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(Bce).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=Sx(v).map(S=>S.toObject(t.defaultProtocol));if(!zce(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:g+S.start+1,to:g+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{iv(S.from,S.to,r.doc).some(E=>E.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function Wce(t){return new rn({key:new kn("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=ov(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function Uce(t){return new rn({key:new kn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=VA(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function qs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Vce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const qce=Or.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){zk(t);return}zk(t.scheme,t.optionalSlashes)})},onDestroy(){Lce()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=VA(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qs(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Hce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!qs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Wce({type:this.type})),this.options.linkOnPaste&&t.push(Uce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Kce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Y7(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(y)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!E)return null;const T=g+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const Yce=new kn("suggestion");function Gce({pluginKey:t=Yce,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=Kce}){let x;const S=y==null?void 0:y(),E=new rn({key:t,view(){return{update:async(T,C)=>{var O,R,P,N,V,M,j;const F=(O=this.key)===null||O===void 0?void 0:O.getState(C),L=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),D=F.active&&L.active&&F.range.from!==L.range.from,_=!F.active&&L.active,I=F.active&&!L.active,B=!_&&!I&&F.query!==L.query,W=_||D&&B,K=B||D,U=I||D&&B;if(!W&&!K&&!U)return;const Y=U&&!W?F:L,oe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:fe=>p({editor:e,range:Y.range,props:fe}),decorationNode:oe,clientRect:oe?()=>{var fe;const{decorationId:he}=(fe=this.key)===null||fe===void 0?void 0:fe.getState(e.state),G=T.dom.querySelector(`[data-decoration-id="${he}"]`);return(G==null?void 0:G.getBoundingClientRect())||null}:null},W&&((P=S==null?void 0:S.onBeforeStart)===null||P===void 0||P.call(S,x)),K&&((N=S==null?void 0:S.onBeforeUpdate)===null||N===void 0||N.call(S,x)),(K||W)&&(x.items=await m({editor:e,query:Y.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),W&&((j=S==null?void 0:S.onStart)===null||j===void 0||j.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,R){const{isEditable:P}=e,{composing:N}=e.view,{selection:V}=T,{empty:M,from:j}=V,F={...C};if(F.composing=N,P&&(M||e.view.composing)){(j<C.range.from||j>C.range.to)&&!N&&!C.composing&&(F.active=!1);const L=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;L&&v({editor:e,state:R,range:L.range,isActive:C.active})?(F.active=!0,F.decorationId=C.decorationId?C.decorationId:D,F.range=L.range,F.query=L.query,F.text=L.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(T,C){var O;const{active:R,range:P}=E.getState(T.state);return R&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:P}))||!1},decorations(T){const{active:C,range:O,decorationId:R,query:P}=E.getState(T);if(!C)return null;const N=!(P!=null&&P.length),V=[l];return N&&V.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return E}function Jce({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new kn;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function zA(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Jce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Hk(t,e){const n=zA(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const Xce=nn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Hk(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:Hk(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new _i,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return zA(this).map(Gce)}}),HA=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new rn({key:new kn("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&_h(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),Zce=Or.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Qce=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",St(this.options.HTMLAttributes,t),0]}}),eue=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",St(this.options.HTMLAttributes,t),0]}}),tue=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}}),nue=/^\s*(\[([( |x])?\])\s$/,rue=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const y=n();if(typeof y!="number")return!1;const v=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[Il({find:nue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),oue=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),iue=mn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),WA=Z.forwardRef((t,e)=>{const[n,r]=Z.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return Z.useEffect(()=>r(0),[t.items]),Z.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?b.jsx(H.Paper,{elevation:5,children:b.jsx(H.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(H.ListItem,{disablePadding:!0,children:b.jsx(H.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});WA.displayName="SuggestionList";const Wk={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},sue={items:async({query:t})=>Promise.resolve(["Lea Thompson","Cyndi Lauper","Tom Cruise","Madonna","Jerry Hall","Joan Collins","Winona Ryder","Christina Applegate","Alyssa Milano","Molly Ringwald","Ally Sheedy","Debbie Harry","Olivia Newton-John","Elton John","Michael J. Fox","Axl Rose","Emilio Estevez","Ralph Macchio","Rob Lowe","Jennifer Grey","Mickey Rourke","John Cusack","Matthew Broderick","Justine Bateman","Lisa Bonet","Benicio Monserrate Rafael del Toro Sánchez"].map((e,n)=>({mentionLabel:e,id:n.toString()})).filter(e=>e.mentionLabel.toLowerCase().startsWith(t.toLowerCase())).slice(0,5)),render:()=>{let t,e;return{onStart:n=>{t=new X2(WA,{props:n,editor:n.editor}),e=Wu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??Wk},appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})[0]},onUpdate(n){t==null||t.updateProps(n),e==null||e.setProps({getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??Wk}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},aue=qce.extend({inclusive:!1}),lue=Zce.extend({excludes:"superscript"}),cue=SI.extend({excludes:"subscript"});function uue({placeholder:t}={}){return Z.useMemo(()=>[Xee.configure({resizable:!0}),tue,eue,Qce,fR,hR,mR,vR,MR,_R,RR,lue,cue,AR,dR,uR,pR,OR,wI,IR,aue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),PQ,bR,AQ,iue.configure({types:["heading","paragraph","image"]}),vce,xce,wce,MZ,PR.configure({multicolor:!0}),kR,GQ,gR,oue,rue.configure({nested:!0}),Xce.configure({suggestion:sue}),HA.configure({placeholder:t}),ER],[t])}function Uk(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const due=t=>{const e=uue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(vI,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ut.useField({name:n}),{setValue:f}=u,{value:p}=a;Z.useEffect(()=>{var S,E,T;(T=(E=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:E.commands)==null||T.setContent(p)},[p]);const m=Z.useRef(null),y=Z.useCallback((S,E)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{Jb({images:O,editor:T,position:E})});else{const O=i(S);Jb({images:O,editor:T,position:E})}},[]),v=Z.useCallback((S,E,T,C)=>{var R;if(!(E instanceof DragEvent)||!E.dataTransfer)return!1;const O=Uk(E.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:E.clientX,top:E.clientY}))==null?void 0:R.pos;return y(O,P),E.preventDefault(),!0}return!1},[y]),g=Z.useCallback((S,E,T)=>{if(!E.clipboardData)return!1;const C=Uk(E.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(H.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(bI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(yce,{onUploadFiles:i}),onBlur:()=>{var S,E;return f(((E=(S=m.current)==null?void 0:S.editor)==null?void 0:E.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(bte,{}),b.jsx(Ate,{})]})})});return b.jsxs(H.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(H.Typography,{...o,children:r}),x]})},x0=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(H.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(H.Box,{className:"text-content",children:[b.jsx(H.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(H.Typography,{"data-testid":"message",children:n})]}),b.jsx(H.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},qk=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=Z.useState(!1),[u,f]=Z.useState(void 0);Z.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?b.jsx(H.Collapse,{in:n,children:u}):b.jsx(H.TableRow,{sx:p,children:b.jsx(H.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(H.Collapse,{in:n,children:u})})})},Tx=t=>{const{id:e,getRowKey:n=X=>"id"in X&&(typeof X.id=="string"||typeof X.id=="number")?X.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(X)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(X)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,renderExpand:a,hideColumnsOnMobile:l=[],sortField:u,sortOrder:f,onSortChange:p,allowSortCols:m,fixedLayout:y=!1,className:v,emptyTableMsg:g="No items to display",errorTableMsg:x,retryCallback:S,isLoading:E=!1,disableMobileCards:T=!1,highlightSelectedRow:C=!1,headerRowStyle:O={},stickyHeader:R,reRenderExpand:P=!1,expandOnRowClick:N=!1,tooltipColor:V,...M}=t,{palette:j}=H.useTheme(),[F,L]=Z.useState(void 0),[D,_]=Z.useState(void 0);fue(t);const I=X=>{X!==u?p&&p(X,"asc"):p&&p(u,f==="asc"?"desc":"asc")},B=X=>u===X?f:null,W=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),K=W&&l?r.filter(X=>!(l.includes(Rn(X))||X.hideCol)):r.filter(X=>!X.hideCol);a&&!W&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:X=>{const le=F===X;return b.jsx(H.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>re(X),children:le?b.jsx(Nf,{"data-testid":"collapse-up"}):b.jsx(eb,{"data-testid":"expand-down"})})}});const U=p!==void 0,Y=X=>U?m?m.includes(X):!0:!1,oe=b.jsxs(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(Rne,{})," ",g]}),fe=b.jsxs(H.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(bM,{color:"error"})," ",x,S&&b.jsx(H.Button,{variant:"text",onClick:S,children:"Retry?"})]}),he=()=>{if(E)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:b.jsx(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:b.jsx(x0,{})})})});if(x)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:fe})});if(o.length===0)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:oe})})},G=()=>{if(E)return b.jsx(x0,{});if(x)return fe;if(o.length===0)return oe},te=X=>{C&&_(X)},ue=X=>{const le=n(X);if((i||s)&&(i==null||i(le),s==null||s(X),te(le)),a&&N){const xe=F===le?void 0:le;L(xe),te(xe)}},re=X=>{const le=F===X?void 0:X;L(le),te(le)},ie=X=>{if(!a)return;const le=F===n(X);return b.jsxs(b.Fragment,{children:[b.jsxs(H.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>re(n(X)),children:[le?b.jsx(Nf,{}):b.jsx(eb,{})," Show"," ",le?"Less":"More"]}),b.jsx(qk,{colSpan:r.length,isExpanded:n(X)===F,obj:X,renderExpand:xe=>a(xe),asMobileCard:!0})]})},de=typeof C=="string"?C:j.grey[j.mode=="dark"?600:50],ye=X=>{const le=D===n(X)?de:"inherit";return{cursor:i||N?"pointer":"default",backgroundColor:le,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===de?Zie(le,.1):de}}}},ee=j.grey[j.mode==="dark"?600:400],ce=X=>X&&b.jsx(H.Tooltip,{title:X,children:b.jsx(_ne,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:V??ee,marginLeft:"2px"}})});return W&&!T?b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:v,"data-testid":"mui-table-mobile",children:[U&&b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(H.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:X=>I(X.target.value),fullWidth:!0,children:K.map(X=>{if(Y(Rn(X)))return b.jsx(H.MenuItem,{value:Rn(X),children:X.label??Fn(Rn(X))},`rowHeader-${Rn(X)}`)})}),b.jsx(H.IconButton,{onClick:()=>{u&&I(u)},children:b.jsx(Lne,{className:`sort-icon-${f}`})})]}),b.jsx(H.Divider,{sx:{margin:"10px 0"}})]}),G()??o.map(X=>b.jsxs(H.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(X)},onClick:()=>ue(X),"data-testid":`card-${n(X)}`,children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:K.map(le=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Rn(le)}`,style:{textWrap:"nowrap"},children:[le.label??Fn(Rn(le)),ce(le.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Rn(le)}`,style:{paddingLeft:"10px"},children:w0(le,X)})]},`row-${n(X)}-${Rn(le)}`))})}),ie(X)]},n(X)))]}):b.jsx(H.TableContainer,{component:H.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:R?{maxHeight:R,overflow:"auto"}:{},children:b.jsxs(H.Table,{stickyHeader:R!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(H.TableHead,{className:"MBv2_Table_Head",children:b.jsx(H.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((X,le)=>{const xe=Y(Rn(X));return b.jsx(H.TableCell,{width:Array.isArray(y)?y[le]:"auto",sx:X.tableCellSx??{},children:b.jsx(H.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(H.Box,{sx:[xe&&{"&:hover":{cursor:"pointer",backgroundColor:j.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:xe?()=>I(Rn(X)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:X.label??Fn(Rn(X))}),ce(X.tooltip),xe&&B(Rn(X))==="asc"&&b.jsx(Nf,{style:{marginLeft:"5px"}}),xe&&B(Rn(X))==="desc"&&b.jsx(eb,{style:{marginLeft:"5px"}}),xe&&B(Rn(X))!=="asc"&&B(Rn(X))!=="desc"&&b.jsx(Nne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${Rn(X)}`)})})}),b.jsx(H.TableBody,{className:"MBv2_Table_Body",children:he()??o.map(X=>b.jsxs(Z.Fragment,{children:[b.jsx(H.TableRow,{"data-testid":`row-${n(X)}`,className:"MBv2_Table_Body_Row",onClick:()=>ue(X),sx:ye(X),children:K.map(le=>b.jsx(H.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Rn(le)}`,children:w0(le,X)},`row-${n(X)}-${Rn(le)}`))}),a&&b.jsx(qk,{colSpan:K.length,isExpanded:n(X)===F,obj:X,renderExpand:le=>a(le),reRenderExpand:P})]},n(X)))})]})})},fue=t=>{const{fixedLayout:e,renderExpand:n,columns:r,expandOnRowClick:o,onRowClick:i,onRowClickObj:s}=t,a="Table component:";Array.isArray(e)&&(!n&&e.length!==r.length&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns".`),n&&e.length!==r.length+1&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),o&&!n&&console.warn(`${a} renderExpand should be defined when expandOnRowClick is defined`),i&&s&&console.warn(`${a} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`)},Rn=t=>t.key??t.fieldName,pue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),w0=(t,e)=>{const n=pue(e,t.fieldName);return S0(t,n,e,!1)},S0=(t,e,n,r)=>t.render?t.render(e,n,r):e,UA=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},y=x=>{r(parseInt(x.target.value,10))},v=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(H.Box,{children:[b.jsx(Tx,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(H.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},Kk=()=>({height:window.innerHeight,width:window.innerWidth}),qA=()=>{const[t,e]=Z.useState(Kk());return Z.useEffect(()=>{const n=()=>{e(Kk())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},ao=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=qA(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(H.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...hr({...t},a)})},hue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(H.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",startIcon:b.jsx(u0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},mue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(H.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",color:"error",startIcon:b.jsx(Jv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},gue=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onViewAttachment:f,onSelect:p,getCitationsPaginated:m,selectedIds:y,setSelectedIds:v,onError:g=()=>{},condenseTable:x=!1,canSelect:S=!1,canLaunchUrl:E,addlActions:T,readOnly:C=!1,showCloseBtn:O=!1}=t,R=!!t.canCreate&&!C,P=!!t.canEdit&&!C,N=!!t.canDelete&&!C,{palette:V}=H.useTheme(),[M,j]=Z.useState([]),[F,L]=Z.useState(!1),[D,_]=Z.useState(!0),[I,B]=Z.useState(null),[W,K]=Z.useState(null),[U,Y]=Z.useState(null),[oe,fe]=Z.useState({pageNo:0,pageSize:x?5:10,totalCount:0}),he=()=>{L(!1),_(!0),m({pageNo:oe.pageNo,pageSize:oe.pageSize}).then(le=>(j(le.data),fe({...oe,totalCount:le.totalCount}),le)).catch(le=>{g(le),L(!0),j([])}).finally(()=>_(!1))};Z.useEffect(he,[oe.pageNo,oe.pageSize,e]);const G=()=>{K(null),Y(null),B(null)},te=b.jsx(ao,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:b.jsx(zh,{}),children:"Add Citation"}),ue=b.jsx(ao,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:b.jsx(II,{}),children:"Add Attachment"}),re=le=>{if(!(!P&&!C)&&!(C&&!x))return b.jsx(H.Tooltip,{title:C?"View":"Edit",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>le.fileName?a(le):s(le),"data-testid":`citation-table_edit-btn-${le.id}`,children:C?b.jsx(jne,{}):b.jsx(Mne,{})})})},ie=le=>{if(!(!N||C))return b.jsx(H.Tooltip,{title:"Delete",children:b.jsx(H.IconButton,{color:"error",onClick:xe=>{K(le),B(xe.currentTarget)},"data-testid":`citation-table_delete-btn-${le.id}`,children:b.jsx(Jv,{})})})},de=le=>{if(!E)return;if(!le.fileName)return b.jsx(H.Tooltip,{title:"Open URL",children:b.jsx(H.IconButton,{color:"primary",onClick:_e=>{B(_e.currentTarget),Y(le)},"data-testid":`citation-table_launch-link-btn-${le.id}`,sx:{visibility:E!=null&&E(le)?"visible":"hidden"},children:b.jsx(u0,{})})})},ye=le=>{if(!f||!le.fileName)return;const xe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],_e=le.fileName.split(".").pop();if(!(!_e||!xe.includes(_e)))return b.jsx(H.Tooltip,{title:"View File",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(le),"data-testid":`citation-table_view-file-btn-${le.id}`,children:b.jsx(u0,{})})})},ee=le=>{if(!u)return;if(!!le.fileName)return b.jsx(H.Tooltip,{title:"Download",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(le),"data-testid":`citation-table_download-btn-${le.id}`,children:b.jsx(One,{})})})},ce=C||P||N||E||f||u||T,X=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(le,xe)=>b.jsx(H.Checkbox,{"data-testid":`citation-table_checkbox-${le}`,onChange:()=>{const _e=y.includes(xe.id);v(_e?y.filter(Me=>Me!==xe.id):[...y,xe.id])},checked:y.includes(le),disabled:C})},...KA(V,x),{fieldName:"id",key:"Action",label:"Action",hideCol:!ce,render:(le,xe)=>b.jsxs(H.Box,{display:"flex",flexDirection:"row-reverse",children:[T==null?void 0:T(xe),ie(xe),re(xe),ye(xe),de(xe),ee(xe)]})}];return b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[b.jsx(H.Typography,{variant:x?"h6":"h2",children:n}),!S&&R&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:1,children:[te,ue]}),O&&b.jsx(H.IconButton,{onClick:r,children:b.jsx(Jh,{})})]}),b.jsx(UA,{"data-testid":"citation-table",size:x?"x-small":"medium",isLoading:D,columns:X,data:M,paginationState:oe,onPageChange:le=>fe({...oe,pageNo:le}),onRowsPerPageChange:le=>fe({...oe,pageSize:le,pageNo:0}),errorTableMsg:F?"Failed to load citations.":void 0,retryCallback:he}),S&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:R&&b.jsxs(b.Fragment,{children:[te,ue]})}),!C&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(ao,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(ao,{variant:"contained",size:"small",onClick:()=>p(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),b.jsx(hue,{citation:U,anchorEl:I,onClose:G}),b.jsx(mue,{citation:W,anchorEl:I,onDeleteCitation:l,onClose:G})]})},KA=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(H.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(II,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(zh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})})},{fieldName:"title",tableCellSx:{width:e?"100%":"auto"},render:n=>e?Fl.truncate(n,{length:40,omission:"..."}):n},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:e,render:(n,r)=>b.jsx("span",{style:{wordBreak:"break-all"},children:n||r.url})},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],Ex=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(ao,{type:n,disabled:e,size:r,startIcon:e?b.jsx(H.CircularProgress,{size:s,color:"inherit"}):null,...o})};var cb,Yk;function yue(){if(Yk)return cb;Yk=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,E){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=E};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);cb={Cache:t,split:p,normalizePath:f,setter:function(S){var E=f(S);return l.get(S)||l.set(S,function(C,O){for(var R=0,P=E.length,N=C;R<P-1;){var V=E[R];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;N=N[E[R++]]}N[E[R]]=O})},getter:function(S,E){var T=f(S);return u.get(S)||u.set(S,function(O){for(var R=0,P=T.length;R<P;)if(O!=null||!E)O=O[T[R++]];else return;return O})},join:function(S){return S.reduce(function(E,T){return E+(y(T)||n.test(T)?"["+T+"]":(E?".":"")+T)},"")},forEach:function(S,E,T){m(Array.isArray(S)?S:p(S),E,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(E){return E.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,E,T){var C=S.length,O,R,P,N;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),N=y(O),P=!N&&/^\d+$/.test(O),E.call(T,O,N,P,R,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return cb}var ha=yue(),ub,Gk;function bue(){if(Gk)return ub;Gk=1;const t=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(t)||[],n=f=>f[0].toUpperCase()+f.slice(1),r=(f,p)=>e(f).join(p).toLowerCase(),o=f=>e(f).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return ub={words:e,upperFirst:n,camelCase:o,pascalCase:f=>n(o(f)),snakeCase:f=>r(f,"_"),kebabCase:f=>r(f,"-"),sentenceCase:f=>n(r(f," ")),titleCase:f=>e(f).map(n).join(" ")},ub}var db=bue(),Sf={exports:{}},Jk;function vue(){if(Jk)return Sf.exports;Jk=1,Sf.exports=function(o){return t(e(o),o)},Sf.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(y,v,g){if(g.has(y)){var x;try{x=", node was:"+JSON.stringify(y)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[v]){l[v]=!0;var S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var E=S[--v];m(E,p.get(E),g)}while(v);g.delete(y)}a[--s]=y}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return Sf.exports}var xue=vue();const wue=sr(xue),Sue=Object.prototype.toString,Cue=Error.prototype.toString,Tue=RegExp.prototype.toString,Eue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",kue=/^Symbol\((.*)\)(.*)$/;function Oue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function Xk(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Oue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Eue.call(t).replace(kue,"Symbol($1)");const r=Sue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Cue.call(t)+"]":r==="RegExp"?Tue.call(t):null}function ws(t,e){let n=Xk(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=Xk(this[r],e);return i!==null?i:o},2)}function YA(t){return t==null?[]:[].concat(t)}let GA,JA,XA,Mue=/\$\{\s*(\w+)\s*\}/g;GA=Symbol.toStringTag;class Zk{constructor(e,n,r,o){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[GA]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],YA(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}JA=Symbol.hasInstance;XA=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Mue,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new Zk(e,n,r,o);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[XA]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[JA](e){return Zk[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},_ue={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},C0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Rue={isValue:"${path} field must be ${value}"},Wf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Iue={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Aue={notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:_ue,date:C0,object:Wf,array:Iue,boolean:Rue,tuple:Aue});const kx=t=>t&&t.__isYupSchema__;class eh{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new eh(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!kx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Cf={context:"$",value:"."};class Pa{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Cf.context,this.isValue=this.key[0]===Cf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Cf.context:this.isValue?Cf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ha.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Pa.prototype.__isYupRef=!0;const sa=t=>t==null;function sl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const E={value:n,parent:v,context:g};function T(j={}){const F=ZA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||S},p,j.params),E),L=new pr(pr.formatError(j.message||m,F),n,F.path,j.type||u,F.disableStackTrace);return L.params=F,L}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return QA(j,E)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?C(j):j?l(null):C(T())},P=j=>{pr.isError(j)?C(j):a(j)};if(y&&sa(n))return R(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(R,P)}}catch(j){P(j);return}R(V)}return e.OPTIONS=t,e}function ZA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=QA(t[n],e);return t}function QA(t,e){return Pa.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Due(t,e,n,r=n){let o,i,s;return e?(ha.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class th extends Set{describe(){const e=[];for(const n of this.values())e.push(Pa.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new th(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function gl(t,e=new Map){if(kx(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=gl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,gl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(gl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=gl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function Pue(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function Nue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:Pue(n)}))}function eD(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Nue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>eD(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new th,this._blacklist=new th,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=gl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&sa(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
404
+ 3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function jce(){Wt.scanner=Rce(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Dce(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function Sx(t){return Wt.initialized||jce(),Pce(Wt.parser.start,t,BA(Wt.scanner.start,t))}Sx.scan=BA;function VA(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new wx(n),o=Sx(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const Cx="[\0-   ᠎ -\u2029  ]",Bce=new RegExp(Cx),Fce=new RegExp(`${Cx}$`),Vce=new RegExp(Cx,"g");function zce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Hce(t){return new rn({key:new kn("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=a7(n.doc,[...e]);if(p7(a).forEach(({newRange:u})=>{const f=c7(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(u.from,u.to," "," ");if(!Fce.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(Bce).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=Sx(v).map(S=>S.toObject(t.defaultProtocol));if(!zce(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:g+S.start+1,to:g+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{iv(S.from,S.to,r.doc).some(E=>E.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function Wce(t){return new rn({key:new kn("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=ov(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function Uce(t){return new rn({key:new kn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=VA(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function qs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Vce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const qce=Or.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){zk(t);return}zk(t.scheme,t.optionalSlashes)})},onDestroy(){Lce()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=VA(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qs(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Hce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!qs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Wce({type:this.type})),this.options.linkOnPaste&&t.push(Uce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Kce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Y7(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(y)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!E)return null;const T=g+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const Yce=new kn("suggestion");function Gce({pluginKey:t=Yce,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=Kce}){let x;const S=y==null?void 0:y(),E=new rn({key:t,view(){return{update:async(T,C)=>{var O,R,P,N,V,M,j;const F=(O=this.key)===null||O===void 0?void 0:O.getState(C),L=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),D=F.active&&L.active&&F.range.from!==L.range.from,_=!F.active&&L.active,I=F.active&&!L.active,B=!_&&!I&&F.query!==L.query,W=_||D&&B,K=B||D,U=I||D&&B;if(!W&&!K&&!U)return;const Y=U&&!W?F:L,oe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:fe=>p({editor:e,range:Y.range,props:fe}),decorationNode:oe,clientRect:oe?()=>{var fe;const{decorationId:he}=(fe=this.key)===null||fe===void 0?void 0:fe.getState(e.state),G=T.dom.querySelector(`[data-decoration-id="${he}"]`);return(G==null?void 0:G.getBoundingClientRect())||null}:null},W&&((P=S==null?void 0:S.onBeforeStart)===null||P===void 0||P.call(S,x)),K&&((N=S==null?void 0:S.onBeforeUpdate)===null||N===void 0||N.call(S,x)),(K||W)&&(x.items=await m({editor:e,query:Y.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),W&&((j=S==null?void 0:S.onStart)===null||j===void 0||j.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,R){const{isEditable:P}=e,{composing:N}=e.view,{selection:V}=T,{empty:M,from:j}=V,F={...C};if(F.composing=N,P&&(M||e.view.composing)){(j<C.range.from||j>C.range.to)&&!N&&!C.composing&&(F.active=!1);const L=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;L&&v({editor:e,state:R,range:L.range,isActive:C.active})?(F.active=!0,F.decorationId=C.decorationId?C.decorationId:D,F.range=L.range,F.query=L.query,F.text=L.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(T,C){var O;const{active:R,range:P}=E.getState(T.state);return R&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:P}))||!1},decorations(T){const{active:C,range:O,decorationId:R,query:P}=E.getState(T);if(!C)return null;const N=!(P!=null&&P.length),V=[l];return N&&V.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return E}function Jce({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new kn;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function zA(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Jce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function Hk(t,e){const n=zA(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const Xce=nn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=Hk(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:Hk(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new _i,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return zA(this).map(Gce)}}),HA=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new rn({key:new kn("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&_h(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),Zce=Or.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Qce=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",St(this.options.HTMLAttributes,t),0]}}),eue=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",St(this.options.HTMLAttributes,t),0]}}),tue=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}}),nue=/^\s*(\[([( |x])?\])\s$/,rue=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const y=n();if(typeof y!="number")return!1;const v=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[Il({find:nue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),oue=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),iue=mn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),WA=Z.forwardRef((t,e)=>{const[n,r]=Z.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return Z.useEffect(()=>r(0),[t.items]),Z.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?b.jsx(H.Paper,{elevation:5,children:b.jsx(H.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(H.ListItem,{disablePadding:!0,children:b.jsx(H.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});WA.displayName="SuggestionList";const Wk={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},sue={items:async({query:t})=>Promise.resolve(["Lea Thompson","Cyndi Lauper","Tom Cruise","Madonna","Jerry Hall","Joan Collins","Winona Ryder","Christina Applegate","Alyssa Milano","Molly Ringwald","Ally Sheedy","Debbie Harry","Olivia Newton-John","Elton John","Michael J. Fox","Axl Rose","Emilio Estevez","Ralph Macchio","Rob Lowe","Jennifer Grey","Mickey Rourke","John Cusack","Matthew Broderick","Justine Bateman","Lisa Bonet","Benicio Monserrate Rafael del Toro Sánchez"].map((e,n)=>({mentionLabel:e,id:n.toString()})).filter(e=>e.mentionLabel.toLowerCase().startsWith(t.toLowerCase())).slice(0,5)),render:()=>{let t,e;return{onStart:n=>{t=new X2(WA,{props:n,editor:n.editor}),e=Wu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??Wk},appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})[0]},onUpdate(n){t==null||t.updateProps(n),e==null||e.setProps({getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??Wk}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},aue=qce.extend({inclusive:!1}),lue=Zce.extend({excludes:"superscript"}),cue=SI.extend({excludes:"subscript"});function uue({placeholder:t}={}){return Z.useMemo(()=>[Xee.configure({resizable:!0}),tue,eue,Qce,fR,hR,mR,vR,MR,_R,RR,lue,cue,AR,dR,uR,pR,OR,wI,IR,aue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),PQ,bR,AQ,iue.configure({types:["heading","paragraph","image"]}),vce,xce,wce,MZ,PR.configure({multicolor:!0}),kR,GQ,gR,oue,rue.configure({nested:!0}),Xce.configure({suggestion:sue}),HA.configure({placeholder:t}),ER],[t])}function Uk(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const due=t=>{const e=uue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(vI,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ut.useField({name:n}),{setValue:f}=u,{value:p}=a;Z.useEffect(()=>{var S,E,T;(T=(E=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:E.commands)==null||T.setContent(p)},[p]);const m=Z.useRef(null),y=Z.useCallback((S,E)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{Jb({images:O,editor:T,position:E})});else{const O=i(S);Jb({images:O,editor:T,position:E})}},[]),v=Z.useCallback((S,E,T,C)=>{var R;if(!(E instanceof DragEvent)||!E.dataTransfer)return!1;const O=Uk(E.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:E.clientX,top:E.clientY}))==null?void 0:R.pos;return y(O,P),E.preventDefault(),!0}return!1},[y]),g=Z.useCallback((S,E,T)=>{if(!E.clipboardData)return!1;const C=Uk(E.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(H.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(bI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(yce,{onUploadFiles:i}),onBlur:()=>{var S,E;return f(((E=(S=m.current)==null?void 0:S.editor)==null?void 0:E.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(bte,{}),b.jsx(Ate,{})]})})});return b.jsxs(H.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(H.Typography,{...o,children:r}),x]})},x0=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(H.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(H.Box,{className:"text-content",children:[b.jsx(H.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(H.Typography,{"data-testid":"message",children:n})]}),b.jsx(H.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},qk=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=Z.useState(!1),[u,f]=Z.useState(void 0);Z.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?b.jsx(H.Collapse,{in:n,children:u}):b.jsx(H.TableRow,{sx:p,children:b.jsx(H.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(H.Collapse,{in:n,children:u})})})},Tx=t=>{const{id:e,getRowKey:n=X=>"id"in X&&(typeof X.id=="string"||typeof X.id=="number")?X.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(X)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(X)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,renderExpand:a,hideColumnsOnMobile:l=[],sortField:u,sortOrder:f,onSortChange:p,allowSortCols:m,fixedLayout:y=!1,className:v,emptyTableMsg:g="No items to display",errorTableMsg:x,retryCallback:S,isLoading:E=!1,disableMobileCards:T=!1,highlightSelectedRow:C=!1,headerRowStyle:O={},stickyHeader:R,reRenderExpand:P=!1,expandOnRowClick:N=!1,tooltipColor:V,...M}=t,{palette:j}=H.useTheme(),[F,L]=Z.useState(void 0),[D,_]=Z.useState(void 0);fue(t);const I=X=>{X!==u?p&&p(X,"asc"):p&&p(u,f==="asc"?"desc":"asc")},B=X=>u===X?f:null,W=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),K=W&&l?r.filter(X=>!(l.includes(Rn(X))||X.hideCol)):r.filter(X=>!X.hideCol);a&&!W&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:X=>{const le=F===X;return b.jsx(H.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>re(X),children:le?b.jsx(Nf,{"data-testid":"collapse-up"}):b.jsx(eb,{"data-testid":"expand-down"})})}});const U=p!==void 0,Y=X=>U?m?m.includes(X):!0:!1,oe=b.jsxs(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(Rne,{})," ",g]}),fe=b.jsxs(H.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(bM,{color:"error"})," ",x,S&&b.jsx(H.Button,{variant:"text",onClick:S,children:"Retry?"})]}),he=()=>{if(E)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:b.jsx(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:b.jsx(x0,{})})})});if(x)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:fe})});if(o.length===0)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:oe})})},G=()=>{if(E)return b.jsx(x0,{});if(x)return fe;if(o.length===0)return oe},te=X=>{C&&_(X)},ue=X=>{const le=n(X);if((i||s)&&(i==null||i(le),s==null||s(X),te(le)),a&&N){const xe=F===le?void 0:le;L(xe),te(xe)}},re=X=>{const le=F===X?void 0:X;L(le),te(le)},ie=X=>{if(!a)return;const le=F===n(X);return b.jsxs(b.Fragment,{children:[b.jsxs(H.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>re(n(X)),children:[le?b.jsx(Nf,{}):b.jsx(eb,{})," Show"," ",le?"Less":"More"]}),b.jsx(qk,{colSpan:r.length,isExpanded:n(X)===F,obj:X,renderExpand:xe=>a(xe),asMobileCard:!0})]})},de=typeof C=="string"?C:j.grey[j.mode=="dark"?600:50],ye=X=>{const le=D===n(X)?de:"inherit";return{cursor:i||N?"pointer":"default",backgroundColor:le,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===de?Zie(le,.1):de}}}},ee=j.grey[j.mode==="dark"?600:400],ce=X=>X&&b.jsx(H.Tooltip,{title:X,children:b.jsx(_ne,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:V??ee,marginLeft:"2px"}})});return W&&!T?b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:v,"data-testid":"mui-table-mobile",children:[U&&b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(H.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:X=>I(X.target.value),fullWidth:!0,children:K.map(X=>{if(Y(Rn(X)))return b.jsx(H.MenuItem,{value:Rn(X),children:X.label??Fn(Rn(X))},`rowHeader-${Rn(X)}`)})}),b.jsx(H.IconButton,{onClick:()=>{u&&I(u)},children:b.jsx(Lne,{className:`sort-icon-${f}`})})]}),b.jsx(H.Divider,{sx:{margin:"10px 0"}})]}),G()??o.map(X=>b.jsxs(H.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(X)},onClick:()=>ue(X),"data-testid":`card-${n(X)}`,children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:K.map(le=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Rn(le)}`,style:{textWrap:"nowrap"},children:[le.label??Fn(Rn(le)),ce(le.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Rn(le)}`,style:{paddingLeft:"10px"},children:w0(le,X)})]},`row-${n(X)}-${Rn(le)}`))})}),ie(X)]},n(X)))]}):b.jsx(H.TableContainer,{component:H.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:R?{maxHeight:R,overflow:"auto"}:{},children:b.jsxs(H.Table,{stickyHeader:R!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(H.TableHead,{className:"MBv2_Table_Head",children:b.jsx(H.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((X,le)=>{const xe=Y(Rn(X));return b.jsx(H.TableCell,{width:Array.isArray(y)?y[le]:"auto",sx:X.tableCellSx??{},children:b.jsx(H.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(H.Box,{sx:[xe&&{"&:hover":{cursor:"pointer",backgroundColor:j.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:xe?()=>I(Rn(X)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:X.label??Fn(Rn(X))}),ce(X.tooltip),xe&&B(Rn(X))==="asc"&&b.jsx(Nf,{style:{marginLeft:"5px"}}),xe&&B(Rn(X))==="desc"&&b.jsx(eb,{style:{marginLeft:"5px"}}),xe&&B(Rn(X))!=="asc"&&B(Rn(X))!=="desc"&&b.jsx(Nne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${Rn(X)}`)})})}),b.jsx(H.TableBody,{className:"MBv2_Table_Body",children:he()??o.map(X=>b.jsxs(Z.Fragment,{children:[b.jsx(H.TableRow,{"data-testid":`row-${n(X)}`,className:"MBv2_Table_Body_Row",onClick:()=>ue(X),sx:ye(X),children:K.map(le=>b.jsx(H.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Rn(le)}`,children:w0(le,X)},`row-${n(X)}-${Rn(le)}`))}),a&&b.jsx(qk,{colSpan:K.length,isExpanded:n(X)===F,obj:X,renderExpand:le=>a(le),reRenderExpand:P})]},n(X)))})]})})},fue=t=>{const{fixedLayout:e,renderExpand:n,columns:r,expandOnRowClick:o,onRowClick:i,onRowClickObj:s}=t,a="Table component:";Array.isArray(e)&&(!n&&e.length!==r.length&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns".`),n&&e.length!==r.length+1&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),o&&!n&&console.warn(`${a} renderExpand should be defined when expandOnRowClick is defined`),i&&s&&console.warn(`${a} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`)},Rn=t=>t.key??t.fieldName,pue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),w0=(t,e)=>{const n=pue(e,t.fieldName);return S0(t,n,e,!1)},S0=(t,e,n,r)=>t.render?t.render(e,n,r):e,UA=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},y=x=>{r(parseInt(x.target.value,10))},v=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(H.Box,{children:[b.jsx(Tx,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(H.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},Kk=()=>({height:window.innerHeight,width:window.innerWidth}),qA=()=>{const[t,e]=Z.useState(Kk());return Z.useEffect(()=>{const n=()=>{e(Kk())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},ao=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=qA(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(H.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...hr({...t},a)})},hue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(H.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",startIcon:b.jsx(u0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},mue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(H.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",color:"error",startIcon:b.jsx(Jv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},gue=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onViewAttachment:f,onSelect:p,getCitationsPaginated:m,selectedIds:y,setSelectedIds:v,onError:g=()=>{},condenseTable:x=!1,canSelect:S=!1,canLaunchUrl:E,addlActions:T,readOnly:C=!1,showCloseBtn:O=!1}=t,R=!!t.canCreate&&!C,P=!!t.canEdit&&!C,N=!!t.canDelete&&!C,{palette:V}=H.useTheme(),[M,j]=Z.useState([]),[F,L]=Z.useState(!1),[D,_]=Z.useState(!0),[I,B]=Z.useState(null),[W,K]=Z.useState(null),[U,Y]=Z.useState(null),[oe,fe]=Z.useState({pageNo:0,pageSize:x?5:10,totalCount:0}),he=()=>{L(!1),_(!0),m({pageNo:oe.pageNo,pageSize:oe.pageSize}).then(le=>(j(le.data),fe({...oe,totalCount:le.totalCount}),le)).catch(le=>{g(le),L(!0),j([])}).finally(()=>_(!1))};Z.useEffect(he,[oe.pageNo,oe.pageSize,e]);const G=()=>{K(null),Y(null),B(null)},te=b.jsx(ao,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:b.jsx(zh,{}),children:"Add Citation"}),ue=b.jsx(ao,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:b.jsx(II,{}),children:"Add Attachment"}),re=le=>{if(!(!P&&!C)&&!(C&&!x))return b.jsx(H.Tooltip,{title:C?"View":"Edit",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>le.fileName?a(le):s(le),"data-testid":`citation-table_edit-btn-${le.id}`,children:C?b.jsx(jne,{}):b.jsx(Mne,{})})})},ie=le=>{if(!(!N||C))return b.jsx(H.Tooltip,{title:"Delete",children:b.jsx(H.IconButton,{color:"error",onClick:xe=>{K(le),B(xe.currentTarget)},"data-testid":`citation-table_delete-btn-${le.id}`,children:b.jsx(Jv,{})})})},de=le=>{if(!E)return;if(!le.fileName)return b.jsx(H.Tooltip,{title:"Open URL",children:b.jsx(H.IconButton,{color:"primary",onClick:_e=>{B(_e.currentTarget),Y(le)},"data-testid":`citation-table_launch-link-btn-${le.id}`,sx:{visibility:E!=null&&E(le)?"visible":"hidden"},children:b.jsx(u0,{})})})},ye=le=>{if(!f||!le.fileName)return;const xe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],_e=le.fileName.split(".").pop();if(!(!_e||!xe.includes(_e)))return b.jsx(H.Tooltip,{title:"View File",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(le),"data-testid":`citation-table_view-file-btn-${le.id}`,children:b.jsx(u0,{})})})},ee=le=>{if(!u)return;if(!!le.fileName)return b.jsx(H.Tooltip,{title:"Download",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(le),"data-testid":`citation-table_download-btn-${le.id}`,children:b.jsx(One,{})})})},ce=C||P||N||E||f||u||T,X=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(le,xe)=>b.jsx(H.Checkbox,{"data-testid":`citation-table_checkbox-${le}`,onChange:()=>{const _e=y.includes(xe.id);v(_e?y.filter(Me=>Me!==xe.id):[...y,xe.id])},checked:y.includes(le),disabled:C})},...KA(V,x),{fieldName:"id",key:"Action",label:"Action",hideCol:!ce,render:(le,xe)=>b.jsxs(H.Box,{display:"flex",flexDirection:"row-reverse",children:[T==null?void 0:T(xe),ie(xe),re(xe),ye(xe),de(xe),ee(xe)]})}];return b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[b.jsx(H.Typography,{variant:x?"h6":"h2",children:n}),!S&&R&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:1,children:[te,ue]}),O&&b.jsx(H.IconButton,{onClick:r,children:b.jsx(Jh,{})})]}),b.jsx(UA,{"data-testid":"citation-table",size:x?"x-small":"medium",isLoading:D,columns:X,data:M,paginationState:oe,onPageChange:le=>fe({...oe,pageNo:le}),onRowsPerPageChange:le=>fe({...oe,pageSize:le,pageNo:0}),errorTableMsg:F?"Failed to load citations.":void 0,retryCallback:he}),S&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:R&&b.jsxs(b.Fragment,{children:[te,ue]})}),!C&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(ao,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(ao,{variant:"contained",size:"small",onClick:()=>p(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),b.jsx(hue,{citation:U,anchorEl:I,onClose:G}),b.jsx(mue,{citation:W,anchorEl:I,onDeleteCitation:l,onClose:G})]})},KA=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(H.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(II,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(zh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",tableCellSx:{width:e?"100%":"auto"},render:n=>e?Fl.truncate(n,{length:40,omission:"..."}):n},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:e,render:(n,r)=>b.jsx("span",{style:{wordBreak:"break-all"},children:n||r.url}),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],Ex=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(ao,{type:n,disabled:e,size:r,startIcon:e?b.jsx(H.CircularProgress,{size:s,color:"inherit"}):null,...o})};var cb,Yk;function yue(){if(Yk)return cb;Yk=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,E){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=E};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);cb={Cache:t,split:p,normalizePath:f,setter:function(S){var E=f(S);return l.get(S)||l.set(S,function(C,O){for(var R=0,P=E.length,N=C;R<P-1;){var V=E[R];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;N=N[E[R++]]}N[E[R]]=O})},getter:function(S,E){var T=f(S);return u.get(S)||u.set(S,function(O){for(var R=0,P=T.length;R<P;)if(O!=null||!E)O=O[T[R++]];else return;return O})},join:function(S){return S.reduce(function(E,T){return E+(y(T)||n.test(T)?"["+T+"]":(E?".":"")+T)},"")},forEach:function(S,E,T){m(Array.isArray(S)?S:p(S),E,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(E){return E.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,E,T){var C=S.length,O,R,P,N;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),N=y(O),P=!N&&/^\d+$/.test(O),E.call(T,O,N,P,R,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return cb}var ha=yue(),ub,Gk;function bue(){if(Gk)return ub;Gk=1;const t=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(t)||[],n=f=>f[0].toUpperCase()+f.slice(1),r=(f,p)=>e(f).join(p).toLowerCase(),o=f=>e(f).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return ub={words:e,upperFirst:n,camelCase:o,pascalCase:f=>n(o(f)),snakeCase:f=>r(f,"_"),kebabCase:f=>r(f,"-"),sentenceCase:f=>n(r(f," ")),titleCase:f=>e(f).map(n).join(" ")},ub}var db=bue(),Sf={exports:{}},Jk;function vue(){if(Jk)return Sf.exports;Jk=1,Sf.exports=function(o){return t(e(o),o)},Sf.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(y,v,g){if(g.has(y)){var x;try{x=", node was:"+JSON.stringify(y)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[v]){l[v]=!0;var S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var E=S[--v];m(E,p.get(E),g)}while(v);g.delete(y)}a[--s]=y}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return Sf.exports}var xue=vue();const wue=sr(xue),Sue=Object.prototype.toString,Cue=Error.prototype.toString,Tue=RegExp.prototype.toString,Eue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",kue=/^Symbol\((.*)\)(.*)$/;function Oue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function Xk(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Oue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Eue.call(t).replace(kue,"Symbol($1)");const r=Sue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Cue.call(t)+"]":r==="RegExp"?Tue.call(t):null}function ws(t,e){let n=Xk(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=Xk(this[r],e);return i!==null?i:o},2)}function YA(t){return t==null?[]:[].concat(t)}let GA,JA,XA,Mue=/\$\{\s*(\w+)\s*\}/g;GA=Symbol.toStringTag;class Zk{constructor(e,n,r,o){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[GA]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],YA(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}JA=Symbol.hasInstance;XA=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Mue,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new Zk(e,n,r,o);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[XA]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[JA](e){return Zk[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},_ue={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},C0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Rue={isValue:"${path} field must be ${value}"},Wf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Iue={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Aue={notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:_ue,date:C0,object:Wf,array:Iue,boolean:Rue,tuple:Aue});const kx=t=>t&&t.__isYupSchema__;class eh{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new eh(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!kx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Cf={context:"$",value:"."};class Pa{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Cf.context,this.isValue=this.key[0]===Cf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Cf.context:this.isValue?Cf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ha.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Pa.prototype.__isYupRef=!0;const sa=t=>t==null;function sl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const E={value:n,parent:v,context:g};function T(j={}){const F=ZA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||S},p,j.params),E),L=new pr(pr.formatError(j.message||m,F),n,F.path,j.type||u,F.disableStackTrace);return L.params=F,L}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return QA(j,E)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?C(j):j?l(null):C(T())},P=j=>{pr.isError(j)?C(j):a(j)};if(y&&sa(n))return R(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(R,P)}}catch(j){P(j);return}R(V)}return e.OPTIONS=t,e}function ZA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=QA(t[n],e);return t}function QA(t,e){return Pa.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Due(t,e,n,r=n){let o,i,s;return e?(ha.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class th extends Set{describe(){const e=[];for(const n of this.values())e.push(Pa.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new th(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function gl(t,e=new Map){if(kx(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=gl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,gl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(gl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=gl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function Pue(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function Nue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:Pue(n)}))}function eD(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Nue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>eD(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new th,this._blacklist=new th,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=gl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&sa(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
405
405
 
406
406
  attempted value: ${s}
407
407
  `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(E){E&&(Array.isArray(E)?y.push(...E):y.push(E)),--m<=0&&p(y)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,y)=>this.resolve(f)._validate(u,f,m,y)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):gl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=sl({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=sl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Vo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Vo.notNull){return this.nullability(!1,e)}required(e=Vo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Vo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=sl(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=YA(e).map(i=>new Pa(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new eh(o,n):eh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=sl({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Vo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=sl({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Vo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=sl({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?ZA(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:eD(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Due(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const $ue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Lue(t){const e=T0(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let n=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(n=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(n=0-n)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+n,e.second,e.millisecond)}function T0(t){var e,n;const r=$ue.exec(t);return r?{year:xi(r[1]),month:xi(r[2],1)-1,day:xi(r[3],1),hour:xi(r[4]),minute:xi(r[5]),second:xi(r[6]),millisecond:r[7]?xi(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:xi(r[10]),minuteOffset:xi(r[11])}:null}function xi(t,e=0){return Number(t)||e}let jue=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Bue=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Fue=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Vue="^\\d{4}-\\d{2}-\\d{2}",zue="\\d{2}:\\d{2}:\\d{2}",Hue="(([+-]\\d{2}(:?\\d{2})?)|Z)",Wue=new RegExp(`${Vue}T${zue}(\\.\\d+)?${Hue}$`),Uue=t=>sa(t)||t===t.trim(),que={}.toString();function aa(){return new tD}class tD extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===que?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Vo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=wr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=wr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=wr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||wr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=wr.email){return this.matches(jue,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(Bue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(Fue,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let n="",r,o;return e&&(typeof e=="object"?{message:n="",allowOffset:r=!1,precision:o=void 0}=e:n=e),this.matches(Wue,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=T0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=T0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Uue})}lowercase(e=wr.lowercase){return this.transform(n=>sa(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toLowerCase()})}uppercase(e=wr.uppercase){return this.transform(n=>sa(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toUpperCase()})}}aa.prototype=tD.prototype;let nD=new Date(""),Kue=t=>Object.prototype.toString.call(t)==="[object Date]";function Ox(){return new Ju}class Ju extends ti{constructor(){super({type:"date",check(e){return Kue(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Lue(e),isNaN(e)?Ju.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Pa.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=C0.min){let r=this.prepareParam(e,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(o){return o>=this.resolve(r)}})}max(e,n=C0.max){let r=this.prepareParam(e,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(o){return o<=this.resolve(r)}})}}Ju.INVALID_DATE=nD;Ox.prototype=Ju.prototype;Ox.INVALID_DATE=nD;function Yue(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=ha.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Pa.isRef(a)&&a.isSibling?i(a.path,s):kx(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return wue.array(Array.from(r),n).reverse()}function Qk(t,e){let n=1/0;return t.some((r,o)=>{var i;if((i=e.path)!=null&&i.includes(r))return n=o,!0}),n}function rD(t){return(e,n)=>Qk(t,e)-Qk(t,n)}const Gue=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function Uf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Uf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Uf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Uf)}):"optional"in t?t.optional():t}const Jue=(t,e)=>{const n=[...ha.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=ha.getter(ha.join(n),!0)(t);return!!(o&&r in o)};let eO=t=>Object.prototype.toString.call(t)==="[object Object]";function tO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Xue=rD([]);function Mx(t){return new oD(t)}class oD extends ti{constructor(e){super({type:"object",check(n){return eO(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Xue,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],y=p in o,v=o[p];if(m){let g;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}g=!n.__validating||!S?m.cast(v,u):v,g!==void 0&&(l[p]=g)}else y&&!s&&(l[p]=v);(y!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!eO(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Pa.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=Yue(e,n),r._sortErrors=rD(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Uf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=ha.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Jue(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Gue)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Wf.exact,test(n){if(n==null)return!0;const r=tO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Wf.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=tO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Wf.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(db.camelCase)}snakeCase(){return this.transformKeys(db.snakeCase)}constantCase(){return this.transformKeys(e=>db.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}Mx.prototype=oD.prototype;const Zue=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=Z.useRef(null),[u,f]=Z.useState(!1),[p,m]=Z.useState(!1),[y,v]=Z.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});return Z.useEffect(()=>{i&&v({...i,type:"Url"})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(H.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&b.jsx(H.IconButton,{onClick:o,children:b.jsx(Jh,{})})]}),b.jsx(Ut.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,onSubmit:async g=>{f(!0),n(g).catch(x=>{throw f(!1),x}).finally(()=>f(!1))},validationSchema:Mx({source:aa().required("Source is required"),title:aa().required("Title is required"),accessedAt:Ox().required("Accessed At is required"),url:aa().required("URL is required"),classification:aa().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:g})=>b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsxs(H.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(xs,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(xs,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(kp,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),b.jsx(xs,{name:"url",label:"URL",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(_I,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:s})]}),b.jsx(H.DialogActions,{sx:{px:0},children:s?b.jsx(H.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Ex,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),g()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},iD=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Que=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=Z.useRef(null),[f,p]=Z.useState(!1),[m,y]=Z.useState(!1),[v,g]=Z.useState({type:"Attachment",title:"",file:void 0,fileName:""});return Z.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(H.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(H.IconButton,{onClick:o,children:b.jsx(Jh,{})})]}),b.jsx(Ut.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:Mx().shape({title:aa().required("Title is required"),fileName:aa().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit:E})=>{var T;return Z.useEffect(()=>{var C,O;(C=x.file)!=null&&C.name&&S("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsx(xs,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(H.Box,{marginTop:i||a?0:1,children:[b.jsxs(iD,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(kI,{name:"file",errorMode:"hidden"}),b.jsx(xs,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(Mr,{name:"fileName"})]}),b.jsx(H.DialogActions,{sx:{px:0},children:a?b.jsx(H.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Ex,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),E()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Xu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",y=()=>{if(s&&p)return b.jsx(H.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(H.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(H.Box,{children:y()}),b.jsxs(H.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(H.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(H.Box,{children:y()})})};return b.jsxs(H.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(H.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(H.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(Jh,{})})]})}):r,o&&(typeof o=="string"?b.jsx(H.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(H.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function ede(t){return We("MuiAlert",t)}const nO=Ve("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),tde=Ae(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),nde=Ae(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),rde=Ae(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),ode=Ae(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),ide=Ae(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),sde=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ie(n||r)}`,`${e}${Ie(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return He(i,ede,o)},ade=ne(Ms,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ie(n.color||n.severity)}`]]}})(yt(({theme:t})=>{const e=t.palette.mode==="light"?ya:kl,n=t.palette.mode==="light"?kl:ya;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${nO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${nO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),lde=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),cde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),ude=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),rO={success:b.jsx(tde,{fontSize:"inherit"}),warning:b.jsx(nde,{fontSize:"inherit"}),error:b.jsx(rde,{fontSize:"inherit"}),info:b.jsx(ode,{fontSize:"inherit"})},sD=A.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=rO,onClose:y,role:v="alert",severity:g="success",slotProps:x={},slots:S={},variant:E="standard",...T}=r,C={...r,color:l,severity:g,variant:E,colorSeverity:l||g},O=sde(C),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[P,N]=kt("root",{ref:n,shouldForwardComponentProp:!0,className:ge(O.root,s),elementType:ade,externalForwardedProps:{...R,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=kt("icon",{className:O.icon,elementType:lde,externalForwardedProps:R,ownerState:C}),[j,F]=kt("message",{className:O.message,elementType:cde,externalForwardedProps:R,ownerState:C}),[L,D]=kt("action",{className:O.action,elementType:ude,externalForwardedProps:R,ownerState:C}),[_,I]=kt("closeButton",{elementType:Jl,externalForwardedProps:R,ownerState:C}),[B,W]=kt("closeIcon",{elementType:ide,externalForwardedProps:R,ownerState:C});return b.jsxs(P,{...N,children:[p!==!1?b.jsx(V,{...M,children:p||m[g]||rO[g]}):null,b.jsx(j,{...F,children:i}),o!=null?b.jsx(L,{...D,children:o}):null,o==null&&y?b.jsx(L,{...D,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...I,children:b.jsx(B,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(sD.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Zu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=H.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return b.jsxs(sD,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(H.Typography,{variant:"h3",children:s}),n]})},aD=t=>b.jsx(Zu,{severity:"error",...t}),lD=t=>b.jsx(Zu,{severity:"success",...t}),dde=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return b.jsxs(b.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&b.jsx(aD,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(lD,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function cD({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsSelectablePopup:m=!1,addlActions:y,canLaunchUrl:v,readOnly:g}){const[x,S]=Z.useState("Insert Citation/Attachment(s)"),[E,T]=Z.useState(u),[C,O]=Z.useState(void 0),[R,P]=Z.useState(void 0),N=G=>{P(void 0),S(G)},[V,M]=Z.useState(0);Z.useEffect(()=>{f==null||f()},[x,R,f]);const j=(G=!1)=>{(!m||G)&&M(te=>te+1)},F=(G,te)=>{var de;const ue=typeof((de=te.response)==null?void 0:de.data)=="string"&&te.response.data,re=typeof te.message=="string"&&te.message;P({type:"Error",title:G,message:ue??re}),p(te)},L=G=>P({type:"Success",title:"",message:G}),D=async G=>{if(x==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(x==="Edit Citation"||x==="Edit Attachment"){if(G.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(G).then(()=>{N("Insert Citation/Attachment(s)"),j()}).catch(ue=>{F("Failed to update",ue)}))}else await(e==null?void 0:e(G).then(ue=>{T([...E,ue.id]),N("Insert Citation/Attachment(s)"),j()}).catch(ue=>{F("Failed to create",ue)}))},_=r&&(async G=>r(G).then(()=>{j(!0),T(E.filter(te=>te!==G)),L("Successfully deleted")}).catch(te=>F("Failed to delete",te))),I=(G,te)=>{o(G.id).then(ue=>{O(ue),N(te)}).catch(ue=>{F("Failed to load",ue)})},B=i&&(async G=>i(G).catch(te=>{F(`Failed to download ${G.fileName}`,te)})),W=s&&(async G=>s(G).catch(te=>{F(`Failed to view ${G.fileName}`,te)})),K=b.jsx(gue,{refreshKey:V,getCitationsPaginated:G=>t(G).then(te=>(f==null||f(),te)),onCancel:l,onNewCitation:()=>{O(void 0),N("Add Citation")},onNewAttachment:()=>{O(void 0),N("Add Attachment")},onEditCitation:G=>I(G,g?"View Citation":"Edit Citation"),onEditAttachment:G=>I(G,g?"View Attachment":"Edit Attachment"),onDeleteCitation:_,onDownloadAttachment:B,onViewAttachment:W,onSelect:a,setSelectedIds:T,selectedIds:E,onError:p,condenseTable:m,canSelect:m,title:m&&!g?x:"Attachments & Citations",addlActions:y,canCreate:!!e,canEdit:!!n,canDelete:!!_,canLaunchUrl:v,readOnly:g,showCloseBtn:m}),U=b.jsx(Zue,{modifyCitation:C,onSave:D,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,title:x,readOnly:x==="View Citation",showCloseBtn:m}),Y=b.jsx(Que,{onSave:D,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:C,disableFileUpload:x==="Edit Attachment",title:x,readOnly:x==="View Attachment",showCloseBtn:m}),oe=b.jsx(dde,{alert:R,setAlert:P}),fe=x==="Add Citation"||x==="Edit Citation"||x==="View Citation",he=x==="Add Attachment"||x==="Edit Attachment"||x==="View Attachment";if(m){let G=null;return!m||x==="Insert Citation/Attachment(s)"?G=K:fe?G=U:he&&(G=Y),b.jsxs(H.Box,{width:"500px",children:[oe,b.jsx(H.Box,{paddingTop:"8px",children:G})]})}return b.jsxs(H.Box,{width:"100%",children:[x==="Insert Citation/Attachment(s)"&&oe,b.jsx(H.Box,{paddingTop:"8px",children:K}),b.jsx(Xu,{open:fe||he,children:b.jsxs(H.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[oe,fe?U:Y]})})]})}function uD({...t}){return b.jsx(cD,{renderAsSelectablePopup:!0,...t})}const fde=H.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function pde({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,canLaunchUrl:a,readOnly:l,...u}){const f=Ct();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,y=p.selectedIds,v=p.selectedNodePos,g=T=>{f&&(T.length===0?f.commands.deleteCitation(v):y.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},v))},x=T=>{g(T),f==null||f.commands.closeCitationBubbleMenu()},S=()=>{g(y),f==null||f.commands.closeCitationBubbleMenu()},E=Z.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?b.jsx(vv,{editor:f,open:m,...p.bubbleMenuOptions,...u,children:b.jsx(fde,{children:b.jsx(uD,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:x,onCancel:S,initialSelectedIds:y,onContentChange:E,canLaunchUrl:a,readOnly:l})})}):null}const hde=()=>mn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function mde(t){const e=Ct(),n=Z.useRef(null);return b.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(Tne,{fontSize:"small"}),b.jsx(H.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const dD=Z.createContext(void 0),fD=()=>{const t=Z.useContext(dD);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},gde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=fD(),[u,f]=Z.useState(s?String(s):""),[p,m]=Z.useState([]),y=r.options.citationMaxLength;if(Z.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),g=v.map(S=>Fl.truncate(S.title,{length:y,omission:"..."})).join(", ");f(g),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return b.jsx(Hv,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(H.Tooltip,{title:b.jsx(H.Box,{className:"citation-tooltip",children:p.map((v,g)=>{var S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return b.jsxs(H.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&b.jsx(H.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:b.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},yde=nn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",St(t)]},addNodeView(){return Wv(gde)},addProseMirrorPlugins(){return[new rn({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),pD=t=>b.jsx(EI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),bde=t=>{const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:y,onViewAttachment:v,onError:g=()=>{},placeholder:x="Start typing here...",notApplicableName:S,errorMode:E="normal",canLaunchUrl:T}=t,C=[DR,HA.configure({placeholder:x}),hde(),yde.configure({citationMaxLength:a})],[O,R,P]=Ut.useField({name:e}),{setValue:N}=P,{value:V}=O,{addUpdateCitation:M,deleteCitation:j,batchUpdate:F,citations:L}=fD();Z.useEffect(()=>{var he;const oe=(he=D==null?void 0:D.current)==null?void 0:he.editor;if(!oe)return;oe.getHTML()!==V&&setTimeout(()=>{oe.commands.setContent(V)},0)},[V]);const D=Z.useRef(null),_={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},I=(oe=void 0)=>{var G,te;const fe=((te=(G=D.current)==null?void 0:G.editor)==null?void 0:te.getHTML())??"",he=!fe.replace(/<\/?p>|<br>/g,"").trim();N(he?"":fe,oe)},B=Z.useMemo(()=>Fl.debounce(()=>I(!1),500),[N]),W=Ma(),{showDiff:K,getPreviousValue:U}=_a(),Y=i??W;if(K){const oe=U(e)??"",fe=V,he=/<citation\s+ids="([^"]*)"><\/citation>/g,G=(re,ie)=>{const de=ie.split(",").map(Number);return`<sup>${L.filter(ye=>de.includes(ye.id)).map(ye=>ye.title)}</sup>`},te=oe.replace(he,G),ue=fe.replace(he,G);return b.jsx(Aa,{label:n,value:ue,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(H.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:Y?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},..._[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(H.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&b.jsx(pD,{name:S})]}),b.jsx(bI,{ref:D,extensions:C,content:V,editable:!Y,renderControls:Y?void 0:()=>b.jsx(jv,{children:b.jsx(mde,{})}),onBlur:()=>I(),onUpdate:B,RichTextFieldProps:{variant:Y?"standard":"outlined",MenuBarProps:{hide:Y}},children:()=>b.jsx(pde,{getCitationsPaginated:oe=>l(oe).then(fe=>(F(fe.data),fe)),onCreateCitation:u&&(oe=>u(oe).then(fe=>(M(fe),fe))),onUpdateCitation:f&&(oe=>f(oe).then(fe=>(M(fe),fe))),onDeleteCitation:p&&(oe=>p(oe).then(()=>j(oe))),getCitationById:m,onDownloadAttachment:y,onViewAttachment:v,onError:g,canLaunchUrl:T,readOnly:Y})}),b.jsx(Mr,{name:e,id:`${e}-err`,errorMode:E})]})},vde=t=>{const{name:e="submit"}=t;return b.jsx(ao,{name:e,type:"submit",...t})},xde=t=>{const{label:e="Return to Top",icon:n=Nf,scrollThresholdPx:r=100}=t,o=H.useScrollTrigger({threshold:r}),i=Z.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(H.Zoom,{in:o,children:b.jsx(H.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(H.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},hD=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=Eo.useNavigate(),[i,s]=A.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(H.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(H.MenuItem,{...Mu(p,o),children:[p.icon&&b.jsx(H.ListItemIcon,{children:p.icon}),b.jsx(H.ListItemText,{primary:p.label})]},p.label))})]})},wde=()=>{const{values:t,errors:e,status:n}=Ut.useFormikContext(),{palette:r}=H.useTheme();return b.jsx(H.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(H.List,{children:[b.jsxs(H.ListItem,{children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(H.Divider,{variant:"inset",component:"li"}),b.jsxs(H.ListItem,{id:"testing",children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(H.ListItem,{children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Sde=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=qA();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...hr({...t},l)};return b.jsx(H.Stepper,{...u,children:e.map(f=>b.jsx(H.Step,{children:b.jsx(H.StepLabel,{children:f})},f))})},Cde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx(DI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=Ut.useField({name:e}),{value:S}=x,E=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(H.FormControl,{fullWidth:!0,children:[b.jsx(H.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(H.Typography,{children:y}):b.jsx(Ut.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(Z.Fragment,{children:b.jsx(Tde,{variant:l,content:b.jsxs(H.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?E(g):{...g},children:[b.jsxs(H.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&b.jsx(H.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(H.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(H.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Tde=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(H.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(H.CardContent,{children:e})});case"elevatedCard":return b.jsx(H.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(H.CardContent,{children:e})});case"none":return e}},Ede=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Xu,{actions:[b.jsx(H.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},kde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Xu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Ode=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(Xu,{actions:[b.jsx(H.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(H.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Mde={added:{icon:Sne,label:"Added",color:"success"},deleted:{icon:DI,label:"Deleted",color:"error"},modified:{icon:Ene,label:"Modified",color:"info"}},mD=t=>{const{beforeData:e,afterData:n,columns:r}=t,[o,i]=Z.useState([]),[s,a]=Z.useState(0),l=r.map(f=>({...f,render:(p,m,y)=>{var v;if(m.changeType==="modified"&&m.before&&!f.ignoreDiff){const g=w0(f,m.before),x=S0(f,p,m,y);if(!(((v=f.isEqual)==null?void 0:v.call(f,m.before,m))??JSON.stringify(g)===JSON.stringify(x)))return b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:xp},children:b.jsx("s",{children:g})}),b.jsx(H.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:vp},children:b.jsx("u",{children:x})})]})}return S0(f,p,m,y)}}));Z.useMemo(()=>{const f=[];e.sort((v,g)=>v.id-g.id),n.sort((v,g)=>v.id-g.id);let p=0,m=0,y=0;for(;p<e.length&&m<n.length;){const v=e[p],g=n[m];v.id===g.id?(JSON.stringify(v)!==JSON.stringify(g)?f.push({...g,changeType:"modified",before:v}):y++,p++,m++):v.id<g.id?(f.push({...v,changeType:"deleted"}),p++):(f.push({...g,changeType:"added"}),m++)}for(;p<e.length;)f.push({...e[p],changeType:"added"}),p++;for(;m<n.length;)f.push({...n[m],changeType:"added"}),m++;i(f),a(y)},[e,n]);const u=t.renderExpand?{renderExpand:f=>{if(f.changeType==="modified"){const p=e.find(m=>m.id===f.id);return b.jsx(SM,{previousSnapshot:p,children:t.renderExpand(f)})}else return b.jsx(xM,{children:t.renderExpand(f)})}}:{};return b.jsxs(b.Fragment,{children:[b.jsx(Tx,{columns:[{fieldName:"changeType",render:f=>{const p=Mde[f];return b.jsx(H.Chip,{color:p.color,label:b.jsxs(H.Typography,{children:[b.jsx(A0,{icon:p.icon}),p.label]})})}},...l],data:o,...u}),s>0&&b.jsx(H.Box,{children:b.jsxs(H.Typography,{fontStyle:"italic",children:["+",s," unmodified rows"]})})]})},_de=t=>{const{beforeCitations:e,afterCitations:n}=t,{palette:r}=H.useTheme(),o=KA(r);return b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:b.jsx(H.Typography,{variant:"h2",children:"Attachments & Citations"})}),b.jsx(mD,{columns:o,beforeData:e,afterData:n})]})},Rde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=H.useTheme(),a=Eo.useNavigate();return b.jsxs(H.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(H.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(H.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(H.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(H.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Mu(l,a),children:l.label},l.label))}),n&&b.jsx(H.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},gD=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=Eo.useLocation(),i=Eo.useNavigate(),[s,a]=Z.useState(!1),l=(m,y)=>b.jsx(H.MenuList,{children:m.map(v=>b.jsxs(H.MenuItem,{...Mu(v,i,()=>a(!1)),children:[v.icon&&b.jsx(H.ListItemIcon,{children:v.icon}),b.jsx(H.ListItemText,{primary:v.label})]},`mobile-drawer-group-${y}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,v)=>b.jsxs(Z.Fragment,{children:[l(y,v),v<m.length-1&&b.jsx(H.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(H.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return Z.useEffect(()=>{a(!1)},[o]),p&&b.jsxs(b.Fragment,{children:[b.jsx(H.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(Ane,{})}),b.jsx(H.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(H.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(H.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},yD=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(H.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(H.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},bD=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(hD,{label:e,menuOptions:n,icon:b.jsx(Pne,{})})},hm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=H.useTheme(),a=Eo.useNavigate();return b.jsx(H.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(H.Tab,{icon:l.icon,label:l.label,value:u,...Mu(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},vD=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(H.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(hm,{menuOptions:e,activeTabIdx:n,sx:r})})},xD=t=>{const{onToggle:e}=t,{palette:n}=H.useTheme(),r=n.mode==="dark";return b.jsx(H.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx(AI,{}):b.jsx(RI,{})})},Ide=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:y}=t,v=Eo.useNavigate(),g=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),{palette:x}=H.useTheme(),{pathname:S}=Eo.useLocation(),E=x.mode==="dark",[T,C]=A.useState(void 0);A.useEffect(()=>{const P=o.findIndex(N=>N.path&&S.startsWith(N.path));C(P>=0?P:void 0)},[S,o]);const O=s&&b.jsx(xD,{onToggle:s}),R=s&&(g||!g&&l)?[{icon:E?b.jsx(AI,{}):b.jsx(RI,{}),label:`Switch to ${E?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(H.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(yD,{...e}),u,b.jsxs(H.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(H.Button,{disableRipple:!0,component:Eo.Link,to:"/",children:r&&typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),b.jsxs(H.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&b.jsx(gD,{menuOptionLists:[o,a,R],anchor:"right"}),!g&&b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((P,N)=>b.jsxs(H.Box,{display:"flex",alignItems:"center",children:[N>0&&b.jsx(H.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(H.Button,{variant:"text",sx:{color:"white"},...Mu(P,v),children:b.jsxs(H.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&b.jsx(bD,{displayName:l,userMenuOptions:R})]})]})]}),!g&&b.jsx(vD,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Ade=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=Eo.useLocation(),o=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),[i,s]=Z.useState(void 0);return Z.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&b.jsx(H.Box,{sx:e,children:b.jsx(H.Card,{sx:{height:"100%",width:200},children:b.jsx(hm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Dde=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=H.useTheme();return e.length>0&&b.jsx(hm,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},Pde=t=>{const{gap:e=1,...n}=t;return b.jsx(H.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Nde=({children:t,getCitations:e})=>{const[n,r]=Z.useState([]),[o,i]=Z.useState(!1);Z.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=Z.useCallback(u=>{r(f=>{const p=f.map(v=>{const g=u.find(x=>x.id===v.id);return g||v}),m=new Set(f.map(v=>v.id)),y=u.filter(v=>!m.has(v.id));return[...p,...y]})},[]),a=Z.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=Z.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return b.jsx(dD.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},$de=t=>b.jsx(Zu,{severity:"info",...t}),Lde=t=>b.jsx(Zu,{severity:"warning",...t}),wD=t=>{const{crumbInfo:e}=t,n=Eo.useNavigate();return b.jsx(H.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(Dne,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(H.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(H.Typography,{color:"primary",children:r},r))})},jde=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Bde(r);return b.jsx(H.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(Zu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:oO(r),warning:oO(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(H.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Bde=t=>t=="logout"?"info":t=="timeout"?"warning":t,oO=t=>{if(t=="timeout")return b.jsx(wne,{});if(t=="logout")return b.jsx(Ine,{})},Fde=t=>{Vde(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=H.useMediaQuery(H.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(H.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(wD,{crumbInfo:i}),b.jsxs(H.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(H.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(H.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(ao,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(Cne,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(H.Box,{width:u?"100%":"50%",children:s})]})]})},Vde=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},zde=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=H.useMediaQuery(H.useTheme().breakpoints.down("sm"));return b.jsxs(H.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(H.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),b.jsx(H.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(H.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Hde({...t}){return b.jsx(cD,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Wde=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return b.jsx(H.Box,{height:n})};exports.AlertModal=kde;exports.Autocomplete=TI;exports.Breadcrumbs=wD;exports.Button=ao;exports.Checkbox=EI;exports.CheckboxGroup=Ute;exports.CitationField=bde;exports.CitationFieldProvider=Nde;exports.CitationManager=Hde;exports.Column=Pde;exports.ConfirmationModal=Ede;exports.DarkModeToggle=xD;exports.DateField=kp;exports.DateRangeField=gce;exports.DecisionModal=Ode;exports.Diff=CI;exports.DiffCitationTable=_de;exports.DiffProvider=SM;exports.DiffTable=mD;exports.Drawer=gD;exports.DynamicAutocomplete=Hte;exports.EnvironmentBanner=yD;exports.ErrorAlert=aD;exports.FileList=Yte;exports.FileUpload=kI;exports.FloatingNavBar=Dde;exports.Footer=Rde;exports.FormDebugger=wde;exports.Header=Ide;exports.InfoAlert=$de;exports.LoadingButton=Ex;exports.LoadingIndicator=x0;exports.Location=gne;exports.MenuButton=hD;exports.Modal=Xu;exports.MultiAutocomplete=Wte;exports.NavBar=vD;exports.NotApplicableCheckbox=pD;exports.PageHeader=Fde;exports.PaginatedTable=UA;exports.ProfileMenu=bD;exports.RadioGroup=_I;exports.RangeSlider=yne;exports.ReadOnly=Aa;exports.ReadOnlyProvider=xM;exports.RepeatableFormGroup=Cde;exports.RichTextField=due;exports.Row=iD;exports.ScrollToTop=xde;exports.SearchField=Bne;exports.Select=bne;exports.SelectableCitationManager=uD;exports.Sidebar=Ade;exports.SingleActionCard=zde;exports.Snackbar=jde;exports.Spacer=Wde;exports.Stepper=Sde;exports.Submit=vde;exports.SuccessAlert=lD;exports.Switch=vne;exports.Table=Tx;exports.Tabs=hm;exports.TextArea=xne;exports.TextField=xs;exports.TextIcon=A0;exports.ValidationError=Mr;exports.WarningAlert=Lde;exports.commonTheme=In;exports.darkTheme=QV;exports.lightTheme=ZV;exports.useDiff=_a;exports.useReadOnly=Ma;
package/dist/index.es.js CHANGED
@@ -60227,7 +60227,9 @@ const xpe = (t) => {
60227
60227
  sx: { color: t.grey[500], marginTop: "6px" },
60228
60228
  "data-testid": `url-icon-${r.id}`
60229
60229
  }
60230
- ) })
60230
+ ) }),
60231
+ ignoreDiff: !0
60232
+ // type cannot be changed
60231
60233
  },
60232
60234
  {
60233
60235
  fieldName: "title",
@@ -60239,7 +60241,8 @@ const xpe = (t) => {
60239
60241
  key: "URL/File Name",
60240
60242
  label: "URL/File Name",
60241
60243
  hideCol: e,
60242
- render: (n, r) => /* @__PURE__ */ w("span", { style: { wordBreak: "break-all" }, children: n || r.url })
60244
+ render: (n, r) => /* @__PURE__ */ w("span", { style: { wordBreak: "break-all" }, children: n || r.url }),
60245
+ isEqual: (n, r) => n.fileName && r.fileName ? n.fileName === r.fileName : n.url === r.url
60243
60246
  },
60244
60247
  {
60245
60248
  fieldName: "source",
package/dist/index.umd.js CHANGED
@@ -402,7 +402,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
402
402
  `,VZ="️",HZ="‍",Z0="";let gh=null,yh=null;function WZ(t=[]){const e={};Tr.groups=e;const n=new Tr;gh==null&&(gh=C2($Z)),yh==null&&(yh=C2(LZ)),Ae(n,"'",oh),Ae(n,"{",Mu),Ae(n,"}",_u),Ae(n,"[",Wp),Ae(n,"]",jp),Ae(n,"(",Up),Ae(n,")",qp),Ae(n,"<",Kp),Ae(n,">",Yp),Ae(n,"(",Gp),Ae(n,")",Jp),Ae(n,"「",Xp),Ae(n,"」",Zp),Ae(n,"『",Qp),Ae(n,"』",eh),Ae(n,"<",th),Ae(n,">",nh),Ae(n,"&",rh),Ae(n,"*",ih),Ae(n,"@",bs),Ae(n,"`",ah),Ae(n,"^",lh),Ae(n,":",vs),Ae(n,",",U0),Ae(n,"$",ch),Ae(n,".",Zo),Ae(n,"=",uh),Ae(n,"!",q0),Ae(n,"-",ao),Ae(n,"%",Iu),Ae(n,"|",dh),Ae(n,"+",fh),Ae(n,"#",ph),Ae(n,"?",Au),Ae(n,'"',K0),Ae(n,"/",Qo),Ae(n,";",Y0),Ae(n,"~",Du),Ae(n,"_",hh),Ae(n,"\\",sh),Ae(n,"・",b2);const r=hn(n,_i,H0,{[N0]:!0});hn(r,_i,r);const o=hn(r,Mi,g2,{[ku]:!0}),i=hn(r,Pu,y2,{[Eu]:!0}),s=hn(n,Mi,Oi,{[$0]:!0});hn(s,_i,o),hn(s,Mi,s),hn(o,_i,o),hn(o,Mi,o);const a=hn(n,Pu,R0,{[L0]:!0});hn(a,Mi),hn(a,_i,i),hn(a,Pu,a),hn(i,_i,i),hn(i,Mi),hn(i,Pu,i);const l=Ae(n,X0,j0,{[F0]:!0}),u=Ae(n,w2,W0,{[F0]:!0}),f=hn(n,J0,W0,{[F0]:!0});Ae(n,Z0,f),Ae(u,X0,l),Ae(u,Z0,f),hn(u,J0,f),Ae(f,w2),Ae(f,X0),hn(f,J0,f),Ae(f,Z0,f);const p=hn(n,G0,v2,{[h2]:!0});Ae(p,"#"),hn(p,G0,p),Ae(p,VZ,p);const m=Ae(p,HZ);Ae(m,"#"),hn(m,G0,p);const y=[[Mi,s],[_i,o]],v=[[Mi,null],[Pu,a],[_i,i]];for(let g=0;g<gh.length;g++)xs(n,gh[g],z0,Oi,y);for(let g=0;g<yh.length;g++)xs(n,yh[g],V0,R0,v);xa(z0,{tld:!0,ascii:!0},e),xa(V0,{utld:!0,alpha:!0},e),xs(n,"file",Hp,Oi,y),xs(n,"mailto",Hp,Oi,y),xs(n,"http",$l,Oi,y),xs(n,"https",$l,Oi,y),xs(n,"ftp",$l,Oi,y),xs(n,"ftps",$l,Oi,y),xa(Hp,{scheme:!0,ascii:!0},e),xa($l,{slashscheme:!0,ascii:!0},e),t=t.sort((g,x)=>g[0]>x[0]?1:-1);for(let g=0;g<t.length;g++){const x=t[g][0],k=t[g][1]?{[BZ]:!0}:{[FZ]:!0};x.indexOf("-")>=0?k[B0]=!0:Mi.test(x)?_i.test(x)?k[ku]=!0:k[$0]=!0:k[N0]=!0,m2(n,x,x,k)}return m2(n,"localhost",Ou,{ascii:!0}),n.jd=new Tr(mh),{start:n,tokens:Object.assign({groups:e},x2)}}function S2(t,e){const n=jZ(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=t,l=null,u=0,f=null,p=-1,m=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(p=0,m=0,f=a):p>=0&&(p+=n[s].length,m++),u+=n[s].length,i+=n[s].length,s++;i-=p,s-=m,u-=p,o.push({t:f.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function jZ(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function xs(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Tr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Tr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function C2(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Nu={defaultProtocol:"http",events:null,format:T2,formatHref:T2,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Q0(t,e=null){let n=Object.assign({},Nu);t&&(n=Object.assign(n,t instanceof Q0?t.o:t));const r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o}Q0.prototype={o:Nu,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Nu[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function T2(t){return t}function k2(t,e){this.t="token",this.v=t,this.tk=e}k2.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Nu.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),f=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),f&&Object.assign(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function bh(t,e){class n extends k2{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const E2=bh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),O2=bh("text"),UZ=bh("nl"),vh=bh("url",{isLink:!0,toHref(t=Nu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Ou&&t[1].t===vs}}),lo=t=>new Tr(t);function qZ({groups:t}){const e=t.domain.concat([rh,ih,bs,sh,ah,lh,ch,uh,ao,H0,Iu,dh,fh,ph,Qo,mh,Du,hh]),n=[oh,vs,U0,Zo,q0,Iu,Au,K0,Y0,Kp,Yp,Mu,_u,jp,Wp,Up,qp,Gp,Jp,Xp,Zp,Qp,eh,th,nh],r=[rh,oh,ih,sh,ah,lh,ch,uh,ao,Mu,_u,Iu,dh,fh,ph,Au,Qo,mh,Du,hh],o=lo(),i=Ae(o,Du);ft(i,r,i),ft(i,t.domain,i);const s=lo(),a=lo(),l=lo();ft(o,t.domain,s),ft(o,t.scheme,a),ft(o,t.slashscheme,l),ft(s,r,i),ft(s,t.domain,s);const u=Ae(s,bs);Ae(i,bs,u),Ae(a,bs,u),Ae(l,bs,u);const f=Ae(i,Zo);ft(f,r,i),ft(f,t.domain,i);const p=lo();ft(u,t.domain,p),ft(p,t.domain,p);const m=Ae(p,Zo);ft(m,t.domain,p);const y=lo(E2);ft(m,t.tld,y),ft(m,t.utld,y),Ae(u,Ou,y);const v=Ae(p,ao);Ae(v,ao,v),ft(v,t.domain,p),ft(y,t.domain,p),Ae(y,Zo,m),Ae(y,ao,v);const g=Ae(y,vs);ft(g,t.numeric,E2);const x=Ae(s,ao),S=Ae(s,Zo);Ae(x,ao,x),ft(x,t.domain,s),ft(S,r,i),ft(S,t.domain,s);const k=lo(vh);ft(S,t.tld,k),ft(S,t.utld,k),ft(k,t.domain,s),ft(k,r,i),Ae(k,Zo,S),Ae(k,ao,x),Ae(k,bs,u);const T=Ae(k,vs),C=lo(vh);ft(T,t.numeric,C);const O=lo(vh),I=lo();ft(O,e,O),ft(O,n,I),ft(I,e,O),ft(I,n,I),Ae(k,Qo,O),Ae(C,Qo,O);const N=Ae(a,vs),$=Ae(l,vs),V=Ae($,Qo),M=Ae(V,Qo);ft(a,t.domain,s),Ae(a,Zo,S),Ae(a,ao,x),ft(l,t.domain,s),Ae(l,Zo,S),Ae(l,ao,x),ft(N,t.domain,O),Ae(N,Qo,O),Ae(N,Au,O),ft(M,t.domain,O),ft(M,e,O),Ae(M,Qo,O);const F=[[Mu,_u],[Wp,jp],[Up,qp],[Kp,Yp],[Gp,Jp],[Xp,Zp],[Qp,eh],[th,nh]];for(let z=0;z<F.length;z++){const[B,P]=F[z],_=Ae(O,B);Ae(I,B,_),Ae(_,P,O);const A=lo(vh);ft(_,e,A);const R=lo();ft(_,n),ft(A,e,A),ft(A,n,R),ft(R,e,A),ft(R,n,R),Ae(A,P,O),Ae(R,P,O)}return Ae(o,Ou,k),Ae(o,j0,UZ),{start:o,tokens:x2}}function KZ(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,u=null,f=0,p=null,m=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(u=l||a.go(n[o].t));)l=null,a=u,a.accepts()?(m=0,p=a):m>=0&&m++,o++,f++;if(m<0)o-=f,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(ev(O2,e,s)),s=[]),o-=m,f-=m;const y=p.t,v=n.slice(o-f,o);i.push(ev(y,e,v))}}return s.length>0&&i.push(ev(O2,e,s)),i}function ev(t,e,n){const r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}const YZ=typeof console<"u"&&console&&console.warn||(()=>{}),GZ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Kt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function JZ(){return Tr.groups={},Kt.scanner=null,Kt.parser=null,Kt.tokenQueue=[],Kt.pluginQueue=[],Kt.customSchemes=[],Kt.initialized=!1,Kt}function M2(t,e=!1){if(Kt.initialized&&YZ(`linkifyjs: already initialized - will not register custom scheme "${t}" ${GZ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
403
403
  1. Must only contain digits, lowercase ASCII letters or "-"
404
404
  2. Cannot start or end with "-"
405
- 3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function XZ(){Kt.scanner=WZ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=qZ(Kt.scanner.tokens);for(let t=0;t<Kt.pluginQueue.length;t++)Kt.pluginQueue[t][1]({scanner:Kt.scanner,parser:Kt.parser});return Kt.initialized=!0,Kt}function tv(t){return Kt.initialized||XZ(),KZ(Kt.parser.start,t,S2(Kt.scanner.start,t))}tv.scan=S2;function _2(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Q0(n),o=tv(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const nv="[\0-   ᠎ -\u2029  ]",ZZ=new RegExp(nv),QZ=new RegExp(`${nv}$`),eQ=new RegExp(nv,"g");function tQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function nQ(t){return new en({key:new En("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=DR(n.doc,[...e]);if(FR(a).forEach(({newRange:u})=>{const f=NR(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(u.from,u.to," "," ");if(!QZ.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(ZZ).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=tv(v).map(S=>S.toObject(t.defaultProtocol));if(!tQ(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:g+S.start+1,to:g+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{jg(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function rQ(t){return new en({key:new En("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=Wg(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function oQ(t){return new en({key:new En("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=_2(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function wa(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(eQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const iQ=xr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){M2(t);return}M2(t.scheme,t.optionalSlashes)})},onDestroy(){JZ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!wa(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!wa(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!wa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xt(this.options.HTMLAttributes,t),0]:["a",xt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!wa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!wa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[as({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=_2(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!wa(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(nQ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!wa(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(rQ({type:this.type})),this.options.linkOnPaste&&t.push(oQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function sQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=c3(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(y)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!k)return null;const T=g+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const aQ=new En("suggestion");function lQ({pluginKey:t=aQ,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=sQ}){let x;const S=y==null?void 0:y(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,$,V,M,F;const z=(O=this.key)===null||O===void 0?void 0:O.getState(C),B=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=z.active&&B.active&&z.range.from!==B.range.from,_=!z.active&&B.active,A=z.active&&!B.active,R=!_&&!A&&z.query!==B.query,j=_||P&&R,K=R||P,U=A||P&&R;if(!j&&!K&&!U)return;const Y=U&&!j?z:B,oe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:fe=>p({editor:e,range:Y.range,props:fe}),decorationNode:oe,clientRect:oe?()=>{var fe;const{decorationId:me}=(fe=this.key)===null||fe===void 0?void 0:fe.getState(e.state),G=T.dom.querySelector(`[data-decoration-id="${me}"]`);return(G==null?void 0:G.getBoundingClientRect())||null}:null},j&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.call(S,x)),K&&(($=S==null?void 0:S.onBeforeUpdate)===null||$===void 0||$.call(S,x)),(K||j)&&(x.items=await m({editor:e,query:Y.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),j&&((F=S==null?void 0:S.onStart)===null||F===void 0||F.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,I){const{isEditable:N}=e,{composing:$}=e.view,{selection:V}=T,{empty:M,from:F}=V,z={...C};if(z.composing=$,N&&(M||e.view.composing)){(F<C.range.from||F>C.range.to)&&!$&&!C.composing&&(z.active=!1);const B=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;B&&v({editor:e,state:I,range:B.range,isActive:C.active})?(z.active=!0,z.decorationId=C.decorationId?C.decorationId:P,z.range=B.range,z.query=B.query,z.text=B.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(T,C){var O;const{active:I,range:N}=k.getState(T.state);return I&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const $=!(N!=null&&N.length),V=[l];return $&&V.push(f),Jt.create(T.doc,[Kn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function cQ({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new En;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function I2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>cQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function A2(t,e){const n=I2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const uQ=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",xt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=A2(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=xt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:A2(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new fi,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return I2(this).map(lQ)}}),D2=ln.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new En("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&sf(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Kn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Jt.create(t,o)}}})]}}),dQ=xr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",xt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),fQ=tn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",xt(this.options.HTMLAttributes,t),0]}}),pQ=tn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",xt(this.options.HTMLAttributes,t),0]}}),hQ=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",xt(this.options.HTMLAttributes,t),0]}}),mQ=/^\s*(\[([( |x])?\])\s$/,gQ=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const y=n();if(typeof y!="number")return!1;const v=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[sl({find:mQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),yQ=tn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",xt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),bQ=ln.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P2=Z.forwardRef((t,e)=>{const[n,r]=Z.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return Z.useEffect(()=>r(0),[t.items]),Z.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?b.jsx(H.Paper,{elevation:5,children:b.jsx(H.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(H.ListItem,{disablePadding:!0,children:b.jsx(H.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});P2.displayName="SuggestionList";const N2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},vQ={items:async({query:t})=>Promise.resolve(["Lea Thompson","Cyndi Lauper","Tom Cruise","Madonna","Jerry Hall","Joan Collins","Winona Ryder","Christina Applegate","Alyssa Milano","Molly Ringwald","Ally Sheedy","Debbie Harry","Olivia Newton-John","Elton John","Michael J. Fox","Axl Rose","Emilio Estevez","Ralph Macchio","Rob Lowe","Jennifer Grey","Mickey Rourke","John Cusack","Matthew Broderick","Justine Bateman","Lisa Bonet","Benicio Monserrate Rafael del Toro Sánchez"].map((e,n)=>({mentionLabel:e,id:n.toString()})).filter(e=>e.mentionLabel.toLowerCase().startsWith(t.toLowerCase())).slice(0,5)),render:()=>{let t,e;return{onStart:n=>{t=new hO(P2,{props:n,editor:n.editor}),e=su("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2},appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})[0]},onUpdate(n){t==null||t.updateProps(n),e==null||e.setProps({getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},xQ=iQ.extend({inclusive:!1}),wQ=dQ.extend({excludes:"superscript"}),SQ=iM.extend({excludes:"subscript"});function CQ({placeholder:t}={}){return Z.useMemo(()=>[u7.configure({resizable:!0}),hQ,pQ,fQ,cT,dT,fT,gT,OT,IT,AT,wQ,SQ,PT,sT,iT,uT,ET,oM,DT,xQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Y9,mT,q9,bQ.configure({types:["heading","paragraph","image"]}),DZ,PZ,NZ,Wj,zT.configure({multicolor:!0}),kT,c8,pT,yQ,gQ.configure({nested:!0}),uQ.configure({suggestion:vQ}),D2.configure({placeholder:t}),TT],[t])}function $2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const TQ=t=>{const e=CQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(nM,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=jt.useField({name:n}),{setValue:f}=u,{value:p}=a;Z.useEffect(()=>{var S,k,T;(T=(k=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:k.commands)==null||T.setContent(p)},[p]);const m=Z.useRef(null),y=Z.useCallback((S,k)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{eb({images:O,editor:T,position:k})});else{const O=i(S);eb({images:O,editor:T,position:k})}},[]),v=Z.useCallback((S,k,T,C)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=$2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return y(O,N),k.preventDefault(),!0}return!1},[y]),g=Z.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=$2(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(H.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(tM,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(IZ,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(A7,{}),b.jsx(U7,{})]})})});return b.jsxs(H.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(H.Typography,{...o,children:r}),x]})},rv=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(H.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(H.Box,{className:"text-content",children:[b.jsx(H.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(H.Typography,{"data-testid":"message",children:n})]}),b.jsx(H.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},L2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=Z.useState(!1),[u,f]=Z.useState(void 0);Z.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?b.jsx(H.Collapse,{in:n,children:u}):b.jsx(H.TableRow,{sx:p,children:b.jsx(H.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(H.Collapse,{in:n,children:u})})})},ov=t=>{const{id:e,getRowKey:n=X=>"id"in X&&(typeof X.id=="string"||typeof X.id=="number")?X.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(X)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(X)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,renderExpand:a,hideColumnsOnMobile:l=[],sortField:u,sortOrder:f,onSortChange:p,allowSortCols:m,fixedLayout:y=!1,className:v,emptyTableMsg:g="No items to display",errorTableMsg:x,retryCallback:S,isLoading:k=!1,disableMobileCards:T=!1,highlightSelectedRow:C=!1,headerRowStyle:O={},stickyHeader:I,reRenderExpand:N=!1,expandOnRowClick:$=!1,tooltipColor:V,...M}=t,{palette:F}=H.useTheme(),[z,B]=Z.useState(void 0),[P,_]=Z.useState(void 0);kQ(t);const A=X=>{X!==u?p&&p(X,"asc"):p&&p(u,f==="asc"?"desc":"asc")},R=X=>u===X?f:null,j=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),K=j&&l?r.filter(X=>!(l.includes(Dn(X))||X.hideCol)):r.filter(X=>!X.hideCol);a&&!j&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:X=>{const le=z===X;return b.jsx(H.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>re(X),children:le?b.jsx(up,{"data-testid":"collapse-up"}):b.jsx(f0,{"data-testid":"expand-down"})})}});const U=p!==void 0,Y=X=>U?m?m.includes(X):!0:!1,oe=b.jsxs(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(WU,{})," ",g]}),fe=b.jsxs(H.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(aw,{color:"error"})," ",x,S&&b.jsx(H.Button,{variant:"text",onClick:S,children:"Retry?"})]}),me=()=>{if(k)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:b.jsx(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:b.jsx(rv,{})})})});if(x)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:fe})});if(o.length===0)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:oe})})},G=()=>{if(k)return b.jsx(rv,{});if(x)return fe;if(o.length===0)return oe},te=X=>{C&&_(X)},ue=X=>{const le=n(X);if((i||s)&&(i==null||i(le),s==null||s(X),te(le)),a&&$){const xe=z===le?void 0:le;B(xe),te(xe)}},re=X=>{const le=z===X?void 0:X;B(le),te(le)},ie=X=>{if(!a)return;const le=z===n(X);return b.jsxs(b.Fragment,{children:[b.jsxs(H.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>re(n(X)),children:[le?b.jsx(up,{}):b.jsx(f0,{})," Show"," ",le?"Less":"More"]}),b.jsx(L2,{colSpan:r.length,isExpanded:n(X)===z,obj:X,renderExpand:xe=>a(xe),asMobileCard:!0})]})},de=typeof C=="string"?C:F.grey[F.mode=="dark"?600:50],ye=X=>{const le=P===n(X)?de:"inherit";return{cursor:i||$?"pointer":"default",backgroundColor:le,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===de?dG(le,.1):de}}}},ee=F.grey[F.mode==="dark"?600:400],ce=X=>X&&b.jsx(H.Tooltip,{title:X,children:b.jsx(HU,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:V??ee,marginLeft:"2px"}})});return j&&!T?b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:v,"data-testid":"mui-table-mobile",children:[U&&b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(H.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:X=>A(X.target.value),fullWidth:!0,children:K.map(X=>{if(Y(Dn(X)))return b.jsx(H.MenuItem,{value:Dn(X),children:X.label??Ln(Dn(X))},`rowHeader-${Dn(X)}`)})}),b.jsx(H.IconButton,{onClick:()=>{u&&A(u)},children:b.jsx(JU,{className:`sort-icon-${f}`})})]}),b.jsx(H.Divider,{sx:{margin:"10px 0"}})]}),G()??o.map(X=>b.jsxs(H.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(X)},onClick:()=>ue(X),"data-testid":`card-${n(X)}`,children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:K.map(le=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Dn(le)}`,style:{textWrap:"nowrap"},children:[le.label??Ln(Dn(le)),ce(le.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Dn(le)}`,style:{paddingLeft:"10px"},children:iv(le,X)})]},`row-${n(X)}-${Dn(le)}`))})}),ie(X)]},n(X)))]}):b.jsx(H.TableContainer,{component:H.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:I?{maxHeight:I,overflow:"auto"}:{},children:b.jsxs(H.Table,{stickyHeader:I!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(H.TableHead,{className:"MBv2_Table_Head",children:b.jsx(H.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((X,le)=>{const xe=Y(Dn(X));return b.jsx(H.TableCell,{width:Array.isArray(y)?y[le]:"auto",sx:X.tableCellSx??{},children:b.jsx(H.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(H.Box,{sx:[xe&&{"&:hover":{cursor:"pointer",backgroundColor:F.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:xe?()=>A(Dn(X)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:X.label??Ln(Dn(X))}),ce(X.tooltip),xe&&R(Dn(X))==="asc"&&b.jsx(up,{style:{marginLeft:"5px"}}),xe&&R(Dn(X))==="desc"&&b.jsx(f0,{style:{marginLeft:"5px"}}),xe&&R(Dn(X))!=="asc"&&R(Dn(X))!=="desc"&&b.jsx(YU,{style:{marginLeft:"5px"}})]})})},`rowHeader-${Dn(X)}`)})})}),b.jsx(H.TableBody,{className:"MBv2_Table_Body",children:me()??o.map(X=>b.jsxs(Z.Fragment,{children:[b.jsx(H.TableRow,{"data-testid":`row-${n(X)}`,className:"MBv2_Table_Body_Row",onClick:()=>ue(X),sx:ye(X),children:K.map(le=>b.jsx(H.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Dn(le)}`,children:iv(le,X)},`row-${n(X)}-${Dn(le)}`))}),a&&b.jsx(L2,{colSpan:K.length,isExpanded:n(X)===z,obj:X,renderExpand:le=>a(le),reRenderExpand:N})]},n(X)))})]})})},kQ=t=>{const{fixedLayout:e,renderExpand:n,columns:r,expandOnRowClick:o,onRowClick:i,onRowClickObj:s}=t,a="Table component:";Array.isArray(e)&&(!n&&e.length!==r.length&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns".`),n&&e.length!==r.length+1&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),o&&!n&&console.warn(`${a} renderExpand should be defined when expandOnRowClick is defined`),i&&s&&console.warn(`${a} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`)},Dn=t=>t.key??t.fieldName,EQ=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),iv=(t,e)=>{const n=EQ(e,t.fieldName);return sv(t,n,e,!1)},sv=(t,e,n,r)=>t.render?t.render(e,n,r):e,B2=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},y=x=>{r(parseInt(x.target.value,10))},v=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(H.Box,{children:[b.jsx(ov,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(H.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},F2=()=>({height:window.innerHeight,width:window.innerWidth}),R2=()=>{const[t,e]=Z.useState(F2());return Z.useEffect(()=>{const n=()=>{e(F2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},co=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=R2(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(H.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...cr({...t},a)})},OQ=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(H.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",startIcon:b.jsx(p0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},MQ=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(H.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",color:"error",startIcon:b.jsx(Gb,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},_Q=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onViewAttachment:f,onSelect:p,getCitationsPaginated:m,selectedIds:y,setSelectedIds:v,onError:g=()=>{},condenseTable:x=!1,canSelect:S=!1,canLaunchUrl:k,addlActions:T,readOnly:C=!1,showCloseBtn:O=!1}=t,I=!!t.canCreate&&!C,N=!!t.canEdit&&!C,$=!!t.canDelete&&!C,{palette:V}=H.useTheme(),[M,F]=Z.useState([]),[z,B]=Z.useState(!1),[P,_]=Z.useState(!0),[A,R]=Z.useState(null),[j,K]=Z.useState(null),[U,Y]=Z.useState(null),[oe,fe]=Z.useState({pageNo:0,pageSize:x?5:10,totalCount:0}),me=()=>{B(!1),_(!0),m({pageNo:oe.pageNo,pageSize:oe.pageSize}).then(le=>(F(le.data),fe({...oe,totalCount:le.totalCount}),le)).catch(le=>{g(le),B(!0),F([])}).finally(()=>_(!1))};Z.useEffect(me,[oe.pageNo,oe.pageSize,e]);const G=()=>{K(null),Y(null),R(null)},te=b.jsx(co,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:b.jsx(zf,{}),children:"Add Citation"}),ue=b.jsx(co,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:b.jsx(NM,{}),children:"Add Attachment"}),re=le=>{if(!(!N&&!C)&&!(C&&!x))return b.jsx(H.Tooltip,{title:C?"View":"Edit",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>le.fileName?a(le):s(le),"data-testid":`citation-table_edit-btn-${le.id}`,children:C?b.jsx(XU,{}):b.jsx(VU,{})})})},ie=le=>{if(!(!$||C))return b.jsx(H.Tooltip,{title:"Delete",children:b.jsx(H.IconButton,{color:"error",onClick:xe=>{K(le),R(xe.currentTarget)},"data-testid":`citation-table_delete-btn-${le.id}`,children:b.jsx(Gb,{})})})},de=le=>{if(!k)return;if(!le.fileName)return b.jsx(H.Tooltip,{title:"Open URL",children:b.jsx(H.IconButton,{color:"primary",onClick:_e=>{R(_e.currentTarget),Y(le)},"data-testid":`citation-table_launch-link-btn-${le.id}`,sx:{visibility:k!=null&&k(le)?"visible":"hidden"},children:b.jsx(p0,{})})})},ye=le=>{if(!f||!le.fileName)return;const xe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],_e=le.fileName.split(".").pop();if(!(!_e||!xe.includes(_e)))return b.jsx(H.Tooltip,{title:"View File",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(le),"data-testid":`citation-table_view-file-btn-${le.id}`,children:b.jsx(p0,{})})})},ee=le=>{if(!u)return;if(!!le.fileName)return b.jsx(H.Tooltip,{title:"Download",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(le),"data-testid":`citation-table_download-btn-${le.id}`,children:b.jsx(zU,{})})})},ce=C||N||$||k||f||u||T,X=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(le,xe)=>b.jsx(H.Checkbox,{"data-testid":`citation-table_checkbox-${le}`,onChange:()=>{const _e=y.includes(xe.id);v(_e?y.filter(Me=>Me!==xe.id):[...y,xe.id])},checked:y.includes(le),disabled:C})},...z2(V,x),{fieldName:"id",key:"Action",label:"Action",hideCol:!ce,render:(le,xe)=>b.jsxs(H.Box,{display:"flex",flexDirection:"row-reverse",children:[T==null?void 0:T(xe),ie(xe),re(xe),ye(xe),de(xe),ee(xe)]})}];return b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[b.jsx(H.Typography,{variant:x?"h6":"h2",children:n}),!S&&I&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:1,children:[te,ue]}),O&&b.jsx(H.IconButton,{onClick:r,children:b.jsx(cp,{})})]}),b.jsx(B2,{"data-testid":"citation-table",size:x?"x-small":"medium",isLoading:P,columns:X,data:M,paginationState:oe,onPageChange:le=>fe({...oe,pageNo:le}),onRowsPerPageChange:le=>fe({...oe,pageSize:le,pageNo:0}),errorTableMsg:z?"Failed to load citations.":void 0,retryCallback:me}),S&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:I&&b.jsxs(b.Fragment,{children:[te,ue]})}),!C&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(co,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(co,{variant:"contained",size:"small",onClick:()=>p(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),b.jsx(OQ,{citation:U,anchorEl:A,onClose:G}),b.jsx(MQ,{citation:j,anchorEl:A,onDeleteCitation:l,onClose:G})]})},z2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(H.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(NM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(zf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})})},{fieldName:"title",tableCellSx:{width:e?"100%":"auto"},render:n=>e?El.truncate(n,{length:40,omission:"..."}):n},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:e,render:(n,r)=>b.jsx("span",{style:{wordBreak:"break-all"},children:n||r.url})},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],av=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(co,{type:n,disabled:e,size:r,startIcon:e?b.jsx(H.CircularProgress,{size:s,color:"inherit"}):null,...o})};var lv,V2;function IQ(){if(V2)return lv;V2=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,k){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=k};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);lv={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var I=0,N=k.length,$=C;I<N-1;){var V=k[I];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;$=$[k[I++]]}$[k[I]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var I=0,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,I,N,$;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),$=y(O),N=!$&&/^\d+$/.test(O),k.call(T,O,$,N,I,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return lv}var Sa=IQ(),cv,H2;function AQ(){if(H2)return cv;H2=1;const t=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(t)||[],n=f=>f[0].toUpperCase()+f.slice(1),r=(f,p)=>e(f).join(p).toLowerCase(),o=f=>e(f).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return cv={words:e,upperFirst:n,camelCase:o,pascalCase:f=>n(o(f)),snakeCase:f=>r(f,"_"),kebabCase:f=>r(f,"-"),sentenceCase:f=>n(r(f," ")),titleCase:f=>e(f).map(n).join(" ")},cv}var uv=AQ(),xh={exports:{}},W2;function DQ(){if(W2)return xh.exports;W2=1,xh.exports=function(o){return t(e(o),o)},xh.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(y,v,g){if(g.has(y)){var x;try{x=", node was:"+JSON.stringify(y)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[v]){l[v]=!0;var S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--v];m(k,p.get(k),g)}while(v);g.delete(y)}a[--s]=y}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return xh.exports}var PQ=DQ();const NQ=tr(PQ),$Q=Object.prototype.toString,LQ=Error.prototype.toString,BQ=RegExp.prototype.toString,FQ=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",RQ=/^Symbol\((.*)\)(.*)$/;function zQ(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function j2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return zQ(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return FQ.call(t).replace(RQ,"Symbol($1)");const r=$Q.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+LQ.call(t)+"]":r==="RegExp"?BQ.call(t):null}function ws(t,e){let n=j2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=j2(this[r],e);return i!==null?i:o},2)}function U2(t){return t==null?[]:[].concat(t)}let q2,K2,Y2,VQ=/\$\{\s*(\w+)\s*\}/g;q2=Symbol.toStringTag;class G2{constructor(e,n,r,o){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[q2]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],U2(e).forEach(i=>{if(hr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}K2=Symbol.hasInstance,Y2=Symbol.toStringTag;class hr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(VQ,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new G2(e,n,r,o);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[Y2]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,hr)}static[K2](e){return G2[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ei={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},kr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},HQ={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},dv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},WQ={isValue:"${path} field must be ${value}"},wh={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:HQ,date:dv,object:wh,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:WQ,tuple:{notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return hr.formatError(ei.notType,t)}}});const fv=t=>t&&t.__isYupSchema__;class Sh{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new Sh(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!fv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ch={context:"$",value:"."};class Ca{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Ch.context,this.isValue=this.key[0]===Ch.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ch.context:this.isValue?Ch.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Sa.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Ca.prototype.__isYupRef=!0;const Ta=t=>t==null;function Ll(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(F={}){const z=J2(Object.assign({value:n,originalValue:i,label:s.spec.label,path:F.path||r,spec:s.spec,disableStackTrace:F.disableStackTrace||S},p,F.params),k),B=new hr(hr.formatError(F.message||m,z),n,z.path,F.type||u,z.disableStackTrace);return B.params=z,B}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(F){return X2(F,k)},options:o,originalValue:i,schema:s};const I=F=>{hr.isError(F)?C(F):F?l(null):C(T())},N=F=>{hr.isError(F)?C(F):a(F)};if(y&&Ta(n))return I(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(I,N)}}catch(F){N(F);return}I(V)}return e.OPTIONS=t,e}function J2(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=X2(t[n],e);return t}function X2(t,e){return Ca.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function jQ(t,e,n,r=n){let o,i,s;return e?(Sa.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class Th extends Set{describe(){const e=[];for(const n of this.values())e.push(Ca.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new Th(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Bl(t,e=new Map){if(fv(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=Bl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,Bl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Bl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Bl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function UQ(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function qQ(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:UQ(n)}))}function Z2(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return qQ(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>Z2(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Th,this._blacklist=new Th,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ei.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Bl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ta(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
405
+ 3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function XZ(){Kt.scanner=WZ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=qZ(Kt.scanner.tokens);for(let t=0;t<Kt.pluginQueue.length;t++)Kt.pluginQueue[t][1]({scanner:Kt.scanner,parser:Kt.parser});return Kt.initialized=!0,Kt}function tv(t){return Kt.initialized||XZ(),KZ(Kt.parser.start,t,S2(Kt.scanner.start,t))}tv.scan=S2;function _2(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Q0(n),o=tv(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const nv="[\0-   ᠎ -\u2029  ]",ZZ=new RegExp(nv),QZ=new RegExp(`${nv}$`),eQ=new RegExp(nv,"g");function tQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function nQ(t){return new en({key:new En("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=DR(n.doc,[...e]);if(FR(a).forEach(({newRange:u})=>{const f=NR(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(u.from,u.to," "," ");if(!QZ.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(ZZ).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=tv(v).map(S=>S.toObject(t.defaultProtocol));if(!tQ(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:g+S.start+1,to:g+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{jg(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function rQ(t){return new en({key:new En("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=Wg(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function oQ(t){return new en({key:new En("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=_2(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function wa(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(eQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const iQ=xr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){M2(t);return}M2(t.scheme,t.optionalSlashes)})},onDestroy(){JZ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!wa(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!wa(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!wa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xt(this.options.HTMLAttributes,t),0]:["a",xt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!wa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!wa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[as({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=_2(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!wa(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(nQ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!wa(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(rQ({type:this.type})),this.options.linkOnPaste&&t.push(oQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function sQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=c3(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(y)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!k)return null;const T=g+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const aQ=new En("suggestion");function lQ({pluginKey:t=aQ,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=sQ}){let x;const S=y==null?void 0:y(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,$,V,M,F;const z=(O=this.key)===null||O===void 0?void 0:O.getState(C),B=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=z.active&&B.active&&z.range.from!==B.range.from,_=!z.active&&B.active,A=z.active&&!B.active,R=!_&&!A&&z.query!==B.query,j=_||P&&R,K=R||P,U=A||P&&R;if(!j&&!K&&!U)return;const Y=U&&!j?z:B,oe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:fe=>p({editor:e,range:Y.range,props:fe}),decorationNode:oe,clientRect:oe?()=>{var fe;const{decorationId:me}=(fe=this.key)===null||fe===void 0?void 0:fe.getState(e.state),G=T.dom.querySelector(`[data-decoration-id="${me}"]`);return(G==null?void 0:G.getBoundingClientRect())||null}:null},j&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.call(S,x)),K&&(($=S==null?void 0:S.onBeforeUpdate)===null||$===void 0||$.call(S,x)),(K||j)&&(x.items=await m({editor:e,query:Y.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),j&&((F=S==null?void 0:S.onStart)===null||F===void 0||F.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,I){const{isEditable:N}=e,{composing:$}=e.view,{selection:V}=T,{empty:M,from:F}=V,z={...C};if(z.composing=$,N&&(M||e.view.composing)){(F<C.range.from||F>C.range.to)&&!$&&!C.composing&&(z.active=!1);const B=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;B&&v({editor:e,state:I,range:B.range,isActive:C.active})?(z.active=!0,z.decorationId=C.decorationId?C.decorationId:P,z.range=B.range,z.query=B.query,z.text=B.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(T,C){var O;const{active:I,range:N}=k.getState(T.state);return I&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const $=!(N!=null&&N.length),V=[l];return $&&V.push(f),Jt.create(T.doc,[Kn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function cQ({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new En;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function I2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>cQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function A2(t,e){const n=I2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const uQ=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",xt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=A2(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=xt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:A2(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new fi,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return I2(this).map(lQ)}}),D2=ln.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new En("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&sf(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Kn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Jt.create(t,o)}}})]}}),dQ=xr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",xt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),fQ=tn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",xt(this.options.HTMLAttributes,t),0]}}),pQ=tn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",xt(this.options.HTMLAttributes,t),0]}}),hQ=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",xt(this.options.HTMLAttributes,t),0]}}),mQ=/^\s*(\[([( |x])?\])\s$/,gQ=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const y=n();if(typeof y!="number")return!1;const v=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[sl({find:mQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),yQ=tn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",xt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),bQ=ln.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P2=Z.forwardRef((t,e)=>{const[n,r]=Z.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return Z.useEffect(()=>r(0),[t.items]),Z.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?b.jsx(H.Paper,{elevation:5,children:b.jsx(H.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(H.ListItem,{disablePadding:!0,children:b.jsx(H.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});P2.displayName="SuggestionList";const N2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},vQ={items:async({query:t})=>Promise.resolve(["Lea Thompson","Cyndi Lauper","Tom Cruise","Madonna","Jerry Hall","Joan Collins","Winona Ryder","Christina Applegate","Alyssa Milano","Molly Ringwald","Ally Sheedy","Debbie Harry","Olivia Newton-John","Elton John","Michael J. Fox","Axl Rose","Emilio Estevez","Ralph Macchio","Rob Lowe","Jennifer Grey","Mickey Rourke","John Cusack","Matthew Broderick","Justine Bateman","Lisa Bonet","Benicio Monserrate Rafael del Toro Sánchez"].map((e,n)=>({mentionLabel:e,id:n.toString()})).filter(e=>e.mentionLabel.toLowerCase().startsWith(t.toLowerCase())).slice(0,5)),render:()=>{let t,e;return{onStart:n=>{t=new hO(P2,{props:n,editor:n.editor}),e=su("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2},appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})[0]},onUpdate(n){t==null||t.updateProps(n),e==null||e.setProps({getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},xQ=iQ.extend({inclusive:!1}),wQ=dQ.extend({excludes:"superscript"}),SQ=iM.extend({excludes:"subscript"});function CQ({placeholder:t}={}){return Z.useMemo(()=>[u7.configure({resizable:!0}),hQ,pQ,fQ,cT,dT,fT,gT,OT,IT,AT,wQ,SQ,PT,sT,iT,uT,ET,oM,DT,xQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Y9,mT,q9,bQ.configure({types:["heading","paragraph","image"]}),DZ,PZ,NZ,Wj,zT.configure({multicolor:!0}),kT,c8,pT,yQ,gQ.configure({nested:!0}),uQ.configure({suggestion:vQ}),D2.configure({placeholder:t}),TT],[t])}function $2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const TQ=t=>{const e=CQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(nM,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=jt.useField({name:n}),{setValue:f}=u,{value:p}=a;Z.useEffect(()=>{var S,k,T;(T=(k=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:k.commands)==null||T.setContent(p)},[p]);const m=Z.useRef(null),y=Z.useCallback((S,k)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{eb({images:O,editor:T,position:k})});else{const O=i(S);eb({images:O,editor:T,position:k})}},[]),v=Z.useCallback((S,k,T,C)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=$2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return y(O,N),k.preventDefault(),!0}return!1},[y]),g=Z.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=$2(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(H.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(tM,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(IZ,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(A7,{}),b.jsx(U7,{})]})})});return b.jsxs(H.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(H.Typography,{...o,children:r}),x]})},rv=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(H.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(H.Box,{className:"text-content",children:[b.jsx(H.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(H.Typography,{"data-testid":"message",children:n})]}),b.jsx(H.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},L2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=Z.useState(!1),[u,f]=Z.useState(void 0);Z.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?b.jsx(H.Collapse,{in:n,children:u}):b.jsx(H.TableRow,{sx:p,children:b.jsx(H.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(H.Collapse,{in:n,children:u})})})},ov=t=>{const{id:e,getRowKey:n=X=>"id"in X&&(typeof X.id=="string"||typeof X.id=="number")?X.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(X)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(X)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,renderExpand:a,hideColumnsOnMobile:l=[],sortField:u,sortOrder:f,onSortChange:p,allowSortCols:m,fixedLayout:y=!1,className:v,emptyTableMsg:g="No items to display",errorTableMsg:x,retryCallback:S,isLoading:k=!1,disableMobileCards:T=!1,highlightSelectedRow:C=!1,headerRowStyle:O={},stickyHeader:I,reRenderExpand:N=!1,expandOnRowClick:$=!1,tooltipColor:V,...M}=t,{palette:F}=H.useTheme(),[z,B]=Z.useState(void 0),[P,_]=Z.useState(void 0);kQ(t);const A=X=>{X!==u?p&&p(X,"asc"):p&&p(u,f==="asc"?"desc":"asc")},R=X=>u===X?f:null,j=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),K=j&&l?r.filter(X=>!(l.includes(Dn(X))||X.hideCol)):r.filter(X=>!X.hideCol);a&&!j&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:X=>{const le=z===X;return b.jsx(H.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>re(X),children:le?b.jsx(up,{"data-testid":"collapse-up"}):b.jsx(f0,{"data-testid":"expand-down"})})}});const U=p!==void 0,Y=X=>U?m?m.includes(X):!0:!1,oe=b.jsxs(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(WU,{})," ",g]}),fe=b.jsxs(H.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(aw,{color:"error"})," ",x,S&&b.jsx(H.Button,{variant:"text",onClick:S,children:"Retry?"})]}),me=()=>{if(k)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:b.jsx(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:b.jsx(rv,{})})})});if(x)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:fe})});if(o.length===0)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:oe})})},G=()=>{if(k)return b.jsx(rv,{});if(x)return fe;if(o.length===0)return oe},te=X=>{C&&_(X)},ue=X=>{const le=n(X);if((i||s)&&(i==null||i(le),s==null||s(X),te(le)),a&&$){const xe=z===le?void 0:le;B(xe),te(xe)}},re=X=>{const le=z===X?void 0:X;B(le),te(le)},ie=X=>{if(!a)return;const le=z===n(X);return b.jsxs(b.Fragment,{children:[b.jsxs(H.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>re(n(X)),children:[le?b.jsx(up,{}):b.jsx(f0,{})," Show"," ",le?"Less":"More"]}),b.jsx(L2,{colSpan:r.length,isExpanded:n(X)===z,obj:X,renderExpand:xe=>a(xe),asMobileCard:!0})]})},de=typeof C=="string"?C:F.grey[F.mode=="dark"?600:50],ye=X=>{const le=P===n(X)?de:"inherit";return{cursor:i||$?"pointer":"default",backgroundColor:le,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===de?dG(le,.1):de}}}},ee=F.grey[F.mode==="dark"?600:400],ce=X=>X&&b.jsx(H.Tooltip,{title:X,children:b.jsx(HU,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:V??ee,marginLeft:"2px"}})});return j&&!T?b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:v,"data-testid":"mui-table-mobile",children:[U&&b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(H.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:X=>A(X.target.value),fullWidth:!0,children:K.map(X=>{if(Y(Dn(X)))return b.jsx(H.MenuItem,{value:Dn(X),children:X.label??Ln(Dn(X))},`rowHeader-${Dn(X)}`)})}),b.jsx(H.IconButton,{onClick:()=>{u&&A(u)},children:b.jsx(JU,{className:`sort-icon-${f}`})})]}),b.jsx(H.Divider,{sx:{margin:"10px 0"}})]}),G()??o.map(X=>b.jsxs(H.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(X)},onClick:()=>ue(X),"data-testid":`card-${n(X)}`,children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:K.map(le=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Dn(le)}`,style:{textWrap:"nowrap"},children:[le.label??Ln(Dn(le)),ce(le.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Dn(le)}`,style:{paddingLeft:"10px"},children:iv(le,X)})]},`row-${n(X)}-${Dn(le)}`))})}),ie(X)]},n(X)))]}):b.jsx(H.TableContainer,{component:H.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:I?{maxHeight:I,overflow:"auto"}:{},children:b.jsxs(H.Table,{stickyHeader:I!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(H.TableHead,{className:"MBv2_Table_Head",children:b.jsx(H.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((X,le)=>{const xe=Y(Dn(X));return b.jsx(H.TableCell,{width:Array.isArray(y)?y[le]:"auto",sx:X.tableCellSx??{},children:b.jsx(H.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(H.Box,{sx:[xe&&{"&:hover":{cursor:"pointer",backgroundColor:F.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:xe?()=>A(Dn(X)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:X.label??Ln(Dn(X))}),ce(X.tooltip),xe&&R(Dn(X))==="asc"&&b.jsx(up,{style:{marginLeft:"5px"}}),xe&&R(Dn(X))==="desc"&&b.jsx(f0,{style:{marginLeft:"5px"}}),xe&&R(Dn(X))!=="asc"&&R(Dn(X))!=="desc"&&b.jsx(YU,{style:{marginLeft:"5px"}})]})})},`rowHeader-${Dn(X)}`)})})}),b.jsx(H.TableBody,{className:"MBv2_Table_Body",children:me()??o.map(X=>b.jsxs(Z.Fragment,{children:[b.jsx(H.TableRow,{"data-testid":`row-${n(X)}`,className:"MBv2_Table_Body_Row",onClick:()=>ue(X),sx:ye(X),children:K.map(le=>b.jsx(H.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Dn(le)}`,children:iv(le,X)},`row-${n(X)}-${Dn(le)}`))}),a&&b.jsx(L2,{colSpan:K.length,isExpanded:n(X)===z,obj:X,renderExpand:le=>a(le),reRenderExpand:N})]},n(X)))})]})})},kQ=t=>{const{fixedLayout:e,renderExpand:n,columns:r,expandOnRowClick:o,onRowClick:i,onRowClickObj:s}=t,a="Table component:";Array.isArray(e)&&(!n&&e.length!==r.length&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns".`),n&&e.length!==r.length+1&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),o&&!n&&console.warn(`${a} renderExpand should be defined when expandOnRowClick is defined`),i&&s&&console.warn(`${a} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`)},Dn=t=>t.key??t.fieldName,EQ=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),iv=(t,e)=>{const n=EQ(e,t.fieldName);return sv(t,n,e,!1)},sv=(t,e,n,r)=>t.render?t.render(e,n,r):e,B2=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},y=x=>{r(parseInt(x.target.value,10))},v=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(H.Box,{children:[b.jsx(ov,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(H.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},F2=()=>({height:window.innerHeight,width:window.innerWidth}),R2=()=>{const[t,e]=Z.useState(F2());return Z.useEffect(()=>{const n=()=>{e(F2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},co=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=R2(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(H.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...cr({...t},a)})},OQ=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(H.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",startIcon:b.jsx(p0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},MQ=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(H.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",color:"error",startIcon:b.jsx(Gb,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},_Q=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onViewAttachment:f,onSelect:p,getCitationsPaginated:m,selectedIds:y,setSelectedIds:v,onError:g=()=>{},condenseTable:x=!1,canSelect:S=!1,canLaunchUrl:k,addlActions:T,readOnly:C=!1,showCloseBtn:O=!1}=t,I=!!t.canCreate&&!C,N=!!t.canEdit&&!C,$=!!t.canDelete&&!C,{palette:V}=H.useTheme(),[M,F]=Z.useState([]),[z,B]=Z.useState(!1),[P,_]=Z.useState(!0),[A,R]=Z.useState(null),[j,K]=Z.useState(null),[U,Y]=Z.useState(null),[oe,fe]=Z.useState({pageNo:0,pageSize:x?5:10,totalCount:0}),me=()=>{B(!1),_(!0),m({pageNo:oe.pageNo,pageSize:oe.pageSize}).then(le=>(F(le.data),fe({...oe,totalCount:le.totalCount}),le)).catch(le=>{g(le),B(!0),F([])}).finally(()=>_(!1))};Z.useEffect(me,[oe.pageNo,oe.pageSize,e]);const G=()=>{K(null),Y(null),R(null)},te=b.jsx(co,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:b.jsx(zf,{}),children:"Add Citation"}),ue=b.jsx(co,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:b.jsx(NM,{}),children:"Add Attachment"}),re=le=>{if(!(!N&&!C)&&!(C&&!x))return b.jsx(H.Tooltip,{title:C?"View":"Edit",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>le.fileName?a(le):s(le),"data-testid":`citation-table_edit-btn-${le.id}`,children:C?b.jsx(XU,{}):b.jsx(VU,{})})})},ie=le=>{if(!(!$||C))return b.jsx(H.Tooltip,{title:"Delete",children:b.jsx(H.IconButton,{color:"error",onClick:xe=>{K(le),R(xe.currentTarget)},"data-testid":`citation-table_delete-btn-${le.id}`,children:b.jsx(Gb,{})})})},de=le=>{if(!k)return;if(!le.fileName)return b.jsx(H.Tooltip,{title:"Open URL",children:b.jsx(H.IconButton,{color:"primary",onClick:_e=>{R(_e.currentTarget),Y(le)},"data-testid":`citation-table_launch-link-btn-${le.id}`,sx:{visibility:k!=null&&k(le)?"visible":"hidden"},children:b.jsx(p0,{})})})},ye=le=>{if(!f||!le.fileName)return;const xe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],_e=le.fileName.split(".").pop();if(!(!_e||!xe.includes(_e)))return b.jsx(H.Tooltip,{title:"View File",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(le),"data-testid":`citation-table_view-file-btn-${le.id}`,children:b.jsx(p0,{})})})},ee=le=>{if(!u)return;if(!!le.fileName)return b.jsx(H.Tooltip,{title:"Download",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(le),"data-testid":`citation-table_download-btn-${le.id}`,children:b.jsx(zU,{})})})},ce=C||N||$||k||f||u||T,X=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(le,xe)=>b.jsx(H.Checkbox,{"data-testid":`citation-table_checkbox-${le}`,onChange:()=>{const _e=y.includes(xe.id);v(_e?y.filter(Me=>Me!==xe.id):[...y,xe.id])},checked:y.includes(le),disabled:C})},...z2(V,x),{fieldName:"id",key:"Action",label:"Action",hideCol:!ce,render:(le,xe)=>b.jsxs(H.Box,{display:"flex",flexDirection:"row-reverse",children:[T==null?void 0:T(xe),ie(xe),re(xe),ye(xe),de(xe),ee(xe)]})}];return b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[b.jsx(H.Typography,{variant:x?"h6":"h2",children:n}),!S&&I&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:1,children:[te,ue]}),O&&b.jsx(H.IconButton,{onClick:r,children:b.jsx(cp,{})})]}),b.jsx(B2,{"data-testid":"citation-table",size:x?"x-small":"medium",isLoading:P,columns:X,data:M,paginationState:oe,onPageChange:le=>fe({...oe,pageNo:le}),onRowsPerPageChange:le=>fe({...oe,pageSize:le,pageNo:0}),errorTableMsg:z?"Failed to load citations.":void 0,retryCallback:me}),S&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:I&&b.jsxs(b.Fragment,{children:[te,ue]})}),!C&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(co,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(co,{variant:"contained",size:"small",onClick:()=>p(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),b.jsx(OQ,{citation:U,anchorEl:A,onClose:G}),b.jsx(MQ,{citation:j,anchorEl:A,onDeleteCitation:l,onClose:G})]})},z2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(H.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(NM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(zf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",tableCellSx:{width:e?"100%":"auto"},render:n=>e?El.truncate(n,{length:40,omission:"..."}):n},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:e,render:(n,r)=>b.jsx("span",{style:{wordBreak:"break-all"},children:n||r.url}),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],av=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(co,{type:n,disabled:e,size:r,startIcon:e?b.jsx(H.CircularProgress,{size:s,color:"inherit"}):null,...o})};var lv,V2;function IQ(){if(V2)return lv;V2=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,k){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=k};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);lv={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var I=0,N=k.length,$=C;I<N-1;){var V=k[I];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;$=$[k[I++]]}$[k[I]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var I=0,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,I,N,$;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),$=y(O),N=!$&&/^\d+$/.test(O),k.call(T,O,$,N,I,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return lv}var Sa=IQ(),cv,H2;function AQ(){if(H2)return cv;H2=1;const t=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(t)||[],n=f=>f[0].toUpperCase()+f.slice(1),r=(f,p)=>e(f).join(p).toLowerCase(),o=f=>e(f).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return cv={words:e,upperFirst:n,camelCase:o,pascalCase:f=>n(o(f)),snakeCase:f=>r(f,"_"),kebabCase:f=>r(f,"-"),sentenceCase:f=>n(r(f," ")),titleCase:f=>e(f).map(n).join(" ")},cv}var uv=AQ(),xh={exports:{}},W2;function DQ(){if(W2)return xh.exports;W2=1,xh.exports=function(o){return t(e(o),o)},xh.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(y,v,g){if(g.has(y)){var x;try{x=", node was:"+JSON.stringify(y)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[v]){l[v]=!0;var S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--v];m(k,p.get(k),g)}while(v);g.delete(y)}a[--s]=y}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return xh.exports}var PQ=DQ();const NQ=tr(PQ),$Q=Object.prototype.toString,LQ=Error.prototype.toString,BQ=RegExp.prototype.toString,FQ=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",RQ=/^Symbol\((.*)\)(.*)$/;function zQ(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function j2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return zQ(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return FQ.call(t).replace(RQ,"Symbol($1)");const r=$Q.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+LQ.call(t)+"]":r==="RegExp"?BQ.call(t):null}function ws(t,e){let n=j2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=j2(this[r],e);return i!==null?i:o},2)}function U2(t){return t==null?[]:[].concat(t)}let q2,K2,Y2,VQ=/\$\{\s*(\w+)\s*\}/g;q2=Symbol.toStringTag;class G2{constructor(e,n,r,o){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[q2]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],U2(e).forEach(i=>{if(hr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}K2=Symbol.hasInstance,Y2=Symbol.toStringTag;class hr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(VQ,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new G2(e,n,r,o);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[Y2]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,hr)}static[K2](e){return G2[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ei={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},kr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},HQ={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},dv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},WQ={isValue:"${path} field must be ${value}"},wh={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:HQ,date:dv,object:wh,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:WQ,tuple:{notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return hr.formatError(ei.notType,t)}}});const fv=t=>t&&t.__isYupSchema__;class Sh{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new Sh(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!fv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ch={context:"$",value:"."};class Ca{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Ch.context,this.isValue=this.key[0]===Ch.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ch.context:this.isValue?Ch.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Sa.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Ca.prototype.__isYupRef=!0;const Ta=t=>t==null;function Ll(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(F={}){const z=J2(Object.assign({value:n,originalValue:i,label:s.spec.label,path:F.path||r,spec:s.spec,disableStackTrace:F.disableStackTrace||S},p,F.params),k),B=new hr(hr.formatError(F.message||m,z),n,z.path,F.type||u,z.disableStackTrace);return B.params=z,B}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(F){return X2(F,k)},options:o,originalValue:i,schema:s};const I=F=>{hr.isError(F)?C(F):F?l(null):C(T())},N=F=>{hr.isError(F)?C(F):a(F)};if(y&&Ta(n))return I(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(I,N)}}catch(F){N(F);return}I(V)}return e.OPTIONS=t,e}function J2(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=X2(t[n],e);return t}function X2(t,e){return Ca.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function jQ(t,e,n,r=n){let o,i,s;return e?(Sa.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class Th extends Set{describe(){const e=[];for(const n of this.values())e.push(Ca.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new Th(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Bl(t,e=new Map){if(fv(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=Bl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,Bl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Bl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Bl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function UQ(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function qQ(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:UQ(n)}))}function Z2(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return qQ(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>Z2(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new Th,this._blacklist=new Th,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ei.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Bl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ta(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
406
406
 
407
407
  attempted value: ${s}
408
408
  `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(k){k&&(Array.isArray(k)?y.push(...k):y.push(k)),--m<=0&&p(y)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,y)=>this.resolve(f)._validate(u,f,m,y)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{hr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new hr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw hr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new hr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(hr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(hr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Bl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=Ll({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=Ll({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=ei.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ei.notNull){return this.nullability(!1,e)}required(e=ei.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=ei.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Ll(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=U2(e).map(i=>new Ca(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Sh(o,n):Sh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Ll({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=ei.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Ll({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=ei.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Ll({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?J2(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof hr)return{issues:Z2(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=jQ(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const KQ=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function YQ(t){const e=pv(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let n=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(n=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(n=0-n)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+n,e.second,e.millisecond)}function pv(t){var e,n;const r=KQ.exec(t);return r?{year:Ii(r[1]),month:Ii(r[2],1)-1,day:Ii(r[3],1),hour:Ii(r[4]),minute:Ii(r[5]),second:Ii(r[6]),millisecond:r[7]?Ii(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:Ii(r[10]),minuteOffset:Ii(r[11])}:null}function Ii(t,e=0){return Number(t)||e}let GQ=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,JQ=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,XQ=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,ZQ="^\\d{4}-\\d{2}-\\d{2}",QQ="\\d{2}:\\d{2}:\\d{2}",eee="(([+-]\\d{2}(:?\\d{2})?)|Z)",tee=new RegExp(`${ZQ}T${QQ}(\\.\\d+)?${eee}$`),nee=t=>Ta(t)||t===t.trim(),ree={}.toString();function ka(){return new Q2}class Q2 extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===ree?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||ei.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=kr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=kr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=kr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||kr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=kr.email){return this.matches(GQ,{name:"email",message:e,excludeEmptyString:!0})}url(e=kr.url){return this.matches(JQ,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=kr.uuid){return this.matches(XQ,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let n="",r,o;return e&&(typeof e=="object"?{message:n="",allowOffset:r=!1,precision:o=void 0}=e:n=e),this.matches(tee,{name:"datetime",message:n||kr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||kr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=pv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||kr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=pv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=kr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:nee})}lowercase(e=kr.lowercase){return this.transform(n=>Ta(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ta(n)||n===n.toLowerCase()})}uppercase(e=kr.uppercase){return this.transform(n=>Ta(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ta(n)||n===n.toUpperCase()})}}ka.prototype=Q2.prototype;let eI=new Date(""),oee=t=>Object.prototype.toString.call(t)==="[object Date]";function hv(){return new $u}class $u extends ti{constructor(){super({type:"date",check(e){return oee(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=YQ(e),isNaN(e)?$u.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ca.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=dv.min){let r=this.prepareParam(e,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(o){return o>=this.resolve(r)}})}max(e,n=dv.max){let r=this.prepareParam(e,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(o){return o<=this.resolve(r)}})}}$u.INVALID_DATE=eI,hv.prototype=$u.prototype,hv.INVALID_DATE=eI;function iee(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Sa.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Ca.isRef(a)&&a.isSibling?i(a.path,s):fv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return NQ.array(Array.from(r),n).reverse()}function tI(t,e){let n=1/0;return t.some((r,o)=>{var i;if((i=e.path)!=null&&i.includes(r))return n=o,!0}),n}function nI(t){return(e,n)=>tI(t,e)-tI(t,n)}const see=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function kh(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=kh(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=kh(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(kh)}):"optional"in t?t.optional():t}const aee=(t,e)=>{const n=[...Sa.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Sa.getter(Sa.join(n),!0)(t);return!!(o&&r in o)};let rI=t=>Object.prototype.toString.call(t)==="[object Object]";function oI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const lee=nI([]);function mv(t){return new iI(t)}class iI extends ti{constructor(e){super({type:"object",check(n){return rI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=lee,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],y=p in o,v=o[p];if(m){let g;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}g=!n.__validating||!S?m.cast(v,u):v,g!==void 0&&(l[p]=g)}else y&&!s&&(l[p]=v);(y!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!rI(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Ca.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=iee(e,n),r._sortErrors=nI(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return kh(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=Sa.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return aee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(see)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||wh.exact,test(n){if(n==null)return!0;const r=oI(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=wh.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=oI(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=wh.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(uv.camelCase)}snakeCase(){return this.transformKeys(uv.snakeCase)}constantCase(){return this.transformKeys(e=>uv.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}mv.prototype=iI.prototype;const cee=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=Z.useRef(null),[u,f]=Z.useState(!1),[p,m]=Z.useState(!1),[y,v]=Z.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});return Z.useEffect(()=>{i&&v({...i,type:"Url"})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(H.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&b.jsx(H.IconButton,{onClick:o,children:b.jsx(cp,{})})]}),b.jsx(jt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,onSubmit:async g=>{f(!0),n(g).catch(x=>{throw f(!1),x}).finally(()=>f(!1))},validationSchema:mv({source:ka().required("Source is required"),title:ka().required("Title is required"),accessedAt:hv().required("Accessed At is required"),url:ka().required("URL is required"),classification:ka().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:g})=>b.jsxs(jt.Form,{autoComplete:"off",children:[b.jsxs(H.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(gs,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(gs,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(Vp,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),b.jsx(gs,{name:"url",label:"URL",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(DM,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:s})]}),b.jsx(H.DialogActions,{sx:{px:0},children:s?b.jsx(H.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(av,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),g()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},sI=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},uee=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=Z.useRef(null),[f,p]=Z.useState(!1),[m,y]=Z.useState(!1),[v,g]=Z.useState({type:"Attachment",title:"",file:void 0,fileName:""});return Z.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(H.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(H.IconButton,{onClick:o,children:b.jsx(cp,{})})]}),b.jsx(jt.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:mv().shape({title:ka().required("Title is required"),fileName:ka().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit:k})=>{var T;return Z.useEffect(()=>{var C,O;(C=x.file)!=null&&C.name&&S("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),b.jsxs(jt.Form,{autoComplete:"off",children:[b.jsx(gs,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(H.Box,{marginTop:i||a?0:1,children:[b.jsxs(sI,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(pM,{name:"file",errorMode:"hidden"}),b.jsx(gs,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(br,{name:"fileName"})]}),b.jsx(H.DialogActions,{sx:{px:0},children:a?b.jsx(H.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(av,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Lu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",y=()=>{if(s&&p)return b.jsx(H.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(H.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(H.Box,{children:y()}),b.jsxs(H.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(H.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(H.Box,{children:y()})})};return b.jsxs(H.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(H.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(H.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(cp,{})})]})}):r,o&&(typeof o=="string"?b.jsx(H.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(H.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function dee(t){return Ue("MuiAlert",t)}const aI=He("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),fee=Pe(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),pee=Pe(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),hee=Pe(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),mee=Pe(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),gee=Pe(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),yee=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ie(n||r)}`,`${e}${Ie(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return je(i,dee,o)},bee=ne(us,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ie(n.color||n.severity)}`]]}})(gt(({theme:t})=>{const e=t.palette.mode==="light"?Rs:za,n=t.palette.mode==="light"?za:Rs;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${aI.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${aI.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),vee=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),xee=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),wee=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),lI={success:b.jsx(fee,{fontSize:"inherit"}),warning:b.jsx(pee,{fontSize:"inherit"}),error:b.jsx(hee,{fontSize:"inherit"}),info:b.jsx(mee,{fontSize:"inherit"})},cI=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=lI,onClose:y,role:v="alert",severity:g="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:g,variant:k,colorSeverity:l||g},O=yee(C),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[N,$]=Ot("root",{ref:n,shouldForwardComponentProp:!0,className:ge(O.root,s),elementType:bee,externalForwardedProps:{...I,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Ot("icon",{className:O.icon,elementType:vee,externalForwardedProps:I,ownerState:C}),[F,z]=Ot("message",{className:O.message,elementType:xee,externalForwardedProps:I,ownerState:C}),[B,P]=Ot("action",{className:O.action,elementType:wee,externalForwardedProps:I,ownerState:C}),[_,A]=Ot("closeButton",{elementType:_l,externalForwardedProps:I,ownerState:C}),[R,j]=Ot("closeIcon",{elementType:gee,externalForwardedProps:I,ownerState:C});return b.jsxs(N,{...$,children:[p!==!1?b.jsx(V,{...M,children:p||m[g]||lI[g]}):null,b.jsx(F,{...z,children:i}),o!=null?b.jsx(B,{...P,children:o}):null,o==null&&y?b.jsx(B,{...P,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...A,children:b.jsx(R,{fontSize:"small",...j})})}):null]})});process.env.NODE_ENV!=="production"&&(cI.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Bu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=H.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return b.jsxs(cI,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(H.Typography,{variant:"h3",children:s}),n]})},uI=t=>b.jsx(Bu,{severity:"error",...t}),dI=t=>b.jsx(Bu,{severity:"success",...t}),See=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return b.jsxs(b.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&b.jsx(uI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(dI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function fI({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsSelectablePopup:m=!1,addlActions:y,canLaunchUrl:v,readOnly:g}){const[x,S]=Z.useState("Insert Citation/Attachment(s)"),[k,T]=Z.useState(u),[C,O]=Z.useState(void 0),[I,N]=Z.useState(void 0),$=G=>{N(void 0),S(G)},[V,M]=Z.useState(0);Z.useEffect(()=>{f==null||f()},[x,I,f]);const F=(G=!1)=>{(!m||G)&&M(te=>te+1)},z=(G,te)=>{var de;const ue=typeof((de=te.response)==null?void 0:de.data)=="string"&&te.response.data,re=typeof te.message=="string"&&te.message;N({type:"Error",title:G,message:ue??re}),p(te)},B=G=>N({type:"Success",title:"",message:G}),P=async G=>{if(x==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(x==="Edit Citation"||x==="Edit Attachment"){if(G.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(G).then(()=>{$("Insert Citation/Attachment(s)"),F()}).catch(ue=>{z("Failed to update",ue)}))}else await(e==null?void 0:e(G).then(ue=>{T([...k,ue.id]),$("Insert Citation/Attachment(s)"),F()}).catch(ue=>{z("Failed to create",ue)}))},_=r&&(async G=>r(G).then(()=>{F(!0),T(k.filter(te=>te!==G)),B("Successfully deleted")}).catch(te=>z("Failed to delete",te))),A=(G,te)=>{o(G.id).then(ue=>{O(ue),$(te)}).catch(ue=>{z("Failed to load",ue)})},R=i&&(async G=>i(G).catch(te=>{z(`Failed to download ${G.fileName}`,te)})),j=s&&(async G=>s(G).catch(te=>{z(`Failed to view ${G.fileName}`,te)})),K=b.jsx(_Q,{refreshKey:V,getCitationsPaginated:G=>t(G).then(te=>(f==null||f(),te)),onCancel:l,onNewCitation:()=>{O(void 0),$("Add Citation")},onNewAttachment:()=>{O(void 0),$("Add Attachment")},onEditCitation:G=>A(G,g?"View Citation":"Edit Citation"),onEditAttachment:G=>A(G,g?"View Attachment":"Edit Attachment"),onDeleteCitation:_,onDownloadAttachment:R,onViewAttachment:j,onSelect:a,setSelectedIds:T,selectedIds:k,onError:p,condenseTable:m,canSelect:m,title:m&&!g?x:"Attachments & Citations",addlActions:y,canCreate:!!e,canEdit:!!n,canDelete:!!_,canLaunchUrl:v,readOnly:g,showCloseBtn:m}),U=b.jsx(cee,{modifyCitation:C,onSave:P,onCancel:()=>$("Insert Citation/Attachment(s)"),onClose:l,title:x,readOnly:x==="View Citation",showCloseBtn:m}),Y=b.jsx(uee,{onSave:P,onCancel:()=>$("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:C,disableFileUpload:x==="Edit Attachment",title:x,readOnly:x==="View Attachment",showCloseBtn:m}),oe=b.jsx(See,{alert:I,setAlert:N}),fe=x==="Add Citation"||x==="Edit Citation"||x==="View Citation",me=x==="Add Attachment"||x==="Edit Attachment"||x==="View Attachment";if(m){let G=null;return!m||x==="Insert Citation/Attachment(s)"?G=K:fe?G=U:me&&(G=Y),b.jsxs(H.Box,{width:"500px",children:[oe,b.jsx(H.Box,{paddingTop:"8px",children:G})]})}return b.jsxs(H.Box,{width:"100%",children:[x==="Insert Citation/Attachment(s)"&&oe,b.jsx(H.Box,{paddingTop:"8px",children:K}),b.jsx(Lu,{open:fe||me,children:b.jsxs(H.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[oe,fe?U:Y]})})]})}function pI({...t}){return b.jsx(fI,{renderAsSelectablePopup:!0,...t})}const Cee=H.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function Tee({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,canLaunchUrl:a,readOnly:l,...u}){const f=wt();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,y=p.selectedIds,v=p.selectedNodePos,g=T=>{f&&(T.length===0?f.commands.deleteCitation(v):y.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},v))},x=T=>{g(T),f==null||f.commands.closeCitationBubbleMenu()},S=()=>{g(y),f==null||f.commands.closeCitationBubbleMenu()},k=Z.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?b.jsx(yy,{editor:f,open:m,...p.bubbleMenuOptions,...u,children:b.jsx(Cee,{children:b.jsx(pI,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:x,onCancel:S,initialSelectedIds:y,onContentChange:k,canLaunchUrl:a,readOnly:l})})}):null}const kee=()=>ln.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function Eee(t){const e=wt(),n=Z.useRef(null);return b.jsx(St,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(BU,{fontSize:"small"}),b.jsx(H.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const hI=Z.createContext(void 0),mI=()=>{const t=Z.useContext(hI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Oee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=mI(),[u,f]=Z.useState(s?String(s):""),[p,m]=Z.useState([]),y=r.options.citationMaxLength;if(Z.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),g=v.map(S=>El.truncate(S.title,{length:y,omission:"..."})).join(", ");f(g),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return b.jsx(kb,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(H.Tooltip,{title:b.jsx(H.Box,{className:"citation-tooltip",children:p.map((v,g)=>{var S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return b.jsxs(H.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&b.jsx(H.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:b.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Mee=tn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",xt(t)]},addNodeView(){return Eb(Oee)},addProseMirrorPlugins(){return[new en({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),gI=t=>b.jsx(dM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),_ee=t=>{const{name:e,label:n=Ln(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:y,onViewAttachment:v,onError:g=()=>{},placeholder:x="Start typing here...",notApplicableName:S,errorMode:k="normal",canLaunchUrl:T}=t,C=[NT,D2.configure({placeholder:x}),kee(),Mee.configure({citationMaxLength:a})],[O,I,N]=jt.useField({name:e}),{setValue:$}=N,{value:V}=O,{addUpdateCitation:M,deleteCitation:F,batchUpdate:z,citations:B}=mI();Z.useEffect(()=>{var me;const oe=(me=P==null?void 0:P.current)==null?void 0:me.editor;if(!oe)return;oe.getHTML()!==V&&setTimeout(()=>{oe.commands.setContent(V)},0)},[V]);const P=Z.useRef(null),_={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},A=(oe=void 0)=>{var G,te;const fe=((te=(G=P.current)==null?void 0:G.editor)==null?void 0:te.getHTML())??"",me=!fe.replace(/<\/?p>|<br>/g,"").trim();$(me?"":fe,oe)},R=Z.useMemo(()=>El.debounce(()=>A(!1),500),[$]),j=zs(),{showDiff:K,getPreviousValue:U}=Vs(),Y=i??j;if(K){const oe=U(e)??"",fe=V,me=/<citation\s+ids="([^"]*)"><\/citation>/g,G=(re,ie)=>{const de=ie.split(",").map(Number);return`<sup>${B.filter(ye=>de.includes(ye.id)).map(ye=>ye.title)}</sup>`},te=oe.replace(me,G),ue=fe.replace(me,G);return b.jsx(ha,{label:n,value:ue,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(H.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:Y?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},..._[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(H.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&b.jsx(gI,{name:S})]}),b.jsx(tM,{ref:P,extensions:C,content:V,editable:!Y,renderControls:Y?void 0:()=>b.jsx(rb,{children:b.jsx(Eee,{})}),onBlur:()=>A(),onUpdate:R,RichTextFieldProps:{variant:Y?"standard":"outlined",MenuBarProps:{hide:Y}},children:()=>b.jsx(Tee,{getCitationsPaginated:oe=>l(oe).then(fe=>(z(fe.data),fe)),onCreateCitation:u&&(oe=>u(oe).then(fe=>(M(fe),fe))),onUpdateCitation:f&&(oe=>f(oe).then(fe=>(M(fe),fe))),onDeleteCitation:p&&(oe=>p(oe).then(()=>F(oe))),getCitationById:m,onDownloadAttachment:y,onViewAttachment:v,onError:g,canLaunchUrl:T,readOnly:Y})}),b.jsx(br,{name:e,id:`${e}-err`,errorMode:k})]})},Iee=t=>{const{name:e="submit"}=t;return b.jsx(co,{name:e,type:"submit",...t})},Aee=t=>{const{label:e="Return to Top",icon:n=up,scrollThresholdPx:r=100}=t,o=H.useScrollTrigger({threshold:r}),i=Z.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(H.Zoom,{in:o,children:b.jsx(H.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(H.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},yI=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=vo.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(H.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(H.MenuItem,{...Zl(p,o),children:[p.icon&&b.jsx(H.ListItemIcon,{children:p.icon}),b.jsx(H.ListItemText,{primary:p.label})]},p.label))})]})},Dee=()=>{const{values:t,errors:e,status:n}=jt.useFormikContext(),{palette:r}=H.useTheme();return b.jsx(H.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(H.List,{children:[b.jsxs(H.ListItem,{children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(H.Divider,{variant:"inset",component:"li"}),b.jsxs(H.ListItem,{id:"testing",children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(H.ListItem,{children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Pee=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=R2();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...cr({...t},l)};return b.jsx(H.Stepper,{...u,children:e.map(f=>b.jsx(H.Step,{children:b.jsx(H.StepLabel,{children:f})},f))})},Nee=t=>{const{name:e,label:n=Ln(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx(LM,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=jt.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(H.FormControl,{fullWidth:!0,children:[b.jsx(H.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(H.Typography,{children:y}):b.jsx(jt.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(Z.Fragment,{children:b.jsx($ee,{variant:l,content:b.jsxs(H.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?k(g):{...g},children:[b.jsxs(H.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&b.jsx(H.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(H.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(H.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},$ee=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(H.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(H.CardContent,{children:e})});case"elevatedCard":return b.jsx(H.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(H.CardContent,{children:e})});case"none":return e}},Lee=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Lu,{actions:[b.jsx(H.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Bee=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Lu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Fee=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(Lu,{actions:[b.jsx(H.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(H.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Ree={added:{icon:$U,label:"Added",color:"success"},deleted:{icon:LM,label:"Deleted",color:"error"},modified:{icon:FU,label:"Modified",color:"info"}},bI=t=>{const{beforeData:e,afterData:n,columns:r}=t,[o,i]=Z.useState([]),[s,a]=Z.useState(0),l=r.map(f=>({...f,render:(p,m,y)=>{var v;if(m.changeType==="modified"&&m.before&&!f.ignoreDiff){const g=iv(f,m.before),x=sv(f,p,m,y);if(!(((v=f.isEqual)==null?void 0:v.call(f,m.before,m))??JSON.stringify(g)===JSON.stringify(x)))return b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:ap},children:b.jsx("s",{children:g})}),b.jsx(H.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:sp},children:b.jsx("u",{children:x})})]})}return sv(f,p,m,y)}}));Z.useMemo(()=>{const f=[];e.sort((v,g)=>v.id-g.id),n.sort((v,g)=>v.id-g.id);let p=0,m=0,y=0;for(;p<e.length&&m<n.length;){const v=e[p],g=n[m];v.id===g.id?(JSON.stringify(v)!==JSON.stringify(g)?f.push({...g,changeType:"modified",before:v}):y++,p++,m++):v.id<g.id?(f.push({...v,changeType:"deleted"}),p++):(f.push({...g,changeType:"added"}),m++)}for(;p<e.length;)f.push({...e[p],changeType:"added"}),p++;for(;m<n.length;)f.push({...n[m],changeType:"added"}),m++;i(f),a(y)},[e,n]);const u=t.renderExpand?{renderExpand:f=>{if(f.changeType==="modified"){const p=e.find(m=>m.id===f.id);return b.jsx(dw,{previousSnapshot:p,children:t.renderExpand(f)})}else return b.jsx(cw,{children:t.renderExpand(f)})}}:{};return b.jsxs(b.Fragment,{children:[b.jsx(ov,{columns:[{fieldName:"changeType",render:f=>{const p=Ree[f];return b.jsx(H.Chip,{color:p.color,label:b.jsxs(H.Typography,{children:[b.jsx(zm,{icon:p.icon}),p.label]})})}},...l],data:o,...u}),s>0&&b.jsx(H.Box,{children:b.jsxs(H.Typography,{fontStyle:"italic",children:["+",s," unmodified rows"]})})]})},zee=t=>{const{beforeCitations:e,afterCitations:n}=t,{palette:r}=H.useTheme(),o=z2(r);return b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:b.jsx(H.Typography,{variant:"h2",children:"Attachments & Citations"})}),b.jsx(bI,{columns:o,beforeData:e,afterData:n})]})},Vee=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=H.useTheme(),a=vo.useNavigate();return b.jsxs(H.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(H.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(H.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(H.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(H.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Zl(l,a),children:l.label},l.label))}),n&&b.jsx(H.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},vI=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=vo.useLocation(),i=vo.useNavigate(),[s,a]=Z.useState(!1),l=(m,y)=>b.jsx(H.MenuList,{children:m.map(v=>b.jsxs(H.MenuItem,{...Zl(v,i,()=>a(!1)),children:[v.icon&&b.jsx(H.ListItemIcon,{children:v.icon}),b.jsx(H.ListItemText,{primary:v.label})]},`mobile-drawer-group-${y}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,v)=>b.jsxs(Z.Fragment,{children:[l(y,v),v<m.length-1&&b.jsx(H.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(H.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return Z.useEffect(()=>{a(!1)},[o]),p&&b.jsxs(b.Fragment,{children:[b.jsx(H.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(UU,{})}),b.jsx(H.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(H.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(H.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},xI=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(H.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(H.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},wI=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(yI,{label:e,menuOptions:n,icon:b.jsx(KU,{})})},Eh=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=H.useTheme(),a=vo.useNavigate();return b.jsx(H.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(H.Tab,{icon:l.icon,label:l.label,value:u,...Zl(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},SI=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(H.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(Eh,{menuOptions:e,activeTabIdx:n,sx:r})})},CI=t=>{const{onToggle:e}=t,{palette:n}=H.useTheme(),r=n.mode==="dark";return b.jsx(H.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx($M,{}):b.jsx(PM,{})})},Hee=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:y}=t,v=vo.useNavigate(),g=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),{palette:x}=H.useTheme(),{pathname:S}=vo.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const N=o.findIndex($=>$.path&&S.startsWith($.path));C(N>=0?N:void 0)},[S,o]);const O=s&&b.jsx(CI,{onToggle:s}),I=s&&(g||!g&&l)?[{icon:k?b.jsx($M,{}):b.jsx(PM,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(H.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(xI,{...e}),u,b.jsxs(H.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(H.Button,{disableRipple:!0,component:vo.Link,to:"/",children:r&&typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),b.jsxs(H.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&b.jsx(vI,{menuOptionLists:[o,a,I],anchor:"right"}),!g&&b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,$)=>b.jsxs(H.Box,{display:"flex",alignItems:"center",children:[$>0&&b.jsx(H.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(H.Button,{variant:"text",sx:{color:"white"},...Zl(N,v),children:b.jsxs(H.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&b.jsx(wI,{displayName:l,userMenuOptions:I})]})]})]}),!g&&b.jsx(SI,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Wee=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=vo.useLocation(),o=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),[i,s]=Z.useState(void 0);return Z.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&b.jsx(H.Box,{sx:e,children:b.jsx(H.Card,{sx:{height:"100%",width:200},children:b.jsx(Eh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},jee=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=H.useTheme();return e.length>0&&b.jsx(Eh,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},Uee=t=>{const{gap:e=1,...n}=t;return b.jsx(H.Box,{display:"flex",flexDirection:"column",gap:e,...n})},qee=({children:t,getCitations:e})=>{const[n,r]=Z.useState([]),[o,i]=Z.useState(!1);Z.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=Z.useCallback(u=>{r(f=>{const p=f.map(v=>{const g=u.find(x=>x.id===v.id);return g||v}),m=new Set(f.map(v=>v.id)),y=u.filter(v=>!m.has(v.id));return[...p,...y]})},[]),a=Z.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=Z.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return b.jsx(hI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Kee=t=>b.jsx(Bu,{severity:"info",...t}),Yee=t=>b.jsx(Bu,{severity:"warning",...t}),TI=t=>{const{crumbInfo:e}=t,n=vo.useNavigate();return b.jsx(H.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(qU,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(H.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(H.Typography,{color:"primary",children:r},r))})},Gee=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Jee(r);return b.jsx(H.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(Bu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:kI(r),warning:kI(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(H.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Jee=t=>t=="logout"?"info":t=="timeout"?"warning":t,kI=t=>{if(t=="timeout")return b.jsx(NU,{});if(t=="logout")return b.jsx(jU,{})},Xee=t=>{Zee(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=H.useMediaQuery(H.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(H.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(TI,{crumbInfo:i}),b.jsxs(H.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(H.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(H.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(co,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(LU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(H.Box,{width:u?"100%":"50%",children:s})]})]})},Zee=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},Qee=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=H.useMediaQuery(H.useTheme().breakpoints.down("sm"));return b.jsxs(H.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(H.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),b.jsx(H.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(H.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function ete({...t}){return b.jsx(fI,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const tte=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return b.jsx(H.Box,{height:n})};De.AlertModal=Bee,De.Autocomplete=cM,De.Breadcrumbs=TI,De.Button=co,De.Checkbox=dM,De.CheckboxGroup=oU,De.CitationField=_ee,De.CitationFieldProvider=qee,De.CitationManager=ete,De.Column=Uee,De.ConfirmationModal=Lee,De.DarkModeToggle=CI,De.DateField=Vp,De.DateRangeField=_Z,De.DecisionModal=Fee,De.Diff=aM,De.DiffCitationTable=zee,De.DiffProvider=dw,De.DiffTable=bI,De.Drawer=vI,De.DynamicAutocomplete=nU,De.EnvironmentBanner=xI,De.ErrorAlert=uI,De.FileList=aU,De.FileUpload=pM,De.FloatingNavBar=jee,De.Footer=Vee,De.FormDebugger=Dee,De.Header=Hee,De.InfoAlert=Kee,De.LoadingButton=av,De.LoadingIndicator=rv,De.Location=_U,De.MenuButton=yI,De.Modal=Lu,De.MultiAutocomplete=rU,De.NavBar=SI,De.NotApplicableCheckbox=gI,De.PageHeader=Xee,De.PaginatedTable=B2,De.ProfileMenu=wI,De.RadioGroup=DM,De.RangeSlider=IU,De.ReadOnly=ha,De.ReadOnlyProvider=cw,De.RepeatableFormGroup=Nee,De.RichTextField=TQ,De.Row=sI,De.ScrollToTop=Aee,De.SearchField=ZU,De.Select=AU,De.SelectableCitationManager=pI,De.Sidebar=Wee,De.SingleActionCard=Qee,De.Snackbar=Gee,De.Spacer=tte,De.Stepper=Pee,De.Submit=Iee,De.SuccessAlert=dI,De.Switch=DU,De.Table=ov,De.Tabs=Eh,De.TextArea=PU,De.TextField=gs,De.TextIcon=zm,De.ValidationError=br,De.WarningAlert=Yee,De.commonTheme=Mn,De.darkTheme=OP,De.lightTheme=EP,De.useDiff=Vs,De.useReadOnly=zs,Object.defineProperty(De,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simoncomputing/mui-bueno-v2",
3
3
  "private": false,
4
- "version": "0.25.5",
4
+ "version": "0.25.6",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",