@simoncomputing/mui-bueno-v2 0.25.24 → 0.25.25

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/dist/index.umd.js CHANGED
@@ -402,7 +402,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
402
402
  `,WZ="️",jZ="‍",Q0="";let yh=null,bh=null;function UZ(t=[]){const e={};Tr.groups=e;const n=new Tr;yh==null&&(yh=C2(BZ)),bh==null&&(bh=C2(FZ)),Pe(n,"'",ih),Pe(n,"{",Mu),Pe(n,"}",_u),Pe(n,"[",jp),Pe(n,"]",Up),Pe(n,"(",qp),Pe(n,")",Kp),Pe(n,"<",Yp),Pe(n,">",Gp),Pe(n,"(",Jp),Pe(n,")",Xp),Pe(n,"「",Zp),Pe(n,"」",Qp),Pe(n,"『",eh),Pe(n,"』",th),Pe(n,"<",nh),Pe(n,">",rh),Pe(n,"&",oh),Pe(n,"*",sh),Pe(n,"@",bs),Pe(n,"`",lh),Pe(n,"^",ch),Pe(n,":",vs),Pe(n,",",q0),Pe(n,"$",uh),Pe(n,".",Zo),Pe(n,"=",dh),Pe(n,"!",K0),Pe(n,"-",ao),Pe(n,"%",Iu),Pe(n,"|",fh),Pe(n,"+",ph),Pe(n,"#",hh),Pe(n,"?",Au),Pe(n,'"',Y0),Pe(n,"/",Qo),Pe(n,";",G0),Pe(n,"~",Du),Pe(n,"_",mh),Pe(n,"\\",ah),Pe(n,"・",b2);const r=hn(n,_i,W0,{[$0]:!0});hn(r,_i,r);const o=hn(r,Mi,g2,{[ku]:!0}),i=hn(r,Pu,y2,{[Eu]:!0}),s=hn(n,Mi,Oi,{[L0]:!0});hn(s,_i,o),hn(s,Mi,s),hn(o,_i,o),hn(o,Mi,o);const a=hn(n,Pu,z0,{[B0]:!0});hn(a,Mi),hn(a,_i,i),hn(a,Pu,a),hn(i,_i,i),hn(i,Mi),hn(i,Pu,i);const l=Pe(n,Z0,U0,{[R0]:!0}),u=Pe(n,w2,j0,{[R0]:!0}),f=hn(n,X0,j0,{[R0]:!0});Pe(n,Q0,f),Pe(u,Z0,l),Pe(u,Q0,f),hn(u,X0,f),Pe(f,w2),Pe(f,Z0),hn(f,X0,f),Pe(f,Q0,f);const p=hn(n,J0,v2,{[h2]:!0});Pe(p,"#"),hn(p,J0,p),Pe(p,WZ,p);const m=Pe(p,jZ);Pe(m,"#"),hn(m,J0,p);const y=[[Mi,s],[_i,o]],v=[[Mi,null],[Pu,a],[_i,i]];for(let g=0;g<yh.length;g++)xs(n,yh[g],V0,Oi,y);for(let g=0;g<bh.length;g++)xs(n,bh[g],H0,z0,v);wa(V0,{tld:!0,ascii:!0},e),wa(H0,{utld:!0,alpha:!0},e),xs(n,"file",Wp,Oi,y),xs(n,"mailto",Wp,Oi,y),xs(n,"http",$l,Oi,y),xs(n,"https",$l,Oi,y),xs(n,"ftp",$l,Oi,y),xs(n,"ftps",$l,Oi,y),wa(Wp,{scheme:!0,ascii:!0},e),wa($l,{slashscheme:!0,ascii:!0},e),t=t.sort((g,x)=>g[0]>x[0]?1:-1);for(let g=0;g<t.length;g++){const x=t[g][0],k=t[g][1]?{[RZ]:!0}:{[zZ]:!0};x.indexOf("-")>=0?k[F0]=!0:Mi.test(x)?_i.test(x)?k[ku]=!0:k[L0]=!0:k[$0]=!0,m2(n,x,x,k)}return m2(n,"localhost",Ou,{ascii:!0}),n.jd=new Tr(gh),{start:n,tokens:Object.assign({groups:e},x2)}}function S2(t,e){const n=qZ(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 qZ(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function xs(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Tr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Tr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function C2(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Nu={defaultProtocol:"http",events:null,format:T2,formatHref:T2,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ev(t,e=null){let n=Object.assign({},Nu);t&&(n=Object.assign(n,t instanceof ev?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}ev.prototype={o:Nu,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Nu[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function T2(t){return t}function k2(t,e){this.t="token",this.v=t,this.tk=e}k2.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Nu.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),f=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),f&&Object.assign(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function vh(t,e){class n extends k2{constructor(o,i){super(o,i),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const E2=vh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),O2=vh("text"),KZ=vh("nl"),xh=vh("url",{isLink:!0,toHref(t=Nu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Ou&&t[1].t===vs}}),lo=t=>new Tr(t);function YZ({groups:t}){const e=t.domain.concat([oh,sh,bs,ah,lh,ch,uh,dh,ao,W0,Iu,fh,ph,hh,Qo,gh,Du,mh]),n=[ih,vs,q0,Zo,K0,Iu,Au,Y0,G0,Yp,Gp,Mu,_u,Up,jp,qp,Kp,Jp,Xp,Zp,Qp,eh,th,nh,rh],r=[oh,ih,sh,ah,lh,ch,uh,dh,ao,Mu,_u,Iu,fh,ph,hh,Au,Qo,gh,Du,mh],o=lo(),i=Pe(o,Du);ft(i,r,i),ft(i,t.domain,i);const s=lo(),a=lo(),l=lo();ft(o,t.domain,s),ft(o,t.scheme,a),ft(o,t.slashscheme,l),ft(s,r,i),ft(s,t.domain,s);const u=Pe(s,bs);Pe(i,bs,u),Pe(a,bs,u),Pe(l,bs,u);const f=Pe(i,Zo);ft(f,r,i),ft(f,t.domain,i);const p=lo();ft(u,t.domain,p),ft(p,t.domain,p);const m=Pe(p,Zo);ft(m,t.domain,p);const y=lo(E2);ft(m,t.tld,y),ft(m,t.utld,y),Pe(u,Ou,y);const v=Pe(p,ao);Pe(v,ao,v),ft(v,t.domain,p),ft(y,t.domain,p),Pe(y,Zo,m),Pe(y,ao,v);const g=Pe(y,vs);ft(g,t.numeric,E2);const x=Pe(s,ao),S=Pe(s,Zo);Pe(x,ao,x),ft(x,t.domain,s),ft(S,r,i),ft(S,t.domain,s);const k=lo(xh);ft(S,t.tld,k),ft(S,t.utld,k),ft(k,t.domain,s),ft(k,r,i),Pe(k,Zo,S),Pe(k,ao,x),Pe(k,bs,u);const T=Pe(k,vs),C=lo(xh);ft(T,t.numeric,C);const O=lo(xh),I=lo();ft(O,e,O),ft(O,n,I),ft(I,e,O),ft(I,n,I),Pe(k,Qo,O),Pe(C,Qo,O);const N=Pe(a,vs),L=Pe(l,vs),V=Pe(L,Qo),M=Pe(V,Qo);ft(a,t.domain,s),Pe(a,Zo,S),Pe(a,ao,x),ft(l,t.domain,s),Pe(l,Zo,S),Pe(l,ao,x),ft(N,t.domain,O),Pe(N,Qo,O),Pe(N,Au,O),ft(M,t.domain,O),ft(M,e,O),Pe(M,Qo,O);const B=[[Mu,_u],[jp,Up],[qp,Kp],[Yp,Gp],[Jp,Xp],[Zp,Qp],[eh,th],[nh,rh]];for(let z=0;z<B.length;z++){const[F,P]=B[z],_=Pe(O,F);Pe(I,F,_),Pe(_,P,O);const A=lo(xh);ft(_,e,A);const R=lo();ft(_,n),ft(A,e,A),ft(A,n,R),ft(R,e,A),ft(R,n,R),Pe(A,P,O),Pe(R,P,O)}return Pe(o,Ou,k),Pe(o,U0,KZ),{start:o,tokens:x2}}function GZ(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(tv(O2,e,s)),s=[]),o-=m,f-=m;const y=p.t,v=n.slice(o-f,o);i.push(tv(y,e,v))}}return s.length>0&&i.push(tv(O2,e,s)),i}function tv(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 JZ=typeof console<"u"&&console&&console.warn||(()=>{}),XZ="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 ZZ(){return Tr.groups={},Kt.scanner=null,Kt.parser=null,Kt.tokenQueue=[],Kt.pluginQueue=[],Kt.customSchemes=[],Kt.initialized=!1,Kt}function M2(t,e=!1){if(Kt.initialized&&JZ(`linkifyjs: already initialized - will not register custom scheme "${t}" ${XZ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
403
403
  1. Must only contain digits, lowercase ASCII letters or "-"
404
404
  2. Cannot start or end with "-"
405
- 3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function QZ(){Kt.scanner=UZ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=YZ(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 nv(t){return Kt.initialized||QZ(),GZ(Kt.parser.start,t,S2(Kt.scanner.start,t))}nv.scan=S2;function _2(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new ev(n),o=nv(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const rv="[\0-   ᠎ -\u2029  ]",eQ=new RegExp(rv),tQ=new RegExp(`${rv}$`),nQ=new RegExp(rv,"g");function rQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function oQ(t){return new en({key:new On("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=$R(n.doc,[...e]);if(VR(a).forEach(({newRange:u})=>{const f=BR(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(u.from,u.to," "," ");if(!tQ.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(eQ).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=nv(v).map(S=>S.toObject(t.defaultProtocol));if(!rQ(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:g+S.start+1,to:g+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{Ug(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function iQ(t){return new en({key:new On("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=jg(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 sQ(t){return new en({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=_2(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function Sa(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(nQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const aQ=xr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){M2(t);return}M2(t.scheme,t.optionalSlashes)})},onDestroy(){ZZ()},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)=>!!Sa(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=>!!Sa(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=>!!Sa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xt(this.options.HTMLAttributes,t),0]:["a",xt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Sa(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=>!!Sa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[as({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=_2(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Sa(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(oQ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Sa(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(iQ({type:this.type})),this.options.linkOnPaste&&t.push(sQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function lQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=f3(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(y)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!k)return null;const T=g+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const cQ=new On("suggestion");function uQ({pluginKey:t=cQ,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=lQ}){let x;const S=y==null?void 0:y(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,L,V,M,B;const z=(O=this.key)===null||O===void 0?void 0:O.getState(C),F=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=z.active&&F.active&&z.range.from!==F.range.from,_=!z.active&&F.active,A=z.active&&!F.active,R=!_&&!A&&z.query!==F.query,j=_||P&&R,K=R||P,U=A||P&&R;if(!j&&!K&&!U)return;const J=U&&!j?z:F,me=T.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);x={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:he=>p({editor:e,range:J.range,props:he}),decorationNode:me,clientRect:me?()=>{var he;const{decorationId:ue}=(he=this.key)===null||he===void 0?void 0:he.getState(e.state),Z=T.dom.querySelector(`[data-decoration-id="${ue}"]`);return(Z==null?void 0:Z.getBoundingClientRect())||null}:null},j&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.call(S,x)),K&&((L=S==null?void 0:S.onBeforeUpdate)===null||L===void 0||L.call(S,x)),(K||j)&&(x.items=await m({editor:e,query:J.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),j&&((B=S==null?void 0:S.onStart)===null||B===void 0||B.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,I){const{isEditable:N}=e,{composing:L}=e.view,{selection:V}=T,{empty:M,from:B}=V,z={...C};if(z.composing=L,N&&(M||e.view.composing)){(B<C.range.from||B>C.range.to)&&!L&&!C.composing&&(z.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;F&&v({editor:e,state:I,range:F.range,isActive:C.active})?(z.active=!0,z.decorationId=C.decorationId?C.decorationId:P,z.range=F.range,z.query=F.query,z.text=F.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(T,C){var O;const{active:I,range:N}=k.getState(T.state);return I&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const L=!(N!=null&&N.length),V=[l];return L&&V.push(f),Jt.create(T.doc,[Yn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function dQ({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new On;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function I2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>dQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function A2(t,e){const n=I2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const fQ=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",xt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=A2(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=xt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:A2(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new fi,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return I2(this).map(uQ)}}),D2=ln.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new On("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&&af(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Yn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Jt.create(t,o)}}})]}}),pQ=xr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",xt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),hQ=tn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",xt(this.options.HTMLAttributes,t),0]}}),mQ=tn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",xt(this.options.HTMLAttributes,t),0]}}),gQ=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",xt(this.options.HTMLAttributes,t),0]}}),yQ=/^\s*(\[([( |x])?\])\s$/,bQ=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const y=n();if(typeof y!="number")return!1;const v=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[al({find:yQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),vQ=tn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",xt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),xQ=ln.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P2=X.forwardRef((t,e)=>{const[n,r]=X.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 X.useEffect(()=>r(0),[t.items]),X.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?b.jsx(H.Paper,{elevation:5,children:b.jsx(H.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(H.ListItem,{disablePadding:!0,children:b.jsx(H.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});P2.displayName="SuggestionList";const N2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},wQ={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 fO(P2,{props:n,editor:n.editor}),e=su("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2},appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})[0]},onUpdate(n){t==null||t.updateProps(n),e==null||e.setProps({getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},SQ=aQ.extend({inclusive:!1}),CQ=pQ.extend({excludes:"superscript"}),TQ=rM.extend({excludes:"subscript"});function kQ({placeholder:t}={}){return X.useMemo(()=>[p7.configure({resizable:!0}),gQ,mQ,hQ,aT,cT,uT,hT,kT,MT,_T,CQ,TQ,AT,oT,rT,lT,TT,nM,IT,SQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),X9,pT,G9,xQ.configure({types:["heading","paragraph","image"]}),NZ,$Z,LZ,qj,FT.configure({multicolor:!0}),CT,f8,dT,vQ,bQ.configure({nested:!0}),fQ.configure({suggestion:wQ}),D2.configure({placeholder:t}),ST],[t])}function $2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const EQ=t=>{const e=kQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(eM,{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;X.useEffect(()=>{var S,k,T;(T=(k=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:k.commands)==null||T.setContent(p)},[p]);const m=X.useRef(null),y=X.useCallback((S,k)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{tb({images:O,editor:T,position:k})});else{const O=i(S);tb({images:O,editor:T,position:k})}},[]),v=X.useCallback((S,k,T,C)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=$2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return y(O,N),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=$2(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(H.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(QO,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(DZ,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(N7,{}),b.jsx(Y7,{})]})})});return b.jsxs(H.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(H.Typography,{...o,children:r}),x]})},L2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=X.useState(!1),[u,f]=X.useState(void 0);X.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?b.jsx(H.Collapse,{in:n,children:u}):b.jsx(H.TableRow,{sx:p,children:b.jsx(H.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(H.Collapse,{in:n,children:u})})})},B2=({isLoading:t,children:e})=>b.jsxs(H.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,b.jsx(H.Box,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,pointerEvents:t?"auto":"none",opacity:t?1:0,transition:"opacity 0.3s ease"},children:b.jsx(H.CircularProgress,{})})]}),ov=t=>{const{id:e,getRowKey:n=ie=>"id"in ie&&(typeof ie.id=="string"||typeof ie.id=="number")?ie.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(ie)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(ie)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,renderExpand:a,hideColumnsOnMobile:l=[],sortField:u,sortOrder:f,onSortChange:p,allowSortCols:m,fixedLayout:y=!1,className:v,emptyTableMsg:g="No items to display",errorTableMsg:x,retryCallback:S,isLoading:k=!1,disableMobileCards:T=!1,highlightSelectedRow:C=!1,headerRowStyle:O={},stickyHeader:I,reRenderExpand:N=!1,expandOnRowClick:L=!1,tooltipColor:V,...M}=t,{palette:B}=H.useTheme(),[z,F]=X.useState(void 0),[P,_]=X.useState(void 0);OQ(t);const A=ie=>{ie!==u?p&&p(ie,"asc"):p&&p(u,f==="asc"?"desc":"asc")},R=ie=>u===ie?f:null,j=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),K=j&&l?r.filter(ie=>!(l.includes(xn(ie))||ie.hideCol)):r.filter(ie=>!ie.hideCol);a&&!j&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:ie=>{const xe=z===ie;return b.jsx(H.IconButton,{"data-testid":"expand-collapse-btn","aria-label":xe?"collapse row":"expand row",size:"small",onClick:()=>te(ie),children:xe?b.jsx(dp,{"data-testid":"collapse-up"}):b.jsx(p0,{"data-testid":"expand-down"})})}});const U=p!==void 0,J=ie=>U?m?m.includes(ie):!0:!1,me=b.jsxs(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(qU,{})," ",g]}),he=b.jsxs(H.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(iw,{color:"error"})," ",x,S&&b.jsx(H.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ue=()=>{if(x)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:me})})},Z=()=>{if(x)return he;if(o.length===0)return me},re=ie=>{C&&_(ie)},de=ie=>{const xe=n(ie);if((i||s)&&(i==null||i(xe),s==null||s(ie),re(xe)),a&&L){const Ee=z===xe?void 0:xe;F(Ee),re(Ee)}},te=ie=>{const xe=z===ie?void 0:ie;F(xe),re(xe)},oe=ie=>{if(!a)return;const xe=z===n(ie);return b.jsxs(b.Fragment,{children:[b.jsxs(H.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>te(n(ie)),children:[xe?b.jsx(dp,{}):b.jsx(p0,{})," Show"," ",xe?"Less":"More"]}),b.jsx(L2,{colSpan:r.length,isExpanded:n(ie)===z,obj:ie,renderExpand:Ee=>a(Ee),asMobileCard:!0})]})},le=typeof C=="string"?C:B.grey[B.mode=="dark"?600:50],ye=ie=>{const xe=P===n(ie)?le:"inherit";return{cursor:i||L?"pointer":"default",backgroundColor:xe,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:xe===le?pG(xe,.1):le}}}},Y=B.grey[B.mode==="dark"?600:400],ee=ie=>ie&&b.jsx(H.Tooltip,{title:ie,children:b.jsx(UU,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:V??Y,marginLeft:"2px"}})}),pe=()=>b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:v,"data-testid":"mui-table-mobile",children:[U&&b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(H.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:ie=>A(ie.target.value),fullWidth:!0,children:K.map(ie=>{if(J(xn(ie)))return b.jsx(H.MenuItem,{value:xn(ie),children:ie.label??Ln(xn(ie))},`rowHeader-${xn(ie)}`)})}),b.jsx(H.IconButton,{onClick:()=>{u&&A(u)},children:b.jsx(QU,{className:`sort-icon-${f}`})})]}),b.jsx(H.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(ie=>b.jsxs(H.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(ie)},onClick:()=>de(ie),"data-testid":`card-${n(ie)}`,children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:K.map(xe=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${xn(xe)}`,style:{textWrap:"nowrap"},children:[xe.label??Ln(xn(xe)),ee(xe.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(xe)}`,style:{paddingLeft:"10px"},children:$u(xe,ie,j)})]},`row-${n(ie)}-${xn(xe)}`))})}),oe(ie)]},n(ie)))]}),Ce=()=>b.jsx(H.TableContainer,{component:H.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:I?{maxHeight:I,overflow:"auto"}:{},children:b.jsxs(H.Table,{stickyHeader:I!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(H.TableHead,{className:"MBv2_Table_Head",children:b.jsx(H.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((ie,xe)=>{const Ee=J(xn(ie));return b.jsx(H.TableCell,{width:Array.isArray(y)?y[xe]:"auto",sx:ie.tableCellSx??{},children:b.jsx(H.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(H.Box,{sx:[Ee&&{"&:hover":{cursor:"pointer",backgroundColor:B.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Ee?()=>A(xn(ie)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ie.label??Ln(xn(ie))}),ee(ie.tooltip),Ee&&R(xn(ie))==="asc"&&b.jsx(dp,{style:{marginLeft:"5px"}}),Ee&&R(xn(ie))==="desc"&&b.jsx(p0,{style:{marginLeft:"5px"}}),Ee&&R(xn(ie))!=="asc"&&R(xn(ie))!=="desc"&&b.jsx(XU,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(ie)}`)})})}),b.jsx(H.TableBody,{className:"MBv2_Table_Body",children:ue()??o.map(ie=>b.jsxs(X.Fragment,{children:[b.jsx(H.TableRow,{"data-testid":`row-${n(ie)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(ie),sx:ye(ie),children:K.map(xe=>b.jsx(H.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(xe)}`,children:$u(xe,ie,j)},`row-${n(ie)}-${xn(xe)}`))}),a&&b.jsx(L2,{colSpan:K.length,isExpanded:n(ie)===z,obj:ie,renderExpand:xe=>a(xe),reRenderExpand:N})]},n(ie)))})]})});return b.jsx(B2,{isLoading:k,children:j&&!T?pe():Ce()})},OQ=t=>{const{fixedLayout:e,renderExpand:n,columns:r,expandOnRowClick:o,onRowClick:i,onRowClickObj:s}=t,a="Table component:";Array.isArray(e)&&(!n&&e.length!==r.length&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns".`),n&&e.length!==r.length+1&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),o&&!n&&console.warn(`${a} renderExpand should be defined when expandOnRowClick is defined`),i&&s&&console.warn(`${a} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`)},xn=t=>t.key??t.fieldName,MQ=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),$u=(t,e,n=!1)=>{const r=MQ(e,t.fieldName);return t.render?t.render(r,e,n):r},F2=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},y=x=>{r(parseInt(x.target.value,10))},v=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(H.Box,{children:[b.jsx(ov,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(H.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},R2=()=>({height:window.innerHeight,width:window.innerWidth}),z2=()=>{const[t,e]=X.useState(R2());return X.useEffect(()=>{const n=()=>{e(R2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},co=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=z2(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(H.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...cr({...t},a)})},_Q=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(H.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",startIcon:b.jsx(h0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},IQ=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(H.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",color:"error",startIcon:b.jsx(Jb,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},V2=t=>{const{gap:e=1,...n}=t;return b.jsx(H.Box,{display:"flex",flexDirection:"column",gap:e,...n})},AQ=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onViewCitation:l,onViewAttachment:u,onDeleteCitation:f,onDownloadAttachment:p,onPreviewAttachment:m,onSelect:y,getCitationsPaginated:v,selectedIds:g,setSelectedIds:x,onError:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:I=!1,showCloseBtn:N=!1,canSearch:L=!1}=t,V=!!t.canCreate&&!I,M=!!a&&!!s&&!I,B=!!u&&!!l&&I&&k,z=!!f&&!I,{palette:F}=H.useTheme(),[P,_]=X.useState([]),[A,R]=X.useState(!1),[j,K]=X.useState(!0),[U,J]=X.useState(null),[me,he]=X.useState(null),[ue,Z]=X.useState(null),[re,de]=X.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:L?"":void 0}),te=()=>{R(!1),K(!0),v({pageNo:re.pageNo,pageSize:re.pageSize,search:re.search}).then(Ne=>(_(Ne.data),de(Ie=>({...Ie,totalCount:Ne.totalCount})),Ne)).catch(Ne=>{S(Ne),R(!0),_([])}).finally(()=>K(!1))};X.useEffect(te,[re.pageNo,re.pageSize,e,re.search]);const oe=()=>{he(null),Z(null),J(null)},le=b.jsx(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Vf,{}),children:"Add Citation"}),ye=b.jsx(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx(PM,{}),children:"Add Attachment"}),Y=Ne=>{if(!(!M&&!B)){if(M)return b.jsx(H.Tooltip,{title:"Edit",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>Ne.fileName?a(Ne):s(Ne),"data-testid":`citation-table_edit-btn-${Ne.id}`,children:b.jsx(jU,{})})});if(B)return b.jsx(H.Tooltip,{title:"View",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>Ne.fileName?u(Ne):l(Ne),"data-testid":`citation-table_view-btn-${Ne.id}`,children:b.jsx(eq,{})})})}},ee=Ne=>{if(!(!z||I))return b.jsx(H.Tooltip,{title:"Delete",children:b.jsx(H.IconButton,{color:"error",onClick:Ie=>{he(Ne),J(Ie.currentTarget)},"data-testid":`citation-table_delete-btn-${Ne.id}`,children:b.jsx(Jb,{})})})},pe=Ne=>{if(!C)return;if(!Ne.fileName)return b.jsx(H.Tooltip,{title:"Open URL",children:b.jsx(H.IconButton,{color:"primary",onClick:Tt=>{J(Tt.currentTarget),Z(Ne)},"data-testid":`citation-table_launch-link-btn-${Ne.id}`,sx:{visibility:C!=null&&C(Ne)?"visible":"hidden"},children:b.jsx(h0,{})})})},Ce=Ne=>{if(!m||!Ne.fileName)return;const Ie=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],Tt=Ne.fileName.split(".").pop();if(!(!Tt||!Ie.includes(Tt)))return b.jsx(H.Tooltip,{title:"View File",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>m==null?void 0:m(Ne),"data-testid":`citation-table_view-file-btn-${Ne.id}`,children:b.jsx(h0,{})})})},ie=Ne=>{if(!p)return;if(!!Ne.fileName)return b.jsx(H.Tooltip,{title:"Download",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>p==null?void 0:p(Ne),"data-testid":`citation-table_download-btn-${Ne.id}`,children:b.jsx(WU,{})})})},xe=B||M||z||C||m||p||O,Ee=[{fieldName:"id",key:"select",label:"",hideCol:!T,render:(Ne,Ie)=>b.jsx(H.Checkbox,{"data-testid":`citation-table_checkbox-${Ne}`,onChange:()=>{const Tt=g.includes(Ie.id);x(Tt?g.filter(_t=>_t!==Ie.id):[...g,Ie.id])},checked:g.includes(Ne),disabled:I})},...H2(F,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!xe,render:(Ne,Ie)=>b.jsxs(H.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(Ie),ee(Ie),Y(Ie),Ce(Ie),pe(Ie),ie(Ie)]})}],Ve=X.useCallback(Ne=>{de(Ie=>({...Ie,pageNo:0,search:Ne}))},[]),Ue=()=>L?b.jsx(LM,{onSearch:Ve}):null;return b.jsxs(V2,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[b.jsx(H.Typography,{variant:k?"h6":"h2",children:n}),!T&&V&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ye]}),N&&b.jsx(H.IconButton,{onClick:r,children:b.jsx(up,{})})]}),Ue(),b.jsx(F2,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:j,columns:Ee,data:P,paginationState:re,onPageChange:Ne=>de(Ie=>({...Ie,pageNo:Ne})),onRowsPerPageChange:Ne=>de(Ie=>({...Ie,pageSize:Ne,pageNo:0})),errorTableMsg:A?"Failed to load citations.":void 0,retryCallback:te}),T&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&b.jsxs(b.Fragment,{children:[le,ye]})}),!I&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(co,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(co,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(_Q,{citation:ue,anchorEl:U,onClose:oe}),b.jsx(IQ,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:oe})]})},H2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(H.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(PM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Vf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",tableCellSx:{width:e?"100%":"auto"},render:n=>e?ma.truncate(n,{length:40,omission:"..."}):n},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:e,render:(n,r)=>b.jsx("span",{style:{wordBreak:"break-all"},children:n||r.url}),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],iv=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(co,{type:n,disabled:e,size:r,startIcon:e?b.jsx(H.CircularProgress,{size:s,color:"inherit"}):null,...o})};var sv,W2;function DQ(){if(W2)return sv;W2=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,k){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=k};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);sv={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var I=0,N=k.length,L=C;I<N-1;){var V=k[I];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;L=L[k[I++]]}L[k[I]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var I=0,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,I,N,L;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),L=y(O),N=!L&&/^\d+$/.test(O),k.call(T,O,L,N,I,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return sv}var Ca=DQ(),av,j2;function PQ(){if(j2)return av;j2=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 av={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(" ")},av}var lv=PQ(),wh={exports:{}},U2;function NQ(){if(U2)return wh.exports;U2=1,wh.exports=function(o){return t(e(o),o)},wh.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(y,v,g){if(g.has(y)){var x;try{x=", node was:"+JSON.stringify(y)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[v]){l[v]=!0;var S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--v];m(k,p.get(k),g)}while(v);g.delete(y)}a[--s]=y}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return wh.exports}var $Q=NQ();const LQ=Un($Q),BQ=Object.prototype.toString,FQ=Error.prototype.toString,RQ=RegExp.prototype.toString,zQ=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",VQ=/^Symbol\((.*)\)(.*)$/;function HQ(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function q2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return HQ(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return zQ.call(t).replace(VQ,"Symbol($1)");const r=BQ.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+FQ.call(t)+"]":r==="RegExp"?RQ.call(t):null}function ws(t,e){let n=q2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=q2(this[r],e);return i!==null?i:o},2)}function K2(t){return t==null?[]:[].concat(t)}let Y2,G2,J2,WQ=/\$\{\s*(\w+)\s*\}/g;Y2=Symbol.toStringTag;class X2{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[Y2]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],K2(e).forEach(i=>{if(hr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}G2=Symbol.hasInstance,J2=Symbol.toStringTag;class hr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(WQ,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new X2(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[J2]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,hr)}static[G2](e){return X2[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ei={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},kr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},jQ={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"},cv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},UQ={isValue:"${path} field must be ${value}"},Sh={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:jQ,date:cv,object:Sh,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:UQ,tuple:{notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return hr.formatError(ei.notType,t)}}});const uv=t=>t&&t.__isYupSchema__;class Ch{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 Ch(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(!uv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Th={context:"$",value:"."};class Ta{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]===Th.context,this.isValue=this.key[0]===Th.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Th.context:this.isValue?Th.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Ca.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}}Ta.prototype.__isYupRef=!0;const ka=t=>t==null;function Ll(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(B={}){const z=Z2(Object.assign({value:n,originalValue:i,label:s.spec.label,path:B.path||r,spec:s.spec,disableStackTrace:B.disableStackTrace||S},p,B.params),k),F=new hr(hr.formatError(B.message||m,z),n,z.path,B.type||u,z.disableStackTrace);return F.params=z,F}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(B){return Q2(B,k)},options:o,originalValue:i,schema:s};const I=B=>{hr.isError(B)?C(B):B?l(null):C(T())},N=B=>{hr.isError(B)?C(B):a(B)};if(y&&ka(n))return I(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(I,N)}}catch(B){N(B);return}I(V)}return e.OPTIONS=t,e}function Z2(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=Q2(t[n],e);return t}function Q2(t,e){return Ta.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function qQ(t,e,n,r=n){let o,i,s;return e?(Ca.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 kh extends Set{describe(){const e=[];for(const n of this.values())e.push(Ta.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 kh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Bl(t,e=new Map){if(uv(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=Bl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,Bl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Bl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Bl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function KQ(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function YQ(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:KQ(n)}))}function eI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return YQ(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>eI(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new kh,this._blacklist=new kh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ei.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Bl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&ka(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
405
+ 3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function QZ(){Kt.scanner=UZ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=YZ(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 nv(t){return Kt.initialized||QZ(),GZ(Kt.parser.start,t,S2(Kt.scanner.start,t))}nv.scan=S2;function _2(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new ev(n),o=nv(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}const rv="[\0-   ᠎ -\u2029  ]",eQ=new RegExp(rv),tQ=new RegExp(`${rv}$`),nQ=new RegExp(rv,"g");function rQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function oQ(t){return new en({key:new On("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=$R(n.doc,[...e]);if(VR(a).forEach(({newRange:u})=>{const f=BR(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1)p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ");else if(f.length){const y=r.doc.textBetween(u.from,u.to," "," ");if(!tQ.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(eQ).filter(Boolean);if(y.length<=0)return!1;const v=y[y.length-1],g=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=nv(v).map(S=>S.toObject(t.defaultProtocol));if(!rQ(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:g+S.start+1,to:g+S.end+1})).filter(S=>r.schema.marks.code?!r.doc.rangeHasMark(S.from,S.to,r.schema.marks.code):!0).filter(S=>t.validate(S.value)).filter(S=>t.shouldAutoLink(S.value)).forEach(S=>{Ug(S.from,S.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(S.from,S.to,t.type.create({href:S.href}))})}}),!!s.steps.length)return s}})}function iQ(t){return new en({key:new On("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=jg(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 sQ(t){return new en({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=_2(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function Sa(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(nQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const aQ=xr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){M2(t);return}M2(t.scheme,t.optionalSlashes)})},onDestroy(){ZZ()},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)=>!!Sa(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=>!!Sa(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=>!!Sa(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xt(this.options.HTMLAttributes,t),0]:["a",xt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Sa(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=>!!Sa(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[as({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=_2(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Sa(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(oQ({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Sa(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(iQ({type:this.type})),this.options.linkOnPaste&&t.push(sQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function lQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=f3(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const g=a.pos-v.length,x=Array.from(v.matchAll(y)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const S=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(S);if(i!==null&&!k)return null;const T=g+x.index;let C=T+x[0].length;return l&&f.test(v.slice(C-1,C+1))&&(x[0]+=" ",C+=1),T<a.pos&&C>=a.pos?{range:{from:T,to:C},query:x[0].slice(n.length),text:x[0]}:null}const cQ=new On("suggestion");function uQ({pluginKey:t=cQ,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:y=()=>({}),allow:v=()=>!0,findSuggestionMatch:g=lQ}){let x;const S=y==null?void 0:y(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,L,V,M,B;const z=(O=this.key)===null||O===void 0?void 0:O.getState(C),F=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=z.active&&F.active&&z.range.from!==F.range.from,_=!z.active&&F.active,A=z.active&&!F.active,R=!_&&!A&&z.query!==F.query,j=_||P&&R,K=R||P,U=A||P&&R;if(!j&&!K&&!U)return;const J=U&&!j?z:F,me=T.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);x={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:he=>p({editor:e,range:J.range,props:he}),decorationNode:me,clientRect:me?()=>{var he;const{decorationId:ue}=(he=this.key)===null||he===void 0?void 0:he.getState(e.state),Z=T.dom.querySelector(`[data-decoration-id="${ue}"]`);return(Z==null?void 0:Z.getBoundingClientRect())||null}:null},j&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.call(S,x)),K&&((L=S==null?void 0:S.onBeforeUpdate)===null||L===void 0||L.call(S,x)),(K||j)&&(x.items=await m({editor:e,query:J.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),j&&((B=S==null?void 0:S.onStart)===null||B===void 0||B.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,I){const{isEditable:N}=e,{composing:L}=e.view,{selection:V}=T,{empty:M,from:B}=V,z={...C};if(z.composing=L,N&&(M||e.view.composing)){(B<C.range.from||B>C.range.to)&&!L&&!C.composing&&(z.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;F&&v({editor:e,state:I,range:F.range,isActive:C.active})?(z.active=!0,z.decorationId=C.decorationId?C.decorationId:P,z.range=F.range,z.query=F.query,z.text=F.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(T,C){var O;const{active:I,range:N}=k.getState(T.state);return I&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const L=!(N!=null&&N.length),V=[l];return L&&V.push(f),Jt.create(T.doc,[Yn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function dQ({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new On;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,f;const p=i.view.state.selection.$to.nodeAfter;((l=p==null?void 0:p.text)===null||l===void 0?void 0:l.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:n,attrs:{...a,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(f=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||f===void 0||f.collapseToEnd()},allow:({state:i,range:s})=>{const a=i.doc.resolve(s.from),l=i.schema.nodes[n];return!!a.parent.type.contentMatch.matchType(l)},...e}}function I2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>dQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function A2(t,e){const n=I2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const fQ=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",xt(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=A2(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=xt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",xt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:A2(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new fi,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return I2(this).map(uQ)}}),D2=ln.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new On("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&&af(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Yn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Jt.create(t,o)}}})]}}),pQ=xr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",xt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),hQ=tn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",xt(this.options.HTMLAttributes,t),0]}}),mQ=tn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",xt(this.options.HTMLAttributes,t),0]}}),gQ=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",xt(this.options.HTMLAttributes,t),0]}}),yQ=/^\s*(\[([( |x])?\])\s$/,bQ=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",xt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const y=n();if(typeof y!="number")return!1;const v=m.doc.nodeAt(y);return m.setNodeMarkup(y,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[al({find:yQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),vQ=tn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",xt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),xQ=ln.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),P2=X.forwardRef((t,e)=>{const[n,r]=X.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 X.useEffect(()=>r(0),[t.items]),X.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?b.jsx(H.Paper,{elevation:5,children:b.jsx(H.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(H.ListItem,{disablePadding:!0,children:b.jsx(H.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});P2.displayName="SuggestionList";const N2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},wQ={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 fO(P2,{props:n,editor:n.editor}),e=su("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2},appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})[0]},onUpdate(n){t==null||t.updateProps(n),e==null||e.setProps({getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??N2}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},SQ=aQ.extend({inclusive:!1}),CQ=pQ.extend({excludes:"superscript"}),TQ=rM.extend({excludes:"subscript"});function kQ({placeholder:t}={}){return X.useMemo(()=>[p7.configure({resizable:!0}),gQ,mQ,hQ,aT,cT,uT,hT,kT,MT,_T,CQ,TQ,AT,oT,rT,lT,TT,nM,IT,SQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),X9,pT,G9,xQ.configure({types:["heading","paragraph","image"]}),NZ,$Z,LZ,qj,FT.configure({multicolor:!0}),CT,f8,dT,vQ,bQ.configure({nested:!0}),fQ.configure({suggestion:wQ}),D2.configure({placeholder:t}),ST],[t])}function $2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const EQ=t=>{const e=kQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(eM,{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;X.useEffect(()=>{var S,k,T;(T=(k=(S=m==null?void 0:m.current)==null?void 0:S.editor)==null?void 0:k.commands)==null||T.setContent(p)},[p]);const m=X.useRef(null),y=X.useCallback((S,k)=>{var C;const T=(C=m.current)==null?void 0:C.editor;if(!(!T||!i))if(i instanceof Promise)i(S).then(O=>{tb({images:O,editor:T,position:k})});else{const O=i(S);tb({images:O,editor:T,position:k})}},[]),v=X.useCallback((S,k,T,C)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=$2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return y(O,N),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=$2(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(H.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(QO,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(DZ,{onUploadFiles:i}),onBlur:()=>{var S,k;return f(((k=(S=m.current)==null?void 0:S.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>b.jsxs(b.Fragment,{children:[b.jsx(N7,{}),b.jsx(Y7,{})]})})});return b.jsxs(H.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(H.Typography,{...o,children:r}),x]})},L2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=X.useState(!1),[u,f]=X.useState(void 0);X.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?b.jsx(H.Collapse,{in:n,children:u}):b.jsx(H.TableRow,{sx:p,children:b.jsx(H.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(H.Collapse,{in:n,children:u})})})},B2=({isLoading:t,children:e})=>{const[n,r]=X.useState(!1);return X.useEffect(()=>{let o,i;return t?o=setTimeout(()=>r(!0),300):n?i=setTimeout(()=>r(!1),200):(o&&clearTimeout(o),r(!1)),()=>{o&&clearTimeout(o),i&&clearTimeout(i)}},[t,n]),b.jsxs(H.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,b.jsx(H.Box,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,pointerEvents:n?"auto":"none",opacity:n?1:0,transition:"opacity 0.3s ease"},children:b.jsx(H.CircularProgress,{})})]})},ov=t=>{const{id:e,getRowKey:n=ie=>"id"in ie&&(typeof ie.id=="string"||typeof ie.id=="number")?ie.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(ie)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(ie)),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,renderExpand:a,hideColumnsOnMobile:l=[],sortField:u,sortOrder:f,onSortChange:p,allowSortCols:m,fixedLayout:y=!1,className:v,emptyTableMsg:g="No items to display",errorTableMsg:x,retryCallback:S,isLoading:k=!1,disableMobileCards:T=!1,highlightSelectedRow:C=!1,headerRowStyle:O={},stickyHeader:I,reRenderExpand:N=!1,expandOnRowClick:L=!1,tooltipColor:V,...M}=t,{palette:B}=H.useTheme(),[z,F]=X.useState(void 0),[P,_]=X.useState(void 0);OQ(t);const A=ie=>{ie!==u?p&&p(ie,"asc"):p&&p(u,f==="asc"?"desc":"asc")},R=ie=>u===ie?f:null,j=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),K=j&&l?r.filter(ie=>!(l.includes(xn(ie))||ie.hideCol)):r.filter(ie=>!ie.hideCol);a&&!j&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:ie=>{const xe=z===ie;return b.jsx(H.IconButton,{"data-testid":"expand-collapse-btn","aria-label":xe?"collapse row":"expand row",size:"small",onClick:()=>te(ie),children:xe?b.jsx(dp,{"data-testid":"collapse-up"}):b.jsx(p0,{"data-testid":"expand-down"})})}});const U=p!==void 0,J=ie=>U?m?m.includes(ie):!0:!1,me=b.jsxs(H.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(qU,{})," ",g]}),he=b.jsxs(H.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(iw,{color:"error"})," ",x,S&&b.jsx(H.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ue=()=>{if(x)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return b.jsx(H.TableRow,{children:b.jsx(H.TableCell,{colSpan:r.length,align:"center",children:me})})},Z=()=>{if(x)return he;if(o.length===0)return me},re=ie=>{C&&_(ie)},de=ie=>{const xe=n(ie);if((i||s)&&(i==null||i(xe),s==null||s(ie),re(xe)),a&&L){const Ee=z===xe?void 0:xe;F(Ee),re(Ee)}},te=ie=>{const xe=z===ie?void 0:ie;F(xe),re(xe)},oe=ie=>{if(!a)return;const xe=z===n(ie);return b.jsxs(b.Fragment,{children:[b.jsxs(H.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>te(n(ie)),children:[xe?b.jsx(dp,{}):b.jsx(p0,{})," Show"," ",xe?"Less":"More"]}),b.jsx(L2,{colSpan:r.length,isExpanded:n(ie)===z,obj:ie,renderExpand:Ee=>a(Ee),asMobileCard:!0})]})},le=typeof C=="string"?C:B.grey[B.mode=="dark"?600:50],ye=ie=>{const xe=P===n(ie)?le:"inherit";return{cursor:i||L?"pointer":"default",backgroundColor:xe,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:xe===le?pG(xe,.1):le}}}},Y=B.grey[B.mode==="dark"?600:400],ee=ie=>ie&&b.jsx(H.Tooltip,{title:ie,children:b.jsx(UU,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:V??Y,marginLeft:"2px"}})}),pe=()=>b.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:v,"data-testid":"mui-table-mobile",children:[U&&b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(H.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:ie=>A(ie.target.value),fullWidth:!0,children:K.map(ie=>{if(J(xn(ie)))return b.jsx(H.MenuItem,{value:xn(ie),children:ie.label??Ln(xn(ie))},`rowHeader-${xn(ie)}`)})}),b.jsx(H.IconButton,{onClick:()=>{u&&A(u)},children:b.jsx(QU,{className:`sort-icon-${f}`})})]}),b.jsx(H.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(ie=>b.jsxs(H.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ye(ie)},onClick:()=>de(ie),"data-testid":`card-${n(ie)}`,children:[b.jsx("table",{className:"MBv2_Table_Stack",children:b.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:K.map(xe=>b.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[b.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${xn(xe)}`,style:{textWrap:"nowrap"},children:[xe.label??Ln(xn(xe)),ee(xe.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(xe)}`,style:{paddingLeft:"10px"},children:$u(xe,ie,j)})]},`row-${n(ie)}-${xn(xe)}`))})}),oe(ie)]},n(ie)))]}),Ce=()=>b.jsx(H.TableContainer,{component:H.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:I?{maxHeight:I,overflow:"auto"}:{},children:b.jsxs(H.Table,{stickyHeader:I!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(H.TableHead,{className:"MBv2_Table_Head",children:b.jsx(H.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((ie,xe)=>{const Ee=J(xn(ie));return b.jsx(H.TableCell,{width:Array.isArray(y)?y[xe]:"auto",sx:ie.tableCellSx??{},children:b.jsx(H.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(H.Box,{sx:[Ee&&{"&:hover":{cursor:"pointer",backgroundColor:B.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Ee?()=>A(xn(ie)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ie.label??Ln(xn(ie))}),ee(ie.tooltip),Ee&&R(xn(ie))==="asc"&&b.jsx(dp,{style:{marginLeft:"5px"}}),Ee&&R(xn(ie))==="desc"&&b.jsx(p0,{style:{marginLeft:"5px"}}),Ee&&R(xn(ie))!=="asc"&&R(xn(ie))!=="desc"&&b.jsx(XU,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(ie)}`)})})}),b.jsx(H.TableBody,{className:"MBv2_Table_Body",children:ue()??o.map(ie=>b.jsxs(X.Fragment,{children:[b.jsx(H.TableRow,{"data-testid":`row-${n(ie)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(ie),sx:ye(ie),children:K.map(xe=>b.jsx(H.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(xe)}`,children:$u(xe,ie,j)},`row-${n(ie)}-${xn(xe)}`))}),a&&b.jsx(L2,{colSpan:K.length,isExpanded:n(ie)===z,obj:ie,renderExpand:xe=>a(xe),reRenderExpand:N})]},n(ie)))})]})});return b.jsx(B2,{isLoading:k,children:j&&!T?pe():Ce()})},OQ=t=>{const{fixedLayout:e,renderExpand:n,columns:r,expandOnRowClick:o,onRowClick:i,onRowClickObj:s}=t,a="Table component:";Array.isArray(e)&&(!n&&e.length!==r.length&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns".`),n&&e.length!==r.length+1&&console.warn(`${a} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),o&&!n&&console.warn(`${a} renderExpand should be defined when expandOnRowClick is defined`),i&&s&&console.warn(`${a} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`)},xn=t=>t.key??t.fieldName,MQ=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),$u=(t,e,n=!1)=>{const r=MQ(e,t.fieldName);return t.render?t.render(r,e,n):r},F2=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=x=>{n(x)},y=x=>{r(parseInt(x.target.value,10))},v=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(H.Box,{children:[b.jsx(ov,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(H.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},R2=()=>({height:window.innerHeight,width:window.innerWidth}),z2=()=>{const[t,e]=X.useState(R2());return X.useEffect(()=>{const n=()=>{e(R2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},co=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=z2(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(H.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...cr({...t},a)})},_Q=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[b.jsxs(H.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",b.jsx("br",{}),b.jsx("b",{children:e.url}),"?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",startIcon:b.jsx(h0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},IQ=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(H.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(H.Box,{component:H.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(H.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(H.Box,{display:"flex",flexDirection:"row",children:[b.jsx(co,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(co,{size:"small",color:"error",startIcon:b.jsx(Jb,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},V2=t=>{const{gap:e=1,...n}=t;return b.jsx(H.Box,{display:"flex",flexDirection:"column",gap:e,...n})},AQ=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onViewCitation:l,onViewAttachment:u,onDeleteCitation:f,onDownloadAttachment:p,onPreviewAttachment:m,onSelect:y,getCitationsPaginated:v,selectedIds:g,setSelectedIds:x,onError:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:I=!1,showCloseBtn:N=!1,canSearch:L=!1}=t,V=!!t.canCreate&&!I,M=!!a&&!!s&&!I,B=!!u&&!!l&&I&&k,z=!!f&&!I,{palette:F}=H.useTheme(),[P,_]=X.useState([]),[A,R]=X.useState(!1),[j,K]=X.useState(!0),[U,J]=X.useState(null),[me,he]=X.useState(null),[ue,Z]=X.useState(null),[re,de]=X.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:L?"":void 0}),te=()=>{R(!1),K(!0),v({pageNo:re.pageNo,pageSize:re.pageSize,search:re.search}).then(Ne=>(_(Ne.data),de(Ie=>({...Ie,totalCount:Ne.totalCount})),Ne)).catch(Ne=>{S(Ne),R(!0),_([])}).finally(()=>K(!1))};X.useEffect(te,[re.pageNo,re.pageSize,e,re.search]);const oe=()=>{he(null),Z(null),J(null)},le=b.jsx(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Vf,{}),children:"Add Citation"}),ye=b.jsx(co,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx(PM,{}),children:"Add Attachment"}),Y=Ne=>{if(!(!M&&!B)){if(M)return b.jsx(H.Tooltip,{title:"Edit",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>Ne.fileName?a(Ne):s(Ne),"data-testid":`citation-table_edit-btn-${Ne.id}`,children:b.jsx(jU,{})})});if(B)return b.jsx(H.Tooltip,{title:"View",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>Ne.fileName?u(Ne):l(Ne),"data-testid":`citation-table_view-btn-${Ne.id}`,children:b.jsx(eq,{})})})}},ee=Ne=>{if(!(!z||I))return b.jsx(H.Tooltip,{title:"Delete",children:b.jsx(H.IconButton,{color:"error",onClick:Ie=>{he(Ne),J(Ie.currentTarget)},"data-testid":`citation-table_delete-btn-${Ne.id}`,children:b.jsx(Jb,{})})})},pe=Ne=>{if(!C)return;if(!Ne.fileName)return b.jsx(H.Tooltip,{title:"Open URL",children:b.jsx(H.IconButton,{color:"primary",onClick:Tt=>{J(Tt.currentTarget),Z(Ne)},"data-testid":`citation-table_launch-link-btn-${Ne.id}`,sx:{visibility:C!=null&&C(Ne)?"visible":"hidden"},children:b.jsx(h0,{})})})},Ce=Ne=>{if(!m||!Ne.fileName)return;const Ie=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],Tt=Ne.fileName.split(".").pop();if(!(!Tt||!Ie.includes(Tt)))return b.jsx(H.Tooltip,{title:"View File",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>m==null?void 0:m(Ne),"data-testid":`citation-table_view-file-btn-${Ne.id}`,children:b.jsx(h0,{})})})},ie=Ne=>{if(!p)return;if(!!Ne.fileName)return b.jsx(H.Tooltip,{title:"Download",children:b.jsx(H.IconButton,{color:"primary",onClick:()=>p==null?void 0:p(Ne),"data-testid":`citation-table_download-btn-${Ne.id}`,children:b.jsx(WU,{})})})},xe=B||M||z||C||m||p||O,Ee=[{fieldName:"id",key:"select",label:"",hideCol:!T,render:(Ne,Ie)=>b.jsx(H.Checkbox,{"data-testid":`citation-table_checkbox-${Ne}`,onChange:()=>{const Tt=g.includes(Ie.id);x(Tt?g.filter(_t=>_t!==Ie.id):[...g,Ie.id])},checked:g.includes(Ne),disabled:I})},...H2(F,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!xe,render:(Ne,Ie)=>b.jsxs(H.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(Ie),ee(Ie),Y(Ie),Ce(Ie),pe(Ie),ie(Ie)]})}],Ve=X.useCallback(Ne=>{de(Ie=>({...Ie,pageNo:0,search:Ne}))},[]),Ue=()=>L?b.jsx(LM,{onSearch:Ve}):null;return b.jsxs(V2,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[b.jsx(H.Typography,{variant:k?"h6":"h2",children:n}),!T&&V&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ye]}),N&&b.jsx(H.IconButton,{onClick:r,children:b.jsx(up,{})})]}),Ue(),b.jsx(F2,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:j,columns:Ee,data:P,paginationState:re,onPageChange:Ne=>de(Ie=>({...Ie,pageNo:Ne})),onRowsPerPageChange:Ne=>de(Ie=>({...Ie,pageSize:Ne,pageNo:0})),errorTableMsg:A?"Failed to load citations.":void 0,retryCallback:te}),T&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&b.jsxs(b.Fragment,{children:[le,ye]})}),!I&&b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(co,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(co,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(_Q,{citation:ue,anchorEl:U,onClose:oe}),b.jsx(IQ,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:oe})]})},H2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(H.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(PM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Vf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",tableCellSx:{width:e?"100%":"auto"},render:n=>e?ma.truncate(n,{length:40,omission:"..."}):n},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:e,render:(n,r)=>b.jsx("span",{style:{wordBreak:"break-all"},children:n||r.url}),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"accessedAt",hideCol:e,render:(n,r)=>{if(!r.fileName)return(n==null?void 0:n.slice(0,10))??""}},{fieldName:"classification",hideCol:e}],iv=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(co,{type:n,disabled:e,size:r,startIcon:e?b.jsx(H.CircularProgress,{size:s,color:"inherit"}):null,...o})};var sv,W2;function DQ(){if(W2)return sv;W2=1;function t(S){this._maxSize=S,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(S){return this._values[S]},t.prototype.set=function(S,k){return this._size>=this._maxSize&&this.clear(),S in this._values||this._size++,this._values[S]=k};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);sv={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var I=0,N=k.length,L=C;I<N-1;){var V=k[I];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;L=L[k[I++]]}L[k[I]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var I=0,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(y(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(S,k,T){m(Array.isArray(S)?S:p(S),k,T)}};function f(S){return a.get(S)||a.set(S,p(S).map(function(k){return k.replace(i,"$2")}))}function p(S){return S.match(e)||[""]}function m(S,k,T){var C=S.length,O,I,N,L;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),L=y(O),N=!L&&/^\d+$/.test(O),k.call(T,O,L,N,I,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return sv}var Ca=DQ(),av,j2;function PQ(){if(j2)return av;j2=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 av={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(" ")},av}var lv=PQ(),wh={exports:{}},U2;function NQ(){if(U2)return wh.exports;U2=1,wh.exports=function(o){return t(e(o),o)},wh.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(y,v,g){if(g.has(y)){var x;try{x=", node was:"+JSON.stringify(y)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[v]){l[v]=!0;var S=f.get(y)||new Set;if(S=Array.from(S),v=S.length){g.add(y);do{var k=S[--v];m(k,p.get(k),g)}while(v);g.delete(y)}a[--s]=y}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return wh.exports}var $Q=NQ();const LQ=Un($Q),BQ=Object.prototype.toString,FQ=Error.prototype.toString,RQ=RegExp.prototype.toString,zQ=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",VQ=/^Symbol\((.*)\)(.*)$/;function HQ(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function q2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return HQ(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return zQ.call(t).replace(VQ,"Symbol($1)");const r=BQ.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+FQ.call(t)+"]":r==="RegExp"?RQ.call(t):null}function ws(t,e){let n=q2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=q2(this[r],e);return i!==null?i:o},2)}function K2(t){return t==null?[]:[].concat(t)}let Y2,G2,J2,WQ=/\$\{\s*(\w+)\s*\}/g;Y2=Symbol.toStringTag;class X2{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[Y2]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],K2(e).forEach(i=>{if(hr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}G2=Symbol.hasInstance,J2=Symbol.toStringTag;class hr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(WQ,(o,i)=>ws(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new X2(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[J2]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,hr)}static[G2](e){return X2[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ei={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},kr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},jQ={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"},cv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},UQ={isValue:"${path} field must be ${value}"},Sh={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:jQ,date:cv,object:Sh,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:UQ,tuple:{notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return hr.formatError(ei.notType,t)}}});const uv=t=>t&&t.__isYupSchema__;class Ch{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 Ch(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(!uv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Th={context:"$",value:"."};class Ta{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]===Th.context,this.isValue=this.key[0]===Th.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Th.context:this.isValue?Th.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Ca.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}}Ta.prototype.__isYupRef=!0;const ka=t=>t==null;function Ll(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:v,context:g,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:g};function T(B={}){const z=Z2(Object.assign({value:n,originalValue:i,label:s.spec.label,path:B.path||r,spec:s.spec,disableStackTrace:B.disableStackTrace||S},p,B.params),k),F=new hr(hr.formatError(B.message||m,z),n,z.path,B.type||u,z.disableStackTrace);return F.params=z,F}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(B){return Q2(B,k)},options:o,originalValue:i,schema:s};const I=B=>{hr.isError(B)?C(B):B?l(null):C(T())},N=B=>{hr.isError(B)?C(B):a(B)};if(y&&ka(n))return I(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(I,N)}}catch(B){N(B);return}I(V)}return e.OPTIONS=t,e}function Z2(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=Q2(t[n],e);return t}function Q2(t,e){return Ta.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function qQ(t,e,n,r=n){let o,i,s;return e?(Ca.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 kh extends Set{describe(){const e=[];for(const n of this.values())e.push(Ta.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 kh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Bl(t,e=new Map){if(uv(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=Bl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,Bl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Bl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Bl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function KQ(t){if(!(t!=null&&t.length))return;const e=[];let n="",r=!1,o=!1;for(let i=0;i<t.length;i++){const s=t[i];if(s==="["&&!o){n&&(e.push(...n.split(".").filter(Boolean)),n=""),r=!0;continue}if(s==="]"&&!o){n&&(/^\d+$/.test(n)?e.push(n):e.push(n.replace(/^"|"$/g,"")),n=""),r=!1;continue}if(s==='"'){o=!o;continue}if(s==="."&&!r&&!o){n&&(e.push(n),n="");continue}n+=s}return n&&e.push(...n.split(".").filter(Boolean)),e}function YQ(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:KQ(n)}))}function eI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return YQ(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>eI(o,r))}class ti{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new kh,this._blacklist=new kh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ei.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Bl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&ka(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
406
406
 
407
407
  attempted value: ${s}
408
408
  `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(k){k&&(Array.isArray(k)?y.push(...k):y.push(k)),--m<=0&&p(y)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,y)=>this.resolve(f)._validate(u,f,m,y)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{hr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new hr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw hr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new hr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(hr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(hr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Bl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=Ll({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=Ll({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=ei.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ei.notNull){return this.nullability(!1,e)}required(e=ei.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=ei.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Ll(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=K2(e).map(i=>new Ta(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Ch(o,n):Ch.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Ll({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=ei.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Ll({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=ei.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Ll({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?Z2(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof hr)return{issues:eI(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=qQ(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const GQ=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function JQ(t){const e=dv(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 dv(t){var e,n;const r=GQ.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 XQ=/^[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])?)*$/,ZQ=/^((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,QQ=/^(?:[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,eee="^\\d{4}-\\d{2}-\\d{2}",tee="\\d{2}:\\d{2}:\\d{2}",nee="(([+-]\\d{2}(:?\\d{2})?)|Z)",ree=new RegExp(`${eee}T${tee}(\\.\\d+)?${nee}$`),oee=t=>ka(t)||t===t.trim(),iee={}.toString();function Ea(){return new tI}class tI extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===iee?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||ei.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=kr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=kr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=kr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||kr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=kr.email){return this.matches(XQ,{name:"email",message:e,excludeEmptyString:!0})}url(e=kr.url){return this.matches(ZQ,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=kr.uuid){return this.matches(QQ,{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(ree,{name:"datetime",message:n||kr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||kr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=dv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||kr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=dv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=kr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:oee})}lowercase(e=kr.lowercase){return this.transform(n=>ka(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toLowerCase()})}uppercase(e=kr.uppercase){return this.transform(n=>ka(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toUpperCase()})}}Ea.prototype=tI.prototype;let nI=new Date(""),see=t=>Object.prototype.toString.call(t)==="[object Date]";function fv(){return new Lu}class Lu extends ti{constructor(){super({type:"date",check(e){return see(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=JQ(e),isNaN(e)?Lu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ta.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=cv.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=cv.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)}})}}Lu.INVALID_DATE=nI,fv.prototype=Lu.prototype,fv.INVALID_DATE=nI;function aee(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Ca.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),Ta.isRef(a)&&a.isSibling?i(a.path,s):uv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return LQ.array(Array.from(r),n).reverse()}function rI(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 oI(t){return(e,n)=>rI(t,e)-rI(t,n)}const lee=(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 Eh(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Eh(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Eh(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Eh)}):"optional"in t?t.optional():t}const cee=(t,e)=>{const n=[...Ca.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Ca.getter(Ca.join(n),!0)(t);return!!(o&&r in o)};let iI=t=>Object.prototype.toString.call(t)==="[object Object]";function sI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const uee=oI([]);function pv(t){return new aI(t)}class aI extends ti{constructor(e){super({type:"object",check(n){return iI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=uee,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],y=p in o,v=o[p];if(m){let g;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}g=!n.__validating||!S?m.cast(v,u):v,g!==void 0&&(l[p]=g)}else y&&!s&&(l[p]=v);(y!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!iI(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Ta.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=aee(e,n),r._sortErrors=oI(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 Eh(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=Ca.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return cee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(lee)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Sh.exact,test(n){if(n==null)return!0;const r=sI(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Sh.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=sI(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Sh.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(lv.camelCase)}snakeCase(){return this.transformKeys(lv.snakeCase)}constantCase(){return this.transformKeys(e=>lv.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}}pv.prototype=aI.prototype;const dee=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState(!1),[y,v]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});return X.useEffect(()=>{i&&v({...i,type:"Url"})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(H.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&b.jsx(H.IconButton,{onClick:o,children:b.jsx(up,{})})]}),b.jsx(jt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,onSubmit:async g=>{f(!0),n(g).catch(x=>{throw f(!1),x}).finally(()=>f(!1))},validationSchema:pv({source:Ea().required("Source is required"),title:Ea().required("Title is required"),accessedAt:fv().required("Accessed At is required"),url:Ea().required("URL is required"),classification:Ea().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:g})=>b.jsxs(jt.Form,{autoComplete:"off",children:[b.jsxs(H.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(gs,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(gs,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(Hp,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),b.jsx(gs,{name:"url",label:"URL",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(AM,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:s})]}),b.jsx(H.DialogActions,{sx:{px:0},children:s?b.jsx(H.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(iv,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),g()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},lI=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(H.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},fee=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=X.useRef(null),[f,p]=X.useState(!1),[m,y]=X.useState(!1),[v,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),b.jsxs(b.Fragment,{children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(H.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(H.IconButton,{onClick:o,children:b.jsx(up,{})})]}),b.jsx(jt.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:pv().shape({title:Ea().required("Title is required"),fileName:Ea().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit:k})=>{var T;return X.useEffect(()=>{var C,O;(C=x.file)!=null&&C.name&&S("fileName",(O=x.file)==null?void 0:O.name)},[(T=x.file)==null?void 0:T.name]),b.jsxs(jt.Form,{autoComplete:"off",children:[b.jsx(gs,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(H.Box,{marginTop:i||a?0:1,children:[b.jsxs(lI,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(fM,{name:"file",errorMode:"hidden"}),b.jsx(gs,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(br,{name:"fileName"})]}),b.jsx(H.DialogActions,{sx:{px:0},children:a?b.jsx(H.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(iv,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Bu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",y=()=>{if(s&&p)return b.jsx(H.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(H.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(H.Box,{children:y()}),b.jsxs(H.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(H.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(H.Box,{children:y()})})};return b.jsxs(H.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(H.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(H.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(up,{})})]})}):r,o&&(typeof o=="string"?b.jsx(H.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(H.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function pee(t){return Ke("MuiAlert",t)}const cI=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"]),hee=$e(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),mee=$e(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),gee=$e(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),yee=$e(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),bee=$e(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),vee=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${De(n||r)}`,`${e}${De(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return qe(i,pee,o)},xee=ne(us,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${De(n.color||n.severity)}`]]}})(gt(({theme:t})=>{const e=t.palette.mode==="light"?Rs:Va,n=t.palette.mode==="light"?Va:Rs;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${cI.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}`,[`& .${cI.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)}}}))]}})),wee=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),See=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),Cee=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),uI={success:b.jsx(hee,{fontSize:"inherit"}),warning:b.jsx(mee,{fontSize:"inherit"}),error:b.jsx(gee,{fontSize:"inherit"}),info:b.jsx(yee,{fontSize:"inherit"})},dI=D.forwardRef(function(e,n){const r=ht({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=uI,onClose:y,role:v="alert",severity:g="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:g,variant:k,colorSeverity:l||g},O=vee(C),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[N,L]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ge(O.root,s),elementType:xee,externalForwardedProps:{...I,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Mt("icon",{className:O.icon,elementType:wee,externalForwardedProps:I,ownerState:C}),[B,z]=Mt("message",{className:O.message,elementType:See,externalForwardedProps:I,ownerState:C}),[F,P]=Mt("action",{className:O.action,elementType:Cee,externalForwardedProps:I,ownerState:C}),[_,A]=Mt("closeButton",{elementType:_l,externalForwardedProps:I,ownerState:C}),[R,j]=Mt("closeIcon",{elementType:bee,externalForwardedProps:I,ownerState:C});return b.jsxs(N,{...L,children:[p!==!1?b.jsx(V,{...M,children:p||m[g]||uI[g]}):null,b.jsx(B,{...z,children:i}),o!=null?b.jsx(F,{...P,children:o}):null,o==null&&y?b.jsx(F,{...P,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...A,children:b.jsx(R,{fontSize:"small",...j})})}):null]})});process.env.NODE_ENV!=="production"&&(dI.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 Fu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=H.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return b.jsxs(dI,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(H.Typography,{variant:"h3",children:s}),n]})},fI=t=>b.jsx(Fu,{severity:"error",...t}),pI=t=>b.jsx(Fu,{severity:"success",...t}),Tee=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return b.jsxs(b.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&b.jsx(fI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(pI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function hI({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onCancel:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:y=!1,tableTitle:v="Attachments & Citations",addlActions:g,canLaunchUrl:x,readOnly:S,canSearch:k=!1}){const[T,C]=X.useState("Insert Citation/Attachment(s)"),[O,I]=X.useState(u),[N,L]=X.useState(void 0),[V,M]=X.useState(void 0),B=Y=>{M(void 0),C(Y)},[z,F]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,V,f]);const P=(Y=!1)=>{(!m||Y)&&F(ee=>ee+1)},_=(Y,ee)=>{var xe;const pe=typeof((xe=ee.response)==null?void 0:xe.data)=="string"&&ee.response.data,Ce=typeof ee.message=="string"&&ee.message;M({type:"Error",title:Y,message:pe??Ce}),p(ee)},A=Y=>M({type:"Success",title:"",message:Y}),R=async Y=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(T==="Edit Citation"||T==="Edit Attachment"){if(Y.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(Y).then(()=>{B("Insert Citation/Attachment(s)"),P()}).catch(pe=>{_("Failed to update",pe)}))}else await(e==null?void 0:e(Y).then(pe=>{I([...O,pe.id]),B("Insert Citation/Attachment(s)"),P()}).catch(pe=>{_("Failed to create",pe)}))},j=r&&(async Y=>r(Y).then(()=>{P(!0),I(O.filter(ee=>ee!==Y)),A("Successfully deleted")}).catch(ee=>_("Failed to delete",ee))),K=o&&((Y,ee)=>{o(Y.id).then(pe=>{L(pe),B(ee)}).catch(pe=>{_("Failed to load",pe)})}),U=K&&(Y=>K(Y,S?"View Citation":"Edit Citation")),J=K&&(Y=>K(Y,S?"View Attachment":"Edit Attachment")),me=n&&U,he=n&&J,ue=i&&(async Y=>i(Y).catch(ee=>{_(`Failed to download ${Y.fileName}`,ee)})),Z=s&&(async Y=>s(Y).catch(ee=>{_(`Failed to view ${Y.fileName}`,ee)})),re=b.jsx(AQ,{refreshKey:z,getCitationsPaginated:Y=>t(Y).then(ee=>(f==null||f(),ee)),onCancel:l,onNewCitation:()=>{L(void 0),B("Add Citation")},onNewAttachment:()=>{L(void 0),B("Add Attachment")},onEditCitation:me,onEditAttachment:he,onViewCitation:U,onViewAttachment:J,onDeleteCitation:j,onDownloadAttachment:ue,onPreviewAttachment:Z,onSelect:a,setSelectedIds:I,selectedIds:O,onError:p,condenseTable:m,canSelect:y,title:v,addlActions:g,canCreate:!!e,canLaunchUrl:x,readOnly:S,showCloseBtn:m,canSearch:k}),de=b.jsx(dee,{modifyCitation:N,onSave:R,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=b.jsx(fee,{onSave:R,onCancel:()=>B("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:N,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),oe=b.jsx(Tee,{alert:V,setAlert:M}),le=T==="Add Citation"||T==="Edit Citation"||T==="View Citation",ye=T==="Add Attachment"||T==="Edit Attachment"||T==="View Attachment";if(m){let Y=null;return!m||T==="Insert Citation/Attachment(s)"?Y=re:le?Y=de:ye&&(Y=te),b.jsxs(H.Box,{width:"500px",children:[oe,b.jsx(H.Box,{paddingTop:"8px",children:Y})]})}return b.jsxs(H.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&oe,b.jsx(H.Box,{paddingTop:"8px",children:re}),b.jsx(Bu,{open:le||ye,children:b.jsxs(H.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[oe,le?de:te]})})]})}function mI({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return b.jsx(hI,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const kee=H.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function Eee({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:f,...p}){const m=wt();if(m&&!("citationBubbleMenuHandler"in(m==null?void 0:m.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const y=m==null?void 0:m.storage.citationBubbleMenuHandler,v=y.isOpen,g=y.selectedIds,x=y.selectedNodePos,S=O=>{m&&(O.length===0?m.commands.deleteCitation(x):g.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{S(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{S(g),m==null||m.commands.closeCitationBubbleMenu()},C=X.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?b.jsx(by,{editor:m,open:v,...y.bubbleMenuOptions,...p,children:b.jsx(kee,{children:b.jsx(mI,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,g),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onCancel:T,initialSelectedIds:g,onContentChange:C,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const Oee=()=>ln.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function Mee(t){const e=wt(),n=X.useRef(null);return b.jsx(St,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:b.jsxs(H.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(zU,{fontSize:"small"}),b.jsx(H.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const gI=X.createContext(void 0),yI=()=>{const t=X.useContext(gI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},_ee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=yI(),[u,f]=X.useState(s?String(s):""),[p,m]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),g=v.map(S=>ma.truncate(S.title,{length:y,omission:"..."})).join(", ");f(g),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return b.jsx(Eb,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(H.Tooltip,{title:b.jsx(H.Box,{className:"citation-tooltip",children:p.map((v,g)=>{var S;const x=[v.source,v.title,v.fileName,v.url,(S=v.accessedAt)==null?void 0:S.slice(0,10),v.classification];return b.jsxs(H.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&b.jsx(H.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:b.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Iee=tn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",xt(t)]},addNodeView(){return Ob(_ee)},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}}}}),bI=t=>b.jsx(uM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Aee=t=>{const{name:e,label:n=Ln(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x=()=>{},placeholder:S="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:C,canSearch:O=!1}=t,I=[DT,D2.configure({placeholder:S}),Oee(),Iee.configure({citationMaxLength:a})],[N,L,V]=jt.useField({name:e}),{setValue:M}=V,{value:B}=N,{addUpdateCitation:z,deleteCitation:F,batchUpdate:P,citations:_}=yI();X.useEffect(()=>{var re;const ue=(re=A==null?void 0:A.current)==null?void 0:re.editor;if(!ue)return;ue.getHTML()!==B&&setTimeout(()=>{ue.commands.setContent(B)},0)},[B]);const A=X.useRef(null),R={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},j=(ue=void 0)=>{var de,te;const Z=((te=(de=A.current)==null?void 0:de.editor)==null?void 0:te.getHTML())??"",re=!Z.replace(/<\/?p>|<br>/g,"").trim();M(re?"":Z,ue)},K=X.useMemo(()=>ma.debounce(()=>j(!1),500),[M]),U=zs(),{showDiff:J,getPreviousValue:me}=Vs(),he=i??U;if(J){const ue=me(e)??"",Z=B,re=/<citation\s+ids="([^"]*)"><\/citation>/g,de=(le,ye)=>{const Y=ye.split(",").map(Number);return`<sup>${_.filter(ee=>Y.includes(ee.id)).map(ee=>ee.title)}</sup>`},te=ue.replace(re,de),oe=Z.replace(re,de);return b.jsx(ha,{label:n,value:oe,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(H.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:he?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...R[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(H.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(H.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&b.jsx(bI,{name:k})]}),b.jsx(QO,{ref:A,extensions:I,content:B,editable:!he,renderControls:he?void 0:()=>b.jsx(ob,{children:b.jsx(Mee,{})}),onBlur:()=>j(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>b.jsx(Eee,{getCitationsPaginated:ue=>l(ue).then(Z=>(P(Z.data),Z)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(ue=>f(ue).then(Z=>(z(Z),Z))),onUpdateCitation:p&&(ue=>p(ue).then(Z=>(z(Z),Z))),onDeleteCitation:m&&(ue=>m(ue).then(()=>F(ue))),getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:C,readOnly:he,canSearch:O})}),b.jsx(br,{name:e,id:`${e}-err`,errorMode:T})]})},Dee=t=>{const{name:e="submit"}=t;return b.jsx(co,{name:e,type:"submit",...t})},Pee=t=>{const{label:e="Return to Top",icon:n=dp,scrollThresholdPx:r=100}=t,o=H.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(H.Zoom,{in:o,children:b.jsx(H.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(H.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},vI=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=vo.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return b.jsxs(b.Fragment,{children:[b.jsx(H.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),b.jsx(H.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(H.MenuItem,{...Zl(p,o),children:[p.icon&&b.jsx(H.ListItemIcon,{children:p.icon}),b.jsx(H.ListItemText,{primary:p.label})]},p.label))})]})},Nee=()=>{const{values:t,errors:e,status:n}=jt.useFormikContext(),{palette:r}=H.useTheme();return b.jsx(H.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(H.List,{children:[b.jsxs(H.ListItem,{children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(H.Divider,{variant:"inset",component:"li"}),b.jsxs(H.ListItem,{id:"testing",children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(H.ListItem,{children:[b.jsx(H.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(H.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},$ee=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=z2();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...cr({...t},l)};return b.jsx(H.Stepper,{...u,children:e.map(f=>b.jsx(H.Step,{children:b.jsx(H.StepLabel,{children:f})},f))})},Lee=t=>{const{name:e,label:n=Ln(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx($M,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=jt.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(H.FormControl,{fullWidth:!0,children:[b.jsx(H.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(H.Typography,{children:y}):b.jsx(jt.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(X.Fragment,{children:b.jsx(Bee,{variant:l,content:b.jsxs(H.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?k(g):{...g},children:[b.jsxs(H.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&b.jsx(H.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(H.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(H.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Bee=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(H.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(H.CardContent,{children:e})});case"elevatedCard":return b.jsx(H.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(H.CardContent,{children:e})});case"none":return e}},Fee=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Bu,{actions:[b.jsx(H.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Ree=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Bu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},zee=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return b.jsx(Bu,{actions:[b.jsx(H.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(H.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Vee={added:{icon:FU,label:"Added",color:"success"},deleted:{icon:$M,label:"Deleted",color:"error"},modified:{icon:VU,label:"Modified",color:"info"}},Hee=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:lp},children:b.jsx("s",{children:t})}),b.jsx(H.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:ap},children:b.jsx("u",{children:e})})]}),Wee=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=$u(s,e,r),l=$u(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??cM.isEqual(a,l))||(o[xn(s)]=Hee(a,l))}return o},jee=(t,e,n,r=!1,o)=>{const i=[];let s=0,a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);s<e.length&&a<n.length;){const u=e[s],f=n[a];if(u.id===f.id){const p=Wee(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?l++:i.push({...f,changeType:"modified",modifiedDiff:p}),s++,a++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),s++):(i.push({...f,changeType:"added"}),a++)}for(;s<e.length;)i.push({...e[s],changeType:"deleted"}),s++;for(;a<n.length;)i.push({...n[a],changeType:"added"}),a++;return{dataDiff:i,unmodifiedCount:l}},xI=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,unmodifiedCount:l}=jee(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=Vee[f];return b.jsx(H.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:b.jsxs(H.Typography,{children:[b.jsx(Vm,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var y;return((y=m.modifiedDiff)==null?void 0:y[xn(f)])??$u(f,m,s)}}))];return{unmodifiedCount:l,columns:u,data:a,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return b.jsx(cw,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},wI=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>b.jsxs(H.Box,{children:[b.jsx(ov,{columns:t,data:e,emptyTableMsg:n,renderExpand:r,size:o}),i>0&&b.jsx(H.Box,{children:b.jsxs(H.Typography,{fontStyle:"italic",children:["+",i," unmodified rows"]})})]}),Uee=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),o="beforeData"in n?xI({...n,isMobileScreen:r}):n;return b.jsx(wI,{...o,size:t.size})},qee=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=H.useTheme(),a=vo.useNavigate();return b.jsxs(H.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(H.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),b.jsxs(H.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(H.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>b.jsx(H.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Zl(l,a),children:l.label},l.label))}),n&&b.jsx(H.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},SI=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=vo.useLocation(),i=vo.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>b.jsx(H.MenuList,{children:m.map(v=>b.jsxs(H.MenuItem,{...Zl(v,i,()=>a(!1)),children:[v.icon&&b.jsx(H.ListItemIcon,{children:v.icon}),b.jsx(H.ListItemText,{primary:v.label})]},`mobile-drawer-group-${y}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,v)=>b.jsxs(X.Fragment,{children:[l(y,v),v<m.length-1&&b.jsx(H.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(H.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&b.jsxs(b.Fragment,{children:[b.jsx(H.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(YU,{})}),b.jsx(H.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(H.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(H.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},CI=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(H.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(H.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},TI=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(vI,{label:e,menuOptions:n,icon:b.jsx(JU,{})})},Oh=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=H.useTheme(),a=vo.useNavigate();return b.jsx(H.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(H.Tab,{icon:l.icon,label:l.label,value:u,...Zl(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},kI=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(H.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(Oh,{menuOptions:e,activeTabIdx:n,sx:r})})},EI=t=>{const{onToggle:e}=t,{palette:n}=H.useTheme(),r=n.mode==="dark";return b.jsx(H.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx(NM,{}):b.jsx(DM,{})})},Kee=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:y}=t,v=vo.useNavigate(),g=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),{palette:x}=H.useTheme(),{pathname:S}=vo.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const N=o.findIndex(L=>L.path&&S.startsWith(L.path));C(N>=0?N:void 0)},[S,o]);const O=s&&b.jsx(EI,{onToggle:s}),I=s&&(g||!g&&l)?[{icon:k?b.jsx(NM,{}):b.jsx(DM,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(H.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(CI,{...e}),u,b.jsxs(H.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(H.Button,{disableRipple:!0,component:vo.Link,to:"/",children:r&&typeof r=="string"?b.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),b.jsxs(H.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&b.jsx(SI,{menuOptionLists:[o,a,I],anchor:"right"}),!g&&b.jsxs(b.Fragment,{children:[b.jsx(H.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,L)=>b.jsxs(H.Box,{display:"flex",alignItems:"center",children:[L>0&&b.jsx(H.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(H.Button,{variant:"text",sx:{color:"white"},...Zl(N,v),children:b.jsxs(H.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&b.jsx(TI,{displayName:l,userMenuOptions:I})]})]})]}),!g&&b.jsx(kI,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Yee=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=vo.useLocation(),o=H.useMediaQuery(H.useTheme().breakpoints.down("sm")),[i,s]=X.useState(void 0);return X.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&b.jsx(H.Box,{sx:e,children:b.jsx(H.Card,{sx:{height:"100%",width:200},children:b.jsx(Oh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Gee=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=H.useTheme();return e.length>0&&b.jsx(Oh,{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}})},Jee=({children:t,getCitations:e})=>{const[n,r]=X.useState([]),[o,i]=X.useState(!1);X.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(v=>{const g=u.find(x=>x.id===v.id);return g||v}),m=new Set(f.map(v=>v.id)),y=u.filter(v=>!m.has(v.id));return[...p,...y]})},[]),a=X.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=X.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return b.jsx(gI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Xee=t=>b.jsx(Fu,{severity:"info",...t}),Zee=t=>b.jsx(Fu,{severity:"warning",...t}),OI=t=>{const{crumbInfo:e}=t,n=vo.useNavigate();return b.jsx(H.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx(GU,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(H.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(H.Typography,{color:"primary",children:r},r))})},Qee=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=ete(r);return b.jsx(H.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(Fu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:MI(r),warning:MI(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(H.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},ete=t=>t=="logout"?"info":t=="timeout"?"warning":t,MI=t=>{if(t=="timeout")return b.jsx(BU,{});if(t=="logout")return b.jsx(KU,{})},tte=t=>{nte(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=H.useMediaQuery(H.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(H.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(OI,{crumbInfo:i}),b.jsxs(H.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(H.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?b.jsx(H.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(co,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(RU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(H.Box,{width:u?"100%":"50%",children:s})]})]})},nte=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},rte=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=H.useMediaQuery(H.useTheme().breakpoints.down("sm"));return b.jsxs(H.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(H.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),b.jsx(H.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(H.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},ote=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(H.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(H.Box,{className:"text-content",children:[b.jsx(H.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(H.Typography,{"data-testid":"message",children:n})]}),b.jsx(H.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function ite({...t}){return b.jsx(hI,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const ste=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return b.jsx(H.Box,{height:n})};Ae.AlertModal=Ree,Ae.Autocomplete=aM,Ae.Breadcrumbs=OI,Ae.Button=co,Ae.Checkbox=uM,Ae.CheckboxGroup=aU,Ae.CitationField=Aee,Ae.CitationFieldProvider=Jee,Ae.CitationManager=ite,Ae.Column=V2,Ae.ConfirmationModal=Fee,Ae.DarkModeToggle=EI,Ae.DateField=Hp,Ae.DateRangeField=AZ,Ae.DecisionModal=zee,Ae.Diff=iM,Ae.DiffProvider=cw,Ae.DiffTable=Uee,Ae.DiffTableView=wI,Ae.Drawer=SI,Ae.DynamicAutocomplete=iU,Ae.EnvironmentBanner=CI,Ae.ErrorAlert=fI,Ae.FileList=uU,Ae.FileUpload=fM,Ae.FloatingNavBar=Gee,Ae.Footer=qee,Ae.FormDebugger=Nee,Ae.Header=Kee,Ae.InfoAlert=Xee,Ae.LoadingButton=iv,Ae.LoadingIndicator=ote,Ae.LoadingOverlay=B2,Ae.Location=DU,Ae.MenuButton=vI,Ae.Modal=Bu,Ae.MultiAutocomplete=sU,Ae.NavBar=kI,Ae.NotApplicableCheckbox=bI,Ae.PageHeader=tte,Ae.PaginatedTable=F2,Ae.ProfileMenu=TI,Ae.RadioGroup=AM,Ae.RangeSlider=PU,Ae.ReadOnly=ha,Ae.ReadOnlyProvider=aw,Ae.RepeatableFormGroup=Lee,Ae.RichTextField=EQ,Ae.Row=lI,Ae.ScrollToTop=Pee,Ae.SearchField=LM,Ae.Select=NU,Ae.SelectableCitationManager=mI,Ae.Sidebar=Yee,Ae.SingleActionCard=rte,Ae.Snackbar=Qee,Ae.Spacer=ste,Ae.Stepper=$ee,Ae.Submit=Dee,Ae.SuccessAlert=pI,Ae.Switch=$U,Ae.Table=ov,Ae.Tabs=Oh,Ae.TextArea=LU,Ae.TextField=gs,Ae.TextIcon=Vm,Ae.ValidationError=br,Ae.WarningAlert=Zee,Ae.baseCitationTableColumns=H2,Ae.buildTableDiff=xI,Ae.commonTheme=_n,Ae.darkTheme=IP,Ae.lightTheme=_P,Ae.useDiff=Vs,Ae.useReadOnly=zs,Object.defineProperty(Ae,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simoncomputing/mui-bueno-v2",
3
3
  "private": false,
4
- "version": "0.25.24",
4
+ "version": "0.25.25",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",