@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/CHANGELOG.md +7 -0
- package/dist/components/LoadingOverlay/LoadingOverlay.d.ts +3 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +175 -167
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
- Minor increment --> singlular/minor changes. Minimal breaking changes.
|
|
12
12
|
- Patch increment --> singlular/minor changes. Zero breaking changes.
|
|
13
13
|
|
|
14
|
+
## [0.25.25] - 2026-03-03
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `LoadingOverlay`
|
|
19
|
+
- Smoothed out animation to avoid flashing when `isLoading` changes quickly
|
|
20
|
+
|
|
14
21
|
## [0.25.24] - 2026-03-02
|
|
15
22
|
|
|
16
23
|
### Fixed
|
|
@@ -6,8 +6,9 @@ export type LoadingOverlayProps = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Applies loading overlay to the children when `isLoading` is true.
|
|
8
8
|
*
|
|
9
|
-
* Similar to MUI's skeleton
|
|
10
|
-
* can still see the existing data (but not interact with it) while the table
|
|
9
|
+
* Similar to MUI's skeleton. Shows loading overlay over child component(s), such as tables,
|
|
10
|
+
* so that the user can still see the existing data (but not interact with it) while the table
|
|
11
|
+
* is updating.
|
|
11
12
|
*
|
|
12
13
|
* See Table/Paginated Table/Citation Manager/Selectable Citation Manager for examples.
|
|
13
14
|
*/
|
package/dist/index.cjs.js
CHANGED
|
@@ -401,7 +401,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
401
401
|
`,Rce="️",Ice="",lb="";let xf=null,wf=null;function Dce(t=[]){const e={};Cr.groups=e;const n=new Cr;xf==null&&(xf=$E(Tce)),wf==null&&(wf=$E(kce)),De(n,"'",Hp),De(n,"{",tu),De(n,"}",nu),De(n,"[",Mp),De(n,"]",_p),De(n,"(",Rp),De(n,")",Ip),De(n,"<",Dp),De(n,">",Ap),De(n,"(",Pp),De(n,")",Np),De(n,"「",$p),De(n,"」",Lp),De(n,"『",jp),De(n,"』",Bp),De(n,"<",Fp),De(n,">",Vp),De(n,"&",zp),De(n,"*",Wp),De(n,"@",rs),De(n,"`",qp),De(n,"^",Kp),De(n,":",as),De(n,",",mx),De(n,"$",Yp),De(n,".",Bo),De(n,"=",Gp),De(n,"!",gx),De(n,"-",eo),De(n,"%",ru),De(n,"|",Jp),De(n,"+",Xp),De(n,"#",Zp),De(n,"?",ou),De(n,'"',yx),De(n,"/",Fo),De(n,";",bx),De(n,"~",iu),De(n,"_",Qp),De(n,"\\",Up),De(n,"・",$D);const r=an(n,vi,px,{[p0]:!0});an(r,vi,r);const o=an(r,bi,PD,{[eu]:!0}),i=an(r,Mc,ND,{[jc]:!0}),s=an(n,bi,Si,{[h0]:!0});an(s,vi,o),an(s,bi,s),an(o,vi,o),an(o,bi,o);const a=an(n,Mc,y0,{[m0]:!0});an(a,bi),an(a,vi,i),an(a,Mc,a),an(i,vi,i),an(i,bi),an(i,Mc,i);const l=De(n,ab,hx,{[ob]:!0}),u=De(n,NE,x0,{[ob]:!0}),f=an(n,sb,x0,{[ob]:!0});De(n,lb,f),De(u,ab,l),De(u,lb,f),an(u,sb,f),De(f,NE),De(f,ab),an(f,sb,f),De(f,lb,f);const p=an(n,ib,LD,{[AD]:!0});De(p,"#"),an(p,ib,p),De(p,Rce,p);const m=De(p,Ice);De(m,"#"),an(m,ib,p);const y=[[bi,s],[vi,o]],v=[[bi,null],[Mc,a],[vi,i]];for(let g=0;g<xf.length;g++)Qi(n,xf[g],b0,Si,y);for(let g=0;g<wf.length;g++)Qi(n,wf[g],v0,y0,v);ia(b0,{tld:!0,ascii:!0},e),ia(v0,{utld:!0,alpha:!0},e),Qi(n,"file",Wf,Si,y),Qi(n,"mailto",Wf,Si,y),Qi(n,"http",pl,Si,y),Qi(n,"https",pl,Si,y),Qi(n,"ftp",pl,Si,y),Qi(n,"ftps",pl,Si,y),ia(Wf,{scheme:!0,ascii:!0},e),ia(pl,{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]?{[Ece]:!0}:{[Oce]:!0};x.indexOf("-")>=0?k[g0]=!0:bi.test(x)?vi.test(x)?k[eu]=!0:k[h0]=!0:k[p0]=!0,PE(n,x,x,k)}return PE(n,"localhost",Eu,{ascii:!0}),n.jd=new Cr(eh),{start:n,tokens:Object.assign({groups:e},jD)}}function BD(t,e){const n=Ace(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 Ace(t){const e=[],n=t.length;let r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Qi(t,e,n,r,o){let i;const s=e.length;for(let a=0;a<s-1;a++){const l=e[a];t.j[l]?i=t.j[l]:(i=new Cr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Cr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function $E(t){const e=[],n=[];let r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}const Ou={defaultProtocol:"http",events:null,format:LE,formatHref:LE,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function vx(t,e=null){let n=Object.assign({},Ou);t&&(n=Object.assign(n,t instanceof vx?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}vx.prototype={o:Ou,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:Ou[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function LE(t){return t}function FD(t,e){this.t="token",this.v=t,this.tk=e}FD.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Ou.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),f=t.getObj("attributes",n,e),p=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),f&&Object.assign(s,f),{tagName:o,attributes:s,content:i,eventListeners:p}}};function hm(t,e){class n extends FD{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 jE=hm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),BE=hm("text"),Pce=hm("nl"),Sf=hm("url",{isLink:!0,toHref(t=Ou.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Eu&&t[1].t===as}}),Zr=t=>new Cr(t);function Nce({groups:t}){const e=t.domain.concat([zp,Wp,rs,Up,qp,Kp,Yp,Gp,eo,px,ru,Jp,Xp,Zp,Fo,eh,iu,Qp]),n=[Hp,as,mx,Bo,gx,ru,ou,yx,bx,Dp,Ap,tu,nu,_p,Mp,Rp,Ip,Pp,Np,$p,Lp,jp,Bp,Fp,Vp],r=[zp,Hp,Wp,Up,qp,Kp,Yp,Gp,eo,tu,nu,ru,Jp,Xp,Zp,ou,Fo,eh,iu,Qp],o=Zr(),i=De(o,iu);dt(i,r,i),dt(i,t.domain,i);const s=Zr(),a=Zr(),l=Zr();dt(o,t.domain,s),dt(o,t.scheme,a),dt(o,t.slashscheme,l),dt(s,r,i),dt(s,t.domain,s);const u=De(s,rs);De(i,rs,u),De(a,rs,u),De(l,rs,u);const f=De(i,Bo);dt(f,r,i),dt(f,t.domain,i);const p=Zr();dt(u,t.domain,p),dt(p,t.domain,p);const m=De(p,Bo);dt(m,t.domain,p);const y=Zr(jE);dt(m,t.tld,y),dt(m,t.utld,y),De(u,Eu,y);const v=De(p,eo);De(v,eo,v),dt(v,t.domain,p),dt(y,t.domain,p),De(y,Bo,m),De(y,eo,v);const g=De(y,as);dt(g,t.numeric,jE);const x=De(s,eo),S=De(s,Bo);De(x,eo,x),dt(x,t.domain,s),dt(S,r,i),dt(S,t.domain,s);const k=Zr(Sf);dt(S,t.tld,k),dt(S,t.utld,k),dt(k,t.domain,s),dt(k,r,i),De(k,Bo,S),De(k,eo,x),De(k,rs,u);const T=De(k,as),C=Zr(Sf);dt(T,t.numeric,C);const O=Zr(Sf),R=Zr();dt(O,e,O),dt(O,n,R),dt(R,e,O),dt(R,n,R),De(k,Fo,O),De(C,Fo,O);const P=De(a,as),$=De(l,as),V=De($,Fo),M=De(V,Fo);dt(a,t.domain,s),De(a,Bo,S),De(a,eo,x),dt(l,t.domain,s),De(l,Bo,S),De(l,eo,x),dt(P,t.domain,O),De(P,Fo,O),De(P,ou,O),dt(M,t.domain,O),dt(M,e,O),De(M,Fo,O);const L=[[tu,nu],[Mp,_p],[Rp,Ip],[Dp,Ap],[Pp,Np],[$p,Lp],[jp,Bp],[Fp,Vp]];for(let F=0;F<L.length;F++){const[j,A]=L[F],_=De(O,j);De(R,j,_),De(_,A,O);const I=Zr(Sf);dt(_,e,I);const B=Zr();dt(_,n),dt(I,e,I),dt(I,n,B),dt(B,e,I),dt(B,n,B),De(I,A,O),De(B,A,O)}return De(o,Eu,k),De(o,hx,Pce),{start:o,tokens:jD}}function $ce(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(cb(BE,e,s)),s=[]),o-=m,f-=m;const y=p.t,v=n.slice(o-f,o);i.push(cb(y,e,v))}}return s.length>0&&i.push(cb(BE,e,s)),i}function cb(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 Lce=typeof console<"u"&&console&&console.warn||(()=>{}),jce="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Wt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bce(){return Cr.groups={},Wt.scanner=null,Wt.parser=null,Wt.tokenQueue=[],Wt.pluginQueue=[],Wt.customSchemes=[],Wt.initialized=!1,Wt}function FE(t,e=!1){if(Wt.initialized&&Lce(`linkifyjs: already initialized - will not register custom scheme "${t}" ${jce}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
402
402
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
403
403
|
2. Cannot start or end with "-"
|
|
404
|
-
3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Fce(){Wt.scanner=Dce(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Nce(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function xx(t){return Wt.initialized||Fce(),$ce(Wt.parser.start,t,BD(Wt.scanner.start,t))}xx.scan=BD;function VD(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 vx(n),o=xx(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 wx="[\0- -\u2029 ]",Vce=new RegExp(wx),zce=new RegExp(`${wx}$`),Hce=new RegExp(wx,"g");function Wce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Uce(t){return new rn({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=u7(n.doc,[...e]);if(g7(a).forEach(({newRange:u})=>{const f=f7(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(!zce.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(Vce).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=xx(v).map(S=>S.toObject(t.defaultProtocol));if(!Wce(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=>{rv(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 qce(t){return new rn({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=nv(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 Kce(t){return new rn({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=VD(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function qs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Hce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Yce=Or.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){FE(t);return}FE(t.scheme,t.optionalSlashes)})},onDestroy(){Bce()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ct(this.options.HTMLAttributes,t),0]:["a",Ct(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=VD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qs(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Uce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!qs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(qce({type:this.type})),this.options.linkOnPaste&&t.push(Kce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Gce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=X7(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 Jce=new On("suggestion");function Xce({pluginKey:t=Jce,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=Gce}){let x;const S=y==null?void 0:y(),k=new rn({key:t,view(){return{update:async(T,C)=>{var O,R,P,$,V,M,L;const F=(O=this.key)===null||O===void 0?void 0:O.getState(C),j=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=F.active&&j.active&&F.range.from!==j.range.from,_=!F.active&&j.active,I=F.active&&!j.active,B=!_&&!I&&F.query!==j.query,W=_||A&&B,K=B||A,U=I||A&&B;if(!W&&!K&&!U)return;const J=U&&!W?F:j,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},W&&((P=S==null?void 0:S.onBeforeStart)===null||P===void 0||P.call(S,x)),K&&(($=S==null?void 0:S.onBeforeUpdate)===null||$===void 0||$.call(S,x)),(K||W)&&(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)),W&&((L=S==null?void 0:S.onStart)===null||L===void 0||L.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,R){const{isEditable:P}=e,{composing:$}=e.view,{selection:V}=T,{empty:M,from:L}=V,F={...C};if(F.composing=$,P&&(M||e.view.composing)){(L<C.range.from||L>C.range.to)&&!$&&!C.composing&&(F.active=!1);const j=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;j&&v({editor:e,state:R,range:j.range,isActive:C.active})?(F.active=!0,F.decorationId=C.decorationId?C.decorationId:A,F.range=j.range,F.query=j.query,F.text=j.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(T,C){var O;const{active:R,range:P}=k.getState(T.state);return R&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:P}))||!1},decorations(T){const{active:C,range:O,decorationId:R,query:P}=k.getState(T);if(!C)return null;const $=!(P!=null&&P.length),V=[l];return $&&V.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function Zce({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 zD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Zce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function VE(t,e){const n=zD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const Qce=nn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",Ct(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=VE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ct({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Ct({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",Ct({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:VE(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new _i,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return zD(this).map(Xce)}}),HD=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new rn({key:new 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&&Rh(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),eue=Or.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",Ct(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()}}}),tue=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ct(this.options.HTMLAttributes,t),0]}}),nue=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ct(this.options.HTMLAttributes,t),0]}}),rue=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ct(this.options.HTMLAttributes,t),0]}}),oue=/^\s*(\[([( |x])?\])\s$/,iue=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ct(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[Dl({find:oue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),sue=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ct(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()}}}),aue=mn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),WD=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(z.Paper,{elevation:5,children:b.jsx(z.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(z.ListItem,{disablePadding:!0,children:b.jsx(z.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});WD.displayName="SuggestionList";const zE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},lue={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 G2(WD,{props:n,editor:n.editor}),e=Uu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??zE},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))??zE}})},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}}}},cue=Yce.extend({inclusive:!1}),uue=eue.extend({excludes:"superscript"}),due=xI.extend({excludes:"subscript"});function fue({placeholder:t}={}){return X.useMemo(()=>[ete.configure({resizable:!0}),rue,nue,tue,uR,fR,pR,yR,ER,OR,MR,uue,due,RR,cR,lR,dR,kR,vI,_R,cue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),LQ,gR,NQ,aue.configure({types:["heading","paragraph","image"]}),wce,Sce,Cce,IZ,DR.configure({multicolor:!0}),TR,ZQ,hR,sue,iue.configure({nested:!0}),Qce.configure({suggestion:lue}),HD.configure({placeholder:t}),CR],[t])}function HE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const pue=t=>{const e=fue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(yI,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ut.useField({name:n}),{setValue:f}=u,{value:p}=a;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=>{Xb({images:O,editor:T,position:k})});else{const O=i(S);Xb({images:O,editor:T,position:k})}},[]),v=X.useCallback((S,k,T,C)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=HE(k.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return y(O,P),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=HE(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(gI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(vce,{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(wte,{}),b.jsx(Nte,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},WE=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(z.Collapse,{in:n,children:u}):b.jsx(z.TableRow,{sx:p,children:b.jsx(z.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(z.Collapse,{in:n,children:u})})})},UD=({isLoading:t,children:e})=>b.jsxs(z.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,b.jsx(z.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(z.CircularProgress,{})})]}),Sx=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:R,reRenderExpand:P=!1,expandOnRowClick:$=!1,tooltipColor:V,...M}=t,{palette:L}=z.useTheme(),[F,j]=X.useState(void 0),[A,_]=X.useState(void 0);hue(t);const I=ie=>{ie!==u?p&&p(ie,"asc"):p&&p(u,f==="asc"?"desc":"asc")},B=ie=>u===ie?f:null,W=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),K=W&&l?r.filter(ie=>!(l.includes(xn(ie))||ie.hideCol)):r.filter(ie=>!ie.hideCol);a&&!W&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:ie=>{const xe=F===ie;return b.jsx(z.IconButton,{"data-testid":"expand-collapse-btn","aria-label":xe?"collapse row":"expand row",size:"small",onClick:()=>te(ie),children:xe?b.jsx($f,{"data-testid":"collapse-up"}):b.jsx(tb,{"data-testid":"expand-down"})})}});const U=p!==void 0,J=ie=>U?m?m.includes(ie):!0:!1,me=b.jsxs(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(Ane,{})," ",g]}),he=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(gM,{color:"error"})," ",x,S&&b.jsx(z.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ue=()=>{if(x)return b.jsx(z.TableRow,{children:b.jsx(z.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return b.jsx(z.TableRow,{children:b.jsx(z.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&&$){const Ee=F===xe?void 0:xe;j(Ee),re(Ee)}},te=ie=>{const xe=F===ie?void 0:ie;j(xe),re(xe)},oe=ie=>{if(!a)return;const xe=F===n(ie);return b.jsxs(b.Fragment,{children:[b.jsxs(z.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>te(n(ie)),children:[xe?b.jsx($f,{}):b.jsx(tb,{})," Show"," ",xe?"Less":"More"]}),b.jsx(WE,{colSpan:r.length,isExpanded:n(ie)===F,obj:ie,renderExpand:Ee=>a(Ee),asMobileCard:!0})]})},le=typeof C=="string"?C:L.grey[L.mode=="dark"?600:50],ge=ie=>{const xe=A===n(ie)?le:"inherit";return{cursor:i||$?"pointer":"default",backgroundColor:xe,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:xe===le?ese(xe,.1):le}}}},Y=L.grey[L.mode==="dark"?600:400],ee=ie=>ie&&b.jsx(z.Tooltip,{title:ie,children:b.jsx(Dne,{"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(z.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(z.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:ie=>I(ie.target.value),fullWidth:!0,children:K.map(ie=>{if(J(xn(ie)))return b.jsx(z.MenuItem,{value:xn(ie),children:ie.label??Fn(xn(ie))},`rowHeader-${xn(ie)}`)})}),b.jsx(z.IconButton,{onClick:()=>{u&&I(u)},children:b.jsx(Fne,{className:`sort-icon-${f}`})})]}),b.jsx(z.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(ie=>b.jsxs(z.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ge(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??Fn(xn(xe)),ee(xe.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(xe)}`,style:{paddingLeft:"10px"},children:Mu(xe,ie,W)})]},`row-${n(ie)}-${xn(xe)}`))})}),oe(ie)]},n(ie)))]}),Ce=()=>b.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:R?{maxHeight:R,overflow:"auto"}:{},children:b.jsxs(z.Table,{stickyHeader:R!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(z.TableHead,{className:"MBv2_Table_Head",children:b.jsx(z.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((ie,xe)=>{const Ee=J(xn(ie));return b.jsx(z.TableCell,{width:Array.isArray(y)?y[xe]:"auto",sx:ie.tableCellSx??{},children:b.jsx(z.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(z.Box,{sx:[Ee&&{"&:hover":{cursor:"pointer",backgroundColor:L.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Ee?()=>I(xn(ie)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ie.label??Fn(xn(ie))}),ee(ie.tooltip),Ee&&B(xn(ie))==="asc"&&b.jsx($f,{style:{marginLeft:"5px"}}),Ee&&B(xn(ie))==="desc"&&b.jsx(tb,{style:{marginLeft:"5px"}}),Ee&&B(xn(ie))!=="asc"&&B(xn(ie))!=="desc"&&b.jsx(jne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(ie)}`)})})}),b.jsx(z.TableBody,{className:"MBv2_Table_Body",children:ue()??o.map(ie=>b.jsxs(X.Fragment,{children:[b.jsx(z.TableRow,{"data-testid":`row-${n(ie)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(ie),sx:ge(ie),children:K.map(xe=>b.jsx(z.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(xe)}`,children:Mu(xe,ie,W)},`row-${n(ie)}-${xn(xe)}`))}),a&&b.jsx(WE,{colSpan:K.length,isExpanded:n(ie)===F,obj:ie,renderExpand:xe=>a(xe),reRenderExpand:P})]},n(ie)))})]})});return b.jsx(UD,{isLoading:k,children:W&&!T?pe():Ce()})},hue=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,mue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Mu=(t,e,n=!1)=>{const r=mue(e,t.fieldName);return t.render?t.render(r,e,n):r},qD=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=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(z.Box,{children:[b.jsx(Sx,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(z.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}}})]})},UE=()=>({height:window.innerHeight,width:window.innerWidth}),KD=()=>{const[t,e]=X.useState(UE());return X.useEffect(()=>{const n=()=>{e(UE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},ao=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=KD(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(z.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...hr({...t},a)})},gue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.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(z.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(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",startIcon:b.jsx(d0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},yue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",color:"error",startIcon:b.jsx(Yv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},YD=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},bue=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:R=!1,showCloseBtn:P=!1,canSearch:$=!1}=t,V=!!t.canCreate&&!R,M=!!a&&!!s&&!R,L=!!u&&!!l&&R&&k,F=!!f&&!R,{palette:j}=z.useTheme(),[A,_]=X.useState([]),[I,B]=X.useState(!1),[W,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:$?"":void 0}),te=()=>{B(!1),K(!0),v({pageNo:re.pageNo,pageSize:re.pageSize,search:re.search}).then(Ie=>(_(Ie.data),de(Re=>({...Re,totalCount:Ie.totalCount})),Ie)).catch(Ie=>{S(Ie),B(!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(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Hh,{}),children:"Add Citation"}),ge=b.jsx(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx(RI,{}),children:"Add Attachment"}),Y=Ie=>{if(!(!M&&!L)){if(M)return b.jsx(z.Tooltip,{title:"Edit",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?a(Ie):s(Ie),"data-testid":`citation-table_edit-btn-${Ie.id}`,children:b.jsx(Ine,{})})});if(L)return b.jsx(z.Tooltip,{title:"View",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?u(Ie):l(Ie),"data-testid":`citation-table_view-btn-${Ie.id}`,children:b.jsx(Vne,{})})})}},ee=Ie=>{if(!(!F||R))return b.jsx(z.Tooltip,{title:"Delete",children:b.jsx(z.IconButton,{color:"error",onClick:Re=>{he(Ie),J(Re.currentTarget)},"data-testid":`citation-table_delete-btn-${Ie.id}`,children:b.jsx(Yv,{})})})},pe=Ie=>{if(!C)return;if(!Ie.fileName)return b.jsx(z.Tooltip,{title:"Open URL",children:b.jsx(z.IconButton,{color:"primary",onClick:vt=>{J(vt.currentTarget),Z(Ie)},"data-testid":`citation-table_launch-link-btn-${Ie.id}`,sx:{visibility:C!=null&&C(Ie)?"visible":"hidden"},children:b.jsx(d0,{})})})},Ce=Ie=>{if(!m||!Ie.fileName)return;const Re=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],vt=Ie.fileName.split(".").pop();if(!(!vt||!Re.includes(vt)))return b.jsx(z.Tooltip,{title:"View File",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>m==null?void 0:m(Ie),"data-testid":`citation-table_view-file-btn-${Ie.id}`,children:b.jsx(d0,{})})})},ie=Ie=>{if(!p)return;if(!!Ie.fileName)return b.jsx(z.Tooltip,{title:"Download",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>p==null?void 0:p(Ie),"data-testid":`citation-table_download-btn-${Ie.id}`,children:b.jsx(Rne,{})})})},xe=L||M||F||C||m||p||O,Ee=[{fieldName:"id",key:"select",label:"",hideCol:!T,render:(Ie,Re)=>b.jsx(z.Checkbox,{"data-testid":`citation-table_checkbox-${Ie}`,onChange:()=>{const vt=g.includes(Re.id);x(vt?g.filter(Et=>Et!==Re.id):[...g,Re.id])},checked:g.includes(Ie),disabled:R})},...GD(j,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!xe,render:(Ie,Re)=>b.jsxs(z.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(Re),ee(Re),Y(Re),Ce(Re),pe(Re),ie(Re)]})}],Fe=X.useCallback(Ie=>{de(Re=>({...Re,pageNo:0,search:Ie}))},[]),We=()=>$?b.jsx(AI,{onSearch:Fe}):null;return b.jsxs(YD,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[b.jsx(z.Typography,{variant:k?"h6":"h2",children:n}),!T&&V&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ge]}),P&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(Xh,{})})]}),We(),b.jsx(qD,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:W,columns:Ee,data:A,paginationState:re,onPageChange:Ie=>de(Re=>({...Re,pageNo:Ie})),onRowsPerPageChange:Ie=>de(Re=>({...Re,pageSize:Ie,pageNo:0})),errorTableMsg:I?"Failed to load citations.":void 0,retryCallback:te}),T&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&b.jsxs(b.Fragment,{children:[le,ge]})}),!R&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(ao,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(ao,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(gue,{citation:ue,anchorEl:U,onClose:oe}),b.jsx(yue,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:oe})]})},GD=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(RI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Hh,{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?ka.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}],Cx=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(ao,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var ub,qE;function vue(){if(qE)return ub;qE=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);ub={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 R=0,P=k.length,$=C;R<P-1;){var V=k[R];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;$=$[k[R++]]}$[k[R]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var R=0,P=T.length;R<P;)if(O!=null||!k)O=O[T[R++]];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,R,P,$;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),$=y(O),P=!$&&/^\d+$/.test(O),k.call(T,O,$,P,R,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return ub}var ha=vue(),db,KE;function xue(){if(KE)return db;KE=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 db={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(" ")},db}var fb=xue(),Cf={exports:{}},YE;function wue(){if(YE)return Cf.exports;YE=1,Cf.exports=function(o){return t(e(o),o)},Cf.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 Cf.exports}var Sue=wue();const Cue=er(Sue),Tue=Object.prototype.toString,kue=Error.prototype.toString,Eue=RegExp.prototype.toString,Oue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Mue=/^Symbol\((.*)\)(.*)$/;function _ue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function GE(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return _ue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Oue.call(t).replace(Mue,"Symbol($1)");const r=Tue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+kue.call(t)+"]":r==="RegExp"?Eue.call(t):null}function ws(t,e){let n=GE(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=GE(this[r],e);return i!==null?i:o},2)}function JD(t){return t==null?[]:[].concat(t)}let XD,ZD,QD,Rue=/\$\{\s*(\w+)\s*\}/g;XD=Symbol.toStringTag;class JE{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[XD]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],JD(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}ZD=Symbol.hasInstance;QD=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Rue,(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 JE(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[QD]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[ZD](e){return JE[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Iue={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"},w0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Due={isValue:"${path} field must be ${value}"},Uf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Aue={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"},Pue={notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:Iue,date:w0,object:Uf,array:Aue,boolean:Due,tuple:Pue});const Tx=t=>t&&t.__isYupSchema__;class th{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 th(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(!Tx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Tf={context:"$",value:"."};class Na{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]===Tf.context,this.isValue=this.key[0]===Tf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Tf.context:this.isValue?Tf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ha.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Na.prototype.__isYupRef=!0;const sa=t=>t==null;function al(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(L={}){const F=eA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:L.path||r,spec:s.spec,disableStackTrace:L.disableStackTrace||S},p,L.params),k),j=new pr(pr.formatError(L.message||m,F),n,F.path,L.type||u,F.disableStackTrace);return j.params=F,j}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(L){return tA(L,k)},options:o,originalValue:i,schema:s};const R=L=>{pr.isError(L)?C(L):L?l(null):C(T())},P=L=>{pr.isError(L)?C(L):a(L)};if(y&&sa(n))return R(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(R,P)}}catch(L){P(L);return}R(V)}return e.OPTIONS=t,e}function eA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=tA(t[n],e);return t}function tA(t,e){return Na.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Nue(t,e,n,r=n){let o,i,s;return e?(ha.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class nh extends Set{describe(){const e=[];for(const n of this.values())e.push(Na.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 nh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function yl(t,e=new Map){if(Tx(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]=yl(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,yl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(yl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=yl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function $ue(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 Lue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:$ue(n)}))}function nA(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Lue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>nA(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 nh,this._blacklist=new nh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=yl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&sa(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
404
|
+
3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Fce(){Wt.scanner=Dce(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Nce(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function xx(t){return Wt.initialized||Fce(),$ce(Wt.parser.start,t,BD(Wt.scanner.start,t))}xx.scan=BD;function VD(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 vx(n),o=xx(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 wx="[\0- -\u2029 ]",Vce=new RegExp(wx),zce=new RegExp(`${wx}$`),Hce=new RegExp(wx,"g");function Wce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Uce(t){return new rn({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=u7(n.doc,[...e]);if(g7(a).forEach(({newRange:u})=>{const f=f7(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(!zce.test(y))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const y=m.split(Vce).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=xx(v).map(S=>S.toObject(t.defaultProtocol));if(!Wce(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=>{rv(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 qce(t){return new rn({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=nv(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 Kce(t){return new rn({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=VD(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}function qs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Hce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Yce=Or.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){FE(t);return}FE(t.scheme,t.optionalSlashes)})},onDestroy(){Bce()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!qs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!qs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!qs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ct(this.options.HTMLAttributes,t),0]:["a",Ct(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!qs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Cs({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=VD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qs(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Uce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!qs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(qce({type:this.type})),this.options.linkOnPaste&&t.push(Kce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function Gce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=X7(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 Jce=new On("suggestion");function Xce({pluginKey:t=Jce,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=Gce}){let x;const S=y==null?void 0:y(),k=new rn({key:t,view(){return{update:async(T,C)=>{var O,R,P,$,V,M,L;const F=(O=this.key)===null||O===void 0?void 0:O.getState(C),j=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=F.active&&j.active&&F.range.from!==j.range.from,_=!F.active&&j.active,I=F.active&&!j.active,B=!_&&!I&&F.query!==j.query,W=_||A&&B,K=B||A,U=I||A&&B;if(!W&&!K&&!U)return;const J=U&&!W?F:j,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},W&&((P=S==null?void 0:S.onBeforeStart)===null||P===void 0||P.call(S,x)),K&&(($=S==null?void 0:S.onBeforeUpdate)===null||$===void 0||$.call(S,x)),(K||W)&&(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)),W&&((L=S==null?void 0:S.onStart)===null||L===void 0||L.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,R){const{isEditable:P}=e,{composing:$}=e.view,{selection:V}=T,{empty:M,from:L}=V,F={...C};if(F.composing=$,P&&(M||e.view.composing)){(L<C.range.from||L>C.range.to)&&!$&&!C.composing&&(F.active=!1);const j=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;j&&v({editor:e,state:R,range:j.range,isActive:C.active})?(F.active=!0,F.decorationId=C.decorationId?C.decorationId:A,F.range=j.range,F.query=j.query,F.text=j.text):F.active=!1}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(T,C){var O;const{active:R,range:P}=k.getState(T.state);return R&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:P}))||!1},decorations(T){const{active:C,range:O,decorationId:R,query:P}=k.getState(T);if(!C)return null;const $=!(P!=null&&P.length),V=[l];return $&&V.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function Zce({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 zD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Zce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function VE(t,e){const n=zD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const Qce=nn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",Ct(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=VE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Ct({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Ct({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",Ct({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:VE(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;if(!o)return!1;e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",u,u+l.nodeSize),!1});let s=new _i,a=0;return e.doc.nodesBetween(i-1,i,(l,u)=>{if(l.type.name===this.name)return n=!0,s=l,a=u,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,a,a+s.nodeSize),n})}},addProseMirrorPlugins(){return zD(this).map(Xce)}}),HD=mn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new rn({key:new 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&&Rh(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),eue=Or.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",Ct(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()}}}),tue=nn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",Ct(this.options.HTMLAttributes,t),0]}}),nue=nn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",Ct(this.options.HTMLAttributes,t),0]}}),rue=nn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Ct(this.options.HTMLAttributes,t),0]}}),oue=/^\s*(\[([( |x])?\])\s$/,iue=nn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Ct(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[Dl({find:oue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),sue=nn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",Ct(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()}}}),aue=mn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:t=>({editor:e,commands:n})=>this.options.alignments.includes(t)?e.isActive({textAlign:t})?n.unsetTextAlign():n.setTextAlign(t):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),WD=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(z.Paper,{elevation:5,children:b.jsx(z.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>b.jsx(z.ListItem,{disablePadding:!0,children:b.jsx(z.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});WD.displayName="SuggestionList";const zE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},lue={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 G2(WD,{props:n,editor:n.editor}),e=Uu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??zE},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))??zE}})},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}}}},cue=Yce.extend({inclusive:!1}),uue=eue.extend({excludes:"superscript"}),due=xI.extend({excludes:"subscript"});function fue({placeholder:t}={}){return X.useMemo(()=>[ete.configure({resizable:!0}),rue,nue,tue,uR,fR,pR,yR,ER,OR,MR,uue,due,RR,cR,lR,dR,kR,vI,_R,cue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),LQ,gR,NQ,aue.configure({types:["heading","paragraph","image"]}),wce,Sce,Cce,IZ,DR.configure({multicolor:!0}),TR,ZQ,hR,sue,iue.configure({nested:!0}),Qce.configure({suggestion:lue}),HD.configure({placeholder:t}),CR],[t])}function HE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const pue=t=>{const e=fue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return b.jsx(yI,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ut.useField({name:n}),{setValue:f}=u,{value:p}=a;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=>{Xb({images:O,editor:T,position:k})});else{const O=i(S);Xb({images:O,editor:T,position:k})}},[]),v=X.useCallback((S,k,T,C)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=HE(k.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return y(O,P),k.preventDefault(),!0}return!1},[y]),g=X.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=HE(k.clipboardData.files);return C.length>0?(y(C),!0):!1},[y]),x=b.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:b.jsx(gI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:g},renderControls:s?void 0:()=>b.jsx(vce,{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(wte,{}),b.jsx(Nte,{})]})})});return b.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&b.jsx(z.Typography,{...o,children:r}),x]})},WE=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(z.Collapse,{in:n,children:u}):b.jsx(z.TableRow,{sx:p,children:b.jsx(z.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:b.jsx(z.Collapse,{in:n,children:u})})})},UD=({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(z.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,b.jsx(z.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(z.CircularProgress,{})})]})},Sx=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:R,reRenderExpand:P=!1,expandOnRowClick:$=!1,tooltipColor:V,...M}=t,{palette:L}=z.useTheme(),[F,j]=X.useState(void 0),[A,_]=X.useState(void 0);hue(t);const I=ie=>{ie!==u?p&&p(ie,"asc"):p&&p(u,f==="asc"?"desc":"asc")},B=ie=>u===ie?f:null,W=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),K=W&&l?r.filter(ie=>!(l.includes(xn(ie))||ie.hideCol)):r.filter(ie=>!ie.hideCol);a&&!W&&K.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:ie=>{const xe=F===ie;return b.jsx(z.IconButton,{"data-testid":"expand-collapse-btn","aria-label":xe?"collapse row":"expand row",size:"small",onClick:()=>te(ie),children:xe?b.jsx($f,{"data-testid":"collapse-up"}):b.jsx(tb,{"data-testid":"expand-down"})})}});const U=p!==void 0,J=ie=>U?m?m.includes(ie):!0:!1,me=b.jsxs(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(Ane,{})," ",g]}),he=b.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[b.jsx(gM,{color:"error"})," ",x,S&&b.jsx(z.Button,{variant:"text",onClick:S,children:"Retry?"})]}),ue=()=>{if(x)return b.jsx(z.TableRow,{children:b.jsx(z.TableCell,{colSpan:r.length,align:"center",children:he})});if(o.length===0)return b.jsx(z.TableRow,{children:b.jsx(z.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&&$){const Ee=F===xe?void 0:xe;j(Ee),re(Ee)}},te=ie=>{const xe=F===ie?void 0:ie;j(xe),re(xe)},oe=ie=>{if(!a)return;const xe=F===n(ie);return b.jsxs(b.Fragment,{children:[b.jsxs(z.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>te(n(ie)),children:[xe?b.jsx($f,{}):b.jsx(tb,{})," Show"," ",xe?"Less":"More"]}),b.jsx(WE,{colSpan:r.length,isExpanded:n(ie)===F,obj:ie,renderExpand:Ee=>a(Ee),asMobileCard:!0})]})},le=typeof C=="string"?C:L.grey[L.mode=="dark"?600:50],ge=ie=>{const xe=A===n(ie)?le:"inherit";return{cursor:i||$?"pointer":"default",backgroundColor:xe,...a?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:xe===le?ese(xe,.1):le}}}},Y=L.grey[L.mode==="dark"?600:400],ee=ie=>ie&&b.jsx(z.Tooltip,{title:ie,children:b.jsx(Dne,{"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(z.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[b.jsx(z.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:u??"",label:"Sort By...",onChange:ie=>I(ie.target.value),fullWidth:!0,children:K.map(ie=>{if(J(xn(ie)))return b.jsx(z.MenuItem,{value:xn(ie),children:ie.label??Fn(xn(ie))},`rowHeader-${xn(ie)}`)})}),b.jsx(z.IconButton,{onClick:()=>{u&&I(u)},children:b.jsx(Fne,{className:`sort-icon-${f}`})})]}),b.jsx(z.Divider,{sx:{margin:"10px 0"}})]}),Z()??o.map(ie=>b.jsxs(z.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ge(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??Fn(xn(xe)),ee(xe.tooltip)]}),b.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(xe)}`,style:{paddingLeft:"10px"},children:Mu(xe,ie,W)})]},`row-${n(ie)}-${xn(xe)}`))})}),oe(ie)]},n(ie)))]}),Ce=()=>b.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:v,style:R?{maxHeight:R,overflow:"auto"}:{},children:b.jsxs(z.Table,{stickyHeader:R!=="undefined",style:{tableLayout:y?"fixed":"auto"},className:"MBv2_Table",sx:O?{"& .MuiTableCell-head":{...O}}:{},...M,children:[b.jsx(z.TableHead,{className:"MBv2_Table_Head",children:b.jsx(z.TableRow,{className:"MBv2_Table_Head_Row",children:K.map((ie,xe)=>{const Ee=J(xn(ie));return b.jsx(z.TableCell,{width:Array.isArray(y)?y[xe]:"auto",sx:ie.tableCellSx??{},children:b.jsx(z.Box,{style:{display:"flex",alignItems:"center"},children:b.jsxs(z.Box,{sx:[Ee&&{"&:hover":{cursor:"pointer",backgroundColor:L.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Ee?()=>I(xn(ie)):void 0,children:[b.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:ie.label??Fn(xn(ie))}),ee(ie.tooltip),Ee&&B(xn(ie))==="asc"&&b.jsx($f,{style:{marginLeft:"5px"}}),Ee&&B(xn(ie))==="desc"&&b.jsx(tb,{style:{marginLeft:"5px"}}),Ee&&B(xn(ie))!=="asc"&&B(xn(ie))!=="desc"&&b.jsx(jne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(ie)}`)})})}),b.jsx(z.TableBody,{className:"MBv2_Table_Body",children:ue()??o.map(ie=>b.jsxs(X.Fragment,{children:[b.jsx(z.TableRow,{"data-testid":`row-${n(ie)}`,className:"MBv2_Table_Body_Row",onClick:()=>de(ie),sx:ge(ie),children:K.map(xe=>b.jsx(z.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(xe)}`,children:Mu(xe,ie,W)},`row-${n(ie)}-${xn(xe)}`))}),a&&b.jsx(WE,{colSpan:K.length,isExpanded:n(ie)===F,obj:ie,renderExpand:xe=>a(xe),reRenderExpand:P})]},n(ie)))})]})});return b.jsx(UD,{isLoading:k,children:W&&!T?pe():Ce()})},hue=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,mue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Mu=(t,e,n=!1)=>{const r=mue(e,t.fieldName);return t.render?t.render(r,e,n):r},qD=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=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return b.jsxs(z.Box,{children:[b.jsx(Sx,{sortOrder:p,sortField:f,...s}),!o&&!g&&b.jsx(z.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}}})]})},UE=()=>({height:window.innerHeight,width:window.innerWidth}),KD=()=>{const[t,e]=X.useState(UE());return X.useEffect(()=>{const n=()=>{e(UE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},ao=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=KD(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return b.jsx(z.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...hr({...t},a)})},gue=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.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(z.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(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",startIcon:b.jsx(d0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},yue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return b.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&b.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[b.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),b.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[b.jsx(ao,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),b.jsx(ao,{size:"small",color:"error",startIcon:b.jsx(Yv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},YD=t=>{const{gap:e=1,...n}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})},bue=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:R=!1,showCloseBtn:P=!1,canSearch:$=!1}=t,V=!!t.canCreate&&!R,M=!!a&&!!s&&!R,L=!!u&&!!l&&R&&k,F=!!f&&!R,{palette:j}=z.useTheme(),[A,_]=X.useState([]),[I,B]=X.useState(!1),[W,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:$?"":void 0}),te=()=>{B(!1),K(!0),v({pageNo:re.pageNo,pageSize:re.pageSize,search:re.search}).then(Ie=>(_(Ie.data),de(Re=>({...Re,totalCount:Ie.totalCount})),Ie)).catch(Ie=>{S(Ie),B(!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(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:b.jsx(Hh,{}),children:"Add Citation"}),ge=b.jsx(ao,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:b.jsx(RI,{}),children:"Add Attachment"}),Y=Ie=>{if(!(!M&&!L)){if(M)return b.jsx(z.Tooltip,{title:"Edit",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?a(Ie):s(Ie),"data-testid":`citation-table_edit-btn-${Ie.id}`,children:b.jsx(Ine,{})})});if(L)return b.jsx(z.Tooltip,{title:"View",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?u(Ie):l(Ie),"data-testid":`citation-table_view-btn-${Ie.id}`,children:b.jsx(Vne,{})})})}},ee=Ie=>{if(!(!F||R))return b.jsx(z.Tooltip,{title:"Delete",children:b.jsx(z.IconButton,{color:"error",onClick:Re=>{he(Ie),J(Re.currentTarget)},"data-testid":`citation-table_delete-btn-${Ie.id}`,children:b.jsx(Yv,{})})})},pe=Ie=>{if(!C)return;if(!Ie.fileName)return b.jsx(z.Tooltip,{title:"Open URL",children:b.jsx(z.IconButton,{color:"primary",onClick:vt=>{J(vt.currentTarget),Z(Ie)},"data-testid":`citation-table_launch-link-btn-${Ie.id}`,sx:{visibility:C!=null&&C(Ie)?"visible":"hidden"},children:b.jsx(d0,{})})})},Ce=Ie=>{if(!m||!Ie.fileName)return;const Re=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],vt=Ie.fileName.split(".").pop();if(!(!vt||!Re.includes(vt)))return b.jsx(z.Tooltip,{title:"View File",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>m==null?void 0:m(Ie),"data-testid":`citation-table_view-file-btn-${Ie.id}`,children:b.jsx(d0,{})})})},ie=Ie=>{if(!p)return;if(!!Ie.fileName)return b.jsx(z.Tooltip,{title:"Download",children:b.jsx(z.IconButton,{color:"primary",onClick:()=>p==null?void 0:p(Ie),"data-testid":`citation-table_download-btn-${Ie.id}`,children:b.jsx(Rne,{})})})},xe=L||M||F||C||m||p||O,Ee=[{fieldName:"id",key:"select",label:"",hideCol:!T,render:(Ie,Re)=>b.jsx(z.Checkbox,{"data-testid":`citation-table_checkbox-${Ie}`,onChange:()=>{const vt=g.includes(Re.id);x(vt?g.filter(Et=>Et!==Re.id):[...g,Re.id])},checked:g.includes(Ie),disabled:R})},...GD(j,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!xe,render:(Ie,Re)=>b.jsxs(z.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(Re),ee(Re),Y(Re),Ce(Re),pe(Re),ie(Re)]})}],Fe=X.useCallback(Ie=>{de(Re=>({...Re,pageNo:0,search:Ie}))},[]),We=()=>$?b.jsx(AI,{onSearch:Fe}):null;return b.jsxs(YD,{children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[b.jsx(z.Typography,{variant:k?"h6":"h2",children:n}),!T&&V&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[le,ge]}),P&&b.jsx(z.IconButton,{onClick:r,children:b.jsx(Xh,{})})]}),We(),b.jsx(qD,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:W,columns:Ee,data:A,paginationState:re,onPageChange:Ie=>de(Re=>({...Re,pageNo:Ie})),onRowsPerPageChange:Ie=>de(Re=>({...Re,pageSize:Ie,pageNo:0})),errorTableMsg:I?"Failed to load citations.":void 0,retryCallback:te}),T&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&b.jsxs(b.Fragment,{children:[le,ge]})}),!R&&b.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[b.jsx(ao,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),b.jsxs(ao,{variant:"contained",size:"small",onClick:()=>y(g),children:["Select",g.length>0&&` (${g.length})`]})]})]}),b.jsx(gue,{citation:ue,anchorEl:U,onClose:oe}),b.jsx(yue,{citation:me,anchorEl:U,onDeleteCitation:f,onClose:oe})]})},GD=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>b.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?b.jsx(RI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):b.jsx(Hh,{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?ka.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}],Cx=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return b.jsx(ao,{type:n,disabled:e,size:r,startIcon:e?b.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})};var ub,qE;function vue(){if(qE)return ub;qE=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);ub={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 R=0,P=k.length,$=C;R<P-1;){var V=k[R];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;$=$[k[R++]]}$[k[R]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var R=0,P=T.length;R<P;)if(O!=null||!k)O=O[T[R++]];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,R,P,$;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),$=y(O),P=!$&&/^\d+$/.test(O),k.call(T,O,$,P,R,S))}function y(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function g(S){return o.test(S)}function x(S){return!y(S)&&(v(S)||g(S))}return ub}var ha=vue(),db,KE;function xue(){if(KE)return db;KE=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 db={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(" ")},db}var fb=xue(),Cf={exports:{}},YE;function wue(){if(YE)return Cf.exports;YE=1,Cf.exports=function(o){return t(e(o),o)},Cf.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 Cf.exports}var Sue=wue();const Cue=er(Sue),Tue=Object.prototype.toString,kue=Error.prototype.toString,Eue=RegExp.prototype.toString,Oue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Mue=/^Symbol\((.*)\)(.*)$/;function _ue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function GE(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return _ue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Oue.call(t).replace(Mue,"Symbol($1)");const r=Tue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+kue.call(t)+"]":r==="RegExp"?Eue.call(t):null}function ws(t,e){let n=GE(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=GE(this[r],e);return i!==null?i:o},2)}function JD(t){return t==null?[]:[].concat(t)}let XD,ZD,QD,Rue=/\$\{\s*(\w+)\s*\}/g;XD=Symbol.toStringTag;class JE{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[XD]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],JD(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}ZD=Symbol.hasInstance;QD=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Rue,(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 JE(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[QD]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[ZD](e){return JE[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${ws(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${ws(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${ws(n,!0)}\``+o}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Iue={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"},w0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Due={isValue:"${path} field must be ${value}"},Uf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Aue={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"},Pue={notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${ws(n,!0)}\``}return pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:Iue,date:w0,object:Uf,array:Aue,boolean:Due,tuple:Pue});const Tx=t=>t&&t.__isYupSchema__;class th{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 th(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(!Tx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Tf={context:"$",value:"."};class Na{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]===Tf.context,this.isValue=this.key[0]===Tf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Tf.context:this.isValue?Tf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ha.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Na.prototype.__isYupRef=!0;const sa=t=>t==null;function al(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(L={}){const F=eA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:L.path||r,spec:s.spec,disableStackTrace:L.disableStackTrace||S},p,L.params),k),j=new pr(pr.formatError(L.message||m,F),n,F.path,L.type||u,F.disableStackTrace);return j.params=F,j}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(L){return tA(L,k)},options:o,originalValue:i,schema:s};const R=L=>{pr.isError(L)?C(L):L?l(null):C(T())},P=L=>{pr.isError(L)?C(L):a(L)};if(y&&sa(n))return R(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(R,P)}}catch(L){P(L);return}R(V)}return e.OPTIONS=t,e}function eA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=tA(t[n],e);return t}function tA(t,e){return Na.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Nue(t,e,n,r=n){let o,i,s;return e?(ha.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class nh extends Set{describe(){const e=[];for(const n of this.values())e.push(Na.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 nh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function yl(t,e=new Map){if(Tx(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]=yl(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,yl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(yl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=yl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function $ue(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 Lue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:$ue(n)}))}function nA(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Lue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>nA(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 nh,this._blacklist=new nh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=yl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&sa(i))return i;let s=ws(e),a=ws(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
405
405
|
|
|
406
406
|
attempted value: ${s}
|
|
407
407
|
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const x=i[g];x(v,f,function(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)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):yl(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=al({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=al({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Vo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Vo.notNull){return this.nullability(!1,e)}required(e=Vo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Vo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=al(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=JD(e).map(i=>new Na(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new th(o,n):th.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=al({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Vo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=al({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Vo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=al({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?eA(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:nA(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}=Nue(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 jue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Bue(t){const e=S0(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 S0(t){var e,n;const r=jue.exec(t);return r?{year:xi(r[1]),month:xi(r[2],1)-1,day:xi(r[3],1),hour:xi(r[4]),minute:xi(r[5]),second:xi(r[6]),millisecond:r[7]?xi(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:xi(r[10]),minuteOffset:xi(r[11])}:null}function xi(t,e=0){return Number(t)||e}let Fue=/^[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])?)*$/,Vue=/^((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,zue=/^(?:[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,Hue="^\\d{4}-\\d{2}-\\d{2}",Wue="\\d{2}:\\d{2}:\\d{2}",Uue="(([+-]\\d{2}(:?\\d{2})?)|Z)",que=new RegExp(`${Hue}T${Wue}(\\.\\d+)?${Uue}$`),Kue=t=>sa(t)||t===t.trim(),Yue={}.toString();function aa(){return new rA}class rA 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===Yue?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Vo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=wr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=wr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=wr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||wr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=wr.email){return this.matches(Fue,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(Vue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(zue,{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(que,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=S0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=S0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Kue})}lowercase(e=wr.lowercase){return this.transform(n=>sa(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toLowerCase()})}uppercase(e=wr.uppercase){return this.transform(n=>sa(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>sa(n)||n===n.toUpperCase()})}}aa.prototype=rA.prototype;let oA=new Date(""),Gue=t=>Object.prototype.toString.call(t)==="[object Date]";function kx(){return new Xu}class Xu extends ti{constructor(){super({type:"date",check(e){return Gue(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Bue(e),isNaN(e)?Xu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Na.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=w0.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=w0.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)}})}}Xu.INVALID_DATE=oA;kx.prototype=Xu.prototype;kx.INVALID_DATE=oA;function Jue(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=ha.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Na.isRef(a)&&a.isSibling?i(a.path,s):Tx(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Cue.array(Array.from(r),n).reverse()}function XE(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 iA(t){return(e,n)=>XE(t,e)-XE(t,n)}const Xue=(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 qf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=qf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=qf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(qf)}):"optional"in t?t.optional():t}const Zue=(t,e)=>{const n=[...ha.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=ha.getter(ha.join(n),!0)(t);return!!(o&&r in o)};let ZE=t=>Object.prototype.toString.call(t)==="[object Object]";function QE(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Que=iA([]);function Ex(t){return new sA(t)}class sA extends ti{constructor(e){super({type:"object",check(n){return ZE(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Que,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||!ZE(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Na.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=Jue(e,n),r._sortErrors=iA(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 qf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=ha.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Zue(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Xue)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Uf.exact,test(n){if(n==null)return!0;const r=QE(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Uf.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=QE(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Uf.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(fb.camelCase)}snakeCase(){return this.transformKeys(fb.snakeCase)}constantCase(){return this.transformKeys(e=>fb.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}}Ex.prototype=sA.prototype;const ede=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(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(Xh,{})})]}),b.jsx(Ut.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,onSubmit:async g=>{f(!0),n(g).catch(x=>{throw f(!1),x}).finally(()=>f(!1))},validationSchema:Ex({source:aa().required("Source is required"),title:aa().required("Title is required"),accessedAt:kx().required("Accessed At is required"),url:aa().required("URL is required"),classification:aa().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:g})=>b.jsxs(Ut.Form,{autoComplete:"off",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[b.jsx(xs,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(xs,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(Op,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),b.jsx(xs,{name:"url",label:"URL",disabled:u,required:!0,margin:"none",readOnly:s}),b.jsx(MI,{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(z.DialogActions,{sx:{px:0},children:s?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Cx,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),g()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},aA=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return b.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},tde=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(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[b.jsx(z.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&b.jsx(z.IconButton,{onClick:o,children:b.jsx(Xh,{})})]}),b.jsx(Ut.Formik,{innerRef:u,enableReinitialize:!0,initialValues:v,validationSchema:Ex().shape({title:aa().required("Title is required"),fileName:aa().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async x=>{p(!0),n(x).catch(S=>{throw p(!1),S}).finally(()=>p(!1))},children:({values:x,setFieldValue:S,handleSubmit: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(Ut.Form,{autoComplete:"off",children:[b.jsx(xs,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),b.jsxs(z.Box,{marginTop:i||a?0:1,children:[b.jsxs(aA,{alignItems:"flex-start",children:[!i&&!a&&b.jsx(kI,{name:"file",errorMode:"hidden"}),b.jsx(xs,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),b.jsx(Mr,{name:"fileName"})]}),b.jsx(z.DialogActions,{sx:{px:0},children:a?b.jsx(z.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):b.jsxs(b.Fragment,{children:[b.jsx(z.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),b.jsx(Cx,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),k()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},Zu=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(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[b.jsx(z.Box,{children:y()}),b.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return b.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:b.jsx(z.Box,{children:y()})})};return b.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?b.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&b.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:b.jsx(Xh,{})})]})}):r,o&&(typeof o=="string"?b.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:b.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function nde(t){return qe("MuiAlert",t)}const eO=ze("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),rde=Pe(b.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),ode=Pe(b.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),ide=Pe(b.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),sde=Pe(b.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),ade=Pe(b.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),lde=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ae(n||r)}`,`${e}${Ae(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ue(i,nde,o)},cde=ne(Ms,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ae(n.color||n.severity)}`]]}})(yt(({theme:t})=>{const e=t.palette.mode==="light"?ya:Ol,n=t.palette.mode==="light"?Ol:ya;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${eO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${eO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(jn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),ude=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),dde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),fde=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}),tO={success:b.jsx(rde,{fontSize:"inherit"}),warning:b.jsx(ode,{fontSize:"inherit"}),error:b.jsx(ide,{fontSize:"inherit"}),info:b.jsx(sde,{fontSize:"inherit"})},lA=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=tO,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=lde(C),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[P,$]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:cde,externalForwardedProps:{...R,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=Mt("icon",{className:O.icon,elementType:ude,externalForwardedProps:R,ownerState:C}),[L,F]=Mt("message",{className:O.message,elementType:dde,externalForwardedProps:R,ownerState:C}),[j,A]=Mt("action",{className:O.action,elementType:fde,externalForwardedProps:R,ownerState:C}),[_,I]=Mt("closeButton",{elementType:Jl,externalForwardedProps:R,ownerState:C}),[B,W]=Mt("closeIcon",{elementType:ade,externalForwardedProps:R,ownerState:C});return b.jsxs(P,{...$,children:[p!==!1?b.jsx(V,{...M,children:p||m[g]||tO[g]}):null,b.jsx(L,{...F,children:i}),o!=null?b.jsx(j,{...A,children:o}):null,o==null&&y?b.jsx(j,{...A,children:b.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...I,children:b.jsx(B,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(lA.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 Qu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.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(lA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&b.jsx(z.Typography,{variant:"h3",children:s}),n]})},cA=t=>b.jsx(Qu,{severity:"error",...t}),uA=t=>b.jsx(Qu,{severity:"success",...t}),pde=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(cA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&b.jsx(uA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function dA({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,R]=X.useState(u),[P,$]=X.useState(void 0),[V,M]=X.useState(void 0),L=Y=>{M(void 0),C(Y)},[F,j]=X.useState(0);X.useEffect(()=>{f==null||f()},[T,V,f]);const A=(Y=!1)=>{(!m||Y)&&j(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)},I=Y=>M({type:"Success",title:"",message:Y}),B=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(()=>{L("Insert Citation/Attachment(s)"),A()}).catch(pe=>{_("Failed to update",pe)}))}else await(e==null?void 0:e(Y).then(pe=>{R([...O,pe.id]),L("Insert Citation/Attachment(s)"),A()}).catch(pe=>{_("Failed to create",pe)}))},W=r&&(async Y=>r(Y).then(()=>{A(!0),R(O.filter(ee=>ee!==Y)),I("Successfully deleted")}).catch(ee=>_("Failed to delete",ee))),K=o&&((Y,ee)=>{o(Y.id).then(pe=>{$(pe),L(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(bue,{refreshKey:F,getCitationsPaginated:Y=>t(Y).then(ee=>(f==null||f(),ee)),onCancel:l,onNewCitation:()=>{$(void 0),L("Add Citation")},onNewAttachment:()=>{$(void 0),L("Add Attachment")},onEditCitation:me,onEditAttachment:he,onViewCitation:U,onViewAttachment:J,onDeleteCitation:W,onDownloadAttachment:ue,onPreviewAttachment:Z,onSelect:a,setSelectedIds:R,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(ede,{modifyCitation:P,onSave:B,onCancel:()=>L("Insert Citation/Attachment(s)"),onClose:l,title:T,readOnly:T==="View Citation",showCloseBtn:m}),te=b.jsx(tde,{onSave:B,onCancel:()=>L("Insert Citation/Attachment(s)"),onClose:l,modifyCitation:P,disableFileUpload:T==="Edit Attachment",title:T,readOnly:T==="View Attachment",showCloseBtn:m}),oe=b.jsx(pde,{alert:V,setAlert:M}),le=T==="Add Citation"||T==="Edit Citation"||T==="View Citation",ge=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:ge&&(Y=te),b.jsxs(z.Box,{width:"500px",children:[oe,b.jsx(z.Box,{paddingTop:"8px",children:Y})]})}return b.jsxs(z.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&oe,b.jsx(z.Box,{paddingTop:"8px",children:re}),b.jsx(Zu,{open:le||ge,children:b.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[oe,le?de:te]})})]})}function fA({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=s=>n?t(s,r):e(s);return b.jsx(dA,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const hde=z.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 mde({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=Tt();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(yv,{editor:m,open:v,...y.bubbleMenuOptions,...p,children:b.jsx(hde,{children:b.jsx(fA,{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 gde=()=>mn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function yde(t){const e=Tt(),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(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[b.jsx(One,{fontSize:"small"}),b.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const pA=X.createContext(void 0),hA=()=>{const t=X.useContext(pA);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},bde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=hA(),[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=>ka.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(Vv,{as:"span",...e,"data-testid":"citation-node-component",children:b.jsx(z.Tooltip,{title:b.jsx(z.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(z.Typography,{variant:"subtitle2",children:[x.filter(Boolean).join(" | "),g<p.length-1&&b.jsx(z.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})})})},vde=nn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",Ct(t)]},addNodeView(){return zv(bde)},addProseMirrorPlugins(){return[new rn({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),mA=t=>b.jsx(TI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),xde=t=>{const{name:e,label:n=Fn(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,R=[IR,HD.configure({placeholder:S}),gde(),vde.configure({citationMaxLength:a})],[P,$,V]=Ut.useField({name:e}),{setValue:M}=V,{value:L}=P,{addUpdateCitation:F,deleteCitation:j,batchUpdate:A,citations:_}=hA();X.useEffect(()=>{var re;const ue=(re=I==null?void 0:I.current)==null?void 0:re.editor;if(!ue)return;ue.getHTML()!==L&&setTimeout(()=>{ue.commands.setContent(L)},0)},[L]);const I=X.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},W=(ue=void 0)=>{var de,te;const Z=((te=(de=I.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(()=>ka.debounce(()=>W(!1),500),[M]),U=_a(),{showDiff:J,getPreviousValue:me}=Ra(),he=i??U;if(J){const ue=me(e)??"",Z=L,re=/<citation\s+ids="([^"]*)"><\/citation>/g,de=(le,ge)=>{const Y=ge.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(Aa,{label:n,value:oe,showDiff:!0,diffSnapshot:te,mode:"html"})}return b.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:he?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...B[s],display:"flex",flexDirection:"column",width:"100%",children:[b.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&b.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&b.jsx(mA,{name:k})]}),b.jsx(gI,{ref:I,extensions:R,content:L,editable:!he,renderControls:he?void 0:()=>b.jsx($v,{children:b.jsx(yde,{})}),onBlur:()=>W(),onUpdate:K,RichTextFieldProps:{variant:he?"standard":"outlined",MenuBarProps:{hide:he}},children:()=>b.jsx(mde,{getCitationsPaginated:ue=>l(ue).then(Z=>(A(Z.data),Z)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(ue=>f(ue).then(Z=>(F(Z),Z))),onUpdateCitation:p&&(ue=>p(ue).then(Z=>(F(Z),Z))),onDeleteCitation:m&&(ue=>m(ue).then(()=>j(ue))),getCitationById:y,onDownloadAttachment:v,onPreviewAttachment:g,onError:x,canLaunchUrl:C,readOnly:he,canSearch:O})}),b.jsx(Mr,{name:e,id:`${e}-err`,errorMode:T})]})},wde=t=>{const{name:e="submit"}=t;return b.jsx(ao,{name:e,type:"submit",...t})},Sde=t=>{const{label:e="Return to Top",icon:n=$f,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return b.jsx(z.Zoom,{in:o,children:b.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:b.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[b.jsx(n,{fontSize:"medium"}),e]})})})},gA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ko.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(z.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(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>b.jsxs(z.MenuItem,{..._u(p,o),children:[p.icon&&b.jsx(z.ListItemIcon,{children:p.icon}),b.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},Cde=()=>{const{values:t,errors:e,status:n}=Ut.useFormikContext(),{palette:r}=z.useTheme();return b.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:b.jsxs(z.List,{children:[b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(t,null,2)})]}),b.jsx(z.Divider,{variant:"inset",component:"li"}),b.jsxs(z.ListItem,{id:"testing",children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(e,null,2)})]}),b.jsxs(z.ListItem,{children:[b.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),b.jsx("br",{}),b.jsx(z.Divider,{variant:"inset"}),b.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Tde=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=KD();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...hr({...t},l)};return b.jsx(z.Stepper,{...u,children:e.map(f=>b.jsx(z.Step,{children:b.jsx(z.StepLabel,{children:f})},f))})},kde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?b.jsx(DI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:v=!1,removePosition:g="bottom"}=t,[x]=Ut.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return b.jsxs(z.FormControl,{fullWidth:!0,children:[b.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?b.jsx(z.Typography,{children:y}):b.jsx(Ut.FieldArray,{name:e,render:T=>b.jsxs("div",{children:[S.map((C,O)=>b.jsx(X.Fragment,{children:b.jsx(Ede,{variant:l,content:b.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?k(g):{...g},children:[b.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&b.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&b.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ede=({variant:t,content:e})=>{switch(t){case"card":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"elevatedCard":return b.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:b.jsx(z.CardContent,{children:e})});case"none":return e}},Ode=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return b.jsx(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Mde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return b.jsx(Zu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},_de=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(Zu,{actions:[b.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),b.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Rde={added:{icon:kne,label:"Added",color:"success"},deleted:{icon:DI,label:"Deleted",color:"error"},modified:{icon:Mne,label:"Modified",color:"info"}},Ide=(t,e)=>b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:wp},children:b.jsx("s",{children:t})}),b.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:xp},children:b.jsx("u",{children:e})})]}),Dde=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Mu(s,e,r),l=Mu(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??CI.isEqual(a,l))||(o[xn(s)]=Ide(a,l))}return o},Ade=(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=Dde(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}},yA=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}=Ade(r,e,n,s,o),u=[{fieldName:"changeType",render:f=>{const p=Rde[f];return b.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:b.jsxs(z.Typography,{children:[b.jsx(R0,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var y;return((y=m.modifiedDiff)==null?void 0:y[xn(f)])??Mu(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(xM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},bA=({columns:t,data:e,emptyTableMsg:n="No changes to display",renderExpand:r,size:o,unmodifiedCount:i})=>b.jsxs(z.Box,{children:[b.jsx(Sx,{columns:t,data:e,emptyTableMsg:n,renderExpand:r,size:o}),i>0&&b.jsx(z.Box,{children:b.jsxs(z.Typography,{fontStyle:"italic",children:["+",i," unmodified rows"]})})]}),Pde=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?yA({...n,isMobileScreen:r}):n;return b.jsx(bA,{...o,size:t.size})},Nde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=ko.useNavigate();return b.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[b.jsx(z.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(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[b.jsx(z.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(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,..._u(l,a),children:l.label},l.label))}),n&&b.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},vA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ko.useLocation(),i=ko.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>b.jsx(z.MenuList,{children:m.map(v=>b.jsxs(z.MenuItem,{..._u(v,i,()=>a(!1)),children:[v.icon&&b.jsx(z.ListItemIcon,{children:v.icon}),b.jsx(z.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(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?b.jsx(z.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(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:b.jsx(Nne,{})}),b.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:b.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:b.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},xA=t=>{const{env:e,isProd:n}=t;return n?null:b.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:b.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},wA=t=>{const{displayName:e,userMenuOptions:n}=t;return b.jsx(gA,{label:e,menuOptions:n,icon:b.jsx(Lne,{})})},mm=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}=z.useTheme(),a=ko.useNavigate();return b.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>b.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,..._u(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))})},SA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&b.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:b.jsx(mm,{menuOptions:e,activeTabIdx:n,sx:r})})},CA=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return b.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?b.jsx(II,{}):b.jsx(_I,{})})},$de=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=ko.useNavigate(),g=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=ko.useLocation(),k=x.mode==="dark",[T,C]=D.useState(void 0);D.useEffect(()=>{const P=o.findIndex($=>$.path&&S.startsWith($.path));C(P>=0?P:void 0)},[S,o]);const O=s&&b.jsx(CA,{onToggle:s}),R=s&&(g||!g&&l)?[{icon:k?b.jsx(II,{}):b.jsx(_I,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return b.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&b.jsx(xA,{...e}),u,b.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[b.jsx(z.Button,{disableRipple:!0,component:ko.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(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&O,g&&b.jsx(vA,{menuOptionLists:[o,a,R],anchor:"right"}),!g&&b.jsxs(b.Fragment,{children:[b.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((P,$)=>b.jsxs(z.Box,{display:"flex",alignItems:"center",children:[$>0&&b.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),b.jsx(z.Button,{variant:"text",sx:{color:"white"},..._u(P,v),children:b.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&b.jsx(wA,{displayName:l,userMenuOptions:R})]})]})]}),!g&&b.jsx(SA,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Lde=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ko.useLocation(),o=z.useMediaQuery(z.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(z.Box,{sx:e,children:b.jsx(z.Card,{sx:{height:"100%",width:200},children:b.jsx(mm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},jde=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&b.jsx(mm,{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}})},Bde=({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(pA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Fde=t=>b.jsx(Qu,{severity:"info",...t}),Vde=t=>b.jsx(Qu,{severity:"warning",...t}),TA=t=>{const{crumbInfo:e}=t,n=ko.useNavigate();return b.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:b.jsx($ne,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?b.jsx(z.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):b.jsx(z.Typography,{color:"primary",children:r},r))})},zde=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Hde(r);return b.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:b.jsx(Qu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:nO(r),warning:nO(r)},onClose:o,elevation:a,variant:s,children:n?b.jsxs(b.Fragment,{children:[b.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Hde=t=>t=="logout"?"info":t=="timeout"?"warning":t,nO=t=>{if(t=="timeout")return b.jsx(Tne,{});if(t=="logout")return b.jsx(Pne,{})},Wde=t=>{Ude(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=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:b.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&b.jsx(TA,{crumbInfo:i}),b.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[b.jsxs(z.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(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&b.jsxs(ao,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[b.jsx(Ene,{style:{marginRight:"0.5rem"}}),n]})]}),s&&b.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},Ude=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`)},qde=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return b.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&b.jsx(z.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(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,b.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},Kde=t=>{const{title:e="Loading...",message:n}=t;return b.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[b.jsxs(z.Box,{className:"text-content",children:[b.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&b.jsx(z.Typography,{"data-testid":"message",children:n})]}),b.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function Yde({...t}){return b.jsx(dA,{onSelectCitations:()=>{},onCancel:()=>{},...t})}const Gde=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(z.Box,{height:n})};exports.AlertModal=Mde;exports.Autocomplete=SI;exports.Breadcrumbs=TA;exports.Button=ao;exports.Checkbox=TI;exports.CheckboxGroup=Yte;exports.CitationField=xde;exports.CitationFieldProvider=Bde;exports.CitationManager=Yde;exports.Column=YD;exports.ConfirmationModal=Ode;exports.DarkModeToggle=CA;exports.DateField=Op;exports.DateRangeField=bce;exports.DecisionModal=_de;exports.Diff=wI;exports.DiffProvider=xM;exports.DiffTable=Pde;exports.DiffTableView=bA;exports.Drawer=vA;exports.DynamicAutocomplete=qte;exports.EnvironmentBanner=xA;exports.ErrorAlert=cA;exports.FileList=Xte;exports.FileUpload=kI;exports.FloatingNavBar=jde;exports.Footer=Nde;exports.FormDebugger=Cde;exports.Header=$de;exports.InfoAlert=Fde;exports.LoadingButton=Cx;exports.LoadingIndicator=Kde;exports.LoadingOverlay=UD;exports.Location=vne;exports.MenuButton=gA;exports.Modal=Zu;exports.MultiAutocomplete=Kte;exports.NavBar=SA;exports.NotApplicableCheckbox=mA;exports.PageHeader=Wde;exports.PaginatedTable=qD;exports.ProfileMenu=wA;exports.RadioGroup=MI;exports.RangeSlider=xne;exports.ReadOnly=Aa;exports.ReadOnlyProvider=bM;exports.RepeatableFormGroup=kde;exports.RichTextField=pue;exports.Row=aA;exports.ScrollToTop=Sde;exports.SearchField=AI;exports.Select=wne;exports.SelectableCitationManager=fA;exports.Sidebar=Lde;exports.SingleActionCard=qde;exports.Snackbar=zde;exports.Spacer=Gde;exports.Stepper=Tde;exports.Submit=wde;exports.SuccessAlert=uA;exports.Switch=Sne;exports.Table=Sx;exports.Tabs=mm;exports.TextArea=Cne;exports.TextField=xs;exports.TextIcon=R0;exports.ValidationError=Mr;exports.WarningAlert=Vde;exports.baseCitationTableColumns=GD;exports.buildTableDiff=yA;exports.commonTheme=In;exports.darkTheme=nz;exports.lightTheme=tz;exports.useDiff=Ra;exports.useReadOnly=_a;
|