@simoncomputing/mui-bueno-v2 0.19.17 → 0.19.18

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.19.18] - 2025-11-24
15
+
16
+ ### Changed
17
+
18
+ - `CitationField`, `CitationManager`, `SelectableCitationManager`
19
+ - Order of actions on citation table changed -- `addlActions` will be last (farthest right)
20
+
14
21
  ## [0.19.17] - 2025-11-21
15
22
 
16
23
  ### Changed
package/dist/index.cjs.js CHANGED
@@ -396,7 +396,7 @@ img.ProseMirror-separator {
396
396
  `,$de="️",Bde="‍",A0="";let zd=null,Hd=null;function Vde(t=[]){const e={};dr.groups=e;const n=new dr;zd==null&&(zd=n2(Dde)),Hd==null&&(Hd=n2(Pde)),Oe(n,"'",P1),Oe(n,"{",wc),Oe(n,"}",Tc),Oe(n,"[",Kf),Oe(n,"]",Yf),Oe(n,"(",Gf),Oe(n,")",Jf),Oe(n,"<",Zf),Oe(n,">",Xf),Oe(n,"(",Qf),Oe(n,")",ep),Oe(n,"「",tp),Oe(n,"」",np),Oe(n,"『",rp),Oe(n,"』",op),Oe(n,"<",ip),Oe(n,">",sp),Oe(n,"&",ap),Oe(n,"*",lp),Oe(n,"@",Ii),Oe(n,"`",up),Oe(n,"^",dp),Oe(n,":",Ni),Oe(n,",",N1),Oe(n,"$",fp),Oe(n,".",wo),Oe(n,"=",pp),Oe(n,"!",j1),Oe(n,"-",Br),Oe(n,"%",_c),Oe(n,"|",hp),Oe(n,"+",mp),Oe(n,"#",gp),Oe(n,"?",kc),Oe(n,'"',L1),Oe(n,"/",To),Oe(n,";",F1),Oe(n,"~",Ec),Oe(n,"_",yp),Oe(n,"\\",cp),Oe(n,"・",JN);const r=on(n,Qo,I1,{[Dv]:!0});on(r,Qo,r);const o=on(r,Xo,YN,{[Cc]:!0}),i=on(r,Gl,GN,{[ac]:!0}),s=on(n,Xo,ni,{[Pv]:!0});on(s,Qo,o),on(s,Xo,s),on(o,Qo,o),on(o,Xo,o);const a=on(n,Gl,Lv,{[Nv]:!0});on(a,Xo),on(a,Qo,i),on(a,Gl,a),on(i,Qo,i),on(i,Xo),on(i,Gl,i);const l=Oe(n,R0,D1,{[E0]:!0}),u=Oe(n,t2,Bv,{[E0]:!0}),f=on(n,O0,Bv,{[E0]:!0});Oe(n,A0,f),Oe(u,R0,l),Oe(u,A0,f),on(u,O0,f),Oe(f,t2),Oe(f,R0),on(f,O0,f),Oe(f,A0,f);const p=on(n,M0,ZN,{[KN]:!0});Oe(p,"#"),on(p,M0,p),Oe(p,$de,p);const m=Oe(p,Bde);Oe(m,"#"),on(m,M0,p);const g=[[Xo,s],[Qo,o]],y=[[Xo,null],[Gl,a],[Qo,i]];for(let b=0;b<zd.length;b++)Ei(n,zd[b],Fv,ni,g);for(let b=0;b<Hd.length;b++)Ei(n,Hd[b],$v,Lv,y);Is(Fv,{tld:!0,ascii:!0},e),Is($v,{utld:!0,alpha:!0},e),Ei(n,"file",hf,ni,g),Ei(n,"mailto",hf,ni,g),Ei(n,"http",Fa,ni,g),Ei(n,"https",Fa,ni,g),Ei(n,"ftp",Fa,ni,g),Ei(n,"ftps",Fa,ni,g),Is(hf,{scheme:!0,ascii:!0},e),Is(Fa,{slashscheme:!0,ascii:!0},e),t=t.sort((b,S)=>b[0]>S[0]?1:-1);for(let b=0;b<t.length;b++){const S=t[b][0],T=t[b][1]?{[Nde]:!0}:{[jde]:!0};S.indexOf("-")>=0?T[jv]=!0:Xo.test(S)?Qo.test(S)?T[Cc]=!0:T[Pv]=!0:T[Dv]=!0,e2(n,S,S,T)}return e2(n,"localhost",Zc,{ascii:!0}),n.jd=new dr(bp),{start:n,tokens:fl({groups:e},XN)}}function QN(t,e){const n=zde(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 zde(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 Ei(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 dr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new dr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function n2(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 Xc={defaultProtocol:"http",events:null,format:r2,formatHref:r2,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function $1(t,e=null){let n=fl({},Xc);t&&(n=fl(n,t instanceof $1?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}$1.prototype={o:Xc,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]:Xc[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 r2(t){return t}function ej(t,e){this.t="token",this.v=t,this.tk=e}ej.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=Xc.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&&fl(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function wh(t,e){class n extends ej{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 o2=wh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),i2=wh("text"),Hde=wh("nl"),Wd=wh("url",{isLink:!0,toHref(t=Xc.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Zc&&t[1].t===Ni}}),$r=t=>new dr(t);function Wde({groups:t}){const e=t.domain.concat([ap,lp,Ii,cp,up,dp,fp,pp,Br,I1,_c,hp,mp,gp,To,bp,Ec,yp]),n=[Ni,N1,wo,j1,_c,kc,L1,F1,Zf,Xf,wc,Tc,Yf,Kf,Gf,Jf,Qf,ep,tp,np,rp,op,ip,sp],r=[ap,P1,lp,cp,up,dp,fp,pp,Br,wc,Tc,_c,hp,mp,gp,kc,To,bp,Ec,yp],o=$r(),i=Oe(o,Ec);lt(i,r,i),lt(i,t.domain,i);const s=$r(),a=$r(),l=$r();lt(o,t.domain,s),lt(o,t.scheme,a),lt(o,t.slashscheme,l),lt(s,r,i),lt(s,t.domain,s);const u=Oe(s,Ii);Oe(i,Ii,u),Oe(a,Ii,u),Oe(l,Ii,u);const f=Oe(i,wo);lt(f,r,i),lt(f,t.domain,i);const p=$r();lt(u,t.domain,p),lt(p,t.domain,p);const m=Oe(p,wo);lt(m,t.domain,p);const g=$r(o2);lt(m,t.tld,g),lt(m,t.utld,g),Oe(u,Zc,g);const y=Oe(p,Br);Oe(y,Br,y),lt(y,t.domain,p),lt(g,t.domain,p),Oe(g,wo,m),Oe(g,Br,y);const b=Oe(g,Ni);lt(b,t.numeric,o2);const S=Oe(s,Br),C=Oe(s,wo);Oe(S,Br,S),lt(S,t.domain,s),lt(C,r,i),lt(C,t.domain,s);const T=$r(Wd);lt(C,t.tld,T),lt(C,t.utld,T),lt(T,t.domain,s),lt(T,r,i),Oe(T,wo,C),Oe(T,Br,S),Oe(T,Ii,u);const _=Oe(T,Ni),w=$r(Wd);lt(_,t.numeric,w);const E=$r(Wd),O=$r();lt(E,e,E),lt(E,n,O),lt(O,e,E),lt(O,n,O),Oe(T,To,E),Oe(w,To,E);const j=Oe(a,Ni),P=Oe(l,Ni),L=Oe(P,To),M=Oe(L,To);lt(a,t.domain,s),Oe(a,wo,C),Oe(a,Br,S),lt(l,t.domain,s),Oe(l,wo,C),Oe(l,Br,S),lt(j,t.domain,E),Oe(j,To,E),Oe(j,kc,E),lt(M,t.domain,E),lt(M,e,E),Oe(M,To,E);const R=[[wc,Tc],[Kf,Yf],[Gf,Jf],[Zf,Xf],[Qf,ep],[tp,np],[rp,op],[ip,sp]];for(let z=0;z<R.length;z++){const[B,$]=R[z],F=Oe(E,B);Oe(O,B,F),Oe(F,$,E);const N=$r(Wd);lt(F,e,N);const W=$r();lt(F,n),lt(N,e,N),lt(N,n,W),lt(W,e,N),lt(W,n,W),Oe(N,$,E),Oe(W,$,E)}return Oe(o,Zc,T),Oe(o,D1,Hde),{start:o,tokens:XN}}function qde(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(I0(i2,e,s)),s=[]),o-=m,f-=m;const g=p.t,y=n.slice(o-f,o);i.push(I0(g,e,y))}}return s.length>0&&i.push(I0(i2,e,s)),i}function I0(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 Ude=typeof console<"u"&&console&&console.warn||(()=>{}),Kde="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 Yde(){return dr.groups={},Wt.scanner=null,Wt.parser=null,Wt.tokenQueue=[],Wt.pluginQueue=[],Wt.customSchemes=[],Wt.initialized=!1,Wt}function s2(t,e=!1){if(Wt.initialized&&Ude(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Kde}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
397
397
  1. Must only contain digits, lowercase ASCII letters or "-"
398
398
  2. Cannot start or end with "-"
399
- 3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Gde(){Wt.scanner=Vde(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Wde(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 B1(t){return Wt.initialized||Gde(),qde(Wt.parser.start,t,QN(Wt.scanner.start,t))}B1.scan=QN;function tj(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 $1(n),o=B1(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}function Jde(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Zde(t){return new tn({key:new yn("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=toe(n.doc,[...e]);if(aoe(a).forEach(({newRange:u})=>{const f=roe(r.doc,u,g=>g.isTextblock);let p,m;if(f.length>1?(p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")),p&&m){const g=m.split(" ").filter(C=>C!=="");if(g.length<=0)return!1;const y=g[g.length-1],b=p.pos+m.lastIndexOf(y);if(!y)return!1;const S=B1(y).map(C=>C.toObject(t.defaultProtocol));if(!Jde(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:b+C.start+1,to:b+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{o1(C.from,C.to,r.doc).some(T=>T.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function Xde(t){return new tn({key:new yn("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=r1(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 Qde(t){return new tn({key:new yn("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=tj(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const efe=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Ss(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(efe,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const tfe=gr.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"){s2(t);return}s2(t.scheme,t.optionalSlashes)})},onDestroy(){Yde()},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)=>!!Ss(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=>!!Ss(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=>!!Ss(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ss(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=>!!Ss(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[Ji({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=tj(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ss(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(Zde({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ss(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Xde({type:this.type})),this.options.linkOnPaste&&t.push(Qde({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),nj=en.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",bt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function nfe(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Voe(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,g=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const b=a.pos-y.length,S=Array.from(y.matchAll(g)).pop();if(!S||S.input===void 0||S.index===void 0)return null;const C=S.input.slice(Math.max(0,S.index-1),S.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!T)return null;const _=b+S.index;let w=_+S[0].length;return l&&f.test(y.slice(w-1,w+1))&&(S[0]+=" ",w+=1),_<a.pos&&w>=a.pos?{range:{from:_,to:w},query:S[0].slice(n.length),text:S[0]}:null}const rfe=new yn("suggestion");function ofe({pluginKey:t=rfe,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=nfe}){let y;const b=p==null?void 0:p(),S=new tn({key:t,view(){return{update:async(C,T)=>{var _,w,E,O,j,P,L;const M=(_=this.key)===null||_===void 0?void 0:_.getState(T),R=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),z=M.active&&R.active&&M.range.from!==R.range.from,B=!M.active&&R.active,$=M.active&&!R.active,F=!B&&!$&&M.query!==R.query,N=B||z&&F,W=F||z,q=$||z&&F;if(!N&&!W&&!q)return;const K=q&&!N?M:R,U=C.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);y={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:X=>u({editor:e,range:K.range,props:X}),decorationNode:U,clientRect:U?()=>{var X;const{decorationId:pe}=(X=this.key)===null||X===void 0?void 0:X.getState(e.state),he=C.dom.querySelector(`[data-decoration-id="${pe}"]`);return(he==null?void 0:he.getBoundingClientRect())||null}:null},N&&((E=b==null?void 0:b.onBeforeStart)===null||E===void 0||E.call(b,y)),W&&((O=b==null?void 0:b.onBeforeUpdate)===null||O===void 0||O.call(b,y)),(W||N)&&(y.items=await f({editor:e,query:K.query})),q&&((j=b==null?void 0:b.onExit)===null||j===void 0||j.call(b,y)),W&&((P=b==null?void 0:b.onUpdate)===null||P===void 0||P.call(b,y)),N&&((L=b==null?void 0:b.onStart)===null||L===void 0||L.call(b,y))},destroy:()=>{var C;y&&((C=b==null?void 0:b.onExit)===null||C===void 0||C.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,T,_,w){const{isEditable:E}=e,{composing:O}=e.view,{selection:j}=C,{empty:P,from:L}=j,M={...T};if(M.composing=O,E&&(P||e.view.composing)){(L<T.range.from||L>T.range.to)&&!O&&!T.composing&&(M.active=!1);const R=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:j.$from}),z=`id_${Math.floor(Math.random()*4294967295)}`;R&&m({editor:e,state:w,range:R.range,isActive:T.active})?(M.active=!0,M.decorationId=T.decorationId?T.decorationId:z,M.range=R.range,M.query=R.query,M.text=R.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,T){var _;const{active:w,range:E}=S.getState(C.state);return w&&((_=b==null?void 0:b.onKeyDown)===null||_===void 0?void 0:_.call(b,{view:C,event:T,range:E}))||!1},decorations(C){const{active:T,range:_,decorationId:w}=S.getState(C);return T?Xt.create(C.doc,[Fn.inline(_.from,_.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const ife=new yn("mention"),sfe=en.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",bt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:ife,command:({editor:t,range:e,props:n})=>{var r,o,i;const s=t.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(o=t.view.dom.ownerDocument.defaultView)===null||o===void 0?void 0:o.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},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}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=bt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[ofe({editor:this.editor,...this.options.suggestion})]}}),afe="listItem",a2="textStyle",l2=/^(\d+)\.\s$/,rj=en.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(afe,this.editor.getAttributes(a2)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ul({find:l2,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ul({find:l2,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(a2)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),oj=en.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ij=un.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new tn({key:new yn("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&&dh(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Fn.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)}}})]}}),lfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,cfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sj=gr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Gs({find:lfe,type:this.type})]},addPasteRules(){return[Ji({find:cfe,type:this.type})]}}),ufe=gr.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",bt(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()}}}),dfe=gr.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),ffe=en.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",bt(this.options.HTMLAttributes,t),0]}}),pfe=en.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",bt(this.options.HTMLAttributes,t),0]}}),hfe=en.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}}),mfe=/^\s*(\[([( |x])?\])\s$/,gfe=en.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},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",bt(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");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[ul({find:mfe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),yfe=en.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",bt(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()}}}),aj=en.create({name:"text",group:"inline"}),bfe=un.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)}},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")}}}),vfe=gr.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),lj=J.forwardRef((t,e)=>{const[n,r]=J.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 J.useEffect(()=>r(0),[t.items]),J.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?v.jsx(D.Paper,{elevation:5,children:v.jsx(D.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(D.ListItem,{disablePadding:!0,children:v.jsx(D.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});lj.displayName="SuggestionList";const c2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},xfe={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 KP(lj,{props:n,editor:n.editor}),e=xu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??c2},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))??c2}})},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}}}},Sfe=tfe.extend({inclusive:!1}),Cfe=ufe.extend({excludes:"superscript"}),wfe=dfe.extend({excludes:"subscript"});function Tfe({placeholder:t}={}){return J.useMemo(()=>[Uue.configure({resizable:!0}),hfe,pfe,ffe,DN,NN,jN,$N,nj,rj,oj,Cfe,wfe,aj,IN,AN,PN,UN,vfe,sj,Sfe.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Bse,FN,Lce,bfe.configure({types:["heading","paragraph","image"]}),ide,sde,cde,Nce,vde.configure({multicolor:!0}),qN,Wce,LN,yfe,gfe.configure({nested:!0}),sfe.configure({suggestion:xfe}),ij.configure({placeholder:t}),WN],[t])}function u2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const _fe=t=>{const e=Tfe({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(ple,{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]=qt.useField({name:n}),{setValue:f}=u,{value:p}=a;J.useEffect(()=>{var C,T,_;(_=(T=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:T.commands)==null||_.setContent(p)},[p]);const m=J.useRef(null),g=J.useCallback((C,T)=>{var w;const _=(w=m.current)==null?void 0:w.editor;if(!(!_||!i))if(i instanceof Promise)i(C).then(E=>{kv({images:E,editor:_,position:T})});else{const E=i(C);kv({images:E,editor:_,position:T})}},[]),y=J.useCallback((C,T,_,w)=>{var O;if(!(T instanceof DragEvent)||!T.dataTransfer)return!1;const E=u2(T.dataTransfer.files);if(E.length>0){const j=(O=C.posAtCoords({left:T.clientX,top:T.clientY}))==null?void 0:O.pos;return g(E,j),T.preventDefault(),!0}return!1},[g]),b=J.useCallback((C,T,_)=>{if(!T.clipboardData)return!1;const w=u2(T.clipboardData.files);return w.length>0?(g(w),!0):!1},[g]),S=v.jsx(D.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(QP,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:y,handlePaste:b},renderControls:s?void 0:()=>v.jsx(Kue,{onUploadFiles:i}),onBlur:()=>{var C,T;return f(((T=(C=m.current)==null?void 0:C.editor)==null?void 0:T.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(AP,{}),v.jsx(eN,{})]})})});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(D.Typography,{...o,children:r}),S]})},Vv=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(D.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(D.Box,{className:"text-content",children:[v.jsx(D.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(D.Typography,{"data-testid":"message",children:n})]}),v.jsx(D.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},d2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?v.jsx(D.Collapse,{in:n,children:u}):v.jsx(D.TableRow,{sx:p,children:v.jsx(D.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(D.Collapse,{in:n,children:u})})})},cj=t=>{const{id:e,getRowKey:n=G=>"id"in G&&(typeof G.id=="string"||typeof G.id=="number")?G.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(G)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(G)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:m=!1,className:g,emptyTableMsg:y="No items to display",errorTableMsg:b,retryCallback:S,isLoading:C=!1,disableMobileCards:T=!1,highlightSelectedRow:_=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,tooltipColor:j,...P}=t,{palette:L}=D.useTheme(),[M,R]=J.useState(void 0),[z,B]=J.useState(void 0);Array.isArray(m)&&(!s&&m.length!==r.length&&console.warn('Table component: Length of "fixedLayout" is not equal to the length of "columns".'),s&&m.length!==r.length+1&&console.warn(`Table component: 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".`)),s&&i&&console.warn("Table component: renderExpand & onRowClick are both defined. Only one should be defined at a time.");const $=G=>{G!==l?f&&f(G,"asc"):f&&f(l,u==="asc"?"desc":"asc")},F=G=>l===G?u:null,N=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),W=N&&a?r.filter(G=>!(a.includes(G.fieldName)||G.hideCol)):r.filter(G=>!G.hideCol);s&&!N&&W.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:G=>{const Q=M===G;return v.jsx(D.IconButton,{"data-testid":"expand-collapse-btn","aria-label":Q?"collapse row":"expand row",size:"small",onClick:()=>ae(G),children:Q?v.jsx(Jd,{"data-testid":"collapse-up"}):v.jsx(ag,{"data-testid":"expand-down"})})}});const q=(G,Q)=>Q.split(".").reduce((fe,Se)=>{if(fe&&typeof fe=="object")return fe[Se]},G),K=(G,Q)=>{const fe=q(Q,G.fieldName);return G.render?G.render(fe,Q,N):fe},U=f!==void 0,X=G=>U?p?p.includes(G):!0:!1,pe=v.jsxs(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(h8,{})," ",y]}),he=v.jsxs(D.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(IR,{color:"error"})," ",b,S&&v.jsx(D.Button,{variant:"text",onClick:S,children:"Retry?"})]}),me=()=>{if(C)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:v.jsx(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(Vv,{})})})});if(b)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:pe})})},Z=()=>{if(C)return v.jsx(Vv,{});if(b)return he;if(o.length===0)return pe},ue=G=>{_&&B(G)},de=G=>{i&&(i(G),ue(G))},ae=G=>{const Q=M===G?void 0:G;R(Q),ue(Q)},oe=G=>{if(!s)return;const Q=M===n(G);return v.jsxs(v.Fragment,{children:[v.jsxs(D.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>ae(n(G)),children:[Q?v.jsx(Jd,{}):v.jsx(ag,{})," Show"," ",Q?"Less":"More"]}),v.jsx(d2,{colSpan:r.length,isExpanded:n(G)===M,obj:G,renderExpand:fe=>s(fe),asMobileCard:!0})]})},le=typeof _=="string"?_:L.grey[L.mode=="dark"?600:50],ye=G=>{const Q=z===n(G)?le:"inherit";return{cursor:i?"pointer":"default",backgroundColor:Q,...s?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:Q===le?Xa(Q,.1):le}}}},te=L.grey[L.mode==="dark"?600:400],ie=G=>G&&v.jsx(D.Tooltip,{title:G,children:v.jsx(f8,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:j??te}})});return N&&!T?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:g,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(D.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:G=>$(G.target.value),fullWidth:!0,children:W.map(G=>{if(X(G.fieldName))return v.jsx(D.MenuItem,{value:G.sortName??G.fieldName,children:G.label??Mn(G.fieldName)},`${G.key??"rowHeader"}-${G.fieldName}`)})}),v.jsx(D.IconButton,{onClick:()=>{l&&$(l)},children:v.jsx(w8,{className:`sort-icon-${u}`})})]}),v.jsx(D.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(G=>v.jsxs(D.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(G)},onClick:()=>de(n(G)),"data-testid":`card-${n(G)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:W.map(Q=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Q.fieldName}`,style:{textWrap:"nowrap"},children:[Q.label??Mn(Q.fieldName),ie(Q.tooltip)]}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Q.fieldName}`,style:{paddingLeft:"10px"},children:K(Q,G)})]},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))})}),oe(G)]},n(G)))]}):v.jsx(D.TableContainer,{component:D.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(D.Table,{stickyHeader:E!=="undefined",style:{tableLayout:m?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...P,children:[v.jsx(D.TableHead,{className:"MBv2_Table_Head",children:v.jsx(D.TableRow,{className:"MBv2_Table_Head_Row",children:W.map((G,Q)=>{const fe=X(G.fieldName);return v.jsx(D.TableCell,{width:Array.isArray(m)?m[Q]:"auto",sx:G.tableCellSx??{},children:v.jsx(D.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(D.Box,{sx:[fe&&{"&:hover":{cursor:"pointer",backgroundColor:L.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:fe?()=>$(G.sortName??G.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:G.label??Mn(G.fieldName)}),ie(G.tooltip),fe&&F(G.fieldName)==="asc"&&v.jsx(Jd,{style:{marginLeft:"5px"}}),fe&&F(G.fieldName)==="desc"&&v.jsx(ag,{style:{marginLeft:"5px"}}),fe&&F(G.fieldName)!=="asc"&&F(G.fieldName)!=="desc"&&v.jsx(x8,{style:{marginLeft:"5px"}})]})})},`${G.key??"rowHeader"}-${G.fieldName}`)})})}),v.jsx(D.TableBody,{className:"MBv2_Table_Body",children:me()??o.map(G=>v.jsxs(J.Fragment,{children:[v.jsx(D.TableRow,{"data-testid":`row-${n(G)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(n(G)),sx:ye(G),children:W.map(Q=>v.jsx(D.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Q.fieldName}`,children:K(Q,G)},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))}),s&&v.jsx(d2,{colSpan:W.length,isExpanded:n(G)===M,obj:G,renderExpand:Q=>s(Q),reRenderExpand:O})]},n(G)))})]})})},uj=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=S=>{n(S)},g=S=>{r(parseInt(S.target.value,10))},y=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),b=!t.data||t.data&&t.data.length===0;return v.jsxs(D.Box,{children:[v.jsx(cj,{sortOrder:p,sortField:f,...s}),!o&&!b&&v.jsx(D.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:y?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>m(C),onRowsPerPageChange:g,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},f2=()=>({height:window.innerHeight,width:window.innerWidth}),dj=()=>{const[t,e]=J.useState(f2());return J.useEffect(()=>{const n=()=>{e(f2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},qr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=dj(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(D.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...er({...t},a)})},kfe=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[v.jsxs(D.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",v.jsx("br",{}),v.jsx("b",{children:e.url}),"?"]}),v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",startIcon:v.jsx(V0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Efe=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(D.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",color:"error",startIcon:v.jsx(Xv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Mfe=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:g,setSelectedIds:y,onError:b=()=>{},condenseTable:S=!1,canSelect:C=!1,canLaunchUrl:T,addlActions:_,readOnly:w=!1,showCloseBtn:E=!1}=t,O=!!t.canCreate&&!w,j=!!t.canEdit&&!w,P=!!t.canDelete&&!w,{palette:L}=D.useTheme(),[M,R]=J.useState([]),[z,B]=J.useState(!1),[$,F]=J.useState(!0),[N,W]=J.useState(null),[q,K]=J.useState(null),[U,X]=J.useState(null),[pe,he]=J.useState({pageNo:0,pageSize:S?5:10,totalCount:0}),me=()=>{B(!1),F(!0),m({pageNo:pe.pageNo,pageSize:pe.pageSize}).then(Q=>(R(Q.data),he({...pe,totalCount:Q.totalCount}),Q)).catch(Q=>{b(Q),B(!0),R([])}).finally(()=>F(!1))};J.useEffect(me,[pe.pageNo,pe.pageSize,e]);const Z=()=>{K(null),X(null),W(null)},ue=v.jsx(qr,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:o,startIcon:v.jsx(xf,{}),children:"Add Citation"}),de=v.jsx(qr,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:i,startIcon:v.jsx(xT,{}),children:"Add Attachment"}),ae=Q=>{if(!(!j&&!w)&&!(w&&!S))return v.jsx(D.Tooltip,{title:w?"View":"Edit",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>Q.fileName?a(Q):s(Q),"data-testid":`citation-table_edit-btn-${Q.id}`,children:w?v.jsx(M8,{}):v.jsx(Gq,{})})})},oe=Q=>{if(!(!P||w))return v.jsx(D.Tooltip,{title:"Delete",children:v.jsx(D.IconButton,{color:"error",onClick:fe=>{K(Q),W(fe.currentTarget)},"data-testid":`citation-table_delete-btn-${Q.id}`,children:v.jsx(Xv,{})})})},le=Q=>{if(!T)return;if(!Q.fileName)return v.jsx(D.Tooltip,{title:"Open URL",children:v.jsx(D.IconButton,{color:"primary",onClick:Se=>{W(Se.currentTarget),X(Q)},"data-testid":`citation-table_launch-link-btn-${Q.id}`,sx:{visibility:T!=null&&T(Q)?"visible":"hidden"},children:v.jsx(V0,{})})})},ye=Q=>{if(!f||!Q.fileName)return;const fe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],Se=Q.fileName.split(".").pop();if(!(!Se||!fe.includes(Se)))return v.jsx(D.Tooltip,{title:"View File",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(Q),"data-testid":`citation-table_view-file-btn-${Q.id}`,children:v.jsx(V0,{})})})},te=Q=>{if(!u)return;if(!!Q.fileName)return v.jsx(D.Tooltip,{title:"Download",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(Q),"data-testid":`citation-table_download-btn-${Q.id}`,children:v.jsx(Yq,{})})})},G=[{fieldName:"id",key:"select",label:"",hideCol:!C,render:(Q,fe)=>v.jsx(D.Checkbox,{"data-testid":`citation-table_checkbox-${Q}`,onChange:()=>{const Se=g.includes(fe.id);y(Se?g.filter(Ee=>Ee!==fe.id):[...g,fe.id])},checked:g.includes(Q),disabled:w})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(Q,fe)=>v.jsx(D.Tooltip,{title:Q?"Attachment":"URL",children:Q?v.jsx(xT,{sx:{color:L.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${fe.id}`}):v.jsx(xf,{sx:{color:L.grey[500],marginTop:"6px"},"data-testid":`url-icon-${fe.id}`})})},{fieldName:"title",tableCellSx:{width:S?"100%":"auto"},render:Q=>S?Ac.truncate(Q,{length:40,omission:"..."}):Q},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:S,render:(Q,fe)=>v.jsx("span",{style:{wordBreak:"break-all"},children:Q||fe.url})},{fieldName:"source",hideCol:S},{fieldName:"accessedAt",hideCol:S,render:(Q,fe)=>{if(!fe.fileName)return(Q==null?void 0:Q.slice(0,10))??""}},{fieldName:"classification",hideCol:S},{fieldName:"id",key:"Action",label:"Action",hideCol:!(w||j||P||T||f||u||_),render:(Q,fe)=>v.jsxs(D.Box,{display:"flex",flexDirection:"row-reverse",children:[oe(fe),ae(fe),_==null?void 0:_(fe),ye(fe),le(fe),te(fe)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(D.Typography,{variant:S?"h6":"h2",children:n}),!C&&O&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:1,children:[ue,de]}),E&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Np,{})})]}),v.jsx(uj,{"data-testid":"citation-table",size:S?"x-small":"medium",isLoading:$,columns:G,data:M,paginationState:pe,onPageChange:Q=>he({...pe,pageNo:Q}),onRowsPerPageChange:Q=>he({...pe,pageSize:Q,pageNo:0}),errorTableMsg:z?"Failed to load citations.":void 0,retryCallback:me}),C&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(D.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:O&&v.jsxs(v.Fragment,{children:[ue,de]})}),!w&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(qr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),v.jsxs(qr,{variant:"contained",size:"small",onClick:()=>p(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),v.jsx(kfe,{citation:U,anchorEl:N,onClose:Z}),v.jsx(Efe,{citation:q,anchorEl:N,onDeleteCitation:l,onClose:Z})]})},V1=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return v.jsx(qr,{type:n,disabled:e,size:r,startIcon:e?v.jsx(D.CircularProgress,{size:s,color:"inherit"}):null,...o})};var D0,p2;function Ofe(){if(p2)return D0;p2=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,T){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=T};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);D0={Cache:t,split:p,normalizePath:f,setter:function(C){var T=f(C);return l.get(C)||l.set(C,function(w,E){for(var O=0,j=T.length,P=w;O<j-1;){var L=T[O];if(L==="__proto__"||L==="constructor"||L==="prototype")return w;P=P[T[O++]]}P[T[O]]=E})},getter:function(C,T){var _=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,j=_.length;O<j;)if(E!=null||!T)E=E[_[O++]];else return;return E})},join:function(C){return C.reduce(function(T,_){return T+(g(_)||n.test(_)?"["+_+"]":(T?".":"")+_)},"")},forEach:function(C,T,_){m(Array.isArray(C)?C:p(C),T,_)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(T){return T.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,T,_){var w=C.length,E,O,j,P;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),P=g(E),j=!P&&/^\d+$/.test(E),T.call(_,E,P,j,O,C))}function g(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function y(C){return C.match(r)&&!C.match(n)}function b(C){return o.test(C)}function S(C){return!g(C)&&(y(C)||b(C))}return D0}var zs=Ofe(),P0,h2;function Rfe(){if(h2)return P0;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 P0={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(" ")},P0}var N0=Rfe(),qd={exports:{}},m2;function Afe(){if(m2)return qd.exports;m2=1,qd.exports=function(o){return t(e(o),o)},qd.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(g){if(!p.has(g[0])||!p.has(g[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(g,y,b){if(b.has(g)){var S;try{S=", node was:"+JSON.stringify(g)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(g))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(g));if(!l[y]){l[y]=!0;var C=f.get(g)||new Set;if(C=Array.from(C),y=C.length){b.add(g);do{var T=C[--y];m(T,p.get(T),b)}while(y);b.delete(g)}a[--s]=g}}}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 qd.exports}var Ife=Afe();const Dfe=or(Ife),Pfe=Object.prototype.toString,Nfe=Error.prototype.toString,jfe=RegExp.prototype.toString,Lfe=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ffe=/^Symbol\((.*)\)(.*)$/;function $fe(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function g2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return $fe(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Lfe.call(t).replace(Ffe,"Symbol($1)");const r=Pfe.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Nfe.call(t)+"]":r==="RegExp"?jfe.call(t):null}function Ui(t,e){let n=g2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=g2(this[r],e);return i!==null?i:o},2)}function fj(t){return t==null?[]:[].concat(t)}let pj,hj,mj,Bfe=/\$\{\s*(\w+)\s*\}/g;pj=Symbol.toStringTag;class y2{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[pj]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],fj(e).forEach(i=>{if(fr.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]}}hj=Symbol.hasInstance;mj=Symbol.toStringTag;class fr 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(Bfe,(o,i)=>Ui(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 y2(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[mj]="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,fr)}static[hj](e){return y2[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let _o={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 \`${Ui(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ui(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ui(n,!0)}\``+o}},ur={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"},Vfe={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"},zv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},zfe={isValue:"${path} field must be ${value}"},mf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Hfe={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"},Wfe={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: \`${Ui(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: \`${Ui(n,!0)}\``}return fr.formatError(_o.notType,t)}};Object.assign(Object.create(null),{mixed:_o,string:ur,number:Vfe,date:zv,object:mf,array:Hfe,boolean:zfe,tuple:Wfe});const z1=t=>t&&t.__isYupSchema__;class vp{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 vp(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(!z1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ud={context:"$",value:"."};class ra{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]===Ud.context,this.isValue=this.key[0]===Ud.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ud.context:this.isValue?Ud.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&zs.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}}ra.prototype.__isYupRef=!0;const Ds=t=>t==null;function Da(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:g}=t;let{parent:y,context:b,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function T(R){return ra.isRef(R)?R.getValue(n,y,b):R}function _(R={}){const z=Object.assign({value:n,originalValue:i,label:s.spec.label,path:R.path||r,spec:s.spec,disableStackTrace:R.disableStackTrace||C},p,R.params);for(const $ of Object.keys(z))z[$]=T(z[$]);const B=new fr(fr.formatError(R.message||m,z),n,z.path,R.type||u,z.disableStackTrace);return B.params=z,B}const w=S?a:l;let E={path:r,parent:y,type:u,from:o.from,createError:_,resolve:T,options:o,originalValue:i,schema:s};const O=R=>{fr.isError(R)?w(R):R?l(null):w(_())},j=R=>{fr.isError(R)?w(R):a(R)};if(g&&Ds(n))return O(!0);let L;try{var M;if(L=f.call(E,n,E),typeof((M=L)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(L).then(O,j)}}catch(R){j(R);return}O(L)}return e.OPTIONS=t,e}function qfe(t,e,n,r=n){let o,i,s;return e?(zs.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 xp extends Set{describe(){const e=[];for(const n of this.values())e.push(ra.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 xp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function za(t,e=new Map){if(z1(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]=za(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,za(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(za(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=za(o,e)}else throw Error(`Unable to clone ${t}`);return n}class jo{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 xp,this._blacklist=new xp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_o.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=za(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({value:e},n)),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ds(i))return i;let s=Ui(e),a=Ui(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
399
+ 3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Gde(){Wt.scanner=Vde(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Wde(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 B1(t){return Wt.initialized||Gde(),qde(Wt.parser.start,t,QN(Wt.scanner.start,t))}B1.scan=QN;function tj(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 $1(n),o=B1(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}function Jde(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Zde(t){return new tn({key:new yn("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=toe(n.doc,[...e]);if(aoe(a).forEach(({newRange:u})=>{const f=roe(r.doc,u,g=>g.isTextblock);let p,m;if(f.length>1?(p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")),p&&m){const g=m.split(" ").filter(C=>C!=="");if(g.length<=0)return!1;const y=g[g.length-1],b=p.pos+m.lastIndexOf(y);if(!y)return!1;const S=B1(y).map(C=>C.toObject(t.defaultProtocol));if(!Jde(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:b+C.start+1,to:b+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{o1(C.from,C.to,r.doc).some(T=>T.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function Xde(t){return new tn({key:new yn("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=r1(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 Qde(t){return new tn({key:new yn("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=tj(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const efe=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Ss(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(efe,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const tfe=gr.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"){s2(t);return}s2(t.scheme,t.optionalSlashes)})},onDestroy(){Yde()},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)=>!!Ss(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=>!!Ss(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=>!!Ss(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ss(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=>!!Ss(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[Ji({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=tj(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ss(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(Zde({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ss(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Xde({type:this.type})),this.options.linkOnPaste&&t.push(Qde({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),nj=en.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",bt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function nfe(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Voe(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,g=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const b=a.pos-y.length,S=Array.from(y.matchAll(g)).pop();if(!S||S.input===void 0||S.index===void 0)return null;const C=S.input.slice(Math.max(0,S.index-1),S.index),T=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!T)return null;const _=b+S.index;let w=_+S[0].length;return l&&f.test(y.slice(w-1,w+1))&&(S[0]+=" ",w+=1),_<a.pos&&w>=a.pos?{range:{from:_,to:w},query:S[0].slice(n.length),text:S[0]}:null}const rfe=new yn("suggestion");function ofe({pluginKey:t=rfe,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=nfe}){let y;const b=p==null?void 0:p(),S=new tn({key:t,view(){return{update:async(C,T)=>{var _,w,E,O,j,P,L;const M=(_=this.key)===null||_===void 0?void 0:_.getState(T),R=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),z=M.active&&R.active&&M.range.from!==R.range.from,B=!M.active&&R.active,$=M.active&&!R.active,F=!B&&!$&&M.query!==R.query,N=B||z&&F,W=F||z,q=$||z&&F;if(!N&&!W&&!q)return;const K=q&&!N?M:R,U=C.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);y={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:X=>u({editor:e,range:K.range,props:X}),decorationNode:U,clientRect:U?()=>{var X;const{decorationId:pe}=(X=this.key)===null||X===void 0?void 0:X.getState(e.state),he=C.dom.querySelector(`[data-decoration-id="${pe}"]`);return(he==null?void 0:he.getBoundingClientRect())||null}:null},N&&((E=b==null?void 0:b.onBeforeStart)===null||E===void 0||E.call(b,y)),W&&((O=b==null?void 0:b.onBeforeUpdate)===null||O===void 0||O.call(b,y)),(W||N)&&(y.items=await f({editor:e,query:K.query})),q&&((j=b==null?void 0:b.onExit)===null||j===void 0||j.call(b,y)),W&&((P=b==null?void 0:b.onUpdate)===null||P===void 0||P.call(b,y)),N&&((L=b==null?void 0:b.onStart)===null||L===void 0||L.call(b,y))},destroy:()=>{var C;y&&((C=b==null?void 0:b.onExit)===null||C===void 0||C.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,T,_,w){const{isEditable:E}=e,{composing:O}=e.view,{selection:j}=C,{empty:P,from:L}=j,M={...T};if(M.composing=O,E&&(P||e.view.composing)){(L<T.range.from||L>T.range.to)&&!O&&!T.composing&&(M.active=!1);const R=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:j.$from}),z=`id_${Math.floor(Math.random()*4294967295)}`;R&&m({editor:e,state:w,range:R.range,isActive:T.active})?(M.active=!0,M.decorationId=T.decorationId?T.decorationId:z,M.range=R.range,M.query=R.query,M.text=R.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,T){var _;const{active:w,range:E}=S.getState(C.state);return w&&((_=b==null?void 0:b.onKeyDown)===null||_===void 0?void 0:_.call(b,{view:C,event:T,range:E}))||!1},decorations(C){const{active:T,range:_,decorationId:w}=S.getState(C);return T?Xt.create(C.doc,[Fn.inline(_.from,_.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const ife=new yn("mention"),sfe=en.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",bt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:ife,command:({editor:t,range:e,props:n})=>{var r,o,i;const s=t.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(o=t.view.dom.ownerDocument.defaultView)===null||o===void 0?void 0:o.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},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}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=bt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[ofe({editor:this.editor,...this.options.suggestion})]}}),afe="listItem",a2="textStyle",l2=/^(\d+)\.\s$/,rj=en.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(afe,this.editor.getAttributes(a2)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ul({find:l2,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ul({find:l2,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(a2)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),oj=en.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ij=un.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new tn({key:new yn("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&&dh(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Fn.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)}}})]}}),lfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,cfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sj=gr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Gs({find:lfe,type:this.type})]},addPasteRules(){return[Ji({find:cfe,type:this.type})]}}),ufe=gr.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",bt(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()}}}),dfe=gr.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),ffe=en.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",bt(this.options.HTMLAttributes,t),0]}}),pfe=en.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",bt(this.options.HTMLAttributes,t),0]}}),hfe=en.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}}),mfe=/^\s*(\[([( |x])?\])\s$/,gfe=en.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},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",bt(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");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[ul({find:mfe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),yfe=en.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",bt(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()}}}),aj=en.create({name:"text",group:"inline"}),bfe=un.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)}},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")}}}),vfe=gr.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),lj=J.forwardRef((t,e)=>{const[n,r]=J.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 J.useEffect(()=>r(0),[t.items]),J.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?v.jsx(D.Paper,{elevation:5,children:v.jsx(D.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(D.ListItem,{disablePadding:!0,children:v.jsx(D.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});lj.displayName="SuggestionList";const c2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},xfe={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 KP(lj,{props:n,editor:n.editor}),e=xu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??c2},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))??c2}})},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}}}},Sfe=tfe.extend({inclusive:!1}),Cfe=ufe.extend({excludes:"superscript"}),wfe=dfe.extend({excludes:"subscript"});function Tfe({placeholder:t}={}){return J.useMemo(()=>[Uue.configure({resizable:!0}),hfe,pfe,ffe,DN,NN,jN,$N,nj,rj,oj,Cfe,wfe,aj,IN,AN,PN,UN,vfe,sj,Sfe.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Bse,FN,Lce,bfe.configure({types:["heading","paragraph","image"]}),ide,sde,cde,Nce,vde.configure({multicolor:!0}),qN,Wce,LN,yfe,gfe.configure({nested:!0}),sfe.configure({suggestion:xfe}),ij.configure({placeholder:t}),WN],[t])}function u2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const _fe=t=>{const e=Tfe({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(ple,{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]=qt.useField({name:n}),{setValue:f}=u,{value:p}=a;J.useEffect(()=>{var C,T,_;(_=(T=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:T.commands)==null||_.setContent(p)},[p]);const m=J.useRef(null),g=J.useCallback((C,T)=>{var w;const _=(w=m.current)==null?void 0:w.editor;if(!(!_||!i))if(i instanceof Promise)i(C).then(E=>{kv({images:E,editor:_,position:T})});else{const E=i(C);kv({images:E,editor:_,position:T})}},[]),y=J.useCallback((C,T,_,w)=>{var O;if(!(T instanceof DragEvent)||!T.dataTransfer)return!1;const E=u2(T.dataTransfer.files);if(E.length>0){const j=(O=C.posAtCoords({left:T.clientX,top:T.clientY}))==null?void 0:O.pos;return g(E,j),T.preventDefault(),!0}return!1},[g]),b=J.useCallback((C,T,_)=>{if(!T.clipboardData)return!1;const w=u2(T.clipboardData.files);return w.length>0?(g(w),!0):!1},[g]),S=v.jsx(D.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(QP,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:y,handlePaste:b},renderControls:s?void 0:()=>v.jsx(Kue,{onUploadFiles:i}),onBlur:()=>{var C,T;return f(((T=(C=m.current)==null?void 0:C.editor)==null?void 0:T.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(AP,{}),v.jsx(eN,{})]})})});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(D.Typography,{...o,children:r}),S]})},Vv=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(D.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(D.Box,{className:"text-content",children:[v.jsx(D.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(D.Typography,{"data-testid":"message",children:n})]}),v.jsx(D.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},d2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?v.jsx(D.Collapse,{in:n,children:u}):v.jsx(D.TableRow,{sx:p,children:v.jsx(D.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(D.Collapse,{in:n,children:u})})})},cj=t=>{const{id:e,getRowKey:n=G=>"id"in G&&(typeof G.id=="string"||typeof G.id=="number")?G.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(G)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(G)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:m=!1,className:g,emptyTableMsg:y="No items to display",errorTableMsg:b,retryCallback:S,isLoading:C=!1,disableMobileCards:T=!1,highlightSelectedRow:_=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,tooltipColor:j,...P}=t,{palette:L}=D.useTheme(),[M,R]=J.useState(void 0),[z,B]=J.useState(void 0);Array.isArray(m)&&(!s&&m.length!==r.length&&console.warn('Table component: Length of "fixedLayout" is not equal to the length of "columns".'),s&&m.length!==r.length+1&&console.warn(`Table component: 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".`)),s&&i&&console.warn("Table component: renderExpand & onRowClick are both defined. Only one should be defined at a time.");const $=G=>{G!==l?f&&f(G,"asc"):f&&f(l,u==="asc"?"desc":"asc")},F=G=>l===G?u:null,N=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),W=N&&a?r.filter(G=>!(a.includes(G.fieldName)||G.hideCol)):r.filter(G=>!G.hideCol);s&&!N&&W.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:G=>{const Q=M===G;return v.jsx(D.IconButton,{"data-testid":"expand-collapse-btn","aria-label":Q?"collapse row":"expand row",size:"small",onClick:()=>ae(G),children:Q?v.jsx(Jd,{"data-testid":"collapse-up"}):v.jsx(ag,{"data-testid":"expand-down"})})}});const q=(G,Q)=>Q.split(".").reduce((fe,Se)=>{if(fe&&typeof fe=="object")return fe[Se]},G),K=(G,Q)=>{const fe=q(Q,G.fieldName);return G.render?G.render(fe,Q,N):fe},U=f!==void 0,X=G=>U?p?p.includes(G):!0:!1,pe=v.jsxs(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(h8,{})," ",y]}),he=v.jsxs(D.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(IR,{color:"error"})," ",b,S&&v.jsx(D.Button,{variant:"text",onClick:S,children:"Retry?"})]}),me=()=>{if(C)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:v.jsx(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(Vv,{})})})});if(b)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:pe})})},Z=()=>{if(C)return v.jsx(Vv,{});if(b)return he;if(o.length===0)return pe},ue=G=>{_&&B(G)},de=G=>{i&&(i(G),ue(G))},ae=G=>{const Q=M===G?void 0:G;R(Q),ue(Q)},oe=G=>{if(!s)return;const Q=M===n(G);return v.jsxs(v.Fragment,{children:[v.jsxs(D.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>ae(n(G)),children:[Q?v.jsx(Jd,{}):v.jsx(ag,{})," Show"," ",Q?"Less":"More"]}),v.jsx(d2,{colSpan:r.length,isExpanded:n(G)===M,obj:G,renderExpand:fe=>s(fe),asMobileCard:!0})]})},le=typeof _=="string"?_:L.grey[L.mode=="dark"?600:50],ye=G=>{const Q=z===n(G)?le:"inherit";return{cursor:i?"pointer":"default",backgroundColor:Q,...s?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:Q===le?Xa(Q,.1):le}}}},te=L.grey[L.mode==="dark"?600:400],ie=G=>G&&v.jsx(D.Tooltip,{title:G,children:v.jsx(f8,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:j??te}})});return N&&!T?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:g,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(D.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:G=>$(G.target.value),fullWidth:!0,children:W.map(G=>{if(X(G.fieldName))return v.jsx(D.MenuItem,{value:G.sortName??G.fieldName,children:G.label??Mn(G.fieldName)},`${G.key??"rowHeader"}-${G.fieldName}`)})}),v.jsx(D.IconButton,{onClick:()=>{l&&$(l)},children:v.jsx(w8,{className:`sort-icon-${u}`})})]}),v.jsx(D.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(G=>v.jsxs(D.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(G)},onClick:()=>de(n(G)),"data-testid":`card-${n(G)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:W.map(Q=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Q.fieldName}`,style:{textWrap:"nowrap"},children:[Q.label??Mn(Q.fieldName),ie(Q.tooltip)]}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Q.fieldName}`,style:{paddingLeft:"10px"},children:K(Q,G)})]},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))})}),oe(G)]},n(G)))]}):v.jsx(D.TableContainer,{component:D.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(D.Table,{stickyHeader:E!=="undefined",style:{tableLayout:m?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...P,children:[v.jsx(D.TableHead,{className:"MBv2_Table_Head",children:v.jsx(D.TableRow,{className:"MBv2_Table_Head_Row",children:W.map((G,Q)=>{const fe=X(G.fieldName);return v.jsx(D.TableCell,{width:Array.isArray(m)?m[Q]:"auto",sx:G.tableCellSx??{},children:v.jsx(D.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(D.Box,{sx:[fe&&{"&:hover":{cursor:"pointer",backgroundColor:L.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:fe?()=>$(G.sortName??G.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:G.label??Mn(G.fieldName)}),ie(G.tooltip),fe&&F(G.fieldName)==="asc"&&v.jsx(Jd,{style:{marginLeft:"5px"}}),fe&&F(G.fieldName)==="desc"&&v.jsx(ag,{style:{marginLeft:"5px"}}),fe&&F(G.fieldName)!=="asc"&&F(G.fieldName)!=="desc"&&v.jsx(x8,{style:{marginLeft:"5px"}})]})})},`${G.key??"rowHeader"}-${G.fieldName}`)})})}),v.jsx(D.TableBody,{className:"MBv2_Table_Body",children:me()??o.map(G=>v.jsxs(J.Fragment,{children:[v.jsx(D.TableRow,{"data-testid":`row-${n(G)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(n(G)),sx:ye(G),children:W.map(Q=>v.jsx(D.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Q.fieldName}`,children:K(Q,G)},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))}),s&&v.jsx(d2,{colSpan:W.length,isExpanded:n(G)===M,obj:G,renderExpand:Q=>s(Q),reRenderExpand:O})]},n(G)))})]})})},uj=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=S=>{n(S)},g=S=>{r(parseInt(S.target.value,10))},y=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),b=!t.data||t.data&&t.data.length===0;return v.jsxs(D.Box,{children:[v.jsx(cj,{sortOrder:p,sortField:f,...s}),!o&&!b&&v.jsx(D.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:y?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>m(C),onRowsPerPageChange:g,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},f2=()=>({height:window.innerHeight,width:window.innerWidth}),dj=()=>{const[t,e]=J.useState(f2());return J.useEffect(()=>{const n=()=>{e(f2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},qr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=dj(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(D.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...er({...t},a)})},kfe=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[v.jsxs(D.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",v.jsx("br",{}),v.jsx("b",{children:e.url}),"?"]}),v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",startIcon:v.jsx(V0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Efe=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(D.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",color:"error",startIcon:v.jsx(Xv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Mfe=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:g,setSelectedIds:y,onError:b=()=>{},condenseTable:S=!1,canSelect:C=!1,canLaunchUrl:T,addlActions:_,readOnly:w=!1,showCloseBtn:E=!1}=t,O=!!t.canCreate&&!w,j=!!t.canEdit&&!w,P=!!t.canDelete&&!w,{palette:L}=D.useTheme(),[M,R]=J.useState([]),[z,B]=J.useState(!1),[$,F]=J.useState(!0),[N,W]=J.useState(null),[q,K]=J.useState(null),[U,X]=J.useState(null),[pe,he]=J.useState({pageNo:0,pageSize:S?5:10,totalCount:0}),me=()=>{B(!1),F(!0),m({pageNo:pe.pageNo,pageSize:pe.pageSize}).then(Q=>(R(Q.data),he({...pe,totalCount:Q.totalCount}),Q)).catch(Q=>{b(Q),B(!0),R([])}).finally(()=>F(!1))};J.useEffect(me,[pe.pageNo,pe.pageSize,e]);const Z=()=>{K(null),X(null),W(null)},ue=v.jsx(qr,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:o,startIcon:v.jsx(xf,{}),children:"Add Citation"}),de=v.jsx(qr,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:i,startIcon:v.jsx(xT,{}),children:"Add Attachment"}),ae=Q=>{if(!(!j&&!w)&&!(w&&!S))return v.jsx(D.Tooltip,{title:w?"View":"Edit",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>Q.fileName?a(Q):s(Q),"data-testid":`citation-table_edit-btn-${Q.id}`,children:w?v.jsx(M8,{}):v.jsx(Gq,{})})})},oe=Q=>{if(!(!P||w))return v.jsx(D.Tooltip,{title:"Delete",children:v.jsx(D.IconButton,{color:"error",onClick:fe=>{K(Q),W(fe.currentTarget)},"data-testid":`citation-table_delete-btn-${Q.id}`,children:v.jsx(Xv,{})})})},le=Q=>{if(!T)return;if(!Q.fileName)return v.jsx(D.Tooltip,{title:"Open URL",children:v.jsx(D.IconButton,{color:"primary",onClick:Se=>{W(Se.currentTarget),X(Q)},"data-testid":`citation-table_launch-link-btn-${Q.id}`,sx:{visibility:T!=null&&T(Q)?"visible":"hidden"},children:v.jsx(V0,{})})})},ye=Q=>{if(!f||!Q.fileName)return;const fe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],Se=Q.fileName.split(".").pop();if(!(!Se||!fe.includes(Se)))return v.jsx(D.Tooltip,{title:"View File",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(Q),"data-testid":`citation-table_view-file-btn-${Q.id}`,children:v.jsx(V0,{})})})},te=Q=>{if(!u)return;if(!!Q.fileName)return v.jsx(D.Tooltip,{title:"Download",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(Q),"data-testid":`citation-table_download-btn-${Q.id}`,children:v.jsx(Yq,{})})})},G=[{fieldName:"id",key:"select",label:"",hideCol:!C,render:(Q,fe)=>v.jsx(D.Checkbox,{"data-testid":`citation-table_checkbox-${Q}`,onChange:()=>{const Se=g.includes(fe.id);y(Se?g.filter(Ee=>Ee!==fe.id):[...g,fe.id])},checked:g.includes(Q),disabled:w})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(Q,fe)=>v.jsx(D.Tooltip,{title:Q?"Attachment":"URL",children:Q?v.jsx(xT,{sx:{color:L.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${fe.id}`}):v.jsx(xf,{sx:{color:L.grey[500],marginTop:"6px"},"data-testid":`url-icon-${fe.id}`})})},{fieldName:"title",tableCellSx:{width:S?"100%":"auto"},render:Q=>S?Ac.truncate(Q,{length:40,omission:"..."}):Q},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:S,render:(Q,fe)=>v.jsx("span",{style:{wordBreak:"break-all"},children:Q||fe.url})},{fieldName:"source",hideCol:S},{fieldName:"accessedAt",hideCol:S,render:(Q,fe)=>{if(!fe.fileName)return(Q==null?void 0:Q.slice(0,10))??""}},{fieldName:"classification",hideCol:S},{fieldName:"id",key:"Action",label:"Action",hideCol:!(w||j||P||T||f||u||_),render:(Q,fe)=>v.jsxs(D.Box,{display:"flex",flexDirection:"row-reverse",children:[_==null?void 0:_(fe),oe(fe),ae(fe),ye(fe),le(fe),te(fe)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(D.Typography,{variant:S?"h6":"h2",children:n}),!C&&O&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:1,children:[ue,de]}),E&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Np,{})})]}),v.jsx(uj,{"data-testid":"citation-table",size:S?"x-small":"medium",isLoading:$,columns:G,data:M,paginationState:pe,onPageChange:Q=>he({...pe,pageNo:Q}),onRowsPerPageChange:Q=>he({...pe,pageSize:Q,pageNo:0}),errorTableMsg:z?"Failed to load citations.":void 0,retryCallback:me}),C&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(D.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:O&&v.jsxs(v.Fragment,{children:[ue,de]})}),!w&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(qr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),v.jsxs(qr,{variant:"contained",size:"small",onClick:()=>p(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),v.jsx(kfe,{citation:U,anchorEl:N,onClose:Z}),v.jsx(Efe,{citation:q,anchorEl:N,onDeleteCitation:l,onClose:Z})]})},V1=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return v.jsx(qr,{type:n,disabled:e,size:r,startIcon:e?v.jsx(D.CircularProgress,{size:s,color:"inherit"}):null,...o})};var D0,p2;function Ofe(){if(p2)return D0;p2=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,T){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=T};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);D0={Cache:t,split:p,normalizePath:f,setter:function(C){var T=f(C);return l.get(C)||l.set(C,function(w,E){for(var O=0,j=T.length,P=w;O<j-1;){var L=T[O];if(L==="__proto__"||L==="constructor"||L==="prototype")return w;P=P[T[O++]]}P[T[O]]=E})},getter:function(C,T){var _=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,j=_.length;O<j;)if(E!=null||!T)E=E[_[O++]];else return;return E})},join:function(C){return C.reduce(function(T,_){return T+(g(_)||n.test(_)?"["+_+"]":(T?".":"")+_)},"")},forEach:function(C,T,_){m(Array.isArray(C)?C:p(C),T,_)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(T){return T.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,T,_){var w=C.length,E,O,j,P;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),P=g(E),j=!P&&/^\d+$/.test(E),T.call(_,E,P,j,O,C))}function g(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function y(C){return C.match(r)&&!C.match(n)}function b(C){return o.test(C)}function S(C){return!g(C)&&(y(C)||b(C))}return D0}var zs=Ofe(),P0,h2;function Rfe(){if(h2)return P0;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 P0={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(" ")},P0}var N0=Rfe(),qd={exports:{}},m2;function Afe(){if(m2)return qd.exports;m2=1,qd.exports=function(o){return t(e(o),o)},qd.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(g){if(!p.has(g[0])||!p.has(g[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(g,y,b){if(b.has(g)){var S;try{S=", node was:"+JSON.stringify(g)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(g))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(g));if(!l[y]){l[y]=!0;var C=f.get(g)||new Set;if(C=Array.from(C),y=C.length){b.add(g);do{var T=C[--y];m(T,p.get(T),b)}while(y);b.delete(g)}a[--s]=g}}}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 qd.exports}var Ife=Afe();const Dfe=or(Ife),Pfe=Object.prototype.toString,Nfe=Error.prototype.toString,jfe=RegExp.prototype.toString,Lfe=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ffe=/^Symbol\((.*)\)(.*)$/;function $fe(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function g2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return $fe(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Lfe.call(t).replace(Ffe,"Symbol($1)");const r=Pfe.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Nfe.call(t)+"]":r==="RegExp"?jfe.call(t):null}function Ui(t,e){let n=g2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=g2(this[r],e);return i!==null?i:o},2)}function fj(t){return t==null?[]:[].concat(t)}let pj,hj,mj,Bfe=/\$\{\s*(\w+)\s*\}/g;pj=Symbol.toStringTag;class y2{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[pj]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],fj(e).forEach(i=>{if(fr.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]}}hj=Symbol.hasInstance;mj=Symbol.toStringTag;class fr 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(Bfe,(o,i)=>Ui(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 y2(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[mj]="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,fr)}static[hj](e){return y2[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let _o={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 \`${Ui(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ui(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ui(n,!0)}\``+o}},ur={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"},Vfe={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"},zv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},zfe={isValue:"${path} field must be ${value}"},mf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Hfe={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"},Wfe={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: \`${Ui(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: \`${Ui(n,!0)}\``}return fr.formatError(_o.notType,t)}};Object.assign(Object.create(null),{mixed:_o,string:ur,number:Vfe,date:zv,object:mf,array:Hfe,boolean:zfe,tuple:Wfe});const z1=t=>t&&t.__isYupSchema__;class vp{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 vp(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(!z1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ud={context:"$",value:"."};class ra{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]===Ud.context,this.isValue=this.key[0]===Ud.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ud.context:this.isValue?Ud.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&zs.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}}ra.prototype.__isYupRef=!0;const Ds=t=>t==null;function Da(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:g}=t;let{parent:y,context:b,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function T(R){return ra.isRef(R)?R.getValue(n,y,b):R}function _(R={}){const z=Object.assign({value:n,originalValue:i,label:s.spec.label,path:R.path||r,spec:s.spec,disableStackTrace:R.disableStackTrace||C},p,R.params);for(const $ of Object.keys(z))z[$]=T(z[$]);const B=new fr(fr.formatError(R.message||m,z),n,z.path,R.type||u,z.disableStackTrace);return B.params=z,B}const w=S?a:l;let E={path:r,parent:y,type:u,from:o.from,createError:_,resolve:T,options:o,originalValue:i,schema:s};const O=R=>{fr.isError(R)?w(R):R?l(null):w(_())},j=R=>{fr.isError(R)?w(R):a(R)};if(g&&Ds(n))return O(!0);let L;try{var M;if(L=f.call(E,n,E),typeof((M=L)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(L).then(O,j)}}catch(R){j(R);return}O(L)}return e.OPTIONS=t,e}function qfe(t,e,n,r=n){let o,i,s;return e?(zs.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 xp extends Set{describe(){const e=[];for(const n of this.values())e.push(ra.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 xp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function za(t,e=new Map){if(z1(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]=za(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,za(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(za(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=za(o,e)}else throw Error(`Unable to clone ${t}`);return n}class jo{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 xp,this._blacklist=new xp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_o.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=za(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({value:e},n)),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ds(i))return i;let s=Ui(e),a=Ui(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
400
400
 
401
401
  attempted value: ${s}
402
402
  `+(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),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=b=>{o||(o=!0,n(b,s))},p=b=>{o||(o=!0,r(b,s))},m=i.length,g=[];if(!m)return p([]);let y={value:s,originalValue:a,path:l,options:u,schema:this};for(let b=0;b<i.length;b++){const S=i[b];S(y,f,function(T){T&&(Array.isArray(T)?g.push(...T):g.push(T)),--m<=0&&p(g)})}}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,g)=>this.resolve(f)._validate(u,f,m,g)}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)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(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 fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):za(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=Da({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=Da({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=_o.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=_o.notNull){return this.nullability(!1,e)}required(e=_o.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=_o.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Da(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=fj(e).map(i=>new ra(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new vp(o,n):vp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Da({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=_o.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Da({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=_o.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Da({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.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}jo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])jo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=qfe(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])jo.prototype[t]=jo.prototype.oneOf;for(const t of["not","nope"])jo.prototype[t]=jo.prototype.notOneOf;const Ufe=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Kfe(t){const e=Hv(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 Hv(t){var e,n;const r=Ufe.exec(t);return r?{year:ei(r[1]),month:ei(r[2],1)-1,day:ei(r[3],1),hour:ei(r[4]),minute:ei(r[5]),second:ei(r[6]),millisecond:r[7]?ei(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:ei(r[10]),minuteOffset:ei(r[11])}:null}function ei(t,e=0){return Number(t)||e}let Yfe=/^[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])?)*$/,Gfe=/^((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,Jfe=/^(?:[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,Zfe="^\\d{4}-\\d{2}-\\d{2}",Xfe="\\d{2}:\\d{2}:\\d{2}",Qfe="(([+-]\\d{2}(:?\\d{2})?)|Z)",epe=new RegExp(`${Zfe}T${Xfe}(\\.\\d+)?${Qfe}$`),tpe=t=>Ds(t)||t===t.trim(),npe={}.toString();function Ps(){return new gj}class gj extends jo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===npe?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||_o.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=ur.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=ur.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=ur.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||ur.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=ur.email){return this.matches(Yfe,{name:"email",message:e,excludeEmptyString:!0})}url(e=ur.url){return this.matches(Gfe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ur.uuid){return this.matches(Jfe,{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(epe,{name:"datetime",message:n||ur.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||ur.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=Hv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||ur.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=Hv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ur.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:tpe})}lowercase(e=ur.lowercase){return this.transform(n=>Ds(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toLowerCase()})}uppercase(e=ur.uppercase){return this.transform(n=>Ds(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toUpperCase()})}}Ps.prototype=gj.prototype;let yj=new Date(""),rpe=t=>Object.prototype.toString.call(t)==="[object Date]";function H1(){return new wu}class wu extends jo{constructor(){super({type:"date",check(e){return rpe(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Kfe(e),isNaN(e)?wu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ra.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=zv.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=zv.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)}})}}wu.INVALID_DATE=yj;H1.prototype=wu.prototype;H1.INVALID_DATE=yj;function ope(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=zs.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),ra.isRef(a)&&a.isSibling?i(a.path,s):z1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Dfe.array(Array.from(r),n).reverse()}function b2(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 bj(t){return(e,n)=>b2(t,e)-b2(t,n)}const ipe=(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 gf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=gf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=gf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(gf)}):"optional"in t?t.optional():t}const spe=(t,e)=>{const n=[...zs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=zs.getter(zs.join(n),!0)(t);return!!(o&&r in o)};let v2=t=>Object.prototype.toString.call(t)==="[object Object]";function x2(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const ape=bj([]);function W1(t){return new vj(t)}class vj extends jo{constructor(e){super({type:"object",check(n){return v2(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=ape,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],g=p in o;if(m){let y,b=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:b,context:n.context,parent:l});let S=m instanceof jo?m.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}y=!n.__validating||!C?m.cast(o[p],u):o[p],y!==void 0&&(l[p]=y)}else g&&!s&&(l[p]=o[p]);(g!==p in l||l[p]!==o[p])&&(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||!v2(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ra.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=ope(e,n),r._sortErrors=bj(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 gf(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=zs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return spe(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(ipe)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||mf.exact,test(n){if(n==null)return!0;const r=x2(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=mf.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=x2(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=mf.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(N0.camelCase)}snakeCase(){return this.transformKeys(N0.snakeCase)}constantCase(){return this.transformKeys(e=>N0.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}}W1.prototype=vj.prototype;const lpe=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=J.useRef(null),[u,f]=J.useState(!1),[p,m]=J.useState(!1),[g,y]=J.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});J.useEffect(()=>{i&&y({...i,type:"Url"})},[]);const b=()=>{var C,T,_;const S=(T=(C=l==null?void 0:l.current)==null?void 0:C.values)==null?void 0:T.url;S&&((_=l==null?void 0:l.current)==null||_.setFieldValue("url",OP(S)))};return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(D.IconButton,{onClick:o,children:v.jsx(Np,{})})]}),v.jsx(qt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:g,onSubmit:async S=>{f(!0),n(S).catch(C=>{throw f(!1),C}).finally(()=>f(!1))},validationSchema:W1({source:Ps().required("Source is required"),title:Ps().required("Title is required"),accessedAt:H1().required("Accessed At is required"),url:Ps().required("URL is required"),classification:Ps().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:S})=>v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[v.jsx(Ns,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsx(Ns,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsx(Of,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),v.jsx(Ns,{name:"url",label:"URL",disabled:u,required:!0,onBlur:b,margin:"none",readOnly:s}),v.jsx(BR,{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})]}),v.jsx(D.DialogActions,{sx:{px:0},children:s?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(V1,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),S()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},xj=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return v.jsx(D.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},cpe=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=J.useRef(null),[f,p]=J.useState(!1),[m,g]=J.useState(!1),[y,b]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{s&&b({...s,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&v.jsx(D.IconButton,{onClick:o,children:v.jsx(Np,{})})]}),v.jsx(qt.Formik,{innerRef:u,enableReinitialize:!0,initialValues:y,validationSchema:W1().shape({title:Ps().required("Title is required"),fileName:Ps().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async S=>{p(!0),n(S).catch(C=>{throw p(!1),C}).finally(()=>p(!1))},children:({values:S,setFieldValue:C,handleSubmit:T})=>{var _;return J.useEffect(()=>{var w,E;(w=S.file)!=null&&w.name&&C("fileName",(E=S.file)==null?void 0:E.name)},[(_=S.file)==null?void 0:_.name]),v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Ns,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),v.jsxs(D.Box,{marginTop:i||a?0:1,children:[v.jsxs(xj,{alignItems:"flex-start",children:[!i&&!a&&v.jsx(NR,{name:"file",errorMode:"hidden"}),v.jsx(Ns,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),v.jsx(yr,{name:"fileName"})]}),v.jsx(D.DialogActions,{sx:{px:0},children:a?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(V1,{size:"small",loading:f,type:"button",onClick:()=>{g(!0),T()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Tu=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",g=()=>{if(s&&p)return v.jsx(D.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},y=()=>{if(i)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(D.Box,{children:g()}),v.jsxs(D.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(D.Box,{children:g()})})};return v.jsxs(D.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(D.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&v.jsx(D.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Np,{})})]})}):r,o&&(typeof o=="string"?v.jsx(D.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(D.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),y()]})};function upe(t){return Ye("MuiAlert",t)}const S2=We("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),dpe=Le(v.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"),fpe=Le(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),ppe=Le(v.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"),hpe=Le(v.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"),mpe=Le(v.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"),gpe=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Re(n||r)}`,`${e}${Re(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ke(i,upe,o)},ype=ve(hl,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Re(n.color||n.severity)}`]]}})(It(({theme:t})=>{const e=t.palette.mode==="light"?Xa:Oc,n=t.palette.mode==="light"?Oc:Xa;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),[`& .${S2.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}`,[`& .${S2.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)}}}))]}})),bpe=ve("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),vpe=ve("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),xpe=ve("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),C2={success:v.jsx(dpe,{fontSize:"inherit"}),warning:v.jsx(fpe,{fontSize:"inherit"}),error:v.jsx(ppe,{fontSize:"inherit"}),info:v.jsx(hpe,{fontSize:"inherit"})},Sj=A.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=C2,onClose:g,role:y="alert",severity:b="success",slotProps:S={},slots:C={},variant:T="standard",..._}=r,w={...r,color:l,severity:b,variant:T,colorSeverity:l||b},E=gpe(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[j,P]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(E.root,s),elementType:ype,externalForwardedProps:{...O,..._},ownerState:w,additionalProps:{role:y,elevation:0}}),[L,M]=Bt("icon",{className:E.icon,elementType:bpe,externalForwardedProps:O,ownerState:w}),[R,z]=Bt("message",{className:E.message,elementType:vpe,externalForwardedProps:O,ownerState:w}),[B,$]=Bt("action",{className:E.action,elementType:xpe,externalForwardedProps:O,ownerState:w}),[F,N]=Bt("closeButton",{elementType:ml,externalForwardedProps:O,ownerState:w}),[W,q]=Bt("closeIcon",{elementType:mpe,externalForwardedProps:O,ownerState:w});return v.jsxs(j,{...P,children:[p!==!1?v.jsx(L,{...M,children:p||m[b]||C2[b]}):null,v.jsx(R,{...z,children:i}),o!=null?v.jsx(B,{...$,children:o}):null,o==null&&g?v.jsx(B,{...$,children:v.jsx(F,{size:"small","aria-label":a,title:a,color:"inherit",onClick:g,...N,children:v.jsx(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(Sj.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 _u=t=>{var g;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=D.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(g=l[r])==null?void 0:g.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(Sj,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(D.Typography,{variant:"h3",children:s}),n]})},Cj=t=>v.jsx(_u,{severity:"error",...t}),wj=t=>v.jsx(_u,{severity:"success",...t}),Spe=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(Cj,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(wj,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function Tj({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:g,canLaunchUrl:y,readOnly:b}){const[S,C]=J.useState("Insert Citation/Attachment(s)"),[T,_]=J.useState(u),[w,E]=J.useState(void 0),[O,j]=J.useState(void 0),P=Z=>{j(void 0),C(Z)},[L,M]=J.useState(0);J.useEffect(()=>{f==null||f()},[S,O,f]);const R=(Z=!1)=>{(!m||Z)&&M(ue=>ue+1)},z=(Z,ue)=>{var le;const de=typeof((le=ue.response)==null?void 0:le.data)=="string"&&ue.response.data,ae=typeof ue.message=="string"&&ue.message;j({type:"Error",title:Z,message:de??ae}),p(ue)},B=Z=>j({type:"Success",title:"",message:Z}),$=async Z=>{if(S==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(S==="Edit Citation"||S==="Edit Attachment"){if(Z.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(Z).then(()=>{P("Insert Citation/Attachment(s)"),R()}).catch(de=>{z("Failed to update",de)}))}else await(e==null?void 0:e(Z).then(de=>{_([...T,de.id]),P("Insert Citation/Attachment(s)"),R()}).catch(de=>{z("Failed to create",de)}))},F=r&&(async Z=>r(Z).then(()=>{R(!0),_(T.filter(ue=>ue!==Z)),B("Successfully deleted")}).catch(ue=>z("Failed to delete",ue))),N=(Z,ue)=>{o(Z.id).then(de=>{E(de),P(ue)}).catch(de=>{z("Failed to load",de)})},W=i&&(async Z=>i(Z).catch(ue=>{z(`Failed to download ${Z.fileName}`,ue)})),q=s&&(async Z=>s(Z).catch(ue=>{z(`Failed to view ${Z.fileName}`,ue)})),K=v.jsx(Mfe,{refreshKey:L,getCitationsPaginated:Z=>t(Z).then(ue=>(f==null||f(),ue)),onCancel:l,onNewCitation:()=>{E(void 0),P("Add Citation")},onNewAttachment:()=>{E(void 0),P("Add Attachment")},onEditCitation:Z=>N(Z,b?"View Citation":"Edit Citation"),onEditAttachment:Z=>N(Z,b?"View Attachment":"Edit Attachment"),onDeleteCitation:F,onDownloadAttachment:W,onViewAttachment:q,onSelect:a,setSelectedIds:_,selectedIds:T,onError:p,condenseTable:m,canSelect:m,title:m&&!b?S:"Attachments & Citations",addlActions:g,canCreate:!!e,canEdit:!!n,canDelete:!!F,canLaunchUrl:y,readOnly:b,showCloseBtn:m}),U=v.jsx(lpe,{modifyCitation:w,onSave:$,onCancel:()=>P("Insert Citation/Attachment(s)"),onClose:l,title:S,readOnly:S==="View Citation",showCloseBtn:m}),X=v.jsx(cpe,{onSave:$,onCancel:()=>P("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:w,disableFileUpload:S==="Edit Attachment",title:S,readOnly:S==="View Attachment",showCloseBtn:m}),pe=v.jsx(Spe,{alert:O,setAlert:j}),he=S==="Add Citation"||S==="Edit Citation"||S==="View Citation",me=S==="Add Attachment"||S==="Edit Attachment"||S==="View Attachment";if(m){let Z=null;return!m||S==="Insert Citation/Attachment(s)"?Z=K:he?Z=U:me&&(Z=X),v.jsxs(D.Box,{width:"500px",children:[pe,v.jsx(D.Box,{paddingTop:"8px",children:Z})]})}return v.jsxs(D.Box,{width:"100%",children:[S==="Insert Citation/Attachment(s)"&&pe,v.jsx(D.Box,{paddingTop:"8px",children:K}),v.jsx(Tu,{open:he||me,children:v.jsxs(D.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[pe,he?U:X]})})]})}function _j({...t}){return v.jsx(Tj,{renderAsSelectablePopup:!0,...t})}const Cpe=Yt({name:{CitationBubbleMenuTipTap:kj}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function kj({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,canLaunchUrl:a,readOnly:l,...u}){const{classes:f}=Cpe(),p=vt();if(p&&!("citationBubbleMenuHandler"in(p==null?void 0:p.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const m=p==null?void 0:p.storage.citationBubbleMenuHandler,g=m.isOpen,y=m.selectedIds,b=m.selectedNodePos,S=w=>{p&&(w.length===0?p.commands.deleteCitation(b):y.length===0?p.commands.insertCitation({ids:w}):p.commands.updateCitation({ids:w},b))},C=w=>{S(w),p==null||p.commands.closeCitationBubbleMenu()},T=()=>{S(y),p==null||p.commands.closeCitationBubbleMenu()},_=J.useCallback(()=>{requestAnimationFrame(()=>{p!=null&&p.view&&p.view.dispatch(p.view.state.tr)})},[p]);return p?v.jsx(bh,{editor:p,open:g,...m.bubbleMenuOptions,...u,children:v.jsx("div",{className:f.content,children:v.jsx(_j,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:C,onCancel:T,initialSelectedIds:y,onContentChange:_,canLaunchUrl:a,readOnly:l})})}):null}const wpe=un.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(IN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(AN.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(DN.configure(this.options.bulletList)),this.options.code!==!1&&t.push(PN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(NN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(jN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(LN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(FN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push($N.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(gN.configure(this.options.heading)),this.options.history!==!1&&t.push(WN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(qN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(UN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(nj.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(rj.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(oj.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(sj.configure(this.options.strike)),this.options.text!==!1&&t.push(aj.configure(this.options.text)),t}}),Tpe=()=>un.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 _pe(t){const e=vt(),n=J.useRef(null);return v.jsx(mt,{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:v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(Hq,{fontSize:"small"}),v.jsx(D.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const Ej=J.createContext(void 0),Mj=()=>{const t=J.useContext(Ej);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},kpe=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=Mj(),[u,f]=J.useState(String(s)),[p,m]=J.useState([]),g=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const y=a.filter(C=>s.includes(C.id)),b=y.map(C=>Ac.truncate(C.title,{length:g,omission:"..."})).join(", ");f(b),m(y);const S=y.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:y.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(S1,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(D.Tooltip,{title:v.jsx(D.Box,{className:"citation-tooltip",children:p.map((y,b)=>{var C;const S=[y.source,y.title,y.fileName,y.url,(C=y.accessedAt)==null?void 0:C.slice(0,10),y.classification];return v.jsxs(D.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),b<p.length-1&&v.jsx(D.Divider,{className:"citation-tooltip-divider"})]},y.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:y=>{y.preventDefault(),y.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Epe=en.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",bt(t)]},addNodeView(){return C1(kpe)},addProseMirrorPlugins(){return[new tn({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}}}}),Oj=t=>v.jsx(PR,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Mpe=t=>{const{name:e,label:n=Mn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:g,onViewAttachment:y,onError:b=()=>{},placeholder:S="Start typing here...",notApplicableName:C,errorMode:T="normal",canLaunchUrl:_}=t,w=[wpe,ij.configure({placeholder:S}),Tpe(),Epe.configure({citationMaxLength:a})],[E,O,j]=qt.useField({name:e}),{setValue:P}=j,{value:L}=E,{addUpdateCitation:M,deleteCitation:R,batchUpdate:z}=Mj();J.useEffect(()=>{var q;const N=(q=B==null?void 0:B.current)==null?void 0:q.editor;if(!N)return;N.getHTML()!==L&&setTimeout(()=>{N.commands.setContent(L)},0)},[L]);const B=J.useRef(null),$={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},F=()=>{var q,K;const N=((K=(q=B.current)==null?void 0:q.editor)==null?void 0:K.getHTML())??"",W=!N.replace(/<\/?p>|<br>/g,"").trim();P(W?"":N)};return v.jsxs(D.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...$[s],display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(D.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),C&&v.jsx(Oj,{name:C})]}),v.jsx(QP,{ref:B,extensions:w,content:L,editable:!i,renderControls:i?void 0:()=>v.jsx(xh,{children:v.jsx(_pe,{})}),onBlur:F,RichTextFieldProps:{variant:i?"standard":"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(kj,{getCitationsPaginated:N=>l(N).then(W=>(z(W.data),W)),onCreateCitation:u&&(N=>u(N).then(W=>(M(W),W))),onUpdateCitation:f&&(N=>f(N).then(W=>(M(W),W))),onDeleteCitation:p&&(N=>p(N).then(()=>R(N))),getCitationById:m,onDownloadAttachment:g,onViewAttachment:y,onError:b,canLaunchUrl:_,readOnly:i})}),v.jsx(yr,{name:e,id:`${e}-err`,errorMode:T})]})},Ope=t=>{const{name:e="submit"}=t;return v.jsx(qr,{name:e,type:"submit",...t})},Rpe=t=>{const{label:e="Return to Top",icon:n=Jd,scrollThresholdPx:r=100}=t,o=D.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(D.Zoom,{in:o,children:v.jsx(D.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(D.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Rj=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ao.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 v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),v.jsx(D.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>v.jsxs(D.MenuItem,{...Qc(p,o),children:[p.icon&&v.jsx(D.ListItemIcon,{children:p.icon}),v.jsx(D.ListItemText,{primary:p.label})]},p.label))})]})},Ape=()=>{const{values:t,errors:e,status:n}=qt.useFormikContext(),{palette:r}=D.useTheme();return v.jsx(D.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(D.List,{children:[v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(D.Divider,{variant:"inset",component:"li"}),v.jsxs(D.ListItem,{id:"testing",children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Ipe=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=dj();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,...er({...t},l)};return v.jsx(D.Stepper,{...u,children:e.map(f=>v.jsx(D.Step,{children:v.jsx(D.StepLabel,{children:f})},f))})},Dpe=t=>{const{name:e,label:n=Mn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(S8,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:g="None",showDivider:y=!1,removePosition:b="bottom"}=t,[S]=qt.useField({name:e}),{value:C}=S,T=_=>({display:"flex",flexDirection:_==="bottom"?"column":"row",alignItems:_==="bottom"?"flex-start":"center"});return v.jsxs(D.FormControl,{fullWidth:!0,children:[v.jsx(D.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(D.Typography,{children:g}):v.jsx(qt.FieldArray,{name:e,render:_=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(J.Fragment,{children:v.jsx(Ppe,{variant:l,content:v.jsxs(D.Box,{"data-testid":"form-group-container",sx:typeof b=="string"?T(b):{...b},children:[v.jsxs(D.Box,{width:"100%",children:[i(`${e}.${E}`,E),y&&E!==C.length-1&&v.jsx(D.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>_.remove(E),children:a})]})})},`${e}-${E}`)),!m&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>_.push(o),sx:u,children:s})]})})]})},Ppe=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"elevatedCard":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"none":return e}},Npe=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(Tu,{actions:[v.jsx(D.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},jpe=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(Tu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Lpe=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 v.jsx(Tu,{actions:[v.jsx(D.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(D.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Fpe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=D.useTheme(),a=ao.useNavigate();return v.jsxs(D.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(D.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(D.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(D.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=>v.jsx(D.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Qc(l,a),children:l.label},l.label))}),n&&v.jsx(D.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},Aj=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ao.useLocation(),i=ao.useNavigate(),[s,a]=J.useState(!1),l=(m,g)=>v.jsx(D.MenuList,{children:m.map(y=>v.jsxs(D.MenuItem,{...Qc(y,i,()=>a(!1)),children:[y.icon&&v.jsx(D.ListItemIcon,{children:y.icon}),v.jsx(D.ListItemText,{primary:y.label})]},`mobile-drawer-group-${g}-item-${y.path}`))}),f=(()=>{if(e){const m=e.filter(g=>g&&g.length>0);return m.length===0?null:m.map((g,y)=>v.jsxs(J.Fragment,{children:[l(g,y),y<m.length-1&&v.jsx(D.Divider,{})]},`mobile-drawer-group-${y}`))}return r?v.jsx(D.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(D.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(g8,{})}),v.jsx(D.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(D.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(D.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},Ij=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(D.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(D.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},Dj=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(Rj,{label:e,menuOptions:n,icon:v.jsx(b8,{})})},Th=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}=D.useTheme(),a=ao.useNavigate();return v.jsx(D.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(D.Tab,{icon:l.icon,label:l.label,value:u,...Qc(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))})},Pj=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(D.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Th,{menuOptions:e,activeTabIdx:n,sx:r})})},Nj=t=>{const{onToggle:e}=t,{palette:n}=D.useTheme(),r=n.mode==="dark";return v.jsx(D.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(zR,{}):v.jsx(VR,{})})},$pe=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:g}=t,y=ao.useNavigate(),b=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),{palette:S}=D.useTheme(),{pathname:C}=ao.useLocation(),T=S.mode==="dark",[_,w]=A.useState(void 0);A.useEffect(()=>{const j=o.findIndex(P=>P.path&&C.startsWith(P.path));w(j>=0?j:void 0)},[C,o]);const E=s&&v.jsx(Nj,{onToggle:s}),O=s&&(b||!b&&l)?[{icon:T?v.jsx(zR,{}):v.jsx(VR,{}),label:`Switch to ${T?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(D.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(Ij,{...e}),u,v.jsxs(D.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(D.Button,{disableRipple:!0,component:ao.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(D.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!b&&E,b&&v.jsx(Aj,{menuOptionLists:[o,a,O],anchor:"right"}),!b&&v.jsxs(v.Fragment,{children:[v.jsx(D.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((j,P)=>v.jsxs(D.Box,{display:"flex",alignItems:"center",children:[P>0&&v.jsx(D.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(D.Button,{variant:"text",sx:{color:"white"},...Qc(j,y),children:v.jsxs(D.Box,{display:"flex",gap:"3px",alignItems:"center",children:[j.icon,j.label]})})]},j.label))}),p,l&&v.jsx(Dj,{displayName:l,userMenuOptions:O})]})]})]}),!b&&v.jsx(Pj,{featureMenuOptions:o,activeTabIdx:_,sx:g})]})},Bpe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ao.useLocation(),o=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.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&&v.jsx(D.Box,{sx:e,children:v.jsx(D.Card,{sx:{height:"100%",width:200},children:v.jsx(Th,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Vpe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=D.useTheme();return e.length>0&&v.jsx(Th,{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}})},zpe=t=>{const{gap:e=1,...n}=t;return v.jsx(D.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Hpe=t=>v.jsx(_u,{severity:"info",...t}),Wpe=t=>v.jsx(_u,{severity:"warning",...t}),jj=t=>{const{crumbInfo:e}=t,n=ao.useNavigate();return v.jsx(D.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(y8,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(D.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(D.Typography,{color:"primary",children:r},r))})},qpe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Upe(r);return v.jsx(D.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(_u,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:w2(r),warning:w2(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(D.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Upe=t=>t=="logout"?"info":t=="timeout"?"warning":t,w2=t=>{if(t=="timeout")return v.jsx(Bq,{});if(t=="logout")return v.jsx(m8,{})},Kpe=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(D.Box,{sx:a,children:[i.length>0&&v.jsx(jj,{crumbInfo:i}),v.jsxs(D.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(D.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(D.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(qr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(Vq,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(D.Box,{width:l?"100%":"50%",children:s})]})]})},Ype=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return v.jsxs(D.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(D.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(D.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(D.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Gpe({...t}){return v.jsx(Tj,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Jpe=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(y=>y.id));return[...p.filter(y=>!m.has(y.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(y=>{const b=u.find(S=>S.id===y.id);return b||y}),m=new Set(f.map(y=>y.id)),g=u.filter(y=>!m.has(y.id));return[...p,...g]})},[]),a=J.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=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(Ej.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Zpe=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 v.jsx(D.Box,{height:n})};exports.AlertModal=jpe;exports.Autocomplete=DR;exports.Breadcrumbs=jj;exports.Button=qr;exports.Checkbox=PR;exports.CheckboxGroup=bq;exports.CitationField=Mpe;exports.CitationFieldProvider=Jpe;exports.CitationManager=Gpe;exports.Column=zpe;exports.ConfirmationModal=Npe;exports.DarkModeToggle=Nj;exports.DateField=Of;exports.DateRangeField=zQ;exports.DecisionModal=Lpe;exports.Drawer=Aj;exports.DynamicAutocomplete=gq;exports.EnvironmentBanner=Ij;exports.ErrorAlert=Cj;exports.FileList=Sq;exports.FileUpload=NR;exports.FloatingNavBar=Vpe;exports.Footer=Fpe;exports.FormDebugger=Ape;exports.Header=$pe;exports.InfoAlert=Hpe;exports.LoadingButton=V1;exports.LoadingIndicator=Vv;exports.Location=jq;exports.MenuButton=Rj;exports.Modal=Tu;exports.MultiAutocomplete=yq;exports.NavBar=Pj;exports.NotApplicableCheckbox=Oj;exports.PageHeader=Kpe;exports.PaginatedTable=uj;exports.ProfileMenu=Dj;exports.RadioGroup=BR;exports.RangeSlider=Lq;exports.RepeatableFormGroup=Dpe;exports.RichTextField=_fe;exports.Row=xj;exports.ScrollToTop=Rpe;exports.SearchField=O8;exports.Select=Fq;exports.SelectableCitationManager=_j;exports.Sidebar=Bpe;exports.SingleActionCard=Ype;exports.Snackbar=qpe;exports.Spacer=Zpe;exports.Stepper=Ipe;exports.Submit=Ope;exports.SuccessAlert=wj;exports.Switch=$q;exports.Table=cj;exports.Tabs=Th;exports.TextField=Ns;exports.ValidationError=yr;exports.WarningAlert=Wpe;exports.commonTheme=Sn;exports.darkTheme=g6;exports.lightTheme=m6;
package/dist/index.es.js CHANGED
@@ -57802,9 +57802,9 @@ const Fme = (t) => {
57802
57802
  u || // download btn
57803
57803
  _),
57804
57804
  render: (Z, de) => /* @__PURE__ */ ee(Ae, { display: "flex", flexDirection: "row-reverse", children: [
57805
+ _ == null ? void 0 : _(de),
57805
57806
  re(de),
57806
57807
  se(de),
57807
- _ == null ? void 0 : _(de),
57808
57808
  ge(de),
57809
57809
  ae(de),
57810
57810
  Q(de)
package/dist/index.umd.js CHANGED
@@ -397,7 +397,7 @@ img.ProseMirror-separator {
397
397
  `,Jee="️",Zee="‍",b1="";let Tp=null,kp=null;function Xee(t=[]){const e={};dr.groups=e;const n=new dr;Tp==null&&(Tp=FD(Wee)),kp==null&&(kp=FD(qee)),Oe(n,"'",u1),Oe(n,"{",Qc),Oe(n,"}",eu),Oe(n,"[",Qf),Oe(n,"]",ep),Oe(n,"(",tp),Oe(n,")",np),Oe(n,"<",rp),Oe(n,">",op),Oe(n,"(",ip),Oe(n,")",sp),Oe(n,"「",ap),Oe(n,"」",lp),Oe(n,"『",cp),Oe(n,"』",up),Oe(n,"<",dp),Oe(n,">",fp),Oe(n,"&",pp),Oe(n,"*",hp),Oe(n,"@",Ki),Oe(n,"`",mp),Oe(n,"^",yp),Oe(n,":",Yi),Oe(n,",",d1),Oe(n,"$",bp),Oe(n,".",Po),Oe(n,"=",vp),Oe(n,"!",f1),Oe(n,"-",Wr),Oe(n,"%",tu),Oe(n,"|",xp),Oe(n,"+",Sp),Oe(n,"#",Cp),Oe(n,"?",nu),Oe(n,'"',p1),Oe(n,"/",No),Oe(n,";",h1),Oe(n,"~",ru),Oe(n,"_",wp),Oe(n,"\\",gp),Oe(n,"・",ID);const r=cn(n,oi,a1,{[Qv]:!0});cn(r,oi,r);const o=cn(r,ri,OD,{[Jc]:!0}),i=cn(r,ou,AD,{[Zc]:!0}),s=cn(n,ri,ni,{[e1]:!0});cn(s,oi,o),cn(s,ri,s),cn(o,oi,o),cn(o,ri,o);const a=cn(n,ou,o1,{[t1]:!0});cn(a,ri),cn(a,oi,i),cn(a,ou,a),cn(i,oi,i),cn(i,ri),cn(i,ou,i);const l=Oe(n,y1,c1,{[r1]:!0}),u=Oe(n,ND,l1,{[r1]:!0}),f=cn(n,m1,l1,{[r1]:!0});Oe(n,b1,f),Oe(u,y1,l),Oe(u,b1,f),cn(u,m1,f),Oe(f,ND),Oe(f,y1),cn(f,m1,f),Oe(f,b1,f);const p=cn(n,g1,DD,{[ED]:!0});Oe(p,"#"),cn(p,g1,p),Oe(p,Jee,p);const g=Oe(p,Zee);Oe(g,"#"),cn(g,g1,p);const m=[[ri,s],[oi,o]],y=[[ri,null],[ou,a],[oi,i]];for(let b=0;b<Tp.length;b++)Gi(n,Tp[b],i1,ni,m);for(let b=0;b<kp.length;b++)Gi(n,kp[b],s1,o1,y);Ws(i1,{tld:!0,ascii:!0},e),Ws(s1,{utld:!0,alpha:!0},e),Gi(n,"file",Xf,ni,m),Gi(n,"mailto",Xf,ni,m),Gi(n,"http",tl,ni,m),Gi(n,"https",tl,ni,m),Gi(n,"ftp",tl,ni,m),Gi(n,"ftps",tl,ni,m),Ws(Xf,{scheme:!0,ascii:!0},e),Ws(tl,{slashscheme:!0,ascii:!0},e),t=t.sort((b,S)=>b[0]>S[0]?1:-1);for(let b=0;b<t.length;b++){const S=t[b][0],_=t[b][1]?{[Uee]:!0}:{[Kee]:!0};S.indexOf("-")>=0?_[n1]=!0:ri.test(S)?oi.test(S)?_[Jc]=!0:_[e1]=!0:_[Qv]=!0,MD(n,S,S,_)}return MD(n,"localhost",Xc,{ascii:!0}),n.jd=new dr(_p),{start:n,tokens:el({groups:e},PD)}}function LD(t,e){const n=Qee(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,g=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(p=0,g=0,f=a):p>=0&&(p+=n[s].length,g++),u+=n[s].length,i+=n[s].length,s++;i-=p,s-=g,u-=p,o.push({t:f.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function Qee(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 Gi(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 dr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new dr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function FD(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 iu={defaultProtocol:"http",events:null,format:$D,formatHref:$D,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function v1(t,e=null){let n=el({},iu);t&&(n=el(n,t instanceof v1?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}v1.prototype={o:iu,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]:iu[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 $D(t){return t}function BD(t,e){this.t="token",this.v=t,this.tk=e}BD.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=iu.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&&el(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function Ep(t,e){class n extends BD{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 RD=Ep("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),zD=Ep("text"),ete=Ep("nl"),Mp=Ep("url",{isLink:!0,toHref(t=iu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Xc&&t[1].t===Yi}}),qr=t=>new dr(t);function tte({groups:t}){const e=t.domain.concat([pp,hp,Ki,gp,mp,yp,bp,vp,Wr,a1,tu,xp,Sp,Cp,No,_p,ru,wp]),n=[Yi,d1,Po,f1,tu,nu,p1,h1,rp,op,Qc,eu,ep,Qf,tp,np,ip,sp,ap,lp,cp,up,dp,fp],r=[pp,u1,hp,gp,mp,yp,bp,vp,Wr,Qc,eu,tu,xp,Sp,Cp,nu,No,_p,ru,wp],o=qr(),i=Oe(o,ru);lt(i,r,i),lt(i,t.domain,i);const s=qr(),a=qr(),l=qr();lt(o,t.domain,s),lt(o,t.scheme,a),lt(o,t.slashscheme,l),lt(s,r,i),lt(s,t.domain,s);const u=Oe(s,Ki);Oe(i,Ki,u),Oe(a,Ki,u),Oe(l,Ki,u);const f=Oe(i,Po);lt(f,r,i),lt(f,t.domain,i);const p=qr();lt(u,t.domain,p),lt(p,t.domain,p);const g=Oe(p,Po);lt(g,t.domain,p);const m=qr(RD);lt(g,t.tld,m),lt(g,t.utld,m),Oe(u,Xc,m);const y=Oe(p,Wr);Oe(y,Wr,y),lt(y,t.domain,p),lt(m,t.domain,p),Oe(m,Po,g),Oe(m,Wr,y);const b=Oe(m,Yi);lt(b,t.numeric,RD);const S=Oe(s,Wr),C=Oe(s,Po);Oe(S,Wr,S),lt(S,t.domain,s),lt(C,r,i),lt(C,t.domain,s);const _=qr(Mp);lt(C,t.tld,_),lt(C,t.utld,_),lt(_,t.domain,s),lt(_,r,i),Oe(_,Po,C),Oe(_,Wr,S),Oe(_,Ki,u);const T=Oe(_,Yi),w=qr(Mp);lt(T,t.numeric,w);const E=qr(Mp),O=qr();lt(E,e,E),lt(E,n,O),lt(O,e,E),lt(O,n,O),Oe(_,No,E),Oe(w,No,E);const F=Oe(a,Yi),N=Oe(l,Yi),$=Oe(N,No),M=Oe($,No);lt(a,t.domain,s),Oe(a,Po,C),Oe(a,Wr,S),lt(l,t.domain,s),Oe(l,Po,C),Oe(l,Wr,S),lt(F,t.domain,E),Oe(F,No,E),Oe(F,nu,E),lt(M,t.domain,E),lt(M,e,E),Oe(M,No,E);const A=[[Qc,eu],[Qf,ep],[tp,np],[rp,op],[ip,sp],[ap,lp],[cp,up],[dp,fp]];for(let H=0;H<A.length;H++){const[z,R]=A[H],B=Oe(E,z);Oe(O,z,B),Oe(B,R,E);const L=qr(Mp);lt(B,e,L);const W=qr();lt(B,n),lt(L,e,L),lt(L,n,W),lt(W,e,L),lt(W,n,W),Oe(L,R,E),Oe(W,R,E)}return Oe(o,Xc,_),Oe(o,c1,ete),{start:o,tokens:PD}}function nte(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,g=-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()?(g=0,p=a):g>=0&&g++,o++,f++;if(g<0)o-=f,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(x1(zD,e,s)),s=[]),o-=g,f-=g;const m=p.t,y=n.slice(o-f,o);i.push(x1(m,e,y))}}return s.length>0&&i.push(x1(zD,e,s)),i}function x1(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 rte=typeof console<"u"&&console&&console.warn||(()=>{}),ote="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 ite(){return dr.groups={},Kt.scanner=null,Kt.parser=null,Kt.tokenQueue=[],Kt.pluginQueue=[],Kt.customSchemes=[],Kt.initialized=!1,Kt}function VD(t,e=!1){if(Kt.initialized&&rte(`linkifyjs: already initialized - will not register custom scheme "${t}" ${ote}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
398
398
  1. Must only contain digits, lowercase ASCII letters or "-"
399
399
  2. Cannot start or end with "-"
400
- 3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function ste(){Kt.scanner=Xee(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=tte(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 S1(t){return Kt.initialized||ste(),nte(Kt.parser.start,t,LD(Kt.scanner.start,t))}S1.scan=LD;function HD(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 v1(n),o=S1(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}function ate(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function lte(t){return new en({key:new bn("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=_K(n.doc,[...e]);if(AK(a).forEach(({newRange:u})=>{const f=kK(r.doc,u,m=>m.isTextblock);let p,g;if(f.length>1?(p=f[0],g=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=f[0],g=r.doc.textBetween(p.pos,u.to,void 0," ")),p&&g){const m=g.split(" ").filter(C=>C!=="");if(m.length<=0)return!1;const y=m[m.length-1],b=p.pos+g.lastIndexOf(y);if(!y)return!1;const S=S1(y).map(C=>C.toObject(t.defaultProtocol));if(!ate(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:b+C.start+1,to:b+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{cy(C.from,C.to,r.doc).some(_=>_.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function cte(t){return new en({key:new bn("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(g=>g.nodeName==="A"))return!1;const l=ly(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 ute(t){return new en({key:new bn("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=HD(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const dte=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;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(dte,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const fte=ur.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"){VD(t);return}VD(t.scheme,t.optionalSlashes)})},onDestroy(){ite()},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",yt(this.options.HTMLAttributes,t),0]:["a",yt(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[Vi({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=HD(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(lte({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(cte({type:this.type})),this.options.linkOnPaste&&t.push(ute({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),jD=tn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",yt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function pte(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=eY(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",g=o?"":u,m=l?new RegExp(`${p}${u}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const b=a.pos-y.length,S=Array.from(y.matchAll(m)).pop();if(!S||S.input===void 0||S.index===void 0)return null;const C=S.input.slice(Math.max(0,S.index-1),S.index),_=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!_)return null;const T=b+S.index;let w=T+S[0].length;return l&&f.test(y.slice(w-1,w+1))&&(S[0]+=" ",w+=1),T<a.pos&&w>=a.pos?{range:{from:T,to:w},query:S[0].slice(n.length),text:S[0]}:null}const hte=new bn("suggestion");function gte({pluginKey:t=hte,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:f=()=>[],render:p=()=>({}),allow:g=()=>!0,findSuggestionMatch:m=pte}){let y;const b=p==null?void 0:p(),S=new en({key:t,view(){return{update:async(C,_)=>{var T,w,E,O,F,N,$;const M=(T=this.key)===null||T===void 0?void 0:T.getState(_),A=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),H=M.active&&A.active&&M.range.from!==A.range.from,z=!M.active&&A.active,R=M.active&&!A.active,B=!z&&!R&&M.query!==A.query,L=z||H&&B,W=B||H,q=R||H&&B;if(!L&&!W&&!q)return;const K=q&&!L?M:A,U=C.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);y={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:X=>u({editor:e,range:K.range,props:X}),decorationNode:U,clientRect:U?()=>{var X;const{decorationId:pe}=(X=this.key)===null||X===void 0?void 0:X.getState(e.state),he=C.dom.querySelector(`[data-decoration-id="${pe}"]`);return(he==null?void 0:he.getBoundingClientRect())||null}:null},L&&((E=b==null?void 0:b.onBeforeStart)===null||E===void 0||E.call(b,y)),W&&((O=b==null?void 0:b.onBeforeUpdate)===null||O===void 0||O.call(b,y)),(W||L)&&(y.items=await f({editor:e,query:K.query})),q&&((F=b==null?void 0:b.onExit)===null||F===void 0||F.call(b,y)),W&&((N=b==null?void 0:b.onUpdate)===null||N===void 0||N.call(b,y)),L&&(($=b==null?void 0:b.onStart)===null||$===void 0||$.call(b,y))},destroy:()=>{var C;y&&((C=b==null?void 0:b.onExit)===null||C===void 0||C.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,T,w){const{isEditable:E}=e,{composing:O}=e.view,{selection:F}=C,{empty:N,from:$}=F,M={..._};if(M.composing=O,E&&(N||e.view.composing)){($<_.range.from||$>_.range.to)&&!O&&!_.composing&&(M.active=!1);const A=m({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:F.$from}),H=`id_${Math.floor(Math.random()*4294967295)}`;A&&g({editor:e,state:w,range:A.range,isActive:_.active})?(M.active=!0,M.decorationId=_.decorationId?_.decorationId:H,M.range=A.range,M.query=A.query,M.text=A.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,_){var T;const{active:w,range:E}=S.getState(C.state);return w&&((T=b==null?void 0:b.onKeyDown)===null||T===void 0?void 0:T.call(b,{view:C,event:_,range:E}))||!1},decorations(C){const{active:_,range:T,decorationId:w}=S.getState(C);return _?Zt.create(C.doc,[Ln.inline(T.from,T.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const mte=new bn("mention"),yte=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",yt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:mte,command:({editor:t,range:e,props:n})=>{var r,o,i;const s=t.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(o=t.view.dom.ownerDocument.defaultView)===null||o===void 0?void 0:o.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},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}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=yt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[gte({editor:this.editor,...this.options.suggestion})]}}),bte="listItem",WD="textStyle",qD=/^(\d+)\.\s$/,UD=tn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",yt(this.options.HTMLAttributes,n),0]:["ol",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bte,this.editor.getAttributes(WD)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=qa({find:qD,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=qa({find:qD,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(WD)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),KD=tn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),YD=sn.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 bn("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&&_f(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Ln.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}),Zt.create(t,o)}}})]}}),vte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,xte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,GD=ur.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Fs({find:vte,type:this.type})]},addPasteRules(){return[Vi({find:xte,type:this.type})]}}),Ste=ur.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",yt(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()}}}),Cte=ur.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),wte=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",yt(this.options.HTMLAttributes,t),0]}}),_te=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",yt(this.options.HTMLAttributes,t),0]}}),Tte=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}}),kte=/^\s*(\[([( |x])?\])\s$/,Ete=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},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",yt(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");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const g=n();if(typeof g!="number")return!1;const m=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...m==null?void 0:m.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[qa({find:kte,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Mte=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",yt(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()}}}),JD=tn.create({name:"text",group:"inline"}),Ote=sn.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)}},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")}}}),Ate=ur.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),ZD=J.forwardRef((t,e)=>{const[n,r]=J.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 J.useEffect(()=>r(0),[t.items]),J.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?v.jsx(I.Paper,{elevation:5,children:v.jsx(I.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(I.ListItem,{disablePadding:!0,children:v.jsx(I.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});ZD.displayName="SuggestionList";const XD={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Ite={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 oI(ZD,{props:n,editor:n.editor}),e=Wc("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??XD},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))??XD}})},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}}}},Dte=fte.extend({inclusive:!1}),Pte=Ste.extend({excludes:"superscript"}),Nte=Cte.extend({excludes:"subscript"});function Lte({placeholder:t}={}){return J.useMemo(()=>[ree.configure({resizable:!0}),Tte,_te,wte,dD,pD,hD,yD,jD,UD,KD,Pte,Nte,JD,lD,aD,fD,kD,Ate,GD,Dte.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),QG,mD,GX,Ote.configure({types:["heading","paragraph","image"]}),mee,yee,xee,KX,Aee.configure({multicolor:!0}),TD,nQ,gD,Mte,Ete.configure({nested:!0}),yte.configure({suggestion:Ite}),YD.configure({placeholder:t}),_D],[t])}function QD(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Fte=t=>{const e=Lte({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(TZ,{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;J.useEffect(()=>{var C,_,T;(T=(_=(C=g==null?void 0:g.current)==null?void 0:C.editor)==null?void 0:_.commands)==null||T.setContent(p)},[p]);const g=J.useRef(null),m=J.useCallback((C,_)=>{var w;const T=(w=g.current)==null?void 0:w.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(E=>{Rv({images:E,editor:T,position:_})});else{const E=i(C);Rv({images:E,editor:T,position:_})}},[]),y=J.useCallback((C,_,T,w)=>{var O;if(!(_ instanceof DragEvent)||!_.dataTransfer)return!1;const E=QD(_.dataTransfer.files);if(E.length>0){const F=(O=C.posAtCoords({left:_.clientX,top:_.clientY}))==null?void 0:O.pos;return m(E,F),_.preventDefault(),!0}return!1},[m]),b=J.useCallback((C,_,T)=>{if(!_.clipboardData)return!1;const w=QD(_.clipboardData.files);return w.length>0?(m(w),!0):!1},[m]),S=v.jsx(I.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(uI,{ref:g,extensions:e,content:p,editable:!s,editorProps:{handleDrop:y,handlePaste:b},renderControls:s?void 0:()=>v.jsx(oee,{onUploadFiles:i}),onBlur:()=>{var C,_;return f(((_=(C=g.current)==null?void 0:C.editor)==null?void 0:_.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(EA,{}),v.jsx(dI,{})]})})});return v.jsxs(I.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(I.Typography,{...o,children:r}),S]})},C1=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(I.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(I.Box,{className:"text-content",children:[v.jsx(I.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(I.Typography,{"data-testid":"message",children:n})]}),v.jsx(I.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},eP=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?v.jsx(I.Collapse,{in:n,children:u}):v.jsx(I.TableRow,{sx:p,children:v.jsx(I.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(I.Collapse,{in:n,children:u})})})},tP=t=>{const{id:e,getRowKey:n=G=>"id"in G&&(typeof G.id=="string"||typeof G.id=="number")?G.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(G)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(G)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:g=!1,className:m,emptyTableMsg:y="No items to display",errorTableMsg:b,retryCallback:S,isLoading:C=!1,disableMobileCards:_=!1,highlightSelectedRow:T=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,tooltipColor:F,...N}=t,{palette:$}=I.useTheme(),[M,A]=J.useState(void 0),[H,z]=J.useState(void 0);Array.isArray(g)&&(!s&&g.length!==r.length&&console.warn('Table component: Length of "fixedLayout" is not equal to the length of "columns".'),s&&g.length!==r.length+1&&console.warn(`Table component: 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".`)),s&&i&&console.warn("Table component: renderExpand & onRowClick are both defined. Only one should be defined at a time.");const R=G=>{G!==l?f&&f(G,"asc"):f&&f(l,u==="asc"?"desc":"asc")},B=G=>l===G?u:null,L=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),W=L&&a?r.filter(G=>!(a.includes(G.fieldName)||G.hideCol)):r.filter(G=>!G.hideCol);s&&!L&&W.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:G=>{const Q=M===G;return v.jsx(I.IconButton,{"data-testid":"expand-collapse-btn","aria-label":Q?"collapse row":"expand row",size:"small",onClick:()=>ae(G),children:Q?v.jsx(Qu,{"data-testid":"collapse-up"}):v.jsx(ug,{"data-testid":"expand-down"})})}});const q=(G,Q)=>Q.split(".").reduce((fe,Se)=>{if(fe&&typeof fe=="object")return fe[Se]},G),K=(G,Q)=>{const fe=q(Q,G.fieldName);return G.render?G.render(fe,Q,L):fe},U=f!==void 0,X=G=>U?p?p.includes(G):!0:!1,pe=v.jsxs(I.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx($R,{})," ",y]}),he=v.jsxs(I.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(mC,{color:"error"})," ",b,S&&v.jsx(I.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ge=()=>{if(C)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:v.jsx(I.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(C1,{})})})});if(b)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:pe})})},Z=()=>{if(C)return v.jsx(C1,{});if(b)return he;if(o.length===0)return pe},ue=G=>{T&&z(G)},de=G=>{i&&(i(G),ue(G))},ae=G=>{const Q=M===G?void 0:G;A(Q),ue(Q)},oe=G=>{if(!s)return;const Q=M===n(G);return v.jsxs(v.Fragment,{children:[v.jsxs(I.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>ae(n(G)),children:[Q?v.jsx(Qu,{}):v.jsx(ug,{})," Show"," ",Q?"Less":"More"]}),v.jsx(eP,{colSpan:r.length,isExpanded:n(G)===M,obj:G,renderExpand:fe=>s(fe),asMobileCard:!0})]})},le=typeof T=="string"?T:$.grey[$.mode=="dark"?600:50],ye=G=>{const Q=H===n(G)?le:"inherit";return{cursor:i?"pointer":"default",backgroundColor:Q,...s?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:Q===le?aa(Q,.1):le}}}},te=$.grey[$.mode==="dark"?600:400],ie=G=>G&&v.jsx(I.Tooltip,{title:G,children:v.jsx(LR,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:F??te}})});return L&&!_?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:m,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(I.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:G=>R(G.target.value),fullWidth:!0,children:W.map(G=>{if(X(G.fieldName))return v.jsx(I.MenuItem,{value:G.sortName??G.fieldName,children:G.label??_n(G.fieldName)},`${G.key??"rowHeader"}-${G.fieldName}`)})}),v.jsx(I.IconButton,{onClick:()=>{l&&R(l)},children:v.jsx(UR,{className:`sort-icon-${u}`})})]}),v.jsx(I.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(G=>v.jsxs(I.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(G)},onClick:()=>de(n(G)),"data-testid":`card-${n(G)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:W.map(Q=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Q.fieldName}`,style:{textWrap:"nowrap"},children:[Q.label??_n(Q.fieldName),ie(Q.tooltip)]}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Q.fieldName}`,style:{paddingLeft:"10px"},children:K(Q,G)})]},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))})}),oe(G)]},n(G)))]}):v.jsx(I.TableContainer,{component:I.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:m,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(I.Table,{stickyHeader:E!=="undefined",style:{tableLayout:g?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...N,children:[v.jsx(I.TableHead,{className:"MBv2_Table_Head",children:v.jsx(I.TableRow,{className:"MBv2_Table_Head_Row",children:W.map((G,Q)=>{const fe=X(G.fieldName);return v.jsx(I.TableCell,{width:Array.isArray(g)?g[Q]:"auto",sx:G.tableCellSx??{},children:v.jsx(I.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(I.Box,{sx:[fe&&{"&:hover":{cursor:"pointer",backgroundColor:$.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:fe?()=>R(G.sortName??G.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:G.label??_n(G.fieldName)}),ie(G.tooltip),fe&&B(G.fieldName)==="asc"&&v.jsx(Qu,{style:{marginLeft:"5px"}}),fe&&B(G.fieldName)==="desc"&&v.jsx(ug,{style:{marginLeft:"5px"}}),fe&&B(G.fieldName)!=="asc"&&B(G.fieldName)!=="desc"&&v.jsx(jR,{style:{marginLeft:"5px"}})]})})},`${G.key??"rowHeader"}-${G.fieldName}`)})})}),v.jsx(I.TableBody,{className:"MBv2_Table_Body",children:ge()??o.map(G=>v.jsxs(J.Fragment,{children:[v.jsx(I.TableRow,{"data-testid":`row-${n(G)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(n(G)),sx:ye(G),children:W.map(Q=>v.jsx(I.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Q.fieldName}`,children:K(Q,G)},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))}),s&&v.jsx(eP,{colSpan:W.length,isExpanded:n(G)===M,obj:G,renderExpand:Q=>s(Q),reRenderExpand:O})]},n(G)))})]})})},nP=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,g=S=>{n(S)},m=S=>{r(parseInt(S.target.value,10))},y=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),b=!t.data||t.data&&t.data.length===0;return v.jsxs(I.Box,{children:[v.jsx(tP,{sortOrder:p,sortField:f,...s}),!o&&!b&&v.jsx(I.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:y?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>g(C),onRowsPerPageChange:m,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},rP=()=>({height:window.innerHeight,width:window.innerWidth}),oP=()=>{const[t,e]=J.useState(rP());return J.useEffect(()=>{const n=()=>{e(rP())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Ur=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=oP(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(I.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...Jn({...t},a)})},$te=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(I.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(I.Box,{component:I.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[v.jsxs(I.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",v.jsx("br",{}),v.jsx("b",{children:e.url}),"?"]}),v.jsxs(I.Box,{display:"flex",flexDirection:"row",children:[v.jsx(Ur,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(Ur,{size:"small",startIcon:v.jsx(dg,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Bte=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(I.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(I.Box,{component:I.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(I.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(I.Box,{display:"flex",flexDirection:"row",children:[v.jsx(Ur,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(Ur,{size:"small",color:"error",startIcon:v.jsx(Yh,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Rte=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:g,selectedIds:m,setSelectedIds:y,onError:b=()=>{},condenseTable:S=!1,canSelect:C=!1,canLaunchUrl:_,addlActions:T,readOnly:w=!1,showCloseBtn:E=!1}=t,O=!!t.canCreate&&!w,F=!!t.canEdit&&!w,N=!!t.canDelete&&!w,{palette:$}=I.useTheme(),[M,A]=J.useState([]),[H,z]=J.useState(!1),[R,B]=J.useState(!0),[L,W]=J.useState(null),[q,K]=J.useState(null),[U,X]=J.useState(null),[pe,he]=J.useState({pageNo:0,pageSize:S?5:10,totalCount:0}),ge=()=>{z(!1),B(!0),g({pageNo:pe.pageNo,pageSize:pe.pageSize}).then(Q=>(A(Q.data),he({...pe,totalCount:Q.totalCount}),Q)).catch(Q=>{b(Q),z(!0),A([])}).finally(()=>B(!1))};J.useEffect(ge,[pe.pageNo,pe.pageSize,e]);const Z=()=>{K(null),X(null),W(null)},ue=v.jsx(Ur,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:o,startIcon:v.jsx(ed,{}),children:"Add Citation"}),de=v.jsx(Ur,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:i,startIcon:v.jsx(WC,{}),children:"Add Attachment"}),ae=Q=>{if(!(!F&&!w)&&!(w&&!S))return v.jsx(I.Tooltip,{title:w?"View":"Edit",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>Q.fileName?a(Q):s(Q),"data-testid":`citation-table_edit-btn-${Q.id}`,children:w?v.jsx(ZR,{}):v.jsx(bR,{})})})},oe=Q=>{if(!(!N||w))return v.jsx(I.Tooltip,{title:"Delete",children:v.jsx(I.IconButton,{color:"error",onClick:fe=>{K(Q),W(fe.currentTarget)},"data-testid":`citation-table_delete-btn-${Q.id}`,children:v.jsx(Yh,{})})})},le=Q=>{if(!_)return;if(!Q.fileName)return v.jsx(I.Tooltip,{title:"Open URL",children:v.jsx(I.IconButton,{color:"primary",onClick:Se=>{W(Se.currentTarget),X(Q)},"data-testid":`citation-table_launch-link-btn-${Q.id}`,sx:{visibility:_!=null&&_(Q)?"visible":"hidden"},children:v.jsx(dg,{})})})},ye=Q=>{if(!f||!Q.fileName)return;const fe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],Se=Q.fileName.split(".").pop();if(!(!Se||!fe.includes(Se)))return v.jsx(I.Tooltip,{title:"View File",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(Q),"data-testid":`citation-table_view-file-btn-${Q.id}`,children:v.jsx(dg,{})})})},te=Q=>{if(!u)return;if(!!Q.fileName)return v.jsx(I.Tooltip,{title:"Download",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(Q),"data-testid":`citation-table_download-btn-${Q.id}`,children:v.jsx(yR,{})})})},G=[{fieldName:"id",key:"select",label:"",hideCol:!C,render:(Q,fe)=>v.jsx(I.Checkbox,{"data-testid":`citation-table_checkbox-${Q}`,onChange:()=>{const Se=m.includes(fe.id);y(Se?m.filter(Ee=>Ee!==fe.id):[...m,fe.id])},checked:m.includes(Q),disabled:w})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(Q,fe)=>v.jsx(I.Tooltip,{title:Q?"Attachment":"URL",children:Q?v.jsx(WC,{sx:{color:$.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${fe.id}`}):v.jsx(ed,{sx:{color:$.grey[500],marginTop:"6px"},"data-testid":`url-icon-${fe.id}`})})},{fieldName:"title",tableCellSx:{width:S?"100%":"auto"},render:Q=>S?Fl.truncate(Q,{length:40,omission:"..."}):Q},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:S,render:(Q,fe)=>v.jsx("span",{style:{wordBreak:"break-all"},children:Q||fe.url})},{fieldName:"source",hideCol:S},{fieldName:"accessedAt",hideCol:S,render:(Q,fe)=>{if(!fe.fileName)return(Q==null?void 0:Q.slice(0,10))??""}},{fieldName:"classification",hideCol:S},{fieldName:"id",key:"Action",label:"Action",hideCol:!(w||F||N||_||f||u||T),render:(Q,fe)=>v.jsxs(I.Box,{display:"flex",flexDirection:"row-reverse",children:[oe(fe),ae(fe),T==null?void 0:T(fe),ye(fe),le(fe),te(fe)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(I.Typography,{variant:S?"h6":"h2",children:n}),!C&&O&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",gap:1,children:[ue,de]}),E&&v.jsx(I.IconButton,{onClick:r,children:v.jsx(Xu,{})})]}),v.jsx(nP,{"data-testid":"citation-table",size:S?"x-small":"medium",isLoading:R,columns:G,data:M,paginationState:pe,onPageChange:Q=>he({...pe,pageNo:Q}),onRowsPerPageChange:Q=>he({...pe,pageSize:Q,pageNo:0}),errorTableMsg:H?"Failed to load citations.":void 0,retryCallback:ge}),C&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(I.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:O&&v.jsxs(v.Fragment,{children:[ue,de]})}),!w&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(Ur,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),v.jsxs(Ur,{variant:"contained",size:"small",onClick:()=>p(m),children:["Select",m.length>0&&` (${m.length})`]})]})]}),v.jsx($te,{citation:U,anchorEl:L,onClose:Z}),v.jsx(Bte,{citation:q,anchorEl:L,onDeleteCitation:l,onClose:Z})]})},w1=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return v.jsx(Ur,{type:n,disabled:e,size:r,startIcon:e?v.jsx(I.CircularProgress,{size:s,color:"inherit"}):null,...o})};var _1,iP;function zte(){if(iP)return _1;iP=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,_){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=_};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);_1={Cache:t,split:p,normalizePath:f,setter:function(C){var _=f(C);return l.get(C)||l.set(C,function(w,E){for(var O=0,F=_.length,N=w;O<F-1;){var $=_[O];if($==="__proto__"||$==="constructor"||$==="prototype")return w;N=N[_[O++]]}N[_[O]]=E})},getter:function(C,_){var T=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,F=T.length;O<F;)if(E!=null||!_)E=E[T[O++]];else return;return E})},join:function(C){return C.reduce(function(_,T){return _+(m(T)||n.test(T)?"["+T+"]":(_?".":"")+T)},"")},forEach:function(C,_,T){g(Array.isArray(C)?C:p(C),_,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(_){return _.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function g(C,_,T){var w=C.length,E,O,F,N;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),N=m(E),F=!N&&/^\d+$/.test(E),_.call(T,E,N,F,O,C))}function m(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function y(C){return C.match(r)&&!C.match(n)}function b(C){return o.test(C)}function S(C){return!m(C)&&(y(C)||b(C))}return _1}var Us=zte(),T1,sP;function Vte(){if(sP)return T1;sP=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,g)=>`${p}${p?g[0].toUpperCase()+g.slice(1).toLowerCase():g.toLowerCase()}`,"");return T1={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(" ")},T1}var k1=Vte(),Op={exports:{}},aP;function Hte(){if(aP)return Op.exports;aP=1,Op.exports=function(o){return t(e(o),o)},Op.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(m){if(!p.has(m[0])||!p.has(m[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||g(o[u],u,new Set);return a;function g(m,y,b){if(b.has(m)){var S;try{S=", node was:"+JSON.stringify(m)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(m))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(m));if(!l[y]){l[y]=!0;var C=f.get(m)||new Set;if(C=Array.from(C),y=C.length){b.add(m);do{var _=C[--y];g(_,p.get(_),b)}while(y);b.delete(m)}a[--s]=m}}}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 Op.exports}var jte=Hte();const Wte=Zn(jte),qte=Object.prototype.toString,Ute=Error.prototype.toString,Kte=RegExp.prototype.toString,Yte=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Gte=/^Symbol\((.*)\)(.*)$/;function Jte(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function lP(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Jte(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Yte.call(t).replace(Gte,"Symbol($1)");const r=qte.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Ute.call(t)+"]":r==="RegExp"?Kte.call(t):null}function Ji(t,e){let n=lP(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=lP(this[r],e);return i!==null?i:o},2)}function cP(t){return t==null?[]:[].concat(t)}let uP,dP,fP,Zte=/\$\{\s*(\w+)\s*\}/g;uP=Symbol.toStringTag;class pP{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[uP]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],cP(e).forEach(i=>{if(fr.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]}}dP=Symbol.hasInstance,fP=Symbol.toStringTag;class fr 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(Zte,(o,i)=>Ji(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 pP(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[fP]="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,fr)}static[dP](e){return pP[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Lo={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 \`${Ji(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ji(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ji(n,!0)}\``+o}},pr={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"},Xte={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"},E1={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Qte={isValue:"${path} field must be ${value}"},Ap={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:Lo,string:pr,number:Xte,date:E1,object:Ap,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:Qte,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: \`${Ji(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: \`${Ji(n,!0)}\``}return fr.formatError(Lo.notType,t)}}});const M1=t=>t&&t.__isYupSchema__;class Ip{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 Ip(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(!M1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Dp={context:"$",value:"."};class Ks{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]===Dp.context,this.isValue=this.key[0]===Dp.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Dp.context:this.isValue?Dp.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Us.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}}Ks.prototype.__isYupRef=!0;const Ys=t=>t==null;function nl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:g,skipAbsent:m}=t;let{parent:y,context:b,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function _(A){return Ks.isRef(A)?A.getValue(n,y,b):A}function T(A={}){const H=Object.assign({value:n,originalValue:i,label:s.spec.label,path:A.path||r,spec:s.spec,disableStackTrace:A.disableStackTrace||C},p,A.params);for(const R of Object.keys(H))H[R]=_(H[R]);const z=new fr(fr.formatError(A.message||g,H),n,H.path,A.type||u,H.disableStackTrace);return z.params=H,z}const w=S?a:l;let E={path:r,parent:y,type:u,from:o.from,createError:T,resolve:_,options:o,originalValue:i,schema:s};const O=A=>{fr.isError(A)?w(A):A?l(null):w(T())},F=A=>{fr.isError(A)?w(A):a(A)};if(m&&Ys(n))return O(!0);let $;try{var M;if($=f.call(E,n,E),typeof((M=$)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve($).then(O,F)}}catch(A){F(A);return}O($)}return e.OPTIONS=t,e}function ene(t,e,n,r=n){let o,i,s;return e?(Us.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",g=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&&g>=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[g],t=p?t.spec.types[g]: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 Pp extends Set{describe(){const e=[];for(const n of this.values())e.push(Ks.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 Pp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function rl(t,e=new Map){if(M1(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]=rl(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,rl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(rl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=rl(o,e)}else throw Error(`Unable to clone ${t}`);return n}class Fo{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 Pp,this._blacklist=new Pp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Lo.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=rl(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({value:e},n)),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ys(i))return i;let s=Ji(e),a=Ji(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
400
+ 3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function ste(){Kt.scanner=Xee(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=tte(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 S1(t){return Kt.initialized||ste(),nte(Kt.parser.start,t,LD(Kt.scanner.start,t))}S1.scan=LD;function HD(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 v1(n),o=S1(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}function ate(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function lte(t){return new en({key:new bn("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=_K(n.doc,[...e]);if(AK(a).forEach(({newRange:u})=>{const f=kK(r.doc,u,m=>m.isTextblock);let p,g;if(f.length>1?(p=f[0],g=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=f[0],g=r.doc.textBetween(p.pos,u.to,void 0," ")),p&&g){const m=g.split(" ").filter(C=>C!=="");if(m.length<=0)return!1;const y=m[m.length-1],b=p.pos+g.lastIndexOf(y);if(!y)return!1;const S=S1(y).map(C=>C.toObject(t.defaultProtocol));if(!ate(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:b+C.start+1,to:b+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{cy(C.from,C.to,r.doc).some(_=>_.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function cte(t){return new en({key:new bn("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(g=>g.nodeName==="A"))return!1;const l=ly(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 ute(t){return new en({key:new bn("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=HD(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const dte=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;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(dte,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const fte=ur.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"){VD(t);return}VD(t.scheme,t.optionalSlashes)})},onDestroy(){ite()},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",yt(this.options.HTMLAttributes,t),0]:["a",yt(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[Vi({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=HD(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(lte({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(cte({type:this.type})),this.options.linkOnPaste&&t.push(ute({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),jD=tn.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",yt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function pte(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=eY(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",g=o?"":u,m=l?new RegExp(`${p}${u}.*?(?=\\s${g}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${g}]*`,"gm"),y=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!y)return null;const b=a.pos-y.length,S=Array.from(y.matchAll(m)).pop();if(!S||S.input===void 0||S.index===void 0)return null;const C=S.input.slice(Math.max(0,S.index-1),S.index),_=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!_)return null;const T=b+S.index;let w=T+S[0].length;return l&&f.test(y.slice(w-1,w+1))&&(S[0]+=" ",w+=1),T<a.pos&&w>=a.pos?{range:{from:T,to:w},query:S[0].slice(n.length),text:S[0]}:null}const hte=new bn("suggestion");function gte({pluginKey:t=hte,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:f=()=>[],render:p=()=>({}),allow:g=()=>!0,findSuggestionMatch:m=pte}){let y;const b=p==null?void 0:p(),S=new en({key:t,view(){return{update:async(C,_)=>{var T,w,E,O,F,N,$;const M=(T=this.key)===null||T===void 0?void 0:T.getState(_),A=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),H=M.active&&A.active&&M.range.from!==A.range.from,z=!M.active&&A.active,R=M.active&&!A.active,B=!z&&!R&&M.query!==A.query,L=z||H&&B,W=B||H,q=R||H&&B;if(!L&&!W&&!q)return;const K=q&&!L?M:A,U=C.dom.querySelector(`[data-decoration-id="${K.decorationId}"]`);y={editor:e,range:K.range,query:K.query,text:K.text,items:[],command:X=>u({editor:e,range:K.range,props:X}),decorationNode:U,clientRect:U?()=>{var X;const{decorationId:pe}=(X=this.key)===null||X===void 0?void 0:X.getState(e.state),he=C.dom.querySelector(`[data-decoration-id="${pe}"]`);return(he==null?void 0:he.getBoundingClientRect())||null}:null},L&&((E=b==null?void 0:b.onBeforeStart)===null||E===void 0||E.call(b,y)),W&&((O=b==null?void 0:b.onBeforeUpdate)===null||O===void 0||O.call(b,y)),(W||L)&&(y.items=await f({editor:e,query:K.query})),q&&((F=b==null?void 0:b.onExit)===null||F===void 0||F.call(b,y)),W&&((N=b==null?void 0:b.onUpdate)===null||N===void 0||N.call(b,y)),L&&(($=b==null?void 0:b.onStart)===null||$===void 0||$.call(b,y))},destroy:()=>{var C;y&&((C=b==null?void 0:b.onExit)===null||C===void 0||C.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,T,w){const{isEditable:E}=e,{composing:O}=e.view,{selection:F}=C,{empty:N,from:$}=F,M={..._};if(M.composing=O,E&&(N||e.view.composing)){($<_.range.from||$>_.range.to)&&!O&&!_.composing&&(M.active=!1);const A=m({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:F.$from}),H=`id_${Math.floor(Math.random()*4294967295)}`;A&&g({editor:e,state:w,range:A.range,isActive:_.active})?(M.active=!0,M.decorationId=_.decorationId?_.decorationId:H,M.range=A.range,M.query=A.query,M.text=A.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,_){var T;const{active:w,range:E}=S.getState(C.state);return w&&((T=b==null?void 0:b.onKeyDown)===null||T===void 0?void 0:T.call(b,{view:C,event:_,range:E}))||!1},decorations(C){const{active:_,range:T,decorationId:w}=S.getState(C);return _?Zt.create(C.doc,[Ln.inline(T.from,T.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const mte=new bn("mention"),yte=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",yt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:mte,command:({editor:t,range:e,props:n})=>{var r,o,i;const s=t.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(o=t.view.dom.ownerDocument.defaultView)===null||o===void 0?void 0:o.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},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}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=yt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",yt({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[gte({editor:this.editor,...this.options.suggestion})]}}),bte="listItem",WD="textStyle",qD=/^(\d+)\.\s$/,UD=tn.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",yt(this.options.HTMLAttributes,n),0]:["ol",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(bte,this.editor.getAttributes(WD)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=qa({find:qD,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=qa({find:qD,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(WD)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),KD=tn.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),YD=sn.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 bn("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&&_f(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Ln.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}),Zt.create(t,o)}}})]}}),vte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,xte=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,GD=ur.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Fs({find:vte,type:this.type})]},addPasteRules(){return[Vi({find:xte,type:this.type})]}}),Ste=ur.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",yt(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()}}}),Cte=ur.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),wte=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",yt(this.options.HTMLAttributes,t),0]}}),_te=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",yt(this.options.HTMLAttributes,t),0]}}),Tte=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}}),kte=/^\s*(\[([( |x])?\])\s$/,Ete=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},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",yt(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");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const g=n();if(typeof g!="number")return!1;const m=p.doc.nodeAt(g);return p.setNodeMarkup(g,void 0,{...m==null?void 0:m.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[qa({find:kte,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Mte=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",yt(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()}}}),JD=tn.create({name:"text",group:"inline"}),Ote=sn.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)}},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")}}}),Ate=ur.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),ZD=J.forwardRef((t,e)=>{const[n,r]=J.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 J.useEffect(()=>r(0),[t.items]),J.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?v.jsx(I.Paper,{elevation:5,children:v.jsx(I.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(I.ListItem,{disablePadding:!0,children:v.jsx(I.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});ZD.displayName="SuggestionList";const XD={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Ite={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 oI(ZD,{props:n,editor:n.editor}),e=Wc("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??XD},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))??XD}})},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}}}},Dte=fte.extend({inclusive:!1}),Pte=Ste.extend({excludes:"superscript"}),Nte=Cte.extend({excludes:"subscript"});function Lte({placeholder:t}={}){return J.useMemo(()=>[ree.configure({resizable:!0}),Tte,_te,wte,dD,pD,hD,yD,jD,UD,KD,Pte,Nte,JD,lD,aD,fD,kD,Ate,GD,Dte.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),QG,mD,GX,Ote.configure({types:["heading","paragraph","image"]}),mee,yee,xee,KX,Aee.configure({multicolor:!0}),TD,nQ,gD,Mte,Ete.configure({nested:!0}),yte.configure({suggestion:Ite}),YD.configure({placeholder:t}),_D],[t])}function QD(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Fte=t=>{const e=Lte({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(TZ,{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;J.useEffect(()=>{var C,_,T;(T=(_=(C=g==null?void 0:g.current)==null?void 0:C.editor)==null?void 0:_.commands)==null||T.setContent(p)},[p]);const g=J.useRef(null),m=J.useCallback((C,_)=>{var w;const T=(w=g.current)==null?void 0:w.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(E=>{Rv({images:E,editor:T,position:_})});else{const E=i(C);Rv({images:E,editor:T,position:_})}},[]),y=J.useCallback((C,_,T,w)=>{var O;if(!(_ instanceof DragEvent)||!_.dataTransfer)return!1;const E=QD(_.dataTransfer.files);if(E.length>0){const F=(O=C.posAtCoords({left:_.clientX,top:_.clientY}))==null?void 0:O.pos;return m(E,F),_.preventDefault(),!0}return!1},[m]),b=J.useCallback((C,_,T)=>{if(!_.clipboardData)return!1;const w=QD(_.clipboardData.files);return w.length>0?(m(w),!0):!1},[m]),S=v.jsx(I.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(uI,{ref:g,extensions:e,content:p,editable:!s,editorProps:{handleDrop:y,handlePaste:b},renderControls:s?void 0:()=>v.jsx(oee,{onUploadFiles:i}),onBlur:()=>{var C,_;return f(((_=(C=g.current)==null?void 0:C.editor)==null?void 0:_.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(EA,{}),v.jsx(dI,{})]})})});return v.jsxs(I.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(I.Typography,{...o,children:r}),S]})},C1=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(I.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(I.Box,{className:"text-content",children:[v.jsx(I.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(I.Typography,{"data-testid":"message",children:n})]}),v.jsx(I.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},eP=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?v.jsx(I.Collapse,{in:n,children:u}):v.jsx(I.TableRow,{sx:p,children:v.jsx(I.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(I.Collapse,{in:n,children:u})})})},tP=t=>{const{id:e,getRowKey:n=G=>"id"in G&&(typeof G.id=="string"||typeof G.id=="number")?G.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(G)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(G)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:g=!1,className:m,emptyTableMsg:y="No items to display",errorTableMsg:b,retryCallback:S,isLoading:C=!1,disableMobileCards:_=!1,highlightSelectedRow:T=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,tooltipColor:F,...N}=t,{palette:$}=I.useTheme(),[M,A]=J.useState(void 0),[H,z]=J.useState(void 0);Array.isArray(g)&&(!s&&g.length!==r.length&&console.warn('Table component: Length of "fixedLayout" is not equal to the length of "columns".'),s&&g.length!==r.length+1&&console.warn(`Table component: 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".`)),s&&i&&console.warn("Table component: renderExpand & onRowClick are both defined. Only one should be defined at a time.");const R=G=>{G!==l?f&&f(G,"asc"):f&&f(l,u==="asc"?"desc":"asc")},B=G=>l===G?u:null,L=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),W=L&&a?r.filter(G=>!(a.includes(G.fieldName)||G.hideCol)):r.filter(G=>!G.hideCol);s&&!L&&W.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:G=>{const Q=M===G;return v.jsx(I.IconButton,{"data-testid":"expand-collapse-btn","aria-label":Q?"collapse row":"expand row",size:"small",onClick:()=>ae(G),children:Q?v.jsx(Qu,{"data-testid":"collapse-up"}):v.jsx(ug,{"data-testid":"expand-down"})})}});const q=(G,Q)=>Q.split(".").reduce((fe,Se)=>{if(fe&&typeof fe=="object")return fe[Se]},G),K=(G,Q)=>{const fe=q(Q,G.fieldName);return G.render?G.render(fe,Q,L):fe},U=f!==void 0,X=G=>U?p?p.includes(G):!0:!1,pe=v.jsxs(I.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx($R,{})," ",y]}),he=v.jsxs(I.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(mC,{color:"error"})," ",b,S&&v.jsx(I.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ge=()=>{if(C)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:v.jsx(I.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(C1,{})})})});if(b)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return v.jsx(I.TableRow,{children:v.jsx(I.TableCell,{colSpan:r.length,align:"center",children:pe})})},Z=()=>{if(C)return v.jsx(C1,{});if(b)return he;if(o.length===0)return pe},ue=G=>{T&&z(G)},de=G=>{i&&(i(G),ue(G))},ae=G=>{const Q=M===G?void 0:G;A(Q),ue(Q)},oe=G=>{if(!s)return;const Q=M===n(G);return v.jsxs(v.Fragment,{children:[v.jsxs(I.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>ae(n(G)),children:[Q?v.jsx(Qu,{}):v.jsx(ug,{})," Show"," ",Q?"Less":"More"]}),v.jsx(eP,{colSpan:r.length,isExpanded:n(G)===M,obj:G,renderExpand:fe=>s(fe),asMobileCard:!0})]})},le=typeof T=="string"?T:$.grey[$.mode=="dark"?600:50],ye=G=>{const Q=H===n(G)?le:"inherit";return{cursor:i?"pointer":"default",backgroundColor:Q,...s?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:Q===le?aa(Q,.1):le}}}},te=$.grey[$.mode==="dark"?600:400],ie=G=>G&&v.jsx(I.Tooltip,{title:G,children:v.jsx(LR,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:F??te}})});return L&&!_?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:m,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(I.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:G=>R(G.target.value),fullWidth:!0,children:W.map(G=>{if(X(G.fieldName))return v.jsx(I.MenuItem,{value:G.sortName??G.fieldName,children:G.label??_n(G.fieldName)},`${G.key??"rowHeader"}-${G.fieldName}`)})}),v.jsx(I.IconButton,{onClick:()=>{l&&R(l)},children:v.jsx(UR,{className:`sort-icon-${u}`})})]}),v.jsx(I.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(G=>v.jsxs(I.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(G)},onClick:()=>de(n(G)),"data-testid":`card-${n(G)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:W.map(Q=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Q.fieldName}`,style:{textWrap:"nowrap"},children:[Q.label??_n(Q.fieldName),ie(Q.tooltip)]}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Q.fieldName}`,style:{paddingLeft:"10px"},children:K(Q,G)})]},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))})}),oe(G)]},n(G)))]}):v.jsx(I.TableContainer,{component:I.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:m,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(I.Table,{stickyHeader:E!=="undefined",style:{tableLayout:g?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...N,children:[v.jsx(I.TableHead,{className:"MBv2_Table_Head",children:v.jsx(I.TableRow,{className:"MBv2_Table_Head_Row",children:W.map((G,Q)=>{const fe=X(G.fieldName);return v.jsx(I.TableCell,{width:Array.isArray(g)?g[Q]:"auto",sx:G.tableCellSx??{},children:v.jsx(I.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(I.Box,{sx:[fe&&{"&:hover":{cursor:"pointer",backgroundColor:$.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:fe?()=>R(G.sortName??G.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:G.label??_n(G.fieldName)}),ie(G.tooltip),fe&&B(G.fieldName)==="asc"&&v.jsx(Qu,{style:{marginLeft:"5px"}}),fe&&B(G.fieldName)==="desc"&&v.jsx(ug,{style:{marginLeft:"5px"}}),fe&&B(G.fieldName)!=="asc"&&B(G.fieldName)!=="desc"&&v.jsx(jR,{style:{marginLeft:"5px"}})]})})},`${G.key??"rowHeader"}-${G.fieldName}`)})})}),v.jsx(I.TableBody,{className:"MBv2_Table_Body",children:ge()??o.map(G=>v.jsxs(J.Fragment,{children:[v.jsx(I.TableRow,{"data-testid":`row-${n(G)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(n(G)),sx:ye(G),children:W.map(Q=>v.jsx(I.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Q.fieldName}`,children:K(Q,G)},`${Q.key??"row"}-${n(G)}-${Q.fieldName}`))}),s&&v.jsx(eP,{colSpan:W.length,isExpanded:n(G)===M,obj:G,renderExpand:Q=>s(Q),reRenderExpand:O})]},n(G)))})]})})},nP=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,g=S=>{n(S)},m=S=>{r(parseInt(S.target.value,10))},y=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),b=!t.data||t.data&&t.data.length===0;return v.jsxs(I.Box,{children:[v.jsx(tP,{sortOrder:p,sortField:f,...s}),!o&&!b&&v.jsx(I.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:y?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>g(C),onRowsPerPageChange:m,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},rP=()=>({height:window.innerHeight,width:window.innerWidth}),oP=()=>{const[t,e]=J.useState(rP());return J.useEffect(()=>{const n=()=>{e(rP())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Ur=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=oP(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(I.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...Jn({...t},a)})},$te=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(I.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(I.Box,{component:I.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[v.jsxs(I.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",v.jsx("br",{}),v.jsx("b",{children:e.url}),"?"]}),v.jsxs(I.Box,{display:"flex",flexDirection:"row",children:[v.jsx(Ur,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(Ur,{size:"small",startIcon:v.jsx(dg,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Bte=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(I.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(I.Box,{component:I.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(I.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(I.Box,{display:"flex",flexDirection:"row",children:[v.jsx(Ur,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(Ur,{size:"small",color:"error",startIcon:v.jsx(Yh,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Rte=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:g,selectedIds:m,setSelectedIds:y,onError:b=()=>{},condenseTable:S=!1,canSelect:C=!1,canLaunchUrl:_,addlActions:T,readOnly:w=!1,showCloseBtn:E=!1}=t,O=!!t.canCreate&&!w,F=!!t.canEdit&&!w,N=!!t.canDelete&&!w,{palette:$}=I.useTheme(),[M,A]=J.useState([]),[H,z]=J.useState(!1),[R,B]=J.useState(!0),[L,W]=J.useState(null),[q,K]=J.useState(null),[U,X]=J.useState(null),[pe,he]=J.useState({pageNo:0,pageSize:S?5:10,totalCount:0}),ge=()=>{z(!1),B(!0),g({pageNo:pe.pageNo,pageSize:pe.pageSize}).then(Q=>(A(Q.data),he({...pe,totalCount:Q.totalCount}),Q)).catch(Q=>{b(Q),z(!0),A([])}).finally(()=>B(!1))};J.useEffect(ge,[pe.pageNo,pe.pageSize,e]);const Z=()=>{K(null),X(null),W(null)},ue=v.jsx(Ur,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:o,startIcon:v.jsx(ed,{}),children:"Add Citation"}),de=v.jsx(Ur,{variant:C?"outlined":"contained",size:C?"small":"medium",onClick:i,startIcon:v.jsx(WC,{}),children:"Add Attachment"}),ae=Q=>{if(!(!F&&!w)&&!(w&&!S))return v.jsx(I.Tooltip,{title:w?"View":"Edit",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>Q.fileName?a(Q):s(Q),"data-testid":`citation-table_edit-btn-${Q.id}`,children:w?v.jsx(ZR,{}):v.jsx(bR,{})})})},oe=Q=>{if(!(!N||w))return v.jsx(I.Tooltip,{title:"Delete",children:v.jsx(I.IconButton,{color:"error",onClick:fe=>{K(Q),W(fe.currentTarget)},"data-testid":`citation-table_delete-btn-${Q.id}`,children:v.jsx(Yh,{})})})},le=Q=>{if(!_)return;if(!Q.fileName)return v.jsx(I.Tooltip,{title:"Open URL",children:v.jsx(I.IconButton,{color:"primary",onClick:Se=>{W(Se.currentTarget),X(Q)},"data-testid":`citation-table_launch-link-btn-${Q.id}`,sx:{visibility:_!=null&&_(Q)?"visible":"hidden"},children:v.jsx(dg,{})})})},ye=Q=>{if(!f||!Q.fileName)return;const fe=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],Se=Q.fileName.split(".").pop();if(!(!Se||!fe.includes(Se)))return v.jsx(I.Tooltip,{title:"View File",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>f==null?void 0:f(Q),"data-testid":`citation-table_view-file-btn-${Q.id}`,children:v.jsx(dg,{})})})},te=Q=>{if(!u)return;if(!!Q.fileName)return v.jsx(I.Tooltip,{title:"Download",children:v.jsx(I.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(Q),"data-testid":`citation-table_download-btn-${Q.id}`,children:v.jsx(yR,{})})})},G=[{fieldName:"id",key:"select",label:"",hideCol:!C,render:(Q,fe)=>v.jsx(I.Checkbox,{"data-testid":`citation-table_checkbox-${Q}`,onChange:()=>{const Se=m.includes(fe.id);y(Se?m.filter(Ee=>Ee!==fe.id):[...m,fe.id])},checked:m.includes(Q),disabled:w})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(Q,fe)=>v.jsx(I.Tooltip,{title:Q?"Attachment":"URL",children:Q?v.jsx(WC,{sx:{color:$.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${fe.id}`}):v.jsx(ed,{sx:{color:$.grey[500],marginTop:"6px"},"data-testid":`url-icon-${fe.id}`})})},{fieldName:"title",tableCellSx:{width:S?"100%":"auto"},render:Q=>S?Fl.truncate(Q,{length:40,omission:"..."}):Q},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:S,render:(Q,fe)=>v.jsx("span",{style:{wordBreak:"break-all"},children:Q||fe.url})},{fieldName:"source",hideCol:S},{fieldName:"accessedAt",hideCol:S,render:(Q,fe)=>{if(!fe.fileName)return(Q==null?void 0:Q.slice(0,10))??""}},{fieldName:"classification",hideCol:S},{fieldName:"id",key:"Action",label:"Action",hideCol:!(w||F||N||_||f||u||T),render:(Q,fe)=>v.jsxs(I.Box,{display:"flex",flexDirection:"row-reverse",children:[T==null?void 0:T(fe),oe(fe),ae(fe),ye(fe),le(fe),te(fe)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(I.Typography,{variant:S?"h6":"h2",children:n}),!C&&O&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",gap:1,children:[ue,de]}),E&&v.jsx(I.IconButton,{onClick:r,children:v.jsx(Xu,{})})]}),v.jsx(nP,{"data-testid":"citation-table",size:S?"x-small":"medium",isLoading:R,columns:G,data:M,paginationState:pe,onPageChange:Q=>he({...pe,pageNo:Q}),onRowsPerPageChange:Q=>he({...pe,pageSize:Q,pageNo:0}),errorTableMsg:H?"Failed to load citations.":void 0,retryCallback:ge}),C&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(I.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:O&&v.jsxs(v.Fragment,{children:[ue,de]})}),!w&&v.jsxs(I.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(Ur,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),v.jsxs(Ur,{variant:"contained",size:"small",onClick:()=>p(m),children:["Select",m.length>0&&` (${m.length})`]})]})]}),v.jsx($te,{citation:U,anchorEl:L,onClose:Z}),v.jsx(Bte,{citation:q,anchorEl:L,onDeleteCitation:l,onClose:Z})]})},w1=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return v.jsx(Ur,{type:n,disabled:e,size:r,startIcon:e?v.jsx(I.CircularProgress,{size:s,color:"inherit"}):null,...o})};var _1,iP;function zte(){if(iP)return _1;iP=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,_){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=_};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);_1={Cache:t,split:p,normalizePath:f,setter:function(C){var _=f(C);return l.get(C)||l.set(C,function(w,E){for(var O=0,F=_.length,N=w;O<F-1;){var $=_[O];if($==="__proto__"||$==="constructor"||$==="prototype")return w;N=N[_[O++]]}N[_[O]]=E})},getter:function(C,_){var T=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,F=T.length;O<F;)if(E!=null||!_)E=E[T[O++]];else return;return E})},join:function(C){return C.reduce(function(_,T){return _+(m(T)||n.test(T)?"["+T+"]":(_?".":"")+T)},"")},forEach:function(C,_,T){g(Array.isArray(C)?C:p(C),_,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(_){return _.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function g(C,_,T){var w=C.length,E,O,F,N;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),N=m(E),F=!N&&/^\d+$/.test(E),_.call(T,E,N,F,O,C))}function m(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function y(C){return C.match(r)&&!C.match(n)}function b(C){return o.test(C)}function S(C){return!m(C)&&(y(C)||b(C))}return _1}var Us=zte(),T1,sP;function Vte(){if(sP)return T1;sP=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,g)=>`${p}${p?g[0].toUpperCase()+g.slice(1).toLowerCase():g.toLowerCase()}`,"");return T1={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(" ")},T1}var k1=Vte(),Op={exports:{}},aP;function Hte(){if(aP)return Op.exports;aP=1,Op.exports=function(o){return t(e(o),o)},Op.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(m){if(!p.has(m[0])||!p.has(m[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||g(o[u],u,new Set);return a;function g(m,y,b){if(b.has(m)){var S;try{S=", node was:"+JSON.stringify(m)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(m))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(m));if(!l[y]){l[y]=!0;var C=f.get(m)||new Set;if(C=Array.from(C),y=C.length){b.add(m);do{var _=C[--y];g(_,p.get(_),b)}while(y);b.delete(m)}a[--s]=m}}}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 Op.exports}var jte=Hte();const Wte=Zn(jte),qte=Object.prototype.toString,Ute=Error.prototype.toString,Kte=RegExp.prototype.toString,Yte=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Gte=/^Symbol\((.*)\)(.*)$/;function Jte(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function lP(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Jte(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Yte.call(t).replace(Gte,"Symbol($1)");const r=qte.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Ute.call(t)+"]":r==="RegExp"?Kte.call(t):null}function Ji(t,e){let n=lP(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=lP(this[r],e);return i!==null?i:o},2)}function cP(t){return t==null?[]:[].concat(t)}let uP,dP,fP,Zte=/\$\{\s*(\w+)\s*\}/g;uP=Symbol.toStringTag;class pP{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[uP]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],cP(e).forEach(i=>{if(fr.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]}}dP=Symbol.hasInstance,fP=Symbol.toStringTag;class fr 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(Zte,(o,i)=>Ji(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 pP(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[fP]="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,fr)}static[dP](e){return pP[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Lo={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 \`${Ji(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ji(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ji(n,!0)}\``+o}},pr={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"},Xte={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"},E1={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Qte={isValue:"${path} field must be ${value}"},Ap={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:Lo,string:pr,number:Xte,date:E1,object:Ap,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:Qte,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: \`${Ji(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: \`${Ji(n,!0)}\``}return fr.formatError(Lo.notType,t)}}});const M1=t=>t&&t.__isYupSchema__;class Ip{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 Ip(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(!M1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Dp={context:"$",value:"."};class Ks{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]===Dp.context,this.isValue=this.key[0]===Dp.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Dp.context:this.isValue?Dp.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Us.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}}Ks.prototype.__isYupRef=!0;const Ys=t=>t==null;function nl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:g,skipAbsent:m}=t;let{parent:y,context:b,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function _(A){return Ks.isRef(A)?A.getValue(n,y,b):A}function T(A={}){const H=Object.assign({value:n,originalValue:i,label:s.spec.label,path:A.path||r,spec:s.spec,disableStackTrace:A.disableStackTrace||C},p,A.params);for(const R of Object.keys(H))H[R]=_(H[R]);const z=new fr(fr.formatError(A.message||g,H),n,H.path,A.type||u,H.disableStackTrace);return z.params=H,z}const w=S?a:l;let E={path:r,parent:y,type:u,from:o.from,createError:T,resolve:_,options:o,originalValue:i,schema:s};const O=A=>{fr.isError(A)?w(A):A?l(null):w(T())},F=A=>{fr.isError(A)?w(A):a(A)};if(m&&Ys(n))return O(!0);let $;try{var M;if($=f.call(E,n,E),typeof((M=$)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve($).then(O,F)}}catch(A){F(A);return}O($)}return e.OPTIONS=t,e}function ene(t,e,n,r=n){let o,i,s;return e?(Us.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",g=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&&g>=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[g],t=p?t.spec.types[g]: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 Pp extends Set{describe(){const e=[];for(const n of this.values())e.push(Ks.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 Pp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function rl(t,e=new Map){if(M1(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]=rl(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,rl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(rl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=rl(o,e)}else throw Error(`Unable to clone ${t}`);return n}class Fo{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 Pp,this._blacklist=new Pp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Lo.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=rl(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({value:e},n)),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ys(i))return i;let s=Ji(e),a=Ji(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
401
401
 
402
402
  attempted value: ${s}
403
403
  `+(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),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=b=>{o||(o=!0,n(b,s))},p=b=>{o||(o=!0,r(b,s))},g=i.length,m=[];if(!g)return p([]);let y={value:s,originalValue:a,path:l,options:u,schema:this};for(let b=0;b<i.length;b++){const S=i[b];S(y,f,function(_){_&&(Array.isArray(_)?m.push(..._):m.push(_)),--g<=0&&p(m)})}}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,g,m)=>this.resolve(f)._validate(u,f,g,m)}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)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(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 fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):rl(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=nl({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=nl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Lo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Lo.notNull){return this.nullability(!1,e)}required(e=Lo.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=Lo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=nl(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=cP(e).map(i=>new Ks(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Ip(o,n):Ip.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=nl({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=Lo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=nl({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=Lo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=nl({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.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}Fo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])Fo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=ene(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])Fo.prototype[t]=Fo.prototype.oneOf;for(const t of["not","nope"])Fo.prototype[t]=Fo.prototype.notOneOf;const tne=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function nne(t){const e=O1(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 O1(t){var e,n;const r=tne.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 rne=/^[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])?)*$/,one=/^((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,ine=/^(?:[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,sne="^\\d{4}-\\d{2}-\\d{2}",ane="\\d{2}:\\d{2}:\\d{2}",lne="(([+-]\\d{2}(:?\\d{2})?)|Z)",cne=new RegExp(`${sne}T${ane}(\\.\\d+)?${lne}$`),une=t=>Ys(t)||t===t.trim(),dne={}.toString();function Gs(){return new hP}class hP extends Fo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===dne?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Lo.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=pr.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=pr.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=pr.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||pr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=pr.email){return this.matches(rne,{name:"email",message:e,excludeEmptyString:!0})}url(e=pr.url){return this.matches(one,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=pr.uuid){return this.matches(ine,{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(cne,{name:"datetime",message:n||pr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||pr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=O1(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||pr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=O1(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=pr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:une})}lowercase(e=pr.lowercase){return this.transform(n=>Ys(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ys(n)||n===n.toLowerCase()})}uppercase(e=pr.uppercase){return this.transform(n=>Ys(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ys(n)||n===n.toUpperCase()})}}Gs.prototype=hP.prototype;let gP=new Date(""),fne=t=>Object.prototype.toString.call(t)==="[object Date]";function A1(){return new su}class su extends Fo{constructor(){super({type:"date",check(e){return fne(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=nne(e),isNaN(e)?su.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ks.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=E1.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=E1.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)}})}}su.INVALID_DATE=gP,A1.prototype=su.prototype,A1.INVALID_DATE=gP;function pne(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Us.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),Ks.isRef(a)&&a.isSibling?i(a.path,s):M1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Wte.array(Array.from(r),n).reverse()}function mP(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 yP(t){return(e,n)=>mP(t,e)-mP(t,n)}const hne=(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 Np(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Np(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Np(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Np)}):"optional"in t?t.optional():t}const gne=(t,e)=>{const n=[...Us.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Us.getter(Us.join(n),!0)(t);return!!(o&&r in o)};let bP=t=>Object.prototype.toString.call(t)==="[object Object]";function vP(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const mne=yP([]);function I1(t){return new xP(t)}class xP extends Fo{constructor(e){super({type:"object",check(n){return bP(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=mne,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 g=i[p],m=p in o;if(g){let y,b=o[p];u.path=(n.path?`${n.path}.`:"")+p,g=g.resolve({value:b,context:n.context,parent:l});let S=g instanceof Fo?g.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}y=!n.__validating||!C?g.cast(o[p],u):o[p],y!==void 0&&(l[p]=y)}else m&&!s&&(l[p]=o[p]);(m!==p in l||l[p]!==o[p])&&(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||!bP(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let g=this.fields[p];!g||Ks.isRef(g)||f.push(g.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=pne(e,n),r._sortErrors=yP(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 Np(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=Us.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return gne(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(hne)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Ap.exact,test(n){if(n==null)return!0;const r=vP(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Ap.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=vP(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Ap.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(k1.camelCase)}snakeCase(){return this.transformKeys(k1.snakeCase)}constantCase(){return this.transformKeys(e=>k1.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}}I1.prototype=xP.prototype;const yne=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=J.useRef(null),[u,f]=J.useState(!1),[p,g]=J.useState(!1),[m,y]=J.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});J.useEffect(()=>{i&&y({...i,type:"Url"})},[]);const b=()=>{var C,_,T;const S=(_=(C=l==null?void 0:l.current)==null?void 0:C.values)==null?void 0:_.url;S&&((T=l==null?void 0:l.current)==null||T.setFieldValue("url",dA(S)))};return v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(I.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(I.IconButton,{onClick:o,children:v.jsx(Xu,{})})]}),v.jsx(jt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:m,onSubmit:async S=>{f(!0),n(S).catch(C=>{throw f(!1),C}).finally(()=>f(!1))},validationSchema:I1({source:Gs().required("Source is required"),title:Gs().required("Title is required"),accessedAt:A1().required("Accessed At is required"),url:Gs().required("URL is required"),classification:Gs().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:S})=>v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsxs(I.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[v.jsx(us,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsx(us,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsx(zd,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),v.jsx(us,{name:"url",label:"URL",disabled:u,required:!0,onBlur:b,margin:"none",readOnly:s}),v.jsx(HC,{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})]}),v.jsx(I.DialogActions,{sx:{px:0},children:s?v.jsx(I.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(w1,{size:"small",loading:u,type:"button",onClick:()=>{g(!0),S()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},SP=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return v.jsx(I.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},bne=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=J.useRef(null),[f,p]=J.useState(!1),[g,m]=J.useState(!1),[y,b]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{s&&b({...s,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(I.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&v.jsx(I.IconButton,{onClick:o,children:v.jsx(Xu,{})})]}),v.jsx(jt.Formik,{innerRef:u,enableReinitialize:!0,initialValues:y,validationSchema:I1().shape({title:Gs().required("Title is required"),fileName:Gs().required("A file is required")}),validateOnBlur:g,validateOnChange:g,onSubmit:async S=>{p(!0),n(S).catch(C=>{throw p(!1),C}).finally(()=>p(!1))},children:({values:S,setFieldValue:C,handleSubmit:_})=>{var T;return J.useEffect(()=>{var w,E;(w=S.file)!=null&&w.name&&C("fileName",(E=S.file)==null?void 0:E.name)},[(T=S.file)==null?void 0:T.name]),v.jsxs(jt.Form,{autoComplete:"off",children:[v.jsx(us,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),v.jsxs(I.Box,{marginTop:i||a?0:1,children:[v.jsxs(SP,{alignItems:"flex-start",children:[!i&&!a&&v.jsx(SC,{name:"file",errorMode:"hidden"}),v.jsx(us,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),v.jsx(sr,{name:"fileName"})]}),v.jsx(I.DialogActions,{sx:{px:0},children:a?v.jsx(I.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(w1,{size:"small",loading:f,type:"button",onClick:()=>{m(!0),_()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},au=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",g=a==="top"||a==="top-and-bottom",m=()=>{if(s&&p)return v.jsx(I.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},y=()=>{if(i)return v.jsx(I.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(I.Box,{children:m()}),v.jsxs(I.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(I.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(I.Box,{children:m()})})};return v.jsxs(I.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(I.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,g&&v.jsx(I.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Xu,{})})]})}):r,o&&(typeof o=="string"?v.jsx(I.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(I.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),y()]})};function vne(t){return Ke("MuiAlert",t)}const CP=qe("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),xne=Fe(v.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"),Sne=Fe(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),Cne=Fe(v.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"),wne=Fe(v.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"),_ne=Fe(v.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"),Tne=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ae(n||r)}`,`${e}${Ae(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ue(i,vne,o)},kne=ve(ba,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ae(n.color||n.severity)}`]]}})(Dt(({theme:t})=>{const e=t.palette.mode==="light"?aa:Al,n=t.palette.mode==="light"?Al:aa;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),[`& .${CP.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}`,[`& .${CP.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)}}}))]}})),Ene=ve("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Mne=ve("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),One=ve("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),wP={success:v.jsx(xne,{fontSize:"inherit"}),warning:v.jsx(Sne,{fontSize:"inherit"}),error:v.jsx(Cne,{fontSize:"inherit"}),info:v.jsx(wne,{fontSize:"inherit"})},_P=D.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:g=wP,onClose:m,role:y="alert",severity:b="success",slotProps:S={},slots:C={},variant:_="standard",...T}=r,w={...r,color:l,severity:b,variant:_,colorSeverity:l||b},E=Tne(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[F,N]=zt("root",{ref:n,shouldForwardComponentProp:!0,className:Le(E.root,s),elementType:kne,externalForwardedProps:{...O,...T},ownerState:w,additionalProps:{role:y,elevation:0}}),[$,M]=zt("icon",{className:E.icon,elementType:Ene,externalForwardedProps:O,ownerState:w}),[A,H]=zt("message",{className:E.message,elementType:Mne,externalForwardedProps:O,ownerState:w}),[z,R]=zt("action",{className:E.action,elementType:One,externalForwardedProps:O,ownerState:w}),[B,L]=zt("closeButton",{elementType:Ca,externalForwardedProps:O,ownerState:w}),[W,q]=zt("closeIcon",{elementType:_ne,externalForwardedProps:O,ownerState:w});return v.jsxs(F,{...N,children:[p!==!1?v.jsx($,{...M,children:p||g[b]||wP[b]}):null,v.jsx(A,{...H,children:i}),o!=null?v.jsx(z,{...R,children:o}):null,o==null&&m?v.jsx(z,{...R,children:v.jsx(B,{size:"small","aria-label":a,title:a,color:"inherit",onClick:m,...L,children:v.jsx(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(_P.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 lu=t=>{var m;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=I.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(m=l[r])==null?void 0:m.main}`}:i,g=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(_P,{severity:r,variant:f,sx:p,slotProps:g,...u,...a,children:[s&&v.jsx(I.Typography,{variant:"h3",children:s}),n]})},TP=t=>v.jsx(lu,{severity:"error",...t}),kP=t=>v.jsx(lu,{severity:"success",...t}),Ane=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(TP,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(kP,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function EP({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:g=!1,addlActions:m,canLaunchUrl:y,readOnly:b}){const[S,C]=J.useState("Insert Citation/Attachment(s)"),[_,T]=J.useState(u),[w,E]=J.useState(void 0),[O,F]=J.useState(void 0),N=Z=>{F(void 0),C(Z)},[$,M]=J.useState(0);J.useEffect(()=>{f==null||f()},[S,O,f]);const A=(Z=!1)=>{(!g||Z)&&M(ue=>ue+1)},H=(Z,ue)=>{var le;const de=typeof((le=ue.response)==null?void 0:le.data)=="string"&&ue.response.data,ae=typeof ue.message=="string"&&ue.message;F({type:"Error",title:Z,message:de??ae}),p(ue)},z=Z=>F({type:"Success",title:"",message:Z}),R=async Z=>{if(S==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(S==="Edit Citation"||S==="Edit Attachment"){if(Z.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(Z).then(()=>{N("Insert Citation/Attachment(s)"),A()}).catch(de=>{H("Failed to update",de)}))}else await(e==null?void 0:e(Z).then(de=>{T([..._,de.id]),N("Insert Citation/Attachment(s)"),A()}).catch(de=>{H("Failed to create",de)}))},B=r&&(async Z=>r(Z).then(()=>{A(!0),T(_.filter(ue=>ue!==Z)),z("Successfully deleted")}).catch(ue=>H("Failed to delete",ue))),L=(Z,ue)=>{o(Z.id).then(de=>{E(de),N(ue)}).catch(de=>{H("Failed to load",de)})},W=i&&(async Z=>i(Z).catch(ue=>{H(`Failed to download ${Z.fileName}`,ue)})),q=s&&(async Z=>s(Z).catch(ue=>{H(`Failed to view ${Z.fileName}`,ue)})),K=v.jsx(Rte,{refreshKey:$,getCitationsPaginated:Z=>t(Z).then(ue=>(f==null||f(),ue)),onCancel:l,onNewCitation:()=>{E(void 0),N("Add Citation")},onNewAttachment:()=>{E(void 0),N("Add Attachment")},onEditCitation:Z=>L(Z,b?"View Citation":"Edit Citation"),onEditAttachment:Z=>L(Z,b?"View Attachment":"Edit Attachment"),onDeleteCitation:B,onDownloadAttachment:W,onViewAttachment:q,onSelect:a,setSelectedIds:T,selectedIds:_,onError:p,condenseTable:g,canSelect:g,title:g&&!b?S:"Attachments & Citations",addlActions:m,canCreate:!!e,canEdit:!!n,canDelete:!!B,canLaunchUrl:y,readOnly:b,showCloseBtn:g}),U=v.jsx(yne,{modifyCitation:w,onSave:R,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,title:S,readOnly:S==="View Citation",showCloseBtn:g}),X=v.jsx(bne,{onSave:R,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:w,disableFileUpload:S==="Edit Attachment",title:S,readOnly:S==="View Attachment",showCloseBtn:g}),pe=v.jsx(Ane,{alert:O,setAlert:F}),he=S==="Add Citation"||S==="Edit Citation"||S==="View Citation",ge=S==="Add Attachment"||S==="Edit Attachment"||S==="View Attachment";if(g){let Z=null;return!g||S==="Insert Citation/Attachment(s)"?Z=K:he?Z=U:ge&&(Z=X),v.jsxs(I.Box,{width:"500px",children:[pe,v.jsx(I.Box,{paddingTop:"8px",children:Z})]})}return v.jsxs(I.Box,{width:"100%",children:[S==="Insert Citation/Attachment(s)"&&pe,v.jsx(I.Box,{paddingTop:"8px",children:K}),v.jsx(au,{open:he||ge,children:v.jsxs(I.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[pe,he?U:X]})})]})}function MP({...t}){return v.jsx(EP,{renderAsSelectablePopup:!0,...t})}const Ine=Ut({name:{CitationBubbleMenuTipTap:OP}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function OP({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,canLaunchUrl:a,readOnly:l,...u}){const{classes:f}=Ine(),p=bt();if(p&&!("citationBubbleMenuHandler"in(p==null?void 0:p.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const g=p==null?void 0:p.storage.citationBubbleMenuHandler,m=g.isOpen,y=g.selectedIds,b=g.selectedNodePos,S=w=>{p&&(w.length===0?p.commands.deleteCitation(b):y.length===0?p.commands.insertCitation({ids:w}):p.commands.updateCitation({ids:w},b))},C=w=>{S(w),p==null||p.commands.closeCitationBubbleMenu()},_=()=>{S(y),p==null||p.commands.closeCitationBubbleMenu()},T=J.useCallback(()=>{requestAnimationFrame(()=>{p!=null&&p.view&&p.view.dispatch(p.view.state.tr)})},[p]);return p?v.jsx(Nf,{editor:p,open:m,...g.bubbleMenuOptions,...u,children:v.jsx("div",{className:f.content,children:v.jsx(MP,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onViewAttachment:s,onSelectCitations:C,onCancel:_,initialSelectedIds:y,onContentChange:T,canLaunchUrl:a,readOnly:l})})}):null}const Dne=sn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(lD.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(aD.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(dD.configure(this.options.bulletList)),this.options.code!==!1&&t.push(fD.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(pD.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(hD.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(gD.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(mD.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(yD.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(PI.configure(this.options.heading)),this.options.history!==!1&&t.push(_D.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(TD.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(kD.configure(this.options.italic)),this.options.listItem!==!1&&t.push(jD.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(UD.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(KD.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(GD.configure(this.options.strike)),this.options.text!==!1&&t.push(JD.configure(this.options.text)),t}}),Pne=()=>sn.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 Nne(t){const e=bt(),n=J.useRef(null);return v.jsx(gt,{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:v.jsxs(I.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(fR,{fontSize:"small"}),v.jsx(I.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const AP=J.createContext(void 0),IP=()=>{const t=J.useContext(AP);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Lne=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=IP(),[u,f]=J.useState(String(s)),[p,g]=J.useState([]),m=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const y=a.filter(C=>s.includes(C.id)),b=y.map(C=>Fl.truncate(C.title,{length:m,omission:"..."})).join(", ");f(b),g(y);const S=y.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:y.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(Cv,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(I.Tooltip,{title:v.jsx(I.Box,{className:"citation-tooltip",children:p.map((y,b)=>{var C;const S=[y.source,y.title,y.fileName,y.url,(C=y.accessedAt)==null?void 0:C.slice(0,10),y.classification];return v.jsxs(I.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),b<p.length-1&&v.jsx(I.Divider,{className:"citation-tooltip-divider"})]},y.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:y=>{y.preventDefault(),y.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Fne=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",yt(t)]},addNodeView(){return wv(Lne)},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}}}}),DP=t=>v.jsx(vC,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),$ne=t=>{const{name:e,label:n=_n(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:g,onDownloadAttachment:m,onViewAttachment:y,onError:b=()=>{},placeholder:S="Start typing here...",notApplicableName:C,errorMode:_="normal",canLaunchUrl:T}=t,w=[Dne,YD.configure({placeholder:S}),Pne(),Fne.configure({citationMaxLength:a})],[E,O,F]=jt.useField({name:e}),{setValue:N}=F,{value:$}=E,{addUpdateCitation:M,deleteCitation:A,batchUpdate:H}=IP();J.useEffect(()=>{var q;const L=(q=z==null?void 0:z.current)==null?void 0:q.editor;if(!L)return;L.getHTML()!==$&&setTimeout(()=>{L.commands.setContent($)},0)},[$]);const z=J.useRef(null),R={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},B=()=>{var q,K;const L=((K=(q=z.current)==null?void 0:q.editor)==null?void 0:K.getHTML())??"",W=!L.replace(/<\/?p>|<br>/g,"").trim();N(W?"":L)};return v.jsxs(I.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...R[s],display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(I.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(I.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),C&&v.jsx(DP,{name:C})]}),v.jsx(uI,{ref:z,extensions:w,content:$,editable:!i,renderControls:i?void 0:()=>v.jsx(Bf,{children:v.jsx(Nne,{})}),onBlur:B,RichTextFieldProps:{variant:i?"standard":"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(OP,{getCitationsPaginated:L=>l(L).then(W=>(H(W.data),W)),onCreateCitation:u&&(L=>u(L).then(W=>(M(W),W))),onUpdateCitation:f&&(L=>f(L).then(W=>(M(W),W))),onDeleteCitation:p&&(L=>p(L).then(()=>A(L))),getCitationById:g,onDownloadAttachment:m,onViewAttachment:y,onError:b,canLaunchUrl:T,readOnly:i})}),v.jsx(sr,{name:e,id:`${e}-err`,errorMode:_})]})},Bne=t=>{const{name:e="submit"}=t;return v.jsx(Ur,{name:e,type:"submit",...t})},Rne=t=>{const{label:e="Return to Top",icon:n=Qu,scrollThresholdPx:r=100}=t,o=I.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(I.Zoom,{in:o,children:v.jsx(I.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(I.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},PP=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=to.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 v.jsxs(v.Fragment,{children:[v.jsx(I.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),v.jsx(I.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>v.jsxs(I.MenuItem,{...xl(p,o),children:[p.icon&&v.jsx(I.ListItemIcon,{children:p.icon}),v.jsx(I.ListItemText,{primary:p.label})]},p.label))})]})},zne=()=>{const{values:t,errors:e,status:n}=jt.useFormikContext(),{palette:r}=I.useTheme();return v.jsx(I.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(I.List,{children:[v.jsxs(I.ListItem,{children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(I.Divider,{variant:"inset",component:"li"}),v.jsxs(I.ListItem,{id:"testing",children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(I.ListItem,{children:[v.jsx(I.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(I.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Vne=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=oP();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,...Jn({...t},l)};return v.jsx(I.Stepper,{...u,children:e.map(f=>v.jsx(I.Step,{children:v.jsx(I.StepLabel,{children:f})},f))})},Hne=t=>{const{name:e,label:n=_n(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(WR,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:g=!1,emptyListMsg:m="None",showDivider:y=!1,removePosition:b="bottom"}=t,[S]=jt.useField({name:e}),{value:C}=S,_=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(I.FormControl,{fullWidth:!0,children:[v.jsx(I.Typography,{...r,children:n}),g&&S.value.length===0?v.jsx(I.Typography,{children:m}):v.jsx(jt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(J.Fragment,{children:v.jsx(jne,{variant:l,content:v.jsxs(I.Box,{"data-testid":"form-group-container",sx:typeof b=="string"?_(b):{...b},children:[v.jsxs(I.Box,{width:"100%",children:[i(`${e}.${E}`,E),y&&E!==C.length-1&&v.jsx(I.Divider,{"data-testid":"divider"})]}),!g&&C.length>(p?0:1)&&v.jsx(I.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(E),children:a})]})})},`${e}-${E}`)),!g&&v.jsx(I.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},jne=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(I.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(I.CardContent,{children:e})});case"elevatedCard":return v.jsx(I.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(I.CardContent,{children:e})});case"none":return e}},Wne=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(au,{actions:[v.jsx(I.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},qne=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(au,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Une=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 v.jsx(au,{actions:[v.jsx(I.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(I.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Kne=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=I.useTheme(),a=to.useNavigate();return v.jsxs(I.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(I.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(I.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(I.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=>v.jsx(I.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...xl(l,a),children:l.label},l.label))}),n&&v.jsx(I.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},NP=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=to.useLocation(),i=to.useNavigate(),[s,a]=J.useState(!1),l=(g,m)=>v.jsx(I.MenuList,{children:g.map(y=>v.jsxs(I.MenuItem,{...xl(y,i,()=>a(!1)),children:[y.icon&&v.jsx(I.ListItemIcon,{children:y.icon}),v.jsx(I.ListItemText,{primary:y.label})]},`mobile-drawer-group-${m}-item-${y.path}`))}),f=(()=>{if(e){const g=e.filter(m=>m&&m.length>0);return g.length===0?null:g.map((m,y)=>v.jsxs(J.Fragment,{children:[l(m,y),y<g.length-1&&v.jsx(I.Divider,{})]},`mobile-drawer-group-${y}`))}return r?v.jsx(I.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(I.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(RR,{})}),v.jsx(I.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(I.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(I.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},LP=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(I.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(I.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},FP=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(PP,{label:e,menuOptions:n,icon:v.jsx(VR,{})})},Lp=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}=I.useTheme(),a=to.useNavigate();return v.jsx(I.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(I.Tab,{icon:l.icon,label:l.label,value:u,...xl(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))})},$P=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(I.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Lp,{menuOptions:e,activeTabIdx:n,sx:r})})},BP=t=>{const{onToggle:e}=t,{palette:n}=I.useTheme(),r=n.mode==="dark";return v.jsx(I.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(qC,{}):v.jsx(jC,{})})},Yne=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:g,navBarSx:m}=t,y=to.useNavigate(),b=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),{palette:S}=I.useTheme(),{pathname:C}=to.useLocation(),_=S.mode==="dark",[T,w]=D.useState(void 0);D.useEffect(()=>{const F=o.findIndex(N=>N.path&&C.startsWith(N.path));w(F>=0?F:void 0)},[C,o]);const E=s&&v.jsx(BP,{onToggle:s}),O=s&&(b||!b&&l)?[{icon:_?v.jsx(qC,{}):v.jsx(jC,{}),label:`Switch to ${_?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(I.AppBar,{ref:n,position:f,sx:g,elevation:4,children:[e&&v.jsx(LP,{...e}),u,v.jsxs(I.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(I.Button,{disableRipple:!0,component:to.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(I.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!b&&E,b&&v.jsx(NP,{menuOptionLists:[o,a,O],anchor:"right"}),!b&&v.jsxs(v.Fragment,{children:[v.jsx(I.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((F,N)=>v.jsxs(I.Box,{display:"flex",alignItems:"center",children:[N>0&&v.jsx(I.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(I.Button,{variant:"text",sx:{color:"white"},...xl(F,y),children:v.jsxs(I.Box,{display:"flex",gap:"3px",alignItems:"center",children:[F.icon,F.label]})})]},F.label))}),p,l&&v.jsx(FP,{displayName:l,userMenuOptions:O})]})]})]}),!b&&v.jsx($P,{featureMenuOptions:o,activeTabIdx:T,sx:m})]})},Gne=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=to.useLocation(),o=I.useMediaQuery(I.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.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&&v.jsx(I.Box,{sx:e,children:v.jsx(I.Card,{sx:{height:"100%",width:200},children:v.jsx(Lp,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Jne=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=I.useTheme();return e.length>0&&v.jsx(Lp,{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}})},Zne=t=>{const{gap:e=1,...n}=t;return v.jsx(I.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Xne=t=>v.jsx(lu,{severity:"info",...t}),Qne=t=>v.jsx(lu,{severity:"warning",...t}),RP=t=>{const{crumbInfo:e}=t,n=to.useNavigate();return v.jsx(I.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(zR,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(I.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(I.Typography,{color:"primary",children:r},r))})},ere=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=tre(r);return v.jsx(I.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(lu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:zP(r),warning:zP(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(I.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},tre=t=>t=="logout"?"info":t=="timeout"?"warning":t,zP=t=>{if(t=="timeout")return v.jsx(cR,{});if(t=="logout")return v.jsx(BR,{})},nre=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=I.useMediaQuery(I.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(I.Box,{sx:a,children:[i.length>0&&v.jsx(RP,{crumbInfo:i}),v.jsxs(I.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(I.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(I.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(Ur,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(uR,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(I.Box,{width:l?"100%":"50%",children:s})]})]})},rre=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=I.useMediaQuery(I.useTheme().breakpoints.down("sm"));return v.jsxs(I.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(I.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(I.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(I.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function ore({...t}){return v.jsx(EP,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const ire=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const g=new Set(p.map(y=>y.id));return[...p.filter(y=>!g.has(y.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(y=>{const b=u.find(S=>S.id===y.id);return b||y}),g=new Set(f.map(y=>y.id)),m=u.filter(y=>!g.has(y.id));return[...p,...m]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const g=[...p];return g[f]=u,g}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(AP.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},sre=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 v.jsx(I.Box,{height:n})};Ie.AlertModal=qne,Ie.Autocomplete=yC,Ie.Breadcrumbs=RP,Ie.Button=Ur,Ie.Checkbox=vC,Ie.CheckboxGroup=VB,Ie.CitationField=$ne,Ie.CitationFieldProvider=ire,Ie.CitationManager=ore,Ie.Column=Zne,Ie.ConfirmationModal=Wne,Ie.DarkModeToggle=BP,Ie.DateField=zd,Ie.DateRangeField=dq,Ie.DecisionModal=Une,Ie.Drawer=NP,Ie.DynamicAutocomplete=RB,Ie.EnvironmentBanner=LP,Ie.ErrorAlert=TP,Ie.FileList=WB,Ie.FileUpload=SC,Ie.FloatingNavBar=Jne,Ie.Footer=Kne,Ie.FormDebugger=zne,Ie.Header=Yne,Ie.InfoAlert=Xne,Ie.LoadingButton=w1,Ie.LoadingIndicator=C1,Ie.Location=iR,Ie.MenuButton=PP,Ie.Modal=au,Ie.MultiAutocomplete=zB,Ie.NavBar=$P,Ie.NotApplicableCheckbox=DP,Ie.PageHeader=nre,Ie.PaginatedTable=nP,Ie.ProfileMenu=FP,Ie.RadioGroup=HC,Ie.RangeSlider=sR,Ie.RepeatableFormGroup=Hne,Ie.RichTextField=Fte,Ie.Row=SP,Ie.ScrollToTop=Rne,Ie.SearchField=XR,Ie.Select=aR,Ie.SelectableCitationManager=MP,Ie.Sidebar=Gne,Ie.SingleActionCard=rre,Ie.Snackbar=ere,Ie.Spacer=sre,Ie.Stepper=Vne,Ie.Submit=Bne,Ie.SuccessAlert=kP,Ie.Switch=lR,Ie.Table=tP,Ie.Tabs=Lp,Ie.TextField=us,Ie.ValidationError=sr,Ie.WarningAlert=Qne,Ie.commonTheme=vn,Ie.darkTheme=HF,Ie.lightTheme=VF,Object.defineProperty(Ie,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.19.17",
4
+ "version": "0.19.18",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",