@simoncomputing/mui-bueno-v2 0.35.6 → 0.35.7
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/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- 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.35.7] - 2026-08-10
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- `CitationManager`, `SelectableCitationManager`, `CitationField`
|
|
19
|
+
- URLs are always truncated in the citation table
|
|
20
|
+
|
|
14
21
|
## [0.35.6] - 2026-08-07
|
|
15
22
|
|
|
16
23
|
### Changed
|
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
|
`,Cce="️",Tce="",fb="";let wf=null,Sf=null;function kce(t=[]){const e={};Sr.groups=e;const n=new Sr;wf==null&&(wf=WE(yce)),Sf==null&&(Sf=WE(bce)),Ae(n,"'",Kp),Ae(n,"{",ru),Ae(n,"}",ou),Ae(n,"[",Dp),Ae(n,"]",Ap),Ae(n,"(",Pp),Ae(n,")",Np),Ae(n,"<",jp),Ae(n,">",$p),Ae(n,"(",Lp),Ae(n,")",Bp),Ae(n,"「",Fp),Ae(n,"」",Vp),Ae(n,"『",zp),Ae(n,"』",Hp),Ae(n,"<",Wp),Ae(n,">",Up),Ae(n,"&",qp),Ae(n,"*",Yp),Ae(n,"@",ss),Ae(n,"`",Jp),Ae(n,"^",Xp),Ae(n,":",cs),Ae(n,",",xx),Ae(n,"$",Zp),Ae(n,".",Lo),Ae(n,"=",Qp),Ae(n,"!",wx),Ae(n,"-",eo),Ae(n,"%",iu),Ae(n,"|",eh),Ae(n,"+",th),Ae(n,"#",nh),Ae(n,"?",su),Ae(n,'"',Sx),Ae(n,"/",Bo),Ae(n,";",Cx),Ae(n,"~",au),Ae(n,"_",rh),Ae(n,"\\",Gp),Ae(n,"・",ID);const r=ln(n,vi,bx,{[g0]:!0});ln(r,vi,r);const o=ln(r,bi,_D,{[nu]:!0}),i=ln(r,Rc,RD,{[Fc]:!0}),s=ln(n,bi,Si,{[y0]:!0});ln(s,vi,o),ln(s,bi,s),ln(o,vi,o),ln(o,bi,o);const a=ln(n,Rc,x0,{[b0]:!0});ln(a,bi),ln(a,vi,i),ln(a,Rc,a),ln(i,vi,i),ln(i,bi),ln(i,Rc,i);const l=Ae(n,db,vx,{[lb]:!0}),u=Ae(n,HE,C0,{[lb]:!0}),f=ln(n,ub,C0,{[lb]:!0});Ae(n,fb,f),Ae(u,db,l),Ae(u,fb,f),ln(u,ub,f),Ae(f,HE),Ae(f,db),ln(f,ub,f),Ae(f,fb,f);const p=ln(n,cb,DD,{[MD]:!0});Ae(p,"#"),ln(p,cb,p),Ae(p,Cce,p);const m=Ae(p,Tce);Ae(m,"#"),ln(m,cb,p);const b=[[bi,s],[vi,o]],v=[[bi,null],[Rc,a],[vi,i]];for(let y=0;y<wf.length;y++)ts(n,wf[y],w0,Si,b);for(let y=0;y<Sf.length;y++)ts(n,Sf[y],S0,x0,v);sa(w0,{tld:!0,ascii:!0},e),sa(S0,{utld:!0,alpha:!0},e),ts(n,"file",Kf,Si,b),ts(n,"mailto",Kf,Si,b),ts(n,"http",fl,Si,b),ts(n,"https",fl,Si,b),ts(n,"ftp",fl,Si,b),ts(n,"ftps",fl,Si,b),sa(Kf,{scheme:!0,ascii:!0},e),sa(fl,{slashscheme:!0,ascii:!0},e),t=t.sort((y,x)=>y[0]>x[0]?1:-1);for(let y=0;y<t.length;y++){const x=t[y][0],k=t[y][1]?{[vce]:!0}:{[xce]:!0};x.indexOf("-")>=0?k[v0]=!0:bi.test(x)?vi.test(x)?k[nu]=!0:k[y0]=!0:k[g0]=!0,zE(n,x,x,k)}return zE(n,"localhost",Mu,{ascii:!0}),n.jd=new Sr(oh),{start:n,tokens:Object.assign({groups:e},AD)}}function PD(t,e){const n=Ece(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 Ece(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 ts(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 Sr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Sr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function WE(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 _u={defaultProtocol:"http",events:null,format:UE,formatHref:UE,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Tx(t,e=null){let n=Object.assign({},_u);t&&(n=Object.assign(n,t instanceof Tx?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}Tx.prototype={o:_u,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]:_u[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 UE(t){return t}function ND(t,e){this.t="token",this.v=t,this.tk=e}ND.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=_u.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 bm(t,e){class n extends ND{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 qE=bm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),KE=bm("text"),Oce=bm("nl"),Cf=bm("url",{isLink:!0,toHref(t=_u.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Mu&&t[1].t===cs}}),Zr=t=>new Sr(t);function Mce({groups:t}){const e=t.domain.concat([qp,Yp,ss,Gp,Jp,Xp,Zp,Qp,eo,bx,iu,eh,th,nh,Bo,oh,au,rh]),n=[Kp,cs,xx,Lo,wx,iu,su,Sx,Cx,jp,$p,ru,ou,Ap,Dp,Pp,Np,Lp,Bp,Fp,Vp,zp,Hp,Wp,Up],r=[qp,Kp,Yp,Gp,Jp,Xp,Zp,Qp,eo,ru,ou,iu,eh,th,nh,su,Bo,oh,au,rh],o=Zr(),i=Ae(o,au);ft(i,r,i),ft(i,t.domain,i);const s=Zr(),a=Zr(),l=Zr();ft(o,t.domain,s),ft(o,t.scheme,a),ft(o,t.slashscheme,l),ft(s,r,i),ft(s,t.domain,s);const u=Ae(s,ss);Ae(i,ss,u),Ae(a,ss,u),Ae(l,ss,u);const f=Ae(i,Lo);ft(f,r,i),ft(f,t.domain,i);const p=Zr();ft(u,t.domain,p),ft(p,t.domain,p);const m=Ae(p,Lo);ft(m,t.domain,p);const b=Zr(qE);ft(m,t.tld,b),ft(m,t.utld,b),Ae(u,Mu,b);const v=Ae(p,eo);Ae(v,eo,v),ft(v,t.domain,p),ft(b,t.domain,p),Ae(b,Lo,m),Ae(b,eo,v);const y=Ae(b,cs);ft(y,t.numeric,qE);const x=Ae(s,eo),S=Ae(s,Lo);Ae(x,eo,x),ft(x,t.domain,s),ft(S,r,i),ft(S,t.domain,s);const k=Zr(Cf);ft(S,t.tld,k),ft(S,t.utld,k),ft(k,t.domain,s),ft(k,r,i),Ae(k,Lo,S),Ae(k,eo,x),Ae(k,ss,u);const T=Ae(k,cs),C=Zr(Cf);ft(T,t.numeric,C);const O=Zr(Cf),R=Zr();ft(O,e,O),ft(O,n,R),ft(R,e,O),ft(R,n,R),Ae(k,Bo,O),Ae(C,Bo,O);const P=Ae(a,cs),j=Ae(l,cs),F=Ae(j,Bo),M=Ae(F,Bo);ft(a,t.domain,s),Ae(a,Lo,S),Ae(a,eo,x),ft(l,t.domain,s),Ae(l,Lo,S),Ae(l,eo,x),ft(P,t.domain,O),Ae(P,Bo,O),Ae(P,su,O),ft(M,t.domain,O),ft(M,e,O),Ae(M,Bo,O);const $=[[ru,ou],[Dp,Ap],[Pp,Np],[jp,$p],[Lp,Bp],[Fp,Vp],[zp,Hp],[Wp,Up]];for(let z=0;z<$.length;z++){const[L,A]=$[z],_=Ae(O,L);Ae(R,L,_),Ae(_,A,O);const I=Zr(Cf);ft(_,e,I);const B=Zr();ft(_,n),ft(I,e,I),ft(I,n,B),ft(B,e,I),ft(B,n,B),Ae(I,A,O),Ae(B,A,O)}return Ae(o,Mu,k),Ae(o,vx,Oce),{start:o,tokens:AD}}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(pb(KE,e,s)),s=[]),o-=m,f-=m;const b=p.t,v=n.slice(o-f,o);i.push(pb(b,e,v))}}return s.length>0&&i.push(pb(KE,e,s)),i}function pb(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 Rce=typeof console<"u"&&console&&console.warn||(()=>{}),Ice="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ut={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Dce(){return Sr.groups={},Ut.scanner=null,Ut.parser=null,Ut.tokenQueue=[],Ut.pluginQueue=[],Ut.customSchemes=[],Ut.initialized=!1,Ut}function YE(t,e=!1){if(Ut.initialized&&Rce(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Ice}`),!/^[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`);Ut.customSchemes.push([t,e])}function Ace(){Ut.scanner=kce(Ut.customSchemes);for(let t=0;t<Ut.tokenQueue.length;t++)Ut.tokenQueue[t][1]({scanner:Ut.scanner});Ut.parser=Mce(Ut.scanner.tokens);for(let t=0;t<Ut.pluginQueue.length;t++)Ut.pluginQueue[t][1]({scanner:Ut.scanner,parser:Ut.parser});return Ut.initialized=!0,Ut}function kx(t){return Ut.initialized||Ace(),_ce(Ut.parser.start,t,PD(Ut.scanner.start,t))}kx.scan=PD;function jD(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 Tx(n),o=kx(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 Ex="[\0- -\u2029 ]",Pce=new RegExp(Ex),Nce=new RegExp(`${Ex}$`),jce=new RegExp(Ex,"g");function $ce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Lce(t){return new on({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=c7(n.doc,[...e]);if(m7(a).forEach(({newRange:u})=>{const f=d7(r.doc,u,b=>b.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 b=r.doc.textBetween(u.from,u.to," "," ");if(!Nce.test(b))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const b=m.split(Pce).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],y=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=kx(v).map(S=>S.toObject(t.defaultProtocol));if(!$ce(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:y+S.start+1,to:y+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=>{av(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 Bce(t){return new on({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=sv(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 Fce(t){return new on({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=jD(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 Ks(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(jce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Vce=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"){YE(t);return}YE(t.scheme,t.optionalSlashes)})},onDestroy(){Dce()},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)=>!!Ks(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=>!!Ks(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=>!!Ks(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Tt(this.options.HTMLAttributes,t),0]:["a",Tt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ks(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=>!!Ks(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[Ts({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=jD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ks(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(Lce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ks(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Bce({type:this.type})),this.options.linkOnPaste&&t.push(Fce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function zce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=J7(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,b=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 y=a.pos-v.length,x=Array.from(v.matchAll(b)).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=y+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 Hce=new On("suggestion");function Wce({pluginKey:t=Hce,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:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:y=zce}){let x;const S=b==null?void 0:b(),k=new on({key:t,view(){return{update:async(T,C)=>{var O,R,P,j,F,M,$;const z=(O=this.key)===null||O===void 0?void 0:O.getState(C),L=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=z.active&&L.active&&z.range.from!==L.range.from,_=!z.active&&L.active,I=z.active&&!L.active,B=!_&&!I&&z.query!==L.query,W=_||A&&B,K=B||A,U=I||A&&B;if(!W&&!K&&!U)return;const Y=U&&!W?z:L,fe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:ue=>p({editor:e,range:Y.range,props:ue}),decorationNode:fe,clientRect:fe?()=>{var ue;const{decorationId:pe}=(ue=this.key)===null||ue===void 0?void 0:ue.getState(e.state),Z=T.dom.querySelector(`[data-decoration-id="${pe}"]`);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&&((j=S==null?void 0:S.onBeforeUpdate)===null||j===void 0||j.call(S,x)),(K||W)&&(x.items=await m({editor:e,query:Y.query})),U&&((F=S==null?void 0:S.onExit)===null||F===void 0||F.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),W&&(($=S==null?void 0:S.onStart)===null||$===void 0||$.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:j}=e.view,{selection:F}=T,{empty:M,from:$}=F,z={...C};if(z.composing=j,P&&(M||e.view.composing)){($<C.range.from||$>C.range.to)&&!j&&!C.composing&&(z.active=!1);const L=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:F.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;L&&v({editor:e,state:R,range:L.range,isActive:C.active})?(z.active=!0,z.decorationId=C.decorationId?C.decorationId:A,z.range=L.range,z.query=L.query,z.text=L.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(T,C){var O;const{active: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 j=!(P!=null&&P.length),F=[l];return j&&F.push(f),Xt.create(T.doc,[Zn.inline(O.from,O.to,{nodeName:a,class:F.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function Uce({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 $D(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Uce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function GE(t,e){const n=$D(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const qce=rn.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",Tt(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=GE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Tt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Tt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",Tt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:GE(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 Ri,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 $D(this).map(Wce)}}),LD=gn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new on({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&&Ph(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Zn.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)}}})]}}),Kce=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",Tt(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()}}}),Yce=rn.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",Tt(this.options.HTMLAttributes,t),0]}}),Gce=rn.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",Tt(this.options.HTMLAttributes,t),0]}}),Jce=rn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Tt(this.options.HTMLAttributes,t),0]}}),Xce=/^\s*(\[([( |x])?\])\s$/,Zce=rn.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",Tt(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 b=n();if(typeof b!="number")return!1;const v=m.doc.nodeAt(b);return m.setNodeMarkup(b,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[Al({find:Xce,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Qce=rn.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",Tt(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()}}}),eue=gn.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")}}}),BD=J.forwardRef((t,e)=>{const[n,r]=J.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return J.useEffect(()=>r(0),[t.items]),J.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?g.jsx(V.Paper,{elevation:5,children:g.jsx(V.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>g.jsx(V.ListItem,{disablePadding:!0,children:g.jsx(V.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});BD.displayName="SuggestionList";const JE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},tue={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 H2(BD,{props:n,editor:n.editor}),e=qu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??JE},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))??JE}})},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}}}},nue=Vce.extend({inclusive:!1}),rue=Kce.extend({excludes:"superscript"}),oue=pI.extend({excludes:"subscript"});function iue({placeholder:t}={}){return J.useMemo(()=>[Uee.configure({resizable:!0}),Jce,Gce,Yce,J_,Z_,Q_,rR,fR,pR,hR,rue,oue,gR,G_,Y_,X_,dR,Jv,mR,nue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),MQ,nR,EQ,eue.configure({types:["heading","paragraph","image"]}),hce,mce,gce,SZ,bR.configure({multicolor:!0}),uR,HQ,eR,Qce,Zce.configure({nested:!0}),qce.configure({suggestion:tue}),LD.configure({placeholder:t}),cR],[t])}function XE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const sue=t=>{const e=iue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(dI,{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]=Ht.useField({name:n}),{setValue:f}=u,{value:p}=a;J.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=J.useRef(null),b=J.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=>{t0({images:O,editor:T,position:k})});else{const O=i(S);t0({images:O,editor:T,position:k})}},[]),v=J.useCallback((S,k,T,C)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=XE(k.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return b(O,P),k.preventDefault(),!0}return!1},[b]),y=J.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=XE(k.clipboardData.files);return C.length>0?(b(C),!0):!1},[b]),x=g.jsx(V.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(uI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(fce,{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:()=>g.jsxs(g.Fragment,{children:[g.jsx(fte,{}),g.jsx(Ete,{})]})})});return g.jsxs(V.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(V.Typography,{...o,children:r}),x]})},ZE=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child > td":{borderBottom:"unset"}};return i?g.jsx(V.Collapse,{in:n,children:u}):g.jsx(V.TableRow,{sx:p,children:g.jsx(V.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:g.jsx(V.Collapse,{in:n,children:u})})})},Ox=({isLoading:t,children:e})=>{const[n,r]=J.useState(!1);return J.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]),g.jsxs(V.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,g.jsx(V.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:g.jsx(V.CircularProgress,{})})]})},Ko=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Ru=t=>{const{gap:e=1,...n}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function FD({icon:t,children:e,sx:n,...r}){return e?g.jsx(V.Tooltip,{title:e,children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:n??{ml:.5},...r})}):null}function VD(t){return g.jsx(FD,{icon:Cne,...t})}const Mx=t=>{const{id:e,getRowKey:n=me=>"id"in me&&(typeof me.id=="string"||typeof me.id=="number")&&me.id!=null?me.id:(console.warn(`Table: "id" not found or undefined in ${JSON.stringify(me)}. If provided, id must have a value and be type string or number. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),String(JSON.stringify(me))),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,checkedKeys:a,setCheckedKeys:l,renderExpand:u,sortField:f,sortOrder:p,onSortChange:m,allowSortCols:b,fixedLayout:v=!1,className:y,emptyTableMsg:x="No items to display",errorTableMsg:S,retryCallback:k,isLoading:T=!1,disableMobileCards:C=!1,highlightSelectedRow:O=!1,selectedRowColor:R,selectedRowKey:P,headerRowStyle:j={},stickyHeader:F,reRenderExpand:M=!1,expandOnRowClick:$=!1,tooltipProps:z={},...L}=t,{palette:A}=V.useTheme(),_=A.grey[A.mode=="dark"?600:50],[I,B]=J.useState(void 0),[W,K]=J.useState(typeof O=="string"||typeof O=="number"?O:void 0);aue(t);const U=me=>{me!==f?m&&m(me,"asc"):m&&m(f,p==="asc"?"desc":"asc")},Y=me=>f===me?p:null,fe=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),ue=r.filter(me=>!me.hideCol&&(!fe||!me.hideOnMobile));u&&!fe&&ue.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,je)=>{const Ie=n(je),gt=I===Ie;return g.jsx(V.IconButton,{"data-testid":"expand-collapse-btn","aria-label":gt?"collapse row":"expand row",size:"small",onClick:()=>X(Ie),children:gt?g.jsx(Lf,{"data-testid":"collapse-up"}):g.jsx(ib,{"data-testid":"expand-down"})})}}),a&&l&&ue.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,je)=>{const Ie=n(je);return g.jsx(V.Checkbox,{onChange:()=>{const gt=a.includes(Ie);l(gt?a.filter(lt=>lt!==Ie):[...a,Ie])},checked:a.includes(Ie)})}});const pe=m!==void 0,Z=me=>pe?b?b.includes(me):!0:!1,te=g.jsxs(V.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(Tne,{})," ",x]}),ce=g.jsxs(V.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(nM,{color:"error"})," ",S,k&&g.jsx(V.Button,{variant:"text",onClick:k,children:"Retry?"})]}),ne=()=>{if(S)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:ce})});if(o.length===0)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:te})})},re=()=>{if(S)return ce;if(o.length===0)return te},le=me=>{O&&K(me)},ge=me=>{const je=n(me);if((i||s)&&(i==null||i(je),s==null||s(me),le(je)),u&&$){const Ie=I===je?void 0:je;B(Ie),le(Ie)}},X=me=>{const je=I===me?void 0:me;B(je),le(je)},ee=me=>{if(!u)return;const je=I===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(V.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>X(n(me)),children:[je?g.jsx(Lf,{}):g.jsx(ib,{})," Show"," ",je?"Less":"More"]}),g.jsx(ZE,{colSpan:r.length,isExpanded:n(me)===I,obj:me,renderExpand:Ie=>u(Ie),asMobileCard:!0})]})},ie=R??_,we=me=>{const Ie=(O?W:P)===n(me)?ie:"inherit",gt=i||s||$;return{cursor:gt?"pointer":"default",backgroundColor:Ie,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...gt&&{"&:hover":{backgroundColor:Ie===ie?Uie(Ie,.1):ie}}}},Ce=me=>g.jsx(VD,{...z,children:me}),De=(me,je)=>{const Ie=me.find(lt=>lt.key==="MBv2_Checkbox_Column"),gt=ue.filter(lt=>lt.key!=="MBv2_Checkbox_Column");return g.jsxs(Ko,{alignItems:"flex-start",children:[Ie&&g.jsx(Ru,{children:Tl(Ie,je,fe)}),g.jsxs(Ru,{width:"100%",children:[g.jsx("table",{className:"MBv2_Table_Stack",children:g.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:gt.map(lt=>g.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[g.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${wn(lt)}`,style:{textWrap:"nowrap"},children:[lt.label??Fn(wn(lt)),Ce(lt.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${wn(lt)}`,style:{paddingLeft:"10px"},children:Tl(lt,je,fe)})]},`row-${n(je)}-${wn(lt)}`))})}),ee(je)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[pe&&g.jsxs(g.Fragment,{children:[g.jsxs(V.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[g.jsx(V.TextField,{select:!0,sx:{flexGrow:1},size:"small",value:f??"",label:"Sort By...",onChange:me=>U(me.target.value),fullWidth:!0,children:ue.map(me=>{if(Z(wn(me)))return g.jsx(V.MenuItem,{value:wn(me),children:me.label??Fn(wn(me))},`rowHeader-${wn(me)}`)})}),g.jsx(V.IconButton,{onClick:()=>{f&&U(f)},children:g.jsx(Dne,{className:`sort-icon-${p}`})})]}),g.jsx(V.Divider,{sx:{margin:"10px 0"}})]}),re()??o.map(me=>g.jsx(V.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...we(me)},onClick:()=>ge(me),"data-testid":`card-${n(me)}`,children:De(ue,me)},n(me)))]}),Re=()=>g.jsx(V.TableContainer,{component:V.Card,"data-testid":"mui-table",...e?{tableId:`table-${e}`}:{},className:y,style:F?{maxHeight:F,overflow:"auto"}:{},children:g.jsxs(V.Table,{stickyHeader:F!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:j?{"& .MuiTableCell-head":{...j}}:{},...L,children:[g.jsx(V.TableHead,{className:"MBv2_Table_Head",children:g.jsx(V.TableRow,{className:"MBv2_Table_Head_Row",children:ue.map((me,je)=>{const Ie=Z(wn(me));return g.jsx(V.TableCell,{width:Array.isArray(v)?v[je]:"auto",sx:me.tableCellSx??{},children:g.jsx(V.Box,{style:{display:"flex",alignItems:"center"},children:g.jsxs(V.Box,{sx:[Ie&&{"&:hover":{cursor:"pointer",backgroundColor:A.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Ie?()=>U(wn(me)):void 0,children:[g.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:me.label??Fn(wn(me))}),Ce(me.tooltip),Ie&&Y(wn(me))==="asc"&&g.jsx(Lf,{style:{marginLeft:"5px"}}),Ie&&Y(wn(me))==="desc"&&g.jsx(ib,{style:{marginLeft:"5px"}}),Ie&&Y(wn(me))!=="asc"&&Y(wn(me))!=="desc"&&g.jsx(Rne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${wn(me)}`)})})}),g.jsx(V.TableBody,{className:"MBv2_Table_Body",children:ne()??o.map(me=>g.jsxs(J.Fragment,{children:[g.jsx(V.TableRow,{"data-testid":`row-${n(me)}`,className:"MBv2_Table_Body_Row",onClick:()=>ge(me),sx:we(me),children:ue.map(je=>g.jsx(V.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${wn(je)}`,children:Tl(je,me,fe)},`row-${n(me)}-${wn(je)}`))}),u&&g.jsx(ZE,{colSpan:ue.length,isExpanded:n(me)===I,obj:me,renderExpand:je=>u(je),reRenderExpand:M})]},n(me)))})]})});return g.jsx(Ox,{isLoading:T,children:fe&&!C?Me():Re()})},aue=t=>{const{fixedLayout:e,checkedKeys:n,setCheckedKeys:r,renderExpand:o,columns:i,expandOnRowClick:s,onRowClick:a,onRowClickObj:l,selectedRowKey:u,highlightSelectedRow:f}=t,p="Table component:";Array.isArray(e)&&(!o&&e.length!==i.length&&console.warn(`${p} Length of "fixedLayout" is not equal to the length of "columns". Got=${e.length}. Expected=${i.length}`),o&&e.length!==i.length+1&&console.warn(`${p} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),s&&!o&&console.warn(`${p} renderExpand should be defined when expandOnRowClick is defined`),a&&l&&console.warn(`${p} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`),(n||r)&&o&&console.warn(`${p} checkedKeys/setCheckedKeys & renderExpand cannot both be defined`),n&&!r&&console.warn(`${p} if checkedKeys is defined, setCheckedKeys must also be defined`),!n&&r&&console.warn(`${p} if setCheckedKeys is defined, checkedKeys must also be defined`);const m=i.map(y=>wn(y)),b=m.filter((y,x)=>m.indexOf(y)!==x),v=[...new Set(b)];v.length>0&&console.warn(`${p} duplicate key/fieldName found in 'columns': ${v.join(", ")}. Make sure to define a unique 'key' if you have multiple column definitions with the same 'fieldName'.`),f&&u&&console.warn(`${p} must choose 'highlightSelectedRow' (uncontrolled) or 'selectedRowKey' (controlled)`)},wn=t=>t.key??t.fieldName,lue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Tl=(t,e,n=!1)=>{const r=lue(e,t.fieldName);return t.render?t.render(r,e,n):r},zD=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)},b=x=>{r(parseInt(x.target.value,10))},v=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return g.jsxs(V.Box,{children:[g.jsx(Mx,{sortOrder:p,sortField:f,...s}),!o&&!y&&g.jsx(V.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:b,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},QE=()=>({height:window.innerHeight,width:window.innerWidth}),HD=()=>{const[t,e]=J.useState(QE());return J.useEffect(()=>{const n=()=>{e(QE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Cr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=HD(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return g.jsx(V.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...pr({...t},a)})},cue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return g.jsx(V.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(V.Box,{component:V.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[g.jsxs(V.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),g.jsxs(V.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Cr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Cr,{size:"small",color:"error",startIcon:g.jsx(Zv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},uue=t=>{const{citation:e,anchorEl:n,onClose:r,open:o}=t;return g.jsx(V.Popper,{open:o,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(V.Box,{component:V.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[g.jsxs(V.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",g.jsx("br",{}),g.jsx("b",{children:e.url}),"?"]}),g.jsxs(V.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Cr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Cr,{size:"small",startIcon:g.jsx(ex,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})};function T0({canLaunchUrl:t,citation:e,asLink:n}){const r=J.useRef(null),[o,i]=J.useState(!1),s=()=>{i(!1)};return!t||e.fileName?null:g.jsxs(g.Fragment,{children:[n?g.jsx(V.Link,{ref:r,component:"button",sx:{cursor:"pointer"},type:"button",onClick:()=>i(!0),children:e.url}):g.jsx(V.Tooltip,{title:"Open URL",children:g.jsx(V.IconButton,{ref:r,color:"primary",onClick:()=>{i(!0)},"data-testid":`citation-table_launch-link-btn-${e.id}`,sx:{visibility:t!=null&&t(e)?"visible":"hidden"},children:g.jsx(ex,{})})}),g.jsx(uue,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function WD({onDownloadAttachment:t,citation:e}){if(!(!t||!e.fileName))return g.jsx(V.Tooltip,{title:"Download",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_download-btn-${e.id}`,children:g.jsx(wne,{})})})}function UD({onPreviewAttachment:t,citation:e}){if(!t||!e.fileName)return;const n=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],r=e.fileName.split(".").pop();if(!(!r||!n.includes(r)))return g.jsx(V.Tooltip,{title:"View File",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_view-file-btn-${e.id}`,children:g.jsx(ex,{})})})}const _x=(t,e=30)=>ka.truncate(t,{length:e,omission:"..."}),due=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:b,getCitationsPaginated:v,selectedIds:y,setSelectedIds:x,onError:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:R=!1,showCloseBtn:P=!1,canSearch:j=!1}=t,F=!!t.canCreate&&!R,M=!!a&&!!s&&!R,$=!!u&&!!l&&R&&k,z=!!f&&!R,{palette:L}=V.useTheme(),[A,_]=J.useState([]),[I,B]=J.useState(!1),[W,K]=J.useState(!0),[U,Y]=J.useState(null),[fe,ue]=J.useState(null),[pe,Z]=J.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:j?"":void 0}),te=()=>{B(!1),K(!0),v({pageNo:pe.pageNo,pageSize:pe.pageSize,search:pe.search},y).then(Re=>(_(Re.data),Z(me=>({...me,totalCount:Re.totalCount})),Re)).catch(Re=>{S(Re),B(!0),_([])}).finally(()=>K(!1))};J.useEffect(te,[pe.pageNo,pe.pageSize,e,pe.search]);const ce=()=>{ue(null),Y(null)},ne=g.jsx(Cr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(Kh,{}),children:"Add Citation"}),re=g.jsx(Cr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(TI,{}),children:"Add Attachment"}),le=Re=>{if(!(!M&&!$)){if(M)return g.jsx(V.Tooltip,{title:"Edit",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>Re.fileName?a(Re.id):s(Re.id),"data-testid":`citation-table_edit-btn-${Re.id}`,children:g.jsx(Sne,{})})});if($)return g.jsx(V.Tooltip,{title:"View",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>Re.fileName?u(Re.id):l(Re.id),"data-testid":`citation-table_view-btn-${Re.id}`,children:g.jsx(Ane,{})})})}},ge=Re=>{if(!(!z||R))return g.jsx(V.Tooltip,{title:"Delete",children:g.jsx(V.IconButton,{color:"error",onClick:me=>{ue(Re),Y(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Re.id}`,children:g.jsx(Zv,{})})})},X=Re=>g.jsx(T0,{citation:Re,canLaunchUrl:C}),ee=Re=>g.jsx(UD,{citation:Re,onPreviewAttachment:m}),ie=Re=>g.jsx(WD,{citation:Re,onDownloadAttachment:p}),we=$||M||z||C||m||p||O,Ce=[...qD(L,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!we,render:(Re,me)=>g.jsxs(V.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(me),ge(me),le(me),ee(me),X(me),ie(me)]})}],De=J.useCallback(Re=>{Z(me=>({...me,pageNo:0,search:Re}))},[]),Me=()=>j?g.jsx(OI,{onSearch:De}):null;return g.jsxs(Ru,{children:[g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(V.Typography,{variant:k?"h6":"h2",children:n}),!T&&F&&g.jsxs(V.Box,{display:"flex",flexDirection:"row",gap:1,children:[ne,re]}),P&&g.jsx(V.IconButton,{onClick:r,children:g.jsx(tm,{})})]}),Me(),g.jsx(zD,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:W,columns:Ce,data:A,paginationState:pe,onPageChange:Re=>Z(me=>({...me,pageNo:Re})),onRowsPerPageChange:Re=>Z(me=>({...me,pageSize:Re,pageNo:0})),errorTableMsg:I?"Failed to load citations.":void 0,retryCallback:te,setCheckedKeys:T?x:void 0,checkedKeys:T?y:void 0}),T&&g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:F&&g.jsxs(g.Fragment,{children:[ne,re]})}),!R&&g.jsxs(V.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[g.jsx(Cr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),g.jsxs(Cr,{variant:"contained",size:"small",onClick:()=>b(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),g.jsx(cue,{citation:fe,anchorEl:U,onDeleteCitation:f,onClose:ce})]})},eO=(t,e)=>{const n=t?_x(e):e,r=n==null?void 0:n.endsWith("...");return g.jsx("span",{style:{wordBreak:"break-all"},children:r?g.jsx(V.Tooltip,{title:e,children:g.jsx("span",{children:n})}):e})},qD=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(V.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(TI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):g.jsx(Kh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>eO(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>eO(e,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"details",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}];var hb,tO;function fue(){if(tO)return hb;tO=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);hb={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,j=C;R<P-1;){var F=k[R];if(F==="__proto__"||F==="constructor"||F==="prototype")return C;j=j[k[R++]]}j[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+(b(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,j;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),j=b(O),P=!j&&/^\d+$/.test(O),k.call(T,O,j,P,R,S))}function b(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function y(S){return o.test(S)}function x(S){return!b(S)&&(v(S)||y(S))}return hb}var ha=fue(),mb,nO;function pue(){if(nO)return mb;nO=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 mb={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(" ")},mb}var gb=pue(),Tf={exports:{}},rO;function hue(){if(rO)return Tf.exports;rO=1,Tf.exports=function(o){return t(e(o),o)},Tf.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(b){if(!p.has(b[0])||!p.has(b[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(b,v,y){if(y.has(b)){var x;try{x=", node was:"+JSON.stringify(b)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(b))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(b));if(!l[v]){l[v]=!0;var S=f.get(b)||new Set;if(S=Array.from(S),v=S.length){y.add(b);do{var k=S[--v];m(k,p.get(k),y)}while(v);y.delete(b)}a[--s]=b}}}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 Tf.exports}var mue=hue();const gue=Qn(mue),yue=Object.prototype.toString,bue=Error.prototype.toString,vue=RegExp.prototype.toString,xue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",wue=/^Symbol\((.*)\)(.*)$/;function Sue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function oO(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Sue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return xue.call(t).replace(wue,"Symbol($1)");const r=yue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+bue.call(t)+"]":r==="RegExp"?vue.call(t):null}function Ss(t,e){let n=oO(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=oO(this[r],e);return i!==null?i:o},2)}function KD(t){return t==null?[]:[].concat(t)}let YD,GD,JD,Cue=/\$\{\s*(\w+)\s*\}/g;YD=Symbol.toStringTag;class iO{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[YD]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],KD(e).forEach(i=>{if(fr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}GD=Symbol.hasInstance;JD=Symbol.toStringTag;class fr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Cue,(o,i)=>Ss(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 iO(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[JD]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,fr)}static[GD](e){return iO[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Fo={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 \`${Ss(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ss(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ss(n,!0)}\``+o}},xr={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"},Tue={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"},k0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},kue={isValue:"${path} field must be ${value}"},Yf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Eue={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"},Oue={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: \`${Ss(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: \`${Ss(n,!0)}\``}return fr.formatError(Fo.notType,t)}};Object.assign(Object.create(null),{mixed:Fo,string:xr,number:Tue,date:k0,object:Yf,array:Eue,boolean:kue,tuple:Oue});const Rx=t=>t&&t.__isYupSchema__;class ih{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 ih(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(!Rx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const kf={context:"$",value:"."};class Pa{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===kf.context,this.isValue=this.key[0]===kf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?kf.context:this.isValue?kf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ha.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Pa.prototype.__isYupRef=!0;const aa=t=>t==null;function sl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:b}=t;let{parent:v,context:y,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:y};function T($={}){const z=XD(Object.assign({value:n,originalValue:i,label:s.spec.label,path:$.path||r,spec:s.spec,disableStackTrace:$.disableStackTrace||S},p,$.params),k),L=new fr(fr.formatError($.message||m,z),n,z.path,$.type||u,z.disableStackTrace);return L.params=z,L}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve($){return ZD($,k)},options:o,originalValue:i,schema:s};const R=$=>{fr.isError($)?C($):$?l(null):C(T())},P=$=>{fr.isError($)?C($):a($)};if(b&&aa(n))return R(!0);let F;try{var M;if(F=f.call(O,n,O),typeof((M=F)==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(F).then(R,P)}}catch($){P($);return}R(F)}return e.OPTIONS=t,e}function XD(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=ZD(t[n],e);return t}function ZD(t,e){return Pa.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Mue(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 sh extends Set{describe(){const e=[];for(const n of this.values())e.push(Pa.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new sh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function gl(t,e=new Map){if(Rx(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=gl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,gl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(gl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=gl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function _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 Rue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:_ue(n)}))}function QD(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Rue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>QD(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 sh,this._blacklist=new sh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Fo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=gl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&aa(i))return i;let s=Ss(e),a=Ss(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`);Ut.customSchemes.push([t,e])}function Ace(){Ut.scanner=kce(Ut.customSchemes);for(let t=0;t<Ut.tokenQueue.length;t++)Ut.tokenQueue[t][1]({scanner:Ut.scanner});Ut.parser=Mce(Ut.scanner.tokens);for(let t=0;t<Ut.pluginQueue.length;t++)Ut.pluginQueue[t][1]({scanner:Ut.scanner,parser:Ut.parser});return Ut.initialized=!0,Ut}function kx(t){return Ut.initialized||Ace(),_ce(Ut.parser.start,t,PD(Ut.scanner.start,t))}kx.scan=PD;function jD(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 Tx(n),o=kx(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 Ex="[\0- -\u2029 ]",Pce=new RegExp(Ex),Nce=new RegExp(`${Ex}$`),jce=new RegExp(Ex,"g");function $ce(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Lce(t){return new on({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=c7(n.doc,[...e]);if(m7(a).forEach(({newRange:u})=>{const f=d7(r.doc,u,b=>b.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 b=r.doc.textBetween(u.from,u.to," "," ");if(!Nce.test(b))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const b=m.split(Pce).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],y=p.pos+m.lastIndexOf(v);if(!v)return!1;const x=kx(v).map(S=>S.toObject(t.defaultProtocol));if(!$ce(x))return!1;x.filter(S=>S.isLink).map(S=>({...S,from:y+S.start+1,to:y+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=>{av(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 Bce(t){return new on({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=sv(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 Fce(t){return new on({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=jD(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 Ks(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(jce,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Vce=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"){YE(t);return}YE(t.scheme,t.optionalSlashes)})},onDestroy(){Dce()},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)=>!!Ks(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=>!!Ks(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=>!!Ks(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Tt(this.options.HTMLAttributes,t),0]:["a",Tt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ks(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=>!!Ks(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[Ts({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=jD(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ks(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(Lce({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ks(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Bce({type:this.type})),this.options.linkOnPaste&&t.push(Fce({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function zce(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=J7(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,b=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 y=a.pos-v.length,x=Array.from(v.matchAll(b)).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=y+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 Hce=new On("suggestion");function Wce({pluginKey:t=Hce,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:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:y=zce}){let x;const S=b==null?void 0:b(),k=new on({key:t,view(){return{update:async(T,C)=>{var O,R,P,j,F,M,$;const z=(O=this.key)===null||O===void 0?void 0:O.getState(C),L=(R=this.key)===null||R===void 0?void 0:R.getState(T.state),A=z.active&&L.active&&z.range.from!==L.range.from,_=!z.active&&L.active,I=z.active&&!L.active,B=!_&&!I&&z.query!==L.query,W=_||A&&B,K=B||A,U=I||A&&B;if(!W&&!K&&!U)return;const Y=U&&!W?z:L,fe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:ue=>p({editor:e,range:Y.range,props:ue}),decorationNode:fe,clientRect:fe?()=>{var ue;const{decorationId:pe}=(ue=this.key)===null||ue===void 0?void 0:ue.getState(e.state),Z=T.dom.querySelector(`[data-decoration-id="${pe}"]`);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&&((j=S==null?void 0:S.onBeforeUpdate)===null||j===void 0||j.call(S,x)),(K||W)&&(x.items=await m({editor:e,query:Y.query})),U&&((F=S==null?void 0:S.onExit)===null||F===void 0||F.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),W&&(($=S==null?void 0:S.onStart)===null||$===void 0||$.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:j}=e.view,{selection:F}=T,{empty:M,from:$}=F,z={...C};if(z.composing=j,P&&(M||e.view.composing)){($<C.range.from||$>C.range.to)&&!j&&!C.composing&&(z.active=!1);const L=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:F.$from}),A=`id_${Math.floor(Math.random()*4294967295)}`;L&&v({editor:e,state:R,range:L.range,isActive:C.active})?(z.active=!0,z.decorationId=C.decorationId?C.decorationId:A,z.range=L.range,z.query=L.query,z.text=L.text):z.active=!1}else z.active=!1;return z.active||(z.decorationId=null,z.range={from:0,to:0},z.query=null,z.text=null),z}},props:{handleKeyDown(T,C){var O;const{active: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 j=!(P!=null&&P.length),F=[l];return j&&F.push(f),Xt.create(T.doc,[Zn.inline(O.from,O.to,{nodeName:a,class:F.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function Uce({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 $D(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>Uce({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function GE(t,e){const n=$D(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const qce=rn.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",Tt(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=GE(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Tt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=Tt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",Tt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:GE(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 Ri,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 $D(this).map(Wce)}}),LD=gn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new on({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&&Ph(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Zn.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)}}})]}}),Kce=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",Tt(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()}}}),Yce=rn.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",Tt(this.options.HTMLAttributes,t),0]}}),Gce=rn.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",Tt(this.options.HTMLAttributes,t),0]}}),Jce=rn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",Tt(this.options.HTMLAttributes,t),0]}}),Xce=/^\s*(\[([( |x])?\])\s$/,Zce=rn.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",Tt(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 b=n();if(typeof b!="number")return!1;const v=m.doc.nodeAt(b);return m.setNodeMarkup(b,void 0,{...v==null?void 0:v.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{o.setAttribute(f,p)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([f,p])=>{o.setAttribute(f,p)}),{dom:o,contentDOM:l,update:f=>f.type!==this.type?!1:(o.dataset.checked=f.attrs.checked,a.checked=f.attrs.checked,u(),!0)}}},addInputRules(){return[Al({find:Xce,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Qce=rn.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",Tt(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()}}}),eue=gn.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")}}}),BD=J.forwardRef((t,e)=>{const[n,r]=J.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return J.useEffect(()=>r(0),[t.items]),J.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?g.jsx(V.Paper,{elevation:5,children:g.jsx(V.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>g.jsx(V.ListItem,{disablePadding:!0,children:g.jsx(V.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});BD.displayName="SuggestionList";const JE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},tue={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 H2(BD,{props:n,editor:n.editor}),e=qu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??JE},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))??JE}})},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}}}},nue=Vce.extend({inclusive:!1}),rue=Kce.extend({excludes:"superscript"}),oue=pI.extend({excludes:"subscript"});function iue({placeholder:t}={}){return J.useMemo(()=>[Uee.configure({resizable:!0}),Jce,Gce,Yce,J_,Z_,Q_,rR,fR,pR,hR,rue,oue,gR,G_,Y_,X_,dR,Jv,mR,nue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),MQ,nR,EQ,eue.configure({types:["heading","paragraph","image"]}),hce,mce,gce,SZ,bR.configure({multicolor:!0}),uR,HQ,eR,Qce,Zce.configure({nested:!0}),qce.configure({suggestion:tue}),LD.configure({placeholder:t}),cR],[t])}function XE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const sue=t=>{const e=iue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(dI,{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]=Ht.useField({name:n}),{setValue:f}=u,{value:p}=a;J.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=J.useRef(null),b=J.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=>{t0({images:O,editor:T,position:k})});else{const O=i(S);t0({images:O,editor:T,position:k})}},[]),v=J.useCallback((S,k,T,C)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=XE(k.dataTransfer.files);if(O.length>0){const P=(R=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:R.pos;return b(O,P),k.preventDefault(),!0}return!1},[b]),y=J.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=XE(k.clipboardData.files);return C.length>0?(b(C),!0):!1},[b]),x=g.jsx(V.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(uI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(fce,{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:()=>g.jsxs(g.Fragment,{children:[g.jsx(fte,{}),g.jsx(Ete,{})]})})});return g.jsxs(V.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(V.Typography,{...o,children:r}),x]})},ZE=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=J.useState(!1),[u,f]=J.useState(void 0);J.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child > td":{borderBottom:"unset"}};return i?g.jsx(V.Collapse,{in:n,children:u}):g.jsx(V.TableRow,{sx:p,children:g.jsx(V.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:g.jsx(V.Collapse,{in:n,children:u})})})},Ox=({isLoading:t,children:e})=>{const[n,r]=J.useState(!1);return J.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]),g.jsxs(V.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,g.jsx(V.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:g.jsx(V.CircularProgress,{})})]})},Ko=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Ru=t=>{const{gap:e=1,...n}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function FD({icon:t,children:e,sx:n,...r}){return e?g.jsx(V.Tooltip,{title:e,children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:n??{ml:.5},...r})}):null}function VD(t){return g.jsx(FD,{icon:Cne,...t})}const Mx=t=>{const{id:e,getRowKey:n=me=>"id"in me&&(typeof me.id=="string"||typeof me.id=="number")&&me.id!=null?me.id:(console.warn(`Table: "id" not found or undefined in ${JSON.stringify(me)}. If provided, id must have a value and be type string or number. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),String(JSON.stringify(me))),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,checkedKeys:a,setCheckedKeys:l,renderExpand:u,sortField:f,sortOrder:p,onSortChange:m,allowSortCols:b,fixedLayout:v=!1,className:y,emptyTableMsg:x="No items to display",errorTableMsg:S,retryCallback:k,isLoading:T=!1,disableMobileCards:C=!1,highlightSelectedRow:O=!1,selectedRowColor:R,selectedRowKey:P,headerRowStyle:j={},stickyHeader:F,reRenderExpand:M=!1,expandOnRowClick:$=!1,tooltipProps:z={},...L}=t,{palette:A}=V.useTheme(),_=A.grey[A.mode=="dark"?600:50],[I,B]=J.useState(void 0),[W,K]=J.useState(typeof O=="string"||typeof O=="number"?O:void 0);aue(t);const U=me=>{me!==f?m&&m(me,"asc"):m&&m(f,p==="asc"?"desc":"asc")},Y=me=>f===me?p:null,fe=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),ue=r.filter(me=>!me.hideCol&&(!fe||!me.hideOnMobile));u&&!fe&&ue.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,je)=>{const Ie=n(je),gt=I===Ie;return g.jsx(V.IconButton,{"data-testid":"expand-collapse-btn","aria-label":gt?"collapse row":"expand row",size:"small",onClick:()=>X(Ie),children:gt?g.jsx(Lf,{"data-testid":"collapse-up"}):g.jsx(ib,{"data-testid":"expand-down"})})}}),a&&l&&ue.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,je)=>{const Ie=n(je);return g.jsx(V.Checkbox,{onChange:()=>{const gt=a.includes(Ie);l(gt?a.filter(lt=>lt!==Ie):[...a,Ie])},checked:a.includes(Ie)})}});const pe=m!==void 0,Z=me=>pe?b?b.includes(me):!0:!1,te=g.jsxs(V.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(Tne,{})," ",x]}),ce=g.jsxs(V.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(nM,{color:"error"})," ",S,k&&g.jsx(V.Button,{variant:"text",onClick:k,children:"Retry?"})]}),ne=()=>{if(S)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:ce})});if(o.length===0)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:te})})},re=()=>{if(S)return ce;if(o.length===0)return te},le=me=>{O&&K(me)},ge=me=>{const je=n(me);if((i||s)&&(i==null||i(je),s==null||s(me),le(je)),u&&$){const Ie=I===je?void 0:je;B(Ie),le(Ie)}},X=me=>{const je=I===me?void 0:me;B(je),le(je)},ee=me=>{if(!u)return;const je=I===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(V.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>X(n(me)),children:[je?g.jsx(Lf,{}):g.jsx(ib,{})," Show"," ",je?"Less":"More"]}),g.jsx(ZE,{colSpan:r.length,isExpanded:n(me)===I,obj:me,renderExpand:Ie=>u(Ie),asMobileCard:!0})]})},ie=R??_,we=me=>{const Ie=(O?W:P)===n(me)?ie:"inherit",gt=i||s||$;return{cursor:gt?"pointer":"default",backgroundColor:Ie,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...gt&&{"&:hover":{backgroundColor:Ie===ie?Uie(Ie,.1):ie}}}},Ce=me=>g.jsx(VD,{...z,children:me}),De=(me,je)=>{const Ie=me.find(lt=>lt.key==="MBv2_Checkbox_Column"),gt=ue.filter(lt=>lt.key!=="MBv2_Checkbox_Column");return g.jsxs(Ko,{alignItems:"flex-start",children:[Ie&&g.jsx(Ru,{children:Tl(Ie,je,fe)}),g.jsxs(Ru,{width:"100%",children:[g.jsx("table",{className:"MBv2_Table_Stack",children:g.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:gt.map(lt=>g.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[g.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${wn(lt)}`,style:{textWrap:"nowrap"},children:[lt.label??Fn(wn(lt)),Ce(lt.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${wn(lt)}`,style:{paddingLeft:"10px"},children:Tl(lt,je,fe)})]},`row-${n(je)}-${wn(lt)}`))})}),ee(je)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[pe&&g.jsxs(g.Fragment,{children:[g.jsxs(V.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[g.jsx(V.TextField,{select:!0,sx:{flexGrow:1},size:"small",value:f??"",label:"Sort By...",onChange:me=>U(me.target.value),fullWidth:!0,children:ue.map(me=>{if(Z(wn(me)))return g.jsx(V.MenuItem,{value:wn(me),children:me.label??Fn(wn(me))},`rowHeader-${wn(me)}`)})}),g.jsx(V.IconButton,{onClick:()=>{f&&U(f)},children:g.jsx(Dne,{className:`sort-icon-${p}`})})]}),g.jsx(V.Divider,{sx:{margin:"10px 0"}})]}),re()??o.map(me=>g.jsx(V.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...we(me)},onClick:()=>ge(me),"data-testid":`card-${n(me)}`,children:De(ue,me)},n(me)))]}),Re=()=>g.jsx(V.TableContainer,{component:V.Card,"data-testid":"mui-table",...e?{tableId:`table-${e}`}:{},className:y,style:F?{maxHeight:F,overflow:"auto"}:{},children:g.jsxs(V.Table,{stickyHeader:F!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:j?{"& .MuiTableCell-head":{...j}}:{},...L,children:[g.jsx(V.TableHead,{className:"MBv2_Table_Head",children:g.jsx(V.TableRow,{className:"MBv2_Table_Head_Row",children:ue.map((me,je)=>{const Ie=Z(wn(me));return g.jsx(V.TableCell,{width:Array.isArray(v)?v[je]:"auto",sx:me.tableCellSx??{},children:g.jsx(V.Box,{style:{display:"flex",alignItems:"center"},children:g.jsxs(V.Box,{sx:[Ie&&{"&:hover":{cursor:"pointer",backgroundColor:A.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Ie?()=>U(wn(me)):void 0,children:[g.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:me.label??Fn(wn(me))}),Ce(me.tooltip),Ie&&Y(wn(me))==="asc"&&g.jsx(Lf,{style:{marginLeft:"5px"}}),Ie&&Y(wn(me))==="desc"&&g.jsx(ib,{style:{marginLeft:"5px"}}),Ie&&Y(wn(me))!=="asc"&&Y(wn(me))!=="desc"&&g.jsx(Rne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${wn(me)}`)})})}),g.jsx(V.TableBody,{className:"MBv2_Table_Body",children:ne()??o.map(me=>g.jsxs(J.Fragment,{children:[g.jsx(V.TableRow,{"data-testid":`row-${n(me)}`,className:"MBv2_Table_Body_Row",onClick:()=>ge(me),sx:we(me),children:ue.map(je=>g.jsx(V.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${wn(je)}`,children:Tl(je,me,fe)},`row-${n(me)}-${wn(je)}`))}),u&&g.jsx(ZE,{colSpan:ue.length,isExpanded:n(me)===I,obj:me,renderExpand:je=>u(je),reRenderExpand:M})]},n(me)))})]})});return g.jsx(Ox,{isLoading:T,children:fe&&!C?Me():Re()})},aue=t=>{const{fixedLayout:e,checkedKeys:n,setCheckedKeys:r,renderExpand:o,columns:i,expandOnRowClick:s,onRowClick:a,onRowClickObj:l,selectedRowKey:u,highlightSelectedRow:f}=t,p="Table component:";Array.isArray(e)&&(!o&&e.length!==i.length&&console.warn(`${p} Length of "fixedLayout" is not equal to the length of "columns". Got=${e.length}. Expected=${i.length}`),o&&e.length!==i.length+1&&console.warn(`${p} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),s&&!o&&console.warn(`${p} renderExpand should be defined when expandOnRowClick is defined`),a&&l&&console.warn(`${p} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`),(n||r)&&o&&console.warn(`${p} checkedKeys/setCheckedKeys & renderExpand cannot both be defined`),n&&!r&&console.warn(`${p} if checkedKeys is defined, setCheckedKeys must also be defined`),!n&&r&&console.warn(`${p} if setCheckedKeys is defined, checkedKeys must also be defined`);const m=i.map(y=>wn(y)),b=m.filter((y,x)=>m.indexOf(y)!==x),v=[...new Set(b)];v.length>0&&console.warn(`${p} duplicate key/fieldName found in 'columns': ${v.join(", ")}. Make sure to define a unique 'key' if you have multiple column definitions with the same 'fieldName'.`),f&&u&&console.warn(`${p} must choose 'highlightSelectedRow' (uncontrolled) or 'selectedRowKey' (controlled)`)},wn=t=>t.key??t.fieldName,lue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Tl=(t,e,n=!1)=>{const r=lue(e,t.fieldName);return t.render?t.render(r,e,n):r},zD=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)},b=x=>{r(parseInt(x.target.value,10))},v=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return g.jsxs(V.Box,{children:[g.jsx(Mx,{sortOrder:p,sortField:f,...s}),!o&&!y&&g.jsx(V.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,S)=>m(S),onRowsPerPageChange:b,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},QE=()=>({height:window.innerHeight,width:window.innerWidth}),HD=()=>{const[t,e]=J.useState(QE());return J.useEffect(()=>{const n=()=>{e(QE())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Cr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=HD(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return g.jsx(V.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...pr({...t},a)})},cue=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return g.jsx(V.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(V.Box,{component:V.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[g.jsxs(V.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),g.jsxs(V.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Cr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Cr,{size:"small",color:"error",startIcon:g.jsx(Zv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},uue=t=>{const{citation:e,anchorEl:n,onClose:r,open:o}=t;return g.jsx(V.Popper,{open:o,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(V.Box,{component:V.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[g.jsxs(V.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",g.jsx("br",{}),g.jsx("b",{children:e.url}),"?"]}),g.jsxs(V.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Cr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Cr,{size:"small",startIcon:g.jsx(ex,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})};function T0({canLaunchUrl:t,citation:e,asLink:n}){const r=J.useRef(null),[o,i]=J.useState(!1),s=()=>{i(!1)};return!t||e.fileName?null:g.jsxs(g.Fragment,{children:[n?g.jsx(V.Link,{ref:r,component:"button",sx:{cursor:"pointer"},type:"button",onClick:()=>i(!0),children:e.url}):g.jsx(V.Tooltip,{title:"Open URL",children:g.jsx(V.IconButton,{ref:r,color:"primary",onClick:()=>{i(!0)},"data-testid":`citation-table_launch-link-btn-${e.id}`,sx:{visibility:t!=null&&t(e)?"visible":"hidden"},children:g.jsx(ex,{})})}),g.jsx(uue,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function WD({onDownloadAttachment:t,citation:e}){if(!(!t||!e.fileName))return g.jsx(V.Tooltip,{title:"Download",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_download-btn-${e.id}`,children:g.jsx(wne,{})})})}function UD({onPreviewAttachment:t,citation:e}){if(!t||!e.fileName)return;const n=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],r=e.fileName.split(".").pop();if(!(!r||!n.includes(r)))return g.jsx(V.Tooltip,{title:"View File",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_view-file-btn-${e.id}`,children:g.jsx(ex,{})})})}const _x=(t,e=30)=>ka.truncate(t,{length:e,omission:"..."}),due=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:b,getCitationsPaginated:v,selectedIds:y,setSelectedIds:x,onError:S=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:C,addlActions:O,readOnly:R=!1,showCloseBtn:P=!1,canSearch:j=!1}=t,F=!!t.canCreate&&!R,M=!!a&&!!s&&!R,$=!!u&&!!l&&R&&k,z=!!f&&!R,{palette:L}=V.useTheme(),[A,_]=J.useState([]),[I,B]=J.useState(!1),[W,K]=J.useState(!0),[U,Y]=J.useState(null),[fe,ue]=J.useState(null),[pe,Z]=J.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:j?"":void 0}),te=()=>{B(!1),K(!0),v({pageNo:pe.pageNo,pageSize:pe.pageSize,search:pe.search},y).then(Re=>(_(Re.data),Z(me=>({...me,totalCount:Re.totalCount})),Re)).catch(Re=>{S(Re),B(!0),_([])}).finally(()=>K(!1))};J.useEffect(te,[pe.pageNo,pe.pageSize,e,pe.search]);const ce=()=>{ue(null),Y(null)},ne=g.jsx(Cr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(Kh,{}),children:"Add Citation"}),re=g.jsx(Cr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(TI,{}),children:"Add Attachment"}),le=Re=>{if(!(!M&&!$)){if(M)return g.jsx(V.Tooltip,{title:"Edit",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>Re.fileName?a(Re.id):s(Re.id),"data-testid":`citation-table_edit-btn-${Re.id}`,children:g.jsx(Sne,{})})});if($)return g.jsx(V.Tooltip,{title:"View",children:g.jsx(V.IconButton,{color:"primary",onClick:()=>Re.fileName?u(Re.id):l(Re.id),"data-testid":`citation-table_view-btn-${Re.id}`,children:g.jsx(Ane,{})})})}},ge=Re=>{if(!(!z||R))return g.jsx(V.Tooltip,{title:"Delete",children:g.jsx(V.IconButton,{color:"error",onClick:me=>{ue(Re),Y(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Re.id}`,children:g.jsx(Zv,{})})})},X=Re=>g.jsx(T0,{citation:Re,canLaunchUrl:C}),ee=Re=>g.jsx(UD,{citation:Re,onPreviewAttachment:m}),ie=Re=>g.jsx(WD,{citation:Re,onDownloadAttachment:p}),we=$||M||z||C||m||p||O,Ce=[...qD(L,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!we,render:(Re,me)=>g.jsxs(V.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(me),ge(me),le(me),ee(me),X(me),ie(me)]})}],De=J.useCallback(Re=>{Z(me=>({...me,pageNo:0,search:Re}))},[]),Me=()=>j?g.jsx(OI,{onSearch:De}):null;return g.jsxs(Ru,{children:[g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(V.Typography,{variant:k?"h6":"h2",children:n}),!T&&F&&g.jsxs(V.Box,{display:"flex",flexDirection:"row",gap:1,children:[ne,re]}),P&&g.jsx(V.IconButton,{onClick:r,children:g.jsx(tm,{})})]}),Me(),g.jsx(zD,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:W,columns:Ce,data:A,paginationState:pe,onPageChange:Re=>Z(me=>({...me,pageNo:Re})),onRowsPerPageChange:Re=>Z(me=>({...me,pageSize:Re,pageNo:0})),errorTableMsg:I?"Failed to load citations.":void 0,retryCallback:te,setCheckedKeys:T?x:void 0,checkedKeys:T?y:void 0}),T&&g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:F&&g.jsxs(g.Fragment,{children:[ne,re]})}),!R&&g.jsxs(V.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[g.jsx(Cr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),g.jsxs(Cr,{variant:"contained",size:"small",onClick:()=>b(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),g.jsx(cue,{citation:fe,anchorEl:U,onDeleteCitation:f,onClose:ce})]})},eO=(t,e)=>{const n=t?_x(e):e,r=n==null?void 0:n.endsWith("...");return g.jsx("span",{style:{wordBreak:"break-all"},children:r?g.jsx(V.Tooltip,{title:e,children:g.jsx("span",{children:n})}):e})},qD=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(V.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(TI,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):g.jsx(Kh,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>eO(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>eO(!0,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"details",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}];var hb,tO;function fue(){if(tO)return hb;tO=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);hb={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,j=C;R<P-1;){var F=k[R];if(F==="__proto__"||F==="constructor"||F==="prototype")return C;j=j[k[R++]]}j[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+(b(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,j;for(R=0;R<C;R++)O=S[R],O&&(x(O)&&(O='"'+O+'"'),j=b(O),P=!j&&/^\d+$/.test(O),k.call(T,O,j,P,R,S))}function b(S){return typeof S=="string"&&S&&["'",'"'].indexOf(S.charAt(0))!==-1}function v(S){return S.match(r)&&!S.match(n)}function y(S){return o.test(S)}function x(S){return!b(S)&&(v(S)||y(S))}return hb}var ha=fue(),mb,nO;function pue(){if(nO)return mb;nO=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 mb={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(" ")},mb}var gb=pue(),Tf={exports:{}},rO;function hue(){if(rO)return Tf.exports;rO=1,Tf.exports=function(o){return t(e(o),o)},Tf.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(b){if(!p.has(b[0])||!p.has(b[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(b,v,y){if(y.has(b)){var x;try{x=", node was:"+JSON.stringify(b)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!p.has(b))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(b));if(!l[v]){l[v]=!0;var S=f.get(b)||new Set;if(S=Array.from(S),v=S.length){y.add(b);do{var k=S[--v];m(k,p.get(k),y)}while(v);y.delete(b)}a[--s]=b}}}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 Tf.exports}var mue=hue();const gue=Qn(mue),yue=Object.prototype.toString,bue=Error.prototype.toString,vue=RegExp.prototype.toString,xue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",wue=/^Symbol\((.*)\)(.*)$/;function Sue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function oO(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Sue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return xue.call(t).replace(wue,"Symbol($1)");const r=yue.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+bue.call(t)+"]":r==="RegExp"?vue.call(t):null}function Ss(t,e){let n=oO(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=oO(this[r],e);return i!==null?i:o},2)}function KD(t){return t==null?[]:[].concat(t)}let YD,GD,JD,Cue=/\$\{\s*(\w+)\s*\}/g;YD=Symbol.toStringTag;class iO{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[YD]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],KD(e).forEach(i=>{if(fr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}GD=Symbol.hasInstance;JD=Symbol.toStringTag;class fr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Cue,(o,i)=>Ss(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 iO(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[JD]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,fr)}static[GD](e){return iO[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Fo={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 \`${Ss(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ss(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ss(n,!0)}\``+o}},xr={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"},Tue={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"},k0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},kue={isValue:"${path} field must be ${value}"},Yf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Eue={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"},Oue={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: \`${Ss(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: \`${Ss(n,!0)}\``}return fr.formatError(Fo.notType,t)}};Object.assign(Object.create(null),{mixed:Fo,string:xr,number:Tue,date:k0,object:Yf,array:Eue,boolean:kue,tuple:Oue});const Rx=t=>t&&t.__isYupSchema__;class ih{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 ih(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(!Rx(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const kf={context:"$",value:"."};class Pa{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===kf.context,this.isValue=this.key[0]===kf.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?kf.context:this.isValue?kf.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ha.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Pa.prototype.__isYupRef=!0;const aa=t=>t==null;function sl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:b}=t;let{parent:v,context:y,abortEarly:x=s.spec.abortEarly,disableStackTrace:S=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:y};function T($={}){const z=XD(Object.assign({value:n,originalValue:i,label:s.spec.label,path:$.path||r,spec:s.spec,disableStackTrace:$.disableStackTrace||S},p,$.params),k),L=new fr(fr.formatError($.message||m,z),n,z.path,$.type||u,z.disableStackTrace);return L.params=z,L}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve($){return ZD($,k)},options:o,originalValue:i,schema:s};const R=$=>{fr.isError($)?C($):$?l(null):C(T())},P=$=>{fr.isError($)?C($):a($)};if(b&&aa(n))return R(!0);let F;try{var M;if(F=f.call(O,n,O),typeof((M=F)==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(F).then(R,P)}}catch($){P($);return}R(F)}return e.OPTIONS=t,e}function XD(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=ZD(t[n],e);return t}function ZD(t,e){return Pa.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Mue(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 sh extends Set{describe(){const e=[];for(const n of this.values())e.push(Pa.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new sh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function gl(t,e=new Map){if(Rx(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=gl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,gl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(gl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=gl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function _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 Rue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:_ue(n)}))}function QD(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Rue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>QD(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 sh,this._blacklist=new sh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Fo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=gl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&aa(i))return i;let s=Ss(e),a=Ss(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=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,b=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const x=i[y];x(v,f,function(k){k&&(Array.isArray(k)?b.push(...k):b.push(k)),--m<=0&&p(b)})}}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,b)=>this.resolve(f)._validate(u,f,m,b)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):gl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=sl({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=sl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Fo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Fo.notNull){return this.nullability(!1,e)}required(e=Fo.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=Fo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=sl(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=KD(e).map(i=>new Pa(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new ih(o,n):ih.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=sl({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Fo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=sl({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Fo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=sl({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?XD(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 fr)return{issues:QD(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}=Mue(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 Iue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Due(t){const e=E0(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 E0(t){var e,n;const r=Iue.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 Aue=/^[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])?)*$/,Pue=/^((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,Nue=/^(?:[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,jue="^\\d{4}-\\d{2}-\\d{2}",$ue="\\d{2}:\\d{2}:\\d{2}",Lue="(([+-]\\d{2}(:?\\d{2})?)|Z)",Bue=new RegExp(`${jue}T${$ue}(\\.\\d+)?${Lue}$`),Fue=t=>aa(t)||t===t.trim(),Vue={}.toString();function kl(){return new eA}class eA 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===Vue?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Fo.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=xr.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=xr.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=xr.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||xr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=xr.email){return this.matches(Aue,{name:"email",message:e,excludeEmptyString:!0})}url(e=xr.url){return this.matches(Pue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=xr.uuid){return this.matches(Nue,{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(Bue,{name:"datetime",message:n||xr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||xr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=E0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||xr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=E0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=xr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Fue})}lowercase(e=xr.lowercase){return this.transform(n=>aa(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>aa(n)||n===n.toLowerCase()})}uppercase(e=xr.uppercase){return this.transform(n=>aa(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>aa(n)||n===n.toUpperCase()})}}kl.prototype=eA.prototype;let tA=new Date(""),zue=t=>Object.prototype.toString.call(t)==="[object Date]";function Ix(){return new Zu}class Zu extends ti{constructor(){super({type:"date",check(e){return zue(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Due(e),isNaN(e)?Zu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Pa.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=k0.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=k0.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)}})}}Zu.INVALID_DATE=tA;Ix.prototype=Zu.prototype;Ix.INVALID_DATE=tA;function Hue(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=ha.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Pa.isRef(a)&&a.isSibling?i(a.path,s):Rx(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return gue.array(Array.from(r),n).reverse()}function sO(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 nA(t){return(e,n)=>sO(t,e)-sO(t,n)}const Wue=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function Gf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Gf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Gf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Gf)}):"optional"in t?t.optional():t}const Uue=(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 aO=t=>Object.prototype.toString.call(t)==="[object Object]";function lO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const que=nA([]);function Dx(t){return new rA(t)}class rA extends ti{constructor(e){super({type:"object",check(n){return aO(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],b=p in o,v=o[p];if(m){let y;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}y=!n.__validating||!S?m.cast(v,u):v,y!==void 0&&(l[p]=y)}else b&&!s&&(l[p]=v);(b!==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||!aO(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Pa.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=Hue(e,n),r._sortErrors=nA(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Gf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=ha.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Uue(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Wue)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Yf.exact,test(n){if(n==null)return!0;const r=lO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Yf.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=lO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Yf.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(gb.camelCase)}snakeCase(){return this.transformKeys(gb.snakeCase)}constantCase(){return this.transformKeys(e=>gb.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}}Dx.prototype=rA.prototype;const Kue=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return g.jsx(V.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:g.jsxs(Ru,{component:V.Paper,p:1,boxShadow:9,gap:.25,children:[g.jsx(V.Typography,{variant:"body1",children:"Paste in a preformatted citation"}),g.jsx(V.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),g.jsx(Ht.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(Jue(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>g.jsxs(Ko,{flexWrap:"wrap",justifyContent:"flex-end",children:[g.jsx(SI,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:g.jsx(V.Tooltip,{title:"Paste from Clipboard",children:g.jsx(V.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:g.jsx(xne,{})})})}),g.jsxs(Ko,{children:[g.jsx(Cr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),g.jsx(Cr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},Yue=["https://","http://","www."],Gue=new RegExp(Yue.join("|")),Jue=t=>{const e=t.replace(/\.\s*$/,"").split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.match(Gue)),r=e.findIndex(f=>f.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(f=>/\bSOURCE\b/.test(f.toUpperCase()));let s=[n,r,o].find(f=>f!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Ef(e,l),title:Ef(e,a),url:Ef(e,n),accessedAt:Xue(e,r),classification:Zue(e,o),details:Ef(e,o)}},Ef=(t,e)=>e<0||e>=t.length?"":t[e],Xue=(t,e)=>e<0||e>=t.length?"":lce(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),Zue=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",oA=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return g.jsx(Cr,{type:n,disabled:e,size:r,startIcon:e?g.jsx(V.CircularProgress,{size:s,color:"inherit"}):null,...o})},iA=t=>{const{onCancel:e,onViewCitationTable:n,readOnly:r=!1,showViewAllCitationsBtn:o=!1,isLoading:i,onSaveClicked:s}=t;return r&&!o?null:r?g.jsx(V.DialogActions,{sx:{px:0},children:g.jsx(V.Button,{onClick:n,size:"small",variant:"outlined",children:"Back To Table"})}):g.jsxs(V.DialogActions,{sx:{px:0,justifyContent:"space-between"},children:[g.jsx(V.Box,{children:o&&g.jsx(V.Button,{onClick:n,size:"small",variant:"outlined",children:"View All Citations"})}),g.jsxs(Ko,{children:[g.jsx(V.Button,{onClick:e,variant:"outlined",size:"small",children:"Cancel"}),g.jsx(oA,{size:"small",loading:i,type:"button",onClick:s,children:"Save"})]})]})},Que=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,canLaunchUrl:l}=t,u=J.useRef(null),[f,p]=J.useState(!1),[m,b]=J.useState(!1),v=J.useRef(null),[y,x]=J.useState(!1),[S,k]=J.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});J.useEffect(()=>{i&&k({...i,type:"Url"})},[]);const T={disabled:f,margin:"none",readOnly:s},C=!s;return g.jsxs(V.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(Ko,{justifyContent:"space-between",children:[g.jsxs(Ko,{gap:2,children:[g.jsxs(V.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Citation"]}),C&&g.jsx(V.Button,{variant:"outlined",size:"small",ref:v,onClick:()=>x(!0),children:"Paste & Prefill"})]}),g.jsx(V.IconButton,{onClick:o,children:g.jsx(tm,{})})]}),g.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:S,onSubmit:async O=>{p(!0),e(O).catch(R=>{throw p(!1),R}).finally(()=>p(!1))},validationSchema:Dx({title:kl().required("Title is required"),accessedAt:Ix().required("Accessed At is required"),url:kl().required("URL is required"),classification:kl().required("Classification is required")}),validateOnBlur:m,validateOnChange:m,children:({submitForm:O,setValues:R,values:P})=>g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsxs(V.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[g.jsx(_i,{...T,name:"title",required:!0}),g.jsx(_i,{...T,name:"source"}),g.jsx(_i,{...T,name:"details",label:"Details (e.g. Source Description)"}),g.jsx(Ip,{...T,name:"accessedAt",required:!0,isDatePicker:!0}),s&&(l!=null&&l(P))?g.jsx(g.Fragment,{children:g.jsx(Fi,{label:"URL / Other Identifier",readOnlyValue:g.jsx(T0,{citation:P,canLaunchUrl:l,asLink:!0}),value:P.url??""})}):g.jsx(_i,{...T,name:"url",label:"URL / Other Identifier",required:!0,endIcon:g.jsx(T0,{citation:P,canLaunchUrl:l})}),g.jsx(wI,{...T,name:"classification",row:!0,required:!0,radios:ede})]}),g.jsx(iA,{isLoading:f,onSaveClicked:()=>{b(!0),O()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n}),g.jsx(Kue,{open:y,onGenerateCitation:j=>{R(j,!0)},anchorEl:v.current,onClose:()=>x(!1)})]})})]})},ede=[{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."}],tde=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,onDownloadAttachment:l,onPreviewAttachment:u}=t,f=J.useRef(null),[p,m]=J.useState(!1),[b,v]=J.useState(!1),[y,x]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{i&&x({...i,type:"Attachment",file:void 0})},[]),g.jsxs(V.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(V.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[g.jsxs(V.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Attachment"]}),g.jsx(V.IconButton,{onClick:o,children:g.jsx(tm,{})})]}),g.jsx(Ht.Formik,{innerRef:f,enableReinitialize:!0,initialValues:y,validationSchema:Dx().shape({title:kl().required("Title is required"),fileName:kl().required("A file is required")}),validateOnBlur:b,validateOnChange:b,onSubmit:async S=>{m(!0),e(S).catch(k=>{throw m(!1),k}).finally(()=>m(!1))},children:({values:S,setFieldValue:k,handleSubmit:T})=>{var O;const C=!s&&!S.id;return J.useEffect(()=>{var R,P;(R=S.file)!=null&&R.name&&k("fileName",(P=S.file)==null?void 0:P.name)},[(O=S.file)==null?void 0:O.name]),g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsx(_i,{name:"title",disabled:p,required:!0,margin:"none",readOnly:s}),g.jsxs(V.Box,{marginTop:C?1:0,children:[g.jsxs(Ko,{alignItems:"flex-start",children:[C&&g.jsx(bI,{name:"file",errorMode:"hidden"}),g.jsxs(Ko,{alignItems:"flex-end",children:[g.jsx(_i,{readOnly:!0,name:"fileName",label:C?"":"File Name"}),!C&&g.jsxs(Ko,{children:[g.jsx(WD,{citation:S,onDownloadAttachment:l}),g.jsx(UD,{citation:S,onPreviewAttachment:u})]})]})]}),g.jsx(Mr,{name:"fileName"})]}),g.jsx(iA,{isLoading:p,onSaveClicked:()=>{v(!0),T()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n})]})}})]})},Qu=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",b=()=>{if(s&&p)return g.jsx(V.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return g.jsx(V.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[g.jsx(V.Box,{children:b()}),g.jsxs(V.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return g.jsx(V.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsx(V.Box,{children:b()})})};return g.jsxs(V.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?g.jsx(V.DialogTitle,{className:"MBv2_Modal_Title",children:g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&g.jsx(V.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:g.jsx(tm,{})})]})}):r,o&&(typeof o=="string"?g.jsx(V.DialogContent,{className:"MBv2_Modal_Content",children:g.jsx(V.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function nde(t){return qe("MuiAlert",t)}const cO=He("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),rde=Ne(g.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=Ne(g.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),ide=Ne(g.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=Ne(g.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=Ne(g.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${Pe(n||r)}`,`${e}${Pe(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ue(i,nde,o)},cde=oe(_s,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Pe(n.color||n.severity)}`]]}})(vt(({theme:t})=>{const e=t.palette.mode==="light"?ya:Ml,n=t.palette.mode==="light"?Ml:ya;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Ln(["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),[`& .${cO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["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}`,[`& .${cO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["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=oe("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),dde=oe("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),fde=oe("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),uO={success:g.jsx(rde,{fontSize:"inherit"}),warning:g.jsx(ode,{fontSize:"inherit"}),error:g.jsx(ide,{fontSize:"inherit"}),info:g.jsx(sde,{fontSize:"inherit"})},sA=D.forwardRef(function(e,n){const r=mt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=uO,onClose:b,role:v="alert",severity:y="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:y,variant:k,colorSeverity:l||y},O=lde(C),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[P,j]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:cde,externalForwardedProps:{...R,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[F,M]=Mt("icon",{className:O.icon,elementType:ude,externalForwardedProps:R,ownerState:C}),[$,z]=Mt("message",{className:O.message,elementType:dde,externalForwardedProps:R,ownerState:C}),[L,A]=Mt("action",{className:O.action,elementType:fde,externalForwardedProps:R,ownerState:C}),[_,I]=Mt("closeButton",{elementType:Zl,externalForwardedProps:R,ownerState:C}),[B,W]=Mt("closeIcon",{elementType:ade,externalForwardedProps:R,ownerState:C});return g.jsxs(P,{...j,children:[p!==!1?g.jsx(F,{...M,children:p||m[y]||uO[y]}):null,g.jsx($,{...z,children:i}),o!=null?g.jsx(L,{...A,children:o}):null,o==null&&b?g.jsx(L,{...A,children:g.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:b,...I,children:g.jsx(B,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(sA.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 ed=t=>{var b;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=V.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(b=l[r])==null?void 0:b.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return g.jsxs(sA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&g.jsx(V.Typography,{variant:"h3",children:s}),n]})},aA=t=>g.jsx(ed,{severity:"error",...t}),lA=t=>g.jsx(ed,{severity:"success",...t}),pde=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return g.jsxs(g.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&g.jsx(aA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&g.jsx(lA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function cA({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onClose:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:b=!1,tableTitle:v="Attachments & Citations",addlActions:y,canLaunchUrl:x,readOnly:S,canSearch:k=!1}){const[T,C]=J.useState("Insert Citation/Attachment(s)"),[O,R]=J.useState(u),[P,j]=J.useState(void 0),[F,M]=J.useState(void 0),[$,z]=J.useState(!1),[L,A]=J.useState(!1),_=ee=>{M(void 0),C(ee)},[I,B]=J.useState(0);J.useEffect(()=>{f==null||f()},[T,F,f]);const W=(ee=!1)=>{(!m||ee)&&B(ie=>ie+1)},K=(ee,ie)=>{var Me;const we=typeof((Me=ie.response)==null?void 0:Me.data)=="string"&&ie.response.data,Ce=typeof ie.message=="string"&&ie.message;M({type:"Error",title:ee,message:we??Ce}),p(ie)},U=ee=>M({type:"Success",title:"",message:ee}),Y=async ee=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");ee.id?await(n==null?void 0:n(ee).then(()=>{$?l():(_("Insert Citation/Attachment(s)"),W())}).catch(ie=>{K("Failed to update",ie)})):await(e==null?void 0:e(ee).then(ie=>{R([...O,ie.id]),_("Insert Citation/Attachment(s)"),W()}).catch(ie=>{K("Failed to create",ie)}))},fe=r&&(async ee=>r(ee).then(()=>{W(!0),R(O.filter(ie=>ie!==ee)),U("Successfully deleted")}).catch(ie=>K("Failed to delete",ie))),ue=o&&(ee=>{o(ee).then(ie=>{const we=!!ie.fileName;j(ie),_(we?"Attachment":"Citation")}).catch(ie=>{K("Failed to load",ie)}).finally(()=>A(!1))}),pe=n&&ue,Z=n&&ue,te=i&&(async ee=>i(ee).catch(ie=>{K(`Failed to download ${ee.fileName}`,ie)})),ce=s&&(async ee=>s(ee).catch(ie=>{K(`Failed to view ${ee.fileName}`,ie)})),ne=g.jsx(due,{refreshKey:I,getCitationsPaginated:(ee,ie)=>t(ee,ie).then(we=>(f==null||f(),we)),onCancel:l,onNewCitation:()=>{j(void 0),_("Citation")},onNewAttachment:()=>{j(void 0),_("Attachment")},onEditCitation:pe,onEditAttachment:Z,onViewCitation:ue,onViewAttachment:ue,onDeleteCitation:fe,onDownloadAttachment:te,onPreviewAttachment:ce,onSelect:a,setSelectedIds:R,selectedIds:O,onError:p,condenseTable:m,canSelect:b,title:v,addlActions:y,canCreate:!!e,canLaunchUrl:x,readOnly:S,showCloseBtn:m,canSearch:k}),re=g.jsx(Que,{modifyCitation:P,onSave:Y,onCancel:()=>$?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),z(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),readOnly:S,showViewAllCitationsBtn:S&&!$||!S&&$,canLaunchUrl:x}),le=g.jsx(tde,{onSave:Y,onCancel:()=>$?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),z(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),modifyCitation:P,readOnly:S,showViewAllCitationsBtn:S&&!$||!S&&$,onDownloadAttachment:te,onPreviewAttachment:ce}),ge=g.jsx(pde,{alert:F,setAlert:M});J.useEffect(()=>{m&&u.length===1&&ue&&(A(!0),z(!0),ue(u[0]))},[]);const X=()=>{switch(T){case"Insert Citation/Attachment(s)":return ne;case"Citation":return re;case"Attachment":return le}};return m?g.jsxs(V.Box,{children:[ge,g.jsx(V.Box,{paddingTop:"8px",children:g.jsx(Ox,{isLoading:L,children:X()})})]}):g.jsxs(V.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&ge,g.jsx(V.Box,{paddingTop:"8px",children:ne}),g.jsx(Qu,{open:T!=="Insert Citation/Attachment(s)",children:g.jsxs(V.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[ge,T==="Citation"?re:le]})})]})}function uA({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=(s,a)=>n?t(s,r):e(s,a);return g.jsx(cA,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const hde=V.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=kt();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 b=m==null?void 0:m.storage.citationBubbleMenuHandler,v=b.isOpen,y=b.selectedIds,x=b.selectedNodePos,S=O=>{m&&(O.length===0?m.commands.deleteCitation(x):y.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{S(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{S(y),m==null||m.commands.closeCitationBubbleMenu()},C=J.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?g.jsx(wv,{editor:m,open:v,...b.bubbleMenuOptions,...p,children:g.jsx(hde,{children:g.jsx(uA,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,y),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onClose:T,initialSelectedIds:y,onContentChange:C,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const gde=()=>gn.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=kt(),n=J.useRef(null);return g.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:g.jsxs(V.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[g.jsx(yne,{fontSize:"small"}),g.jsx(V.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const dA=J.createContext(void 0),fA=()=>{const t=J.useContext(dA);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}=fA(),[u,f]=J.useState(s?String(s):""),[p,m]=J.useState([]),b=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),y=v.map(S=>_x(S.title,b)).join(", ");f(y),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 g.jsx(Wv,{as:"span",...e,"data-testid":"citation-node-component","data-drag-handle":!0,onDragOver:v=>v.preventDefault(),onDrop:()=>{},children:g.jsx(V.Tooltip,{title:g.jsx(V.Box,{className:"citation-tooltip",children:p.map((v,y)=>{var k;const S=!!v.fileName?[v.title,v.fileName]:[v.title,v.source,v.details,(k=v.accessedAt)==null?void 0:k.slice(0,10),v.url,v.classification];return g.jsxs(V.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),y<p.length-1&&g.jsx(V.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:g.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},vde=rn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,draggable:!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",Tt(t)]},addNodeView(){return Uv(bde)},addProseMirrorPlugins(){return[new on({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1},appendTransaction(t,e,n){if(!t.some(i=>i.docChanged))return null;let r=n.tr,o=!1;return n.doc.descendants((i,s)=>{if(i.type.name!=="citation")return;const a=s+i.nodeSize,l=n.doc.nodeAt(a);if(l&&l.type===i.type){const u=[...new Set([...i.attrs.ids,...l.attrs.ids])],f=i.type.create({...i.attrs,ids:u});return r.replaceWith(s,a+l.nodeSize,f),o=!0,!1}}),o?r:null}})]},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}}}});function dO({editor:t,canComment:e=!0,onComment:n,commentCount:r,commentResolved:o,...i}){const s=J.useRef(null);if(!n)return null;const a=o?g.jsx(n2,{sx:{width:14,height:14},"data-testid":"resolved-checkmark"}):r,l=o?"success":"primary",u=o?{"& .MuiBadge-badge":{padding:0,height:16,minWidth:16}}:{"& .MuiBadge-badge":{fontSize:14,height:16,minWidth:16}};return e?g.jsx(wt,{buttonRef:s,tooltipLabel:"Comments",onClick:()=>{if(!t)return;const{from:f,to:p}=t.state.selection,m=t.state.doc.textBetween(f,p,`
|
package/dist/index.es.js
CHANGED
|
@@ -60346,7 +60346,7 @@ const ux = (t, e = 30) => Fa.truncate(t, { length: e, omission: "..." }), Mde =
|
|
|
60346
60346
|
fieldName: "fileName",
|
|
60347
60347
|
key: "URL/File Name",
|
|
60348
60348
|
label: "URL/Other Identifier/File Name",
|
|
60349
|
-
render: (n, r) => FO(
|
|
60349
|
+
render: (n, r) => FO(!0, n || r.url),
|
|
60350
60350
|
isEqual: (n, r) => n.fileName && r.fileName ? n.fileName === r.fileName : n.url === r.url
|
|
60351
60351
|
},
|
|
60352
60352
|
{
|
package/dist/index.umd.js
CHANGED
|
@@ -402,7 +402,7 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
402
402
|
`,B_="️",V_="",rv="";let xh=null,Sh=null;function R_(t=[]){const e={};wr.groups=e;const n=new wr;xh==null&&(xh=WA(I_)),Sh==null&&(Sh=WA(P_)),Fe(n,"'",lh),Fe(n,"{",Au),Fe(n,"}",Iu),Fe(n,"[",Gf),Fe(n,"]",Jf),Fe(n,"(",Zf),Fe(n,")",Xf),Fe(n,"<",Qf),Fe(n,">",_f),Fe(n,"(",$f),Fe(n,")",eh),Fe(n,"「",th),Fe(n,"」",nh),Fe(n,"『",rh),Fe(n,"』",oh),Fe(n,"<",ih),Fe(n,">",sh),Fe(n,"&",ah),Fe(n,"*",ch),Fe(n,"@",vs),Fe(n,"`",dh),Fe(n,"^",ph),Fe(n,":",xs),Fe(n,",",X0),Fe(n,"$",fh),Fe(n,".",Qo),Fe(n,"=",hh),Fe(n,"!",Q0),Fe(n,"-",ao),Fe(n,"%",Pu),Fe(n,"|",mh),Fe(n,"+",gh),Fe(n,"#",yh),Fe(n,"?",Du),Fe(n,'"',_0),Fe(n,"/",_o),Fe(n,";",$0),Fe(n,"~",Nu),Fe(n,"_",bh),Fe(n,"\\",uh),Fe(n,"・",FA);const r=mn(n,Pi,G0,{[z0]:!0});mn(r,Pi,r);const o=mn(r,Ii,NA,{[Ou]:!0}),i=mn(r,Lu,LA,{[Eu]:!0}),s=mn(n,Ii,Ai,{[W0]:!0});mn(s,Pi,o),mn(s,Ii,s),mn(o,Pi,o),mn(o,Ii,o);const a=mn(n,Lu,U0,{[q0]:!0});mn(a,Ii),mn(a,Pi,i),mn(a,Lu,a),mn(i,Pi,i),mn(i,Ii),mn(i,Lu,i);const l=Fe(n,nv,Z0,{[H0]:!0}),u=Fe(n,RA,J0,{[H0]:!0}),p=mn(n,tv,J0,{[H0]:!0});Fe(n,rv,p),Fe(u,nv,l),Fe(u,rv,p),mn(u,tv,p),Fe(p,RA),Fe(p,nv),mn(p,tv,p),Fe(p,rv,p);const f=mn(n,ev,BA,{[PA]:!0});Fe(f,"#"),mn(f,ev,f),Fe(f,B_,f);const m=Fe(f,V_);Fe(m,"#"),mn(m,ev,f);const b=[[Ii,s],[Pi,o]],v=[[Ii,null],[Lu,a],[Pi,i]];for(let y=0;y<xh.length;y++)Ss(n,xh[y],K0,Ai,b);for(let y=0;y<Sh.length;y++)Ss(n,Sh[y],Y0,U0,v);Sa(K0,{tld:!0,ascii:!0},e),Sa(Y0,{utld:!0,alpha:!0},e),Ss(n,"file",Yf,Ai,b),Ss(n,"mailto",Yf,Ai,b),Ss(n,"http",Fl,Ai,b),Ss(n,"https",Fl,Ai,b),Ss(n,"ftp",Fl,Ai,b),Ss(n,"ftps",Fl,Ai,b),Sa(Yf,{scheme:!0,ascii:!0},e),Sa(Fl,{slashscheme:!0,ascii:!0},e),t=t.sort((y,x)=>y[0]>x[0]?1:-1);for(let y=0;y<t.length;y++){const x=t[y][0],k=t[y][1]?{[D_]:!0}:{[N_]:!0};x.indexOf("-")>=0?k[j0]=!0:Ii.test(x)?Pi.test(x)?k[Ou]=!0:k[W0]=!0:k[z0]=!0,DA(n,x,x,k)}return DA(n,"localhost",Mu,{ascii:!0}),n.jd=new wr(vh),{start:n,tokens:Object.assign({groups:e},VA)}}function zA(t,e){const n=z_(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,p=null,f=-1,m=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(f=0,m=0,p=a):f>=0&&(f+=n[s].length,m++),u+=n[s].length,i+=n[s].length,s++;i-=f,s-=m,u-=f,o.push({t:p.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function z_(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 Ss(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 wr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new wr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function WA(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 Fu={defaultProtocol:"http",events:null,format:qA,formatHref:qA,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ov(t,e=null){let n=Object.assign({},Fu);t&&(n=Object.assign(n,t instanceof ov?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}ov.prototype={o:Fu,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]:Fu[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 qA(t){return t}function jA(t,e){this.t="token",this.v=t,this.tk=e}jA.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=Fu.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),p=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),p&&Object.assign(s,p),{tagName:o,attributes:s,content:i,eventListeners:f}}};function Ch(t,e){class n extends jA{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 HA=Ch("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),UA=Ch("text"),W_=Ch("nl"),wh=Ch("url",{isLink:!0,toHref(t=Fu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Mu&&t[1].t===xs}}),lo=t=>new wr(t);function q_({groups:t}){const e=t.domain.concat([ah,ch,vs,uh,dh,ph,fh,hh,ao,G0,Pu,mh,gh,yh,_o,vh,Nu,bh]),n=[lh,xs,X0,Qo,Q0,Pu,Du,_0,$0,Qf,_f,Au,Iu,Jf,Gf,Zf,Xf,$f,eh,th,nh,rh,oh,ih,sh],r=[ah,lh,ch,uh,dh,ph,fh,hh,ao,Au,Iu,Pu,mh,gh,yh,Du,_o,vh,Nu,bh],o=lo(),i=Fe(o,Nu);ft(i,r,i),ft(i,t.domain,i);const s=lo(),a=lo(),l=lo();ft(o,t.domain,s),ft(o,t.scheme,a),ft(o,t.slashscheme,l),ft(s,r,i),ft(s,t.domain,s);const u=Fe(s,vs);Fe(i,vs,u),Fe(a,vs,u),Fe(l,vs,u);const p=Fe(i,Qo);ft(p,r,i),ft(p,t.domain,i);const f=lo();ft(u,t.domain,f),ft(f,t.domain,f);const m=Fe(f,Qo);ft(m,t.domain,f);const b=lo(HA);ft(m,t.tld,b),ft(m,t.utld,b),Fe(u,Mu,b);const v=Fe(f,ao);Fe(v,ao,v),ft(v,t.domain,f),ft(b,t.domain,f),Fe(b,Qo,m),Fe(b,ao,v);const y=Fe(b,xs);ft(y,t.numeric,HA);const x=Fe(s,ao),C=Fe(s,Qo);Fe(x,ao,x),ft(x,t.domain,s),ft(C,r,i),ft(C,t.domain,s);const k=lo(wh);ft(C,t.tld,k),ft(C,t.utld,k),ft(k,t.domain,s),ft(k,r,i),Fe(k,Qo,C),Fe(k,ao,x),Fe(k,vs,u);const T=Fe(k,xs),w=lo(wh);ft(T,t.numeric,w);const E=lo(wh),I=lo();ft(E,e,E),ft(E,n,I),ft(I,e,E),ft(I,n,I),Fe(k,_o,E),Fe(w,_o,E);const L=Fe(a,xs),B=Fe(l,xs),q=Fe(B,_o),M=Fe(q,_o);ft(a,t.domain,s),Fe(a,Qo,C),Fe(a,ao,x),ft(l,t.domain,s),Fe(l,Qo,C),Fe(l,ao,x),ft(L,t.domain,E),Fe(L,_o,E),Fe(L,Du,E),ft(M,t.domain,E),ft(M,e,E),Fe(M,_o,E);const V=[[Au,Iu],[Gf,Jf],[Zf,Xf],[Qf,_f],[$f,eh],[th,nh],[rh,oh],[ih,sh]];for(let j=0;j<V.length;j++){const[R,N]=V[j],A=Fe(E,R);Fe(I,R,A),Fe(A,N,E);const P=lo(wh);ft(A,e,P);const z=lo();ft(A,n),ft(P,e,P),ft(P,n,z),ft(z,e,P),ft(z,n,z),Fe(P,N,E),Fe(z,N,E)}return Fe(o,Mu,k),Fe(o,Z0,W_),{start:o,tokens:VA}}function j_(t,e,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=t,l=null,u=null,p=0,f=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,f=a):m>=0&&m++,o++,p++;if(m<0)o-=p,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(iv(UA,e,s)),s=[]),o-=m,p-=m;const b=f.t,v=n.slice(o-p,o);i.push(iv(b,e,v))}}return s.length>0&&i.push(iv(UA,e,s)),i}function iv(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 H_=typeof console<"u"&&console&&console.warn||(()=>{}),U_="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Gt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function K_(){return wr.groups={},Gt.scanner=null,Gt.parser=null,Gt.tokenQueue=[],Gt.pluginQueue=[],Gt.customSchemes=[],Gt.initialized=!1,Gt}function KA(t,e=!1){if(Gt.initialized&&H_(`linkifyjs: already initialized - will not register custom scheme "${t}" ${U_}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
403
403
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
404
404
|
2. Cannot start or end with "-"
|
|
405
|
-
3. "-" cannot repeat`);Gt.customSchemes.push([t,e])}function Y_(){Gt.scanner=R_(Gt.customSchemes);for(let t=0;t<Gt.tokenQueue.length;t++)Gt.tokenQueue[t][1]({scanner:Gt.scanner});Gt.parser=q_(Gt.scanner.tokens);for(let t=0;t<Gt.pluginQueue.length;t++)Gt.pluginQueue[t][1]({scanner:Gt.scanner,parser:Gt.parser});return Gt.initialized=!0,Gt}function sv(t){return Gt.initialized||Y_(),j_(Gt.parser.start,t,zA(Gt.scanner.start,t))}sv.scan=zA;function YA(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 ov(n),o=sv(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 av="[\0- -\u2029 ]",G_=new RegExp(av),J_=new RegExp(`${av}$`),Z_=new RegExp(av,"g");function X_(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Q_(t){return new en({key:new En("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=LR(n.doc,[...e]);if(WR(a).forEach(({newRange:u})=>{const p=BR(r.doc,u,b=>b.isTextblock);let f,m;if(p.length>1)f=p[0],m=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(u.from,u.to," "," ");if(!J_.test(b))return;f=p[0],m=r.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&m){const b=m.split(G_).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],y=f.pos+m.lastIndexOf(v);if(!v)return!1;const x=sv(v).map(C=>C.toObject(t.defaultProtocol));if(!X_(x))return!1;x.filter(C=>C.isLink).map(C=>({...C,from:y+C.start+1,to:y+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{Zg(C.from,C.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function __(t){return new en({key:new En("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=Jg(e.state,t.type.name),u=r.target,p=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,f=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&p?(window.open(p,f),!0):!1}}})}function $_(t){return new en({key:new En("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=YA(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 Ca(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(Z_,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const e$=vr.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"){KA(t);return}KA(t.scheme,t.optionalSlashes)})},onDestroy(){K_()},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)=>!!Ca(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=>!!Ca(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=>!!Ca(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",wt(this.options.HTMLAttributes,t),0]:["a",wt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ca(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=>!!Ca(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=YA(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ca(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(Q_({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ca(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(__({type:this.type})),this.options.linkOnPaste&&t.push($_({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function t$(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=dz(n),p=new RegExp(`\\s${u}$`),f=s?"^":"",m=o?"":u,b=l?new RegExp(`${f}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const y=a.pos-v.length,x=Array.from(v.matchAll(b)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const C=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!k)return null;const T=y+x.index;let w=T+x[0].length;return l&&p.test(v.slice(w-1,w+1))&&(x[0]+=" ",w+=1),T<a.pos&&w>=a.pos?{range:{from:T,to:w},query:x[0].slice(n.length),text:x[0]}:null}const n$=new En("suggestion");function r$({pluginKey:t=n$,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:p="is-empty",command:f=()=>null,items:m=()=>[],render:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:y=t$}){let x;const C=b==null?void 0:b(),k=new en({key:t,view(){return{update:async(T,w)=>{var E,I,L,B,q,M,V;const j=(E=this.key)===null||E===void 0?void 0:E.getState(w),R=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),N=j.active&&R.active&&j.range.from!==R.range.from,A=!j.active&&R.active,P=j.active&&!R.active,z=!A&&!P&&j.query!==R.query,U=A||N&&z,G=z||N,K=P||N&&z;if(!U&&!G&&!K)return;const J=K&&!U?j:R,pe=T.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);x={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:ue=>f({editor:e,range:J.range,props:ue}),decorationNode:pe,clientRect:pe?()=>{var ue;const{decorationId:fe}=(ue=this.key)===null||ue===void 0?void 0:ue.getState(e.state),_=T.dom.querySelector(`[data-decoration-id="${fe}"]`);return(_==null?void 0:_.getBoundingClientRect())||null}:null},U&&((L=C==null?void 0:C.onBeforeStart)===null||L===void 0||L.call(C,x)),G&&((B=C==null?void 0:C.onBeforeUpdate)===null||B===void 0||B.call(C,x)),(G||U)&&(x.items=await m({editor:e,query:J.query})),K&&((q=C==null?void 0:C.onExit)===null||q===void 0||q.call(C,x)),G&&((M=C==null?void 0:C.onUpdate)===null||M===void 0||M.call(C,x)),U&&((V=C==null?void 0:C.onStart)===null||V===void 0||V.call(C,x))},destroy:()=>{var T;x&&((T=C==null?void 0:C.onExit)===null||T===void 0||T.call(C,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,w,E,I){const{isEditable:L}=e,{composing:B}=e.view,{selection:q}=T,{empty:M,from:V}=q,j={...w};if(j.composing=B,L&&(M||e.view.composing)){(V<w.range.from||V>w.range.to)&&!B&&!w.composing&&(j.active=!1);const R=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:q.$from}),N=`id_${Math.floor(Math.random()*4294967295)}`;R&&v({editor:e,state:I,range:R.range,isActive:w.active})?(j.active=!0,j.decorationId=w.decorationId?w.decorationId:N,j.range=R.range,j.query=R.query,j.text=R.text):j.active=!1}else j.active=!1;return j.active||(j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null),j}},props:{handleKeyDown(T,w){var E;const{active:I,range:L}=k.getState(T.state);return I&&((E=C==null?void 0:C.onKeyDown)===null||E===void 0?void 0:E.call(C,{view:T,event:w,range:L}))||!1},decorations(T){const{active:w,range:E,decorationId:I,query:L}=k.getState(T);if(!w)return null;const B=!(L!=null&&L.length),q=[l];return B&&q.push(p),Xt.create(T.doc,[Jn.inline(E.from,E.to,{nodeName:a,class:q.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function o$({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new En;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,p;const f=i.view.state.selection.$to.nodeAfter;((l=f==null?void 0:f.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(),(p=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||p===void 0||p.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 GA(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>o$({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function JA(t,e){const n=GA(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const i$=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",wt(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=JA(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",wt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=wt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",wt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:JA(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 pi,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 GA(this).map(r$)}}),ZA=cn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new En("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&ap(s);if((l||!this.options.showOnlyCurrent)&&u){const p=[this.options.emptyNodeClass];i&&p.push(this.options.emptyEditorClass);const f=Jn.node(a,a+s.nodeSize,{class:p.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(f)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),s$=vr.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",wt(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()}}}),a$=tn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",wt(this.options.HTMLAttributes,t),0]}}),l$=tn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",wt(this.options.HTMLAttributes,t),0]}}),c$=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",wt(this.options.HTMLAttributes,t),0]}}),u$=/^\s*(\[([( |x])?\])\s$/,d$=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",wt(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 p,f;a.ariaLabel=((f=(p=this.options.a11y)===null||p===void 0?void 0:p.checkboxLabel)===null||f===void 0?void 0:f.call(p,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",p=>p.preventDefault()),a.addEventListener("change",p=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=p.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const b=n();if(typeof b!="number")return!1;const v=m.doc.nodeAt(b);return m.setNodeMarkup(b,void 0,{...v==null?void 0:v.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([p,f])=>{o.setAttribute(p,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([p,f])=>{o.setAttribute(p,f)}),{dom:o,contentDOM:l,update:p=>p.type!==this.type?!1:(o.dataset.checked=p.attrs.checked,a.checked=p.attrs.checked,u(),!0)}}},addInputRules(){return[al({find:u$,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),p$=tn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",wt(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()}}}),f$=cn.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")}}}),XA=X.forwardRef((t,e)=>{const[n,r]=X.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],p={id:u.id,label:u.mentionLabel};t.command(p)},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?g.jsx(W.Paper,{elevation:5,children:g.jsx(W.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>g.jsx(W.ListItem,{disablePadding:!0,children:g.jsx(W.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});XA.displayName="SuggestionList";const QA={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},h$={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 EE(XA,{props:n,editor:n.editor}),e=au("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??QA},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))??QA}})},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}}}},m$=e$.extend({inclusive:!1}),g$=s$.extend({excludes:"superscript"}),y$=yM.extend({excludes:"subscript"});function b$({placeholder:t}={}){return X.useMemo(()=>[o9.configure({resizable:!0}),c$,l$,a$,hT,gT,yT,ST,DT,FT,BT,g$,y$,RT,dT,uT,mT,PT,Qb,VT,m$.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),jU,xT,WU,f$.configure({types:["heading","paragraph","image"]}),E_,M_,A_,V6,KT.configure({multicolor:!0}),IT,r8,bT,p$,d$.configure({nested:!0}),i$.configure({suggestion:h$}),ZA.configure({placeholder:t}),AT],[t])}function _A(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const v$=t=>{const e=b$({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(mM,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=jt.useField({name:n}),{setValue:p}=u,{value:f}=a;X.useEffect(()=>{var C,k,T;(T=(k=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:k.commands)==null||T.setContent(f)},[f]);const m=X.useRef(null),b=X.useCallback((C,k)=>{var w;const T=(w=m.current)==null?void 0:w.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(E=>{ib({images:E,editor:T,position:k})});else{const E=i(C);ib({images:E,editor:T,position:k})}},[]),v=X.useCallback((C,k,T,w)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const E=_A(k.dataTransfer.files);if(E.length>0){const L=(I=C.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return b(E,L),k.preventDefault(),!0}return!1},[b]),y=X.useCallback((C,k,T)=>{if(!k.clipboardData)return!1;const w=_A(k.clipboardData.files);return w.length>0?(b(w),!0):!1},[b]),x=g.jsx(W.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(hM,{ref:m,extensions:e,content:f,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(k_,{onUploadFiles:i}),onBlur:()=>{var C,k;return p(((k=(C=m.current)==null?void 0:C.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>g.jsxs(g.Fragment,{children:[g.jsx(k9,{}),g.jsx(z9,{})]})})});return g.jsxs(W.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(W.Typography,{...o,children:r}),x]})},$A=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=X.useState(!1),[u,p]=X.useState(void 0);X.useEffect(()=>{n&&(!a||s)&&(l(!0),p(r(o)))},[n,o]);const f={"&:last-child > td":{borderBottom:"unset"}};return i?g.jsx(W.Collapse,{in:n,children:u}):g.jsx(W.TableRow,{sx:f,children:g.jsx(W.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:g.jsx(W.Collapse,{in:n,children:u})})})},lv=({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]),g.jsxs(W.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,g.jsx(W.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:g.jsx(W.CircularProgress,{})})]})},$o=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(W.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Bu=t=>{const{gap:e=1,...n}=t;return g.jsx(W.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function eI({icon:t,children:e,sx:n,...r}){return e?g.jsx(W.Tooltip,{title:e,children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:n??{ml:.5},...r})}):null}function tI(t){return g.jsx(eI,{icon:BK,...t})}const cv=t=>{const{id:e,getRowKey:n=me=>"id"in me&&(typeof me.id=="string"||typeof me.id=="number")&&me.id!=null?me.id:(console.warn(`Table: "id" not found or undefined in ${JSON.stringify(me)}. If provided, id must have a value and be type string or number. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),String(JSON.stringify(me))),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,checkedKeys:a,setCheckedKeys:l,renderExpand:u,sortField:p,sortOrder:f,onSortChange:m,allowSortCols:b,fixedLayout:v=!1,className:y,emptyTableMsg:x="No items to display",errorTableMsg:C,retryCallback:k,isLoading:T=!1,disableMobileCards:w=!1,highlightSelectedRow:E=!1,selectedRowColor:I,selectedRowKey:L,headerRowStyle:B={},stickyHeader:q,reRenderExpand:M=!1,expandOnRowClick:V=!1,tooltipProps:j={},...R}=t,{palette:N}=W.useTheme(),A=N.grey[N.mode=="dark"?600:50],[P,z]=X.useState(void 0),[U,G]=X.useState(typeof E=="string"||typeof E=="number"?E:void 0);x$(t);const K=me=>{me!==p?m&&m(me,"asc"):m&&m(p,f==="asc"?"desc":"asc")},J=me=>p===me?f:null,pe=W.useMediaQuery(W.useTheme().breakpoints.down("sm")),ue=r.filter(me=>!me.hideCol&&(!pe||!me.hideOnMobile));u&&!pe&&ue.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,Ve)=>{const Pe=n(Ve),yt=P===Pe;return g.jsx(W.IconButton,{"data-testid":"expand-collapse-btn","aria-label":yt?"collapse row":"expand row",size:"small",onClick:()=>Q(Pe),children:yt?g.jsx(ff,{"data-testid":"collapse-up"}):g.jsx(y0,{"data-testid":"expand-down"})})}}),a&&l&&ue.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,Ve)=>{const Pe=n(Ve);return g.jsx(W.Checkbox,{onChange:()=>{const yt=a.includes(Pe);l(yt?a.filter(ct=>ct!==Pe):[...a,Pe])},checked:a.includes(Pe)})}});const fe=m!==void 0,_=me=>fe?b?b.includes(me):!0:!1,te=g.jsxs(W.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(VK,{})," ",x]}),ce=g.jsxs(W.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(pS,{color:"error"})," ",C,k&&g.jsx(W.Button,{variant:"text",onClick:k,children:"Retry?"})]}),ne=()=>{if(C)return g.jsx(W.TableRow,{children:g.jsx(W.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:ce})});if(o.length===0)return g.jsx(W.TableRow,{children:g.jsx(W.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:te})})},re=()=>{if(C)return ce;if(o.length===0)return te},le=me=>{E&&G(me)},ye=me=>{const Ve=n(me);if((i||s)&&(i==null||i(Ve),s==null||s(me),le(Ve)),u&&V){const Pe=P===Ve?void 0:Ve;z(Pe),le(Pe)}},Q=me=>{const Ve=P===me?void 0:me;z(Ve),le(Ve)},ee=me=>{if(!u)return;const Ve=P===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(W.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>Q(n(me)),children:[Ve?g.jsx(ff,{}):g.jsx(y0,{})," Show"," ",Ve?"Less":"More"]}),g.jsx($A,{colSpan:r.length,isExpanded:n(me)===P,obj:me,renderExpand:Pe=>u(Pe),asMobileCard:!0})]})},ie=I??A,Se=me=>{const Pe=(E?U:L)===n(me)?ie:"inherit",yt=i||s||V;return{cursor:yt?"pointer":"default",backgroundColor:Pe,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...yt&&{"&:hover":{backgroundColor:Pe===ie?oZ(Pe,.1):ie}}}},we=me=>g.jsx(tI,{...j,children:me}),Ne=(me,Ve)=>{const Pe=me.find(ct=>ct.key==="MBv2_Checkbox_Column"),yt=ue.filter(ct=>ct.key!=="MBv2_Checkbox_Column");return g.jsxs($o,{alignItems:"flex-start",children:[Pe&&g.jsx(Bu,{children:Bl(Pe,Ve,pe)}),g.jsxs(Bu,{width:"100%",children:[g.jsx("table",{className:"MBv2_Table_Stack",children:g.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:yt.map(ct=>g.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[g.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${xn(ct)}`,style:{textWrap:"nowrap"},children:[ct.label??Bn(xn(ct)),we(ct.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(ct)}`,style:{paddingLeft:"10px"},children:Bl(ct,Ve,pe)})]},`row-${n(Ve)}-${xn(ct)}`))})}),ee(Ve)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[fe&&g.jsxs(g.Fragment,{children:[g.jsxs(W.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[g.jsx(W.TextField,{select:!0,sx:{flexGrow:1},size:"small",value:p??"",label:"Sort By...",onChange:me=>K(me.target.value),fullWidth:!0,children:ue.map(me=>{if(_(xn(me)))return g.jsx(W.MenuItem,{value:xn(me),children:me.label??Bn(xn(me))},`rowHeader-${xn(me)}`)})}),g.jsx(W.IconButton,{onClick:()=>{p&&K(p)},children:g.jsx(KK,{className:`sort-icon-${f}`})})]}),g.jsx(W.Divider,{sx:{margin:"10px 0"}})]}),re()??o.map(me=>g.jsx(W.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...Se(me)},onClick:()=>ye(me),"data-testid":`card-${n(me)}`,children:Ne(ue,me)},n(me)))]}),Ie=()=>g.jsx(W.TableContainer,{component:W.Card,"data-testid":"mui-table",...e?{tableId:`table-${e}`}:{},className:y,style:q?{maxHeight:q,overflow:"auto"}:{},children:g.jsxs(W.Table,{stickyHeader:q!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:B?{"& .MuiTableCell-head":{...B}}:{},...R,children:[g.jsx(W.TableHead,{className:"MBv2_Table_Head",children:g.jsx(W.TableRow,{className:"MBv2_Table_Head_Row",children:ue.map((me,Ve)=>{const Pe=_(xn(me));return g.jsx(W.TableCell,{width:Array.isArray(v)?v[Ve]:"auto",sx:me.tableCellSx??{},children:g.jsx(W.Box,{style:{display:"flex",alignItems:"center"},children:g.jsxs(W.Box,{sx:[Pe&&{"&:hover":{cursor:"pointer",backgroundColor:N.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Pe?()=>K(xn(me)):void 0,children:[g.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:me.label??Bn(xn(me))}),we(me.tooltip),Pe&&J(xn(me))==="asc"&&g.jsx(ff,{style:{marginLeft:"5px"}}),Pe&&J(xn(me))==="desc"&&g.jsx(y0,{style:{marginLeft:"5px"}}),Pe&&J(xn(me))!=="asc"&&J(xn(me))!=="desc"&&g.jsx(HK,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(me)}`)})})}),g.jsx(W.TableBody,{className:"MBv2_Table_Body",children:ne()??o.map(me=>g.jsxs(X.Fragment,{children:[g.jsx(W.TableRow,{"data-testid":`row-${n(me)}`,className:"MBv2_Table_Body_Row",onClick:()=>ye(me),sx:Se(me),children:ue.map(Ve=>g.jsx(W.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(Ve)}`,children:Bl(Ve,me,pe)},`row-${n(me)}-${xn(Ve)}`))}),u&&g.jsx($A,{colSpan:ue.length,isExpanded:n(me)===P,obj:me,renderExpand:Ve=>u(Ve),reRenderExpand:M})]},n(me)))})]})});return g.jsx(lv,{isLoading:T,children:pe&&!w?Me():Ie()})},x$=t=>{const{fixedLayout:e,checkedKeys:n,setCheckedKeys:r,renderExpand:o,columns:i,expandOnRowClick:s,onRowClick:a,onRowClickObj:l,selectedRowKey:u,highlightSelectedRow:p}=t,f="Table component:";Array.isArray(e)&&(!o&&e.length!==i.length&&console.warn(`${f} Length of "fixedLayout" is not equal to the length of "columns". Got=${e.length}. Expected=${i.length}`),o&&e.length!==i.length+1&&console.warn(`${f} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),s&&!o&&console.warn(`${f} renderExpand should be defined when expandOnRowClick is defined`),a&&l&&console.warn(`${f} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`),(n||r)&&o&&console.warn(`${f} checkedKeys/setCheckedKeys & renderExpand cannot both be defined`),n&&!r&&console.warn(`${f} if checkedKeys is defined, setCheckedKeys must also be defined`),!n&&r&&console.warn(`${f} if setCheckedKeys is defined, checkedKeys must also be defined`);const m=i.map(y=>xn(y)),b=m.filter((y,x)=>m.indexOf(y)!==x),v=[...new Set(b)];v.length>0&&console.warn(`${f} duplicate key/fieldName found in 'columns': ${v.join(", ")}. Make sure to define a unique 'key' if you have multiple column definitions with the same 'fieldName'.`),p&&u&&console.warn(`${f} must choose 'highlightSelectedRow' (uncontrolled) or 'selectedRowKey' (controlled)`)},xn=t=>t.key??t.fieldName,S$=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Bl=(t,e,n=!1)=>{const r=S$(e,t.fieldName);return t.render?t.render(r,e,n):r},nI=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:p,sortOrder:f}=e,m=x=>{n(x)},b=x=>{r(parseInt(x.target.value,10))},v=W.useMediaQuery(W.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return g.jsxs(W.Box,{children:[g.jsx(cv,{sortOrder:f,sortField:p,...s}),!o&&!y&&g.jsx(W.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,C)=>m(C),onRowsPerPageChange:b,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},rI=()=>({height:window.innerHeight,width:window.innerWidth}),oI=()=>{const[t,e]=X.useState(rI());return X.useEffect(()=>{const n=()=>{e(rI())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Tr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=oI(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return g.jsx(W.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...lr({...t},a)})},C$=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return g.jsx(W.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(W.Box,{component:W.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[g.jsxs(W.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),g.jsxs(W.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Tr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Tr,{size:"small",color:"error",startIcon:g.jsx(e0,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},w$=t=>{const{citation:e,anchorEl:n,onClose:r,open:o}=t;return g.jsx(W.Popper,{open:o,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(W.Box,{component:W.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[g.jsxs(W.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",g.jsx("br",{}),g.jsx("b",{children:e.url}),"?"]}),g.jsxs(W.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Tr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Tr,{size:"small",startIcon:g.jsx(b0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})};function uv({canLaunchUrl:t,citation:e,asLink:n}){const r=X.useRef(null),[o,i]=X.useState(!1),s=()=>{i(!1)};return!t||e.fileName?null:g.jsxs(g.Fragment,{children:[n?g.jsx(W.Link,{ref:r,component:"button",sx:{cursor:"pointer"},type:"button",onClick:()=>i(!0),children:e.url}):g.jsx(W.Tooltip,{title:"Open URL",children:g.jsx(W.IconButton,{ref:r,color:"primary",onClick:()=>{i(!0)},"data-testid":`citation-table_launch-link-btn-${e.id}`,sx:{visibility:t!=null&&t(e)?"visible":"hidden"},children:g.jsx(b0,{})})}),g.jsx(w$,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function iI({onDownloadAttachment:t,citation:e}){if(!(!t||!e.fileName))return g.jsx(W.Tooltip,{title:"Download",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_download-btn-${e.id}`,children:g.jsx(LK,{})})})}function sI({onPreviewAttachment:t,citation:e}){if(!t||!e.fileName)return;const n=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],r=e.fileName.split(".").pop();if(!(!r||!n.includes(r)))return g.jsx(W.Tooltip,{title:"View File",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_view-file-btn-${e.id}`,children:g.jsx(b0,{})})})}const dv=(t,e=30)=>ma.truncate(t,{length:e,omission:"..."}),T$=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onViewCitation:l,onViewAttachment:u,onDeleteCitation:p,onDownloadAttachment:f,onPreviewAttachment:m,onSelect:b,getCitationsPaginated:v,selectedIds:y,setSelectedIds:x,onError:C=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:w,addlActions:E,readOnly:I=!1,showCloseBtn:L=!1,canSearch:B=!1}=t,q=!!t.canCreate&&!I,M=!!a&&!!s&&!I,V=!!u&&!!l&&I&&k,j=!!p&&!I,{palette:R}=W.useTheme(),[N,A]=X.useState([]),[P,z]=X.useState(!1),[U,G]=X.useState(!0),[K,J]=X.useState(null),[pe,ue]=X.useState(null),[fe,_]=X.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:B?"":void 0}),te=()=>{z(!1),G(!0),v({pageNo:fe.pageNo,pageSize:fe.pageSize,search:fe.search},y).then(Ie=>(A(Ie.data),_(me=>({...me,totalCount:Ie.totalCount})),Ie)).catch(Ie=>{C(Ie),z(!0),A([])}).finally(()=>G(!1))};X.useEffect(te,[fe.pageNo,fe.pageSize,e,fe.search]);const ce=()=>{ue(null),J(null)},ne=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(qp,{}),children:"Add Citation"}),re=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(JM,{}),children:"Add Attachment"}),le=Ie=>{if(!(!M&&!V)){if(M)return g.jsx(W.Tooltip,{title:"Edit",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>Ie.fileName?a(Ie.id):s(Ie.id),"data-testid":`citation-table_edit-btn-${Ie.id}`,children:g.jsx(FK,{})})});if(V)return g.jsx(W.Tooltip,{title:"View",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>Ie.fileName?u(Ie.id):l(Ie.id),"data-testid":`citation-table_view-btn-${Ie.id}`,children:g.jsx(YK,{})})})}},ye=Ie=>{if(!(!j||I))return g.jsx(W.Tooltip,{title:"Delete",children:g.jsx(W.IconButton,{color:"error",onClick:me=>{ue(Ie),J(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Ie.id}`,children:g.jsx(e0,{})})})},Q=Ie=>g.jsx(uv,{citation:Ie,canLaunchUrl:w}),ee=Ie=>g.jsx(sI,{citation:Ie,onPreviewAttachment:m}),ie=Ie=>g.jsx(iI,{citation:Ie,onDownloadAttachment:f}),Se=V||M||j||w||m||f||E,we=[...lI(R,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Se,render:(Ie,me)=>g.jsxs(W.Box,{display:"flex",flexDirection:"row-reverse",children:[E==null?void 0:E(me),ye(me),le(me),ee(me),Q(me),ie(me)]})}],Ne=X.useCallback(Ie=>{_(me=>({...me,pageNo:0,search:Ie}))},[]),Me=()=>B?g.jsx(QM,{onSearch:Ne}):null;return g.jsxs(Bu,{children:[g.jsxs(W.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(W.Typography,{variant:k?"h6":"h2",children:n}),!T&&q&&g.jsxs(W.Box,{display:"flex",flexDirection:"row",gap:1,children:[ne,re]}),L&&g.jsx(W.IconButton,{onClick:r,children:g.jsx(pf,{})})]}),Me(),g.jsx(nI,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:U,columns:we,data:N,paginationState:fe,onPageChange:Ie=>_(me=>({...me,pageNo:Ie})),onRowsPerPageChange:Ie=>_(me=>({...me,pageSize:Ie,pageNo:0})),errorTableMsg:P?"Failed to load citations.":void 0,retryCallback:te,setCheckedKeys:T?x:void 0,checkedKeys:T?y:void 0}),T&&g.jsxs(W.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[g.jsx(W.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:q&&g.jsxs(g.Fragment,{children:[ne,re]})}),!I&&g.jsxs(W.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[g.jsx(Tr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),g.jsxs(Tr,{variant:"contained",size:"small",onClick:()=>b(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),g.jsx(C$,{citation:pe,anchorEl:K,onDeleteCitation:p,onClose:ce})]})},aI=(t,e)=>{const n=t?dv(e):e,r=n==null?void 0:n.endsWith("...");return g.jsx("span",{style:{wordBreak:"break-all"},children:r?g.jsx(W.Tooltip,{title:e,children:g.jsx("span",{children:n})}):e})},lI=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(W.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(JM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):g.jsx(qp,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>aI(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>aI(e,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"details",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}];var pv,cI;function k$(){if(cI)return pv;cI=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,k){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=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);pv={Cache:t,split:f,normalizePath:p,setter:function(C){var k=p(C);return l.get(C)||l.set(C,function(w,E){for(var I=0,L=k.length,B=w;I<L-1;){var q=k[I];if(q==="__proto__"||q==="constructor"||q==="prototype")return w;B=B[k[I++]]}B[k[I]]=E})},getter:function(C,k){var T=p(C);return u.get(C)||u.set(C,function(E){for(var I=0,L=T.length;I<L;)if(E!=null||!k)E=E[T[I++]];else return;return E})},join:function(C){return C.reduce(function(k,T){return k+(b(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(C,k,T){m(Array.isArray(C)?C:f(C),k,T)}};function p(C){return a.get(C)||a.set(C,f(C).map(function(k){return k.replace(i,"$2")}))}function f(C){return C.match(e)||[""]}function m(C,k,T){var w=C.length,E,I,L,B;for(I=0;I<w;I++)E=C[I],E&&(x(E)&&(E='"'+E+'"'),B=b(E),L=!B&&/^\d+$/.test(E),k.call(T,E,B,L,I,C))}function b(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function v(C){return C.match(r)&&!C.match(n)}function y(C){return o.test(C)}function x(C){return!b(C)&&(v(C)||y(C))}return pv}var wa=k$(),fv,uI;function O$(){if(uI)return fv;uI=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=p=>p.match(t)||[],n=p=>p[0].toUpperCase()+p.slice(1),r=(p,f)=>e(p).join(f).toLowerCase(),o=p=>e(p).reduce((f,m)=>`${f}${f?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return fv={words:e,upperFirst:n,camelCase:o,pascalCase:p=>n(o(p)),snakeCase:p=>r(p,"_"),kebabCase:p=>r(p,"-"),sentenceCase:p=>n(r(p," ")),titleCase:p=>e(p).map(n).join(" ")},fv}var hv=O$(),Th={exports:{}},dI;function E$(){if(dI)return Th.exports;dI=1,Th.exports=function(o){return t(e(o),o)},Th.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,p=n(i),f=r(o);for(i.forEach(function(b){if(!f.has(b[0])||!f.has(b[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(b,v,y){if(y.has(b)){var x;try{x=", node was:"+JSON.stringify(b)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!f.has(b))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(b));if(!l[v]){l[v]=!0;var C=p.get(b)||new Set;if(C=Array.from(C),v=C.length){y.add(b);do{var k=C[--v];m(k,f.get(k),y)}while(v);y.delete(b)}a[--s]=b}}}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 Th.exports}var M$=E$();const A$=Kn(M$),I$=Object.prototype.toString,P$=Error.prototype.toString,D$=RegExp.prototype.toString,N$=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",L$=/^Symbol\((.*)\)(.*)$/;function F$(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function pI(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return F$(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return N$.call(t).replace(L$,"Symbol($1)");const r=I$.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+P$.call(t)+"]":r==="RegExp"?D$.call(t):null}function Cs(t,e){let n=pI(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=pI(this[r],e);return i!==null?i:o},2)}function fI(t){return t==null?[]:[].concat(t)}let hI,mI,gI,B$=/\$\{\s*(\w+)\s*\}/g;hI=Symbol.toStringTag;class yI{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[hI]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],fI(e).forEach(i=>{if(fr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}mI=Symbol.hasInstance,gI=Symbol.toStringTag;class fr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(B$,(o,i)=>Cs(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 yI(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[gI]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,fr)}static[mI](e){return yI[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ei={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${Cs(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Cs(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Cs(n,!0)}\``+o}},kr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},V$={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"},mv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},R$={isValue:"${path} field must be ${value}"},kh={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:V$,date:mv,object:kh,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:R$,tuple:{notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${Cs(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: \`${Cs(n,!0)}\``}return fr.formatError(ei.notType,t)}}});const gv=t=>t&&t.__isYupSchema__;class Oh{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 Oh(e,(a,l)=>{var u;let p=s(...a)?o:i;return(u=p==null?void 0:p(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(!gv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Eh={context:"$",value:"."};class Ta{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Eh.context,this.isValue=this.key[0]===Eh.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Eh.context:this.isValue?Eh.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&wa.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Ta.prototype.__isYupRef=!0;const ka=t=>t==null;function Vl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:p,params:f,message:m,skipAbsent:b}=t;let{parent:v,context:y,abortEarly:x=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:y};function T(V={}){const j=bI(Object.assign({value:n,originalValue:i,label:s.spec.label,path:V.path||r,spec:s.spec,disableStackTrace:V.disableStackTrace||C},f,V.params),k),R=new fr(fr.formatError(V.message||m,j),n,j.path,V.type||u,j.disableStackTrace);return R.params=j,R}const w=x?a:l;let E={path:r,parent:v,type:u,from:o.from,createError:T,resolve(V){return vI(V,k)},options:o,originalValue:i,schema:s};const I=V=>{fr.isError(V)?w(V):V?l(null):w(T())},L=V=>{fr.isError(V)?w(V):a(V)};if(b&&ka(n))return I(!0);let q;try{var M;if(q=p.call(E,n,E),typeof((M=q)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(q).then(I,L)}}catch(V){L(V);return}I(q)}return e.OPTIONS=t,e}function bI(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=vI(t[n],e);return t}function vI(t,e){return Ta.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function z$(t,e,n,r=n){let o,i,s;return e?(wa.forEach(e,(a,l,u)=>{let p=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let f=t.type==="tuple",m=u?parseInt(p,10):0;if(t.innerType||f){if(f&&!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=f?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[p])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[p],t=t.fields[p]}i=p,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class Mh extends Set{describe(){const e=[];for(const n of this.values())e.push(Ta.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new Mh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Rl(t,e=new Map){if(gv(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=Rl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,Rl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Rl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Rl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function W$(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 q$(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:W$(n)}))}function xI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return q$(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>xI(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 Mh,this._blacklist=new Mh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ei.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Rl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&ka(i))return i;let s=Cs(e),a=Cs(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
405
|
+
3. "-" cannot repeat`);Gt.customSchemes.push([t,e])}function Y_(){Gt.scanner=R_(Gt.customSchemes);for(let t=0;t<Gt.tokenQueue.length;t++)Gt.tokenQueue[t][1]({scanner:Gt.scanner});Gt.parser=q_(Gt.scanner.tokens);for(let t=0;t<Gt.pluginQueue.length;t++)Gt.pluginQueue[t][1]({scanner:Gt.scanner,parser:Gt.parser});return Gt.initialized=!0,Gt}function sv(t){return Gt.initialized||Y_(),j_(Gt.parser.start,t,zA(Gt.scanner.start,t))}sv.scan=zA;function YA(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 ov(n),o=sv(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 av="[\0- -\u2029 ]",G_=new RegExp(av),J_=new RegExp(`${av}$`),Z_=new RegExp(av,"g");function X_(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Q_(t){return new en({key:new En("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=LR(n.doc,[...e]);if(WR(a).forEach(({newRange:u})=>{const p=BR(r.doc,u,b=>b.isTextblock);let f,m;if(p.length>1)f=p[0],m=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(u.from,u.to," "," ");if(!J_.test(b))return;f=p[0],m=r.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&m){const b=m.split(G_).filter(Boolean);if(b.length<=0)return!1;const v=b[b.length-1],y=f.pos+m.lastIndexOf(v);if(!v)return!1;const x=sv(v).map(C=>C.toObject(t.defaultProtocol));if(!X_(x))return!1;x.filter(C=>C.isLink).map(C=>({...C,from:y+C.start+1,to:y+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{Zg(C.from,C.to,r.doc).some(k=>k.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function __(t){return new en({key:new En("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=Jg(e.state,t.type.name),u=r.target,p=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,f=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&p?(window.open(p,f),!0):!1}}})}function $_(t){return new en({key:new En("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=YA(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 Ca(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(Z_,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const e$=vr.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"){KA(t);return}KA(t.scheme,t.optionalSlashes)})},onDestroy(){K_()},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)=>!!Ca(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=>!!Ca(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=>!!Ca(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",wt(this.options.HTMLAttributes,t),0]:["a",wt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ca(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=>!!Ca(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=YA(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ca(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(Q_({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ca(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(__({type:this.type})),this.options.linkOnPaste&&t.push($_({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function t$(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=dz(n),p=new RegExp(`\\s${u}$`),f=s?"^":"",m=o?"":u,b=l?new RegExp(`${f}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${m}]*`,"gm"),v=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!v)return null;const y=a.pos-v.length,x=Array.from(v.matchAll(b)).pop();if(!x||x.input===void 0||x.index===void 0)return null;const C=x.input.slice(Math.max(0,x.index-1),x.index),k=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!k)return null;const T=y+x.index;let w=T+x[0].length;return l&&p.test(v.slice(w-1,w+1))&&(x[0]+=" ",w+=1),T<a.pos&&w>=a.pos?{range:{from:T,to:w},query:x[0].slice(n.length),text:x[0]}:null}const n$=new En("suggestion");function r$({pluginKey:t=n$,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:p="is-empty",command:f=()=>null,items:m=()=>[],render:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:y=t$}){let x;const C=b==null?void 0:b(),k=new en({key:t,view(){return{update:async(T,w)=>{var E,I,L,B,q,M,V;const j=(E=this.key)===null||E===void 0?void 0:E.getState(w),R=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),N=j.active&&R.active&&j.range.from!==R.range.from,A=!j.active&&R.active,P=j.active&&!R.active,z=!A&&!P&&j.query!==R.query,U=A||N&&z,G=z||N,K=P||N&&z;if(!U&&!G&&!K)return;const J=K&&!U?j:R,pe=T.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);x={editor:e,range:J.range,query:J.query,text:J.text,items:[],command:ue=>f({editor:e,range:J.range,props:ue}),decorationNode:pe,clientRect:pe?()=>{var ue;const{decorationId:fe}=(ue=this.key)===null||ue===void 0?void 0:ue.getState(e.state),_=T.dom.querySelector(`[data-decoration-id="${fe}"]`);return(_==null?void 0:_.getBoundingClientRect())||null}:null},U&&((L=C==null?void 0:C.onBeforeStart)===null||L===void 0||L.call(C,x)),G&&((B=C==null?void 0:C.onBeforeUpdate)===null||B===void 0||B.call(C,x)),(G||U)&&(x.items=await m({editor:e,query:J.query})),K&&((q=C==null?void 0:C.onExit)===null||q===void 0||q.call(C,x)),G&&((M=C==null?void 0:C.onUpdate)===null||M===void 0||M.call(C,x)),U&&((V=C==null?void 0:C.onStart)===null||V===void 0||V.call(C,x))},destroy:()=>{var T;x&&((T=C==null?void 0:C.onExit)===null||T===void 0||T.call(C,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,w,E,I){const{isEditable:L}=e,{composing:B}=e.view,{selection:q}=T,{empty:M,from:V}=q,j={...w};if(j.composing=B,L&&(M||e.view.composing)){(V<w.range.from||V>w.range.to)&&!B&&!w.composing&&(j.active=!1);const R=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:q.$from}),N=`id_${Math.floor(Math.random()*4294967295)}`;R&&v({editor:e,state:I,range:R.range,isActive:w.active})?(j.active=!0,j.decorationId=w.decorationId?w.decorationId:N,j.range=R.range,j.query=R.query,j.text=R.text):j.active=!1}else j.active=!1;return j.active||(j.decorationId=null,j.range={from:0,to:0},j.query=null,j.text=null),j}},props:{handleKeyDown(T,w){var E;const{active:I,range:L}=k.getState(T.state);return I&&((E=C==null?void 0:C.onKeyDown)===null||E===void 0?void 0:E.call(C,{view:T,event:w,range:L}))||!1},decorations(T){const{active:w,range:E,decorationId:I,query:L}=k.getState(T);if(!w)return null;const B=!(L!=null&&L.length),q=[l];return B&&q.push(p),Xt.create(T.doc,[Jn.inline(E.from,E.to,{nodeName:a,class:q.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function o$({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const o=new En;return{editor:t,char:r,pluginKey:o,command:({editor:i,range:s,props:a})=>{var l,u,p;const f=i.view.state.selection.$to.nodeAfter;((l=f==null?void 0:f.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(),(p=(u=i.view.dom.ownerDocument.defaultView)===null||u===void 0?void 0:u.getSelection())===null||p===void 0||p.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 GA(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>o$({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function JA(t,e){const n=GA(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const i$=tn.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e==null?void 0:e.char)!==null&&n!==void 0?n:"@"}${(r=t.attrs.label)!==null&&r!==void 0?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,o;return["span",wt(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=JA(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",wt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=wt({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",wt({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:JA(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 pi,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 GA(this).map(r$)}}),ZA=cn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new En("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&ap(s);if((l||!this.options.showOnlyCurrent)&&u){const p=[this.options.emptyNodeClass];i&&p.push(this.options.emptyEditorClass);const f=Jn.node(a,a+s.nodeSize,{class:p.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(f)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),s$=vr.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",wt(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()}}}),a$=tn.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",wt(this.options.HTMLAttributes,t),0]}}),l$=tn.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",wt(this.options.HTMLAttributes,t),0]}}),c$=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",wt(this.options.HTMLAttributes,t),0]}}),u$=/^\s*(\[([( |x])?\])\s$/,d$=tn.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",wt(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 p,f;a.ariaLabel=((f=(p=this.options.a11y)===null||p===void 0?void 0:p.checkboxLabel)===null||f===void 0?void 0:f.call(p,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",p=>p.preventDefault()),a.addEventListener("change",p=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=p.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const b=n();if(typeof b!="number")return!1;const v=m.doc.nodeAt(b);return m.setNodeMarkup(b,void 0,{...v==null?void 0:v.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([p,f])=>{o.setAttribute(p,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([p,f])=>{o.setAttribute(p,f)}),{dom:o,contentDOM:l,update:p=>p.type!==this.type?!1:(o.dataset.checked=p.attrs.checked,a.checked=p.attrs.checked,u(),!0)}}},addInputRules(){return[al({find:u$,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),p$=tn.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",wt(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()}}}),f$=cn.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")}}}),XA=X.forwardRef((t,e)=>{const[n,r]=X.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],p={id:u.id,label:u.mentionLabel};t.command(p)},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?g.jsx(W.Paper,{elevation:5,children:g.jsx(W.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>g.jsx(W.ListItem,{disablePadding:!0,children:g.jsx(W.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});XA.displayName="SuggestionList";const QA={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},h$={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 EE(XA,{props:n,editor:n.editor}),e=au("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??QA},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))??QA}})},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}}}},m$=e$.extend({inclusive:!1}),g$=s$.extend({excludes:"superscript"}),y$=yM.extend({excludes:"subscript"});function b$({placeholder:t}={}){return X.useMemo(()=>[o9.configure({resizable:!0}),c$,l$,a$,hT,gT,yT,ST,DT,FT,BT,g$,y$,RT,dT,uT,mT,PT,Qb,VT,m$.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),jU,xT,WU,f$.configure({types:["heading","paragraph","image"]}),E_,M_,A_,V6,KT.configure({multicolor:!0}),IT,r8,bT,p$,d$.configure({nested:!0}),i$.configure({suggestion:h$}),ZA.configure({placeholder:t}),AT],[t])}function _A(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const v$=t=>{const e=b$({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(mM,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=jt.useField({name:n}),{setValue:p}=u,{value:f}=a;X.useEffect(()=>{var C,k,T;(T=(k=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:k.commands)==null||T.setContent(f)},[f]);const m=X.useRef(null),b=X.useCallback((C,k)=>{var w;const T=(w=m.current)==null?void 0:w.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(E=>{ib({images:E,editor:T,position:k})});else{const E=i(C);ib({images:E,editor:T,position:k})}},[]),v=X.useCallback((C,k,T,w)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const E=_A(k.dataTransfer.files);if(E.length>0){const L=(I=C.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return b(E,L),k.preventDefault(),!0}return!1},[b]),y=X.useCallback((C,k,T)=>{if(!k.clipboardData)return!1;const w=_A(k.clipboardData.files);return w.length>0?(b(w),!0):!1},[b]),x=g.jsx(W.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(hM,{ref:m,extensions:e,content:f,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(k_,{onUploadFiles:i}),onBlur:()=>{var C,k;return p(((k=(C=m.current)==null?void 0:C.editor)==null?void 0:k.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>g.jsxs(g.Fragment,{children:[g.jsx(k9,{}),g.jsx(z9,{})]})})});return g.jsxs(W.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(W.Typography,{...o,children:r}),x]})},$A=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=X.useState(!1),[u,p]=X.useState(void 0);X.useEffect(()=>{n&&(!a||s)&&(l(!0),p(r(o)))},[n,o]);const f={"&:last-child > td":{borderBottom:"unset"}};return i?g.jsx(W.Collapse,{in:n,children:u}):g.jsx(W.TableRow,{sx:f,children:g.jsx(W.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:g.jsx(W.Collapse,{in:n,children:u})})})},lv=({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]),g.jsxs(W.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,g.jsx(W.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:g.jsx(W.CircularProgress,{})})]})},$o=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(W.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Bu=t=>{const{gap:e=1,...n}=t;return g.jsx(W.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function eI({icon:t,children:e,sx:n,...r}){return e?g.jsx(W.Tooltip,{title:e,children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:n??{ml:.5},...r})}):null}function tI(t){return g.jsx(eI,{icon:BK,...t})}const cv=t=>{const{id:e,getRowKey:n=me=>"id"in me&&(typeof me.id=="string"||typeof me.id=="number")&&me.id!=null?me.id:(console.warn(`Table: "id" not found or undefined in ${JSON.stringify(me)}. If provided, id must have a value and be type string or number. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),String(JSON.stringify(me))),columns:r,data:o=[],onRowClick:i,onRowClickObj:s,checkedKeys:a,setCheckedKeys:l,renderExpand:u,sortField:p,sortOrder:f,onSortChange:m,allowSortCols:b,fixedLayout:v=!1,className:y,emptyTableMsg:x="No items to display",errorTableMsg:C,retryCallback:k,isLoading:T=!1,disableMobileCards:w=!1,highlightSelectedRow:E=!1,selectedRowColor:I,selectedRowKey:L,headerRowStyle:B={},stickyHeader:q,reRenderExpand:M=!1,expandOnRowClick:V=!1,tooltipProps:j={},...R}=t,{palette:N}=W.useTheme(),A=N.grey[N.mode=="dark"?600:50],[P,z]=X.useState(void 0),[U,G]=X.useState(typeof E=="string"||typeof E=="number"?E:void 0);x$(t);const K=me=>{me!==p?m&&m(me,"asc"):m&&m(p,f==="asc"?"desc":"asc")},J=me=>p===me?f:null,pe=W.useMediaQuery(W.useTheme().breakpoints.down("sm")),ue=r.filter(me=>!me.hideCol&&(!pe||!me.hideOnMobile));u&&!pe&&ue.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,Ve)=>{const Pe=n(Ve),yt=P===Pe;return g.jsx(W.IconButton,{"data-testid":"expand-collapse-btn","aria-label":yt?"collapse row":"expand row",size:"small",onClick:()=>Q(Pe),children:yt?g.jsx(ff,{"data-testid":"collapse-up"}):g.jsx(y0,{"data-testid":"expand-down"})})}}),a&&l&&ue.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,Ve)=>{const Pe=n(Ve);return g.jsx(W.Checkbox,{onChange:()=>{const yt=a.includes(Pe);l(yt?a.filter(ct=>ct!==Pe):[...a,Pe])},checked:a.includes(Pe)})}});const fe=m!==void 0,_=me=>fe?b?b.includes(me):!0:!1,te=g.jsxs(W.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(VK,{})," ",x]}),ce=g.jsxs(W.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(pS,{color:"error"})," ",C,k&&g.jsx(W.Button,{variant:"text",onClick:k,children:"Retry?"})]}),ne=()=>{if(C)return g.jsx(W.TableRow,{children:g.jsx(W.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:ce})});if(o.length===0)return g.jsx(W.TableRow,{children:g.jsx(W.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:te})})},re=()=>{if(C)return ce;if(o.length===0)return te},le=me=>{E&&G(me)},ye=me=>{const Ve=n(me);if((i||s)&&(i==null||i(Ve),s==null||s(me),le(Ve)),u&&V){const Pe=P===Ve?void 0:Ve;z(Pe),le(Pe)}},Q=me=>{const Ve=P===me?void 0:me;z(Ve),le(Ve)},ee=me=>{if(!u)return;const Ve=P===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(W.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>Q(n(me)),children:[Ve?g.jsx(ff,{}):g.jsx(y0,{})," Show"," ",Ve?"Less":"More"]}),g.jsx($A,{colSpan:r.length,isExpanded:n(me)===P,obj:me,renderExpand:Pe=>u(Pe),asMobileCard:!0})]})},ie=I??A,Se=me=>{const Pe=(E?U:L)===n(me)?ie:"inherit",yt=i||s||V;return{cursor:yt?"pointer":"default",backgroundColor:Pe,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...yt&&{"&:hover":{backgroundColor:Pe===ie?oZ(Pe,.1):ie}}}},we=me=>g.jsx(tI,{...j,children:me}),Ne=(me,Ve)=>{const Pe=me.find(ct=>ct.key==="MBv2_Checkbox_Column"),yt=ue.filter(ct=>ct.key!=="MBv2_Checkbox_Column");return g.jsxs($o,{alignItems:"flex-start",children:[Pe&&g.jsx(Bu,{children:Bl(Pe,Ve,pe)}),g.jsxs(Bu,{width:"100%",children:[g.jsx("table",{className:"MBv2_Table_Stack",children:g.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:yt.map(ct=>g.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[g.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${xn(ct)}`,style:{textWrap:"nowrap"},children:[ct.label??Bn(xn(ct)),we(ct.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(ct)}`,style:{paddingLeft:"10px"},children:Bl(ct,Ve,pe)})]},`row-${n(Ve)}-${xn(ct)}`))})}),ee(Ve)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[fe&&g.jsxs(g.Fragment,{children:[g.jsxs(W.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[g.jsx(W.TextField,{select:!0,sx:{flexGrow:1},size:"small",value:p??"",label:"Sort By...",onChange:me=>K(me.target.value),fullWidth:!0,children:ue.map(me=>{if(_(xn(me)))return g.jsx(W.MenuItem,{value:xn(me),children:me.label??Bn(xn(me))},`rowHeader-${xn(me)}`)})}),g.jsx(W.IconButton,{onClick:()=>{p&&K(p)},children:g.jsx(KK,{className:`sort-icon-${f}`})})]}),g.jsx(W.Divider,{sx:{margin:"10px 0"}})]}),re()??o.map(me=>g.jsx(W.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...Se(me)},onClick:()=>ye(me),"data-testid":`card-${n(me)}`,children:Ne(ue,me)},n(me)))]}),Ie=()=>g.jsx(W.TableContainer,{component:W.Card,"data-testid":"mui-table",...e?{tableId:`table-${e}`}:{},className:y,style:q?{maxHeight:q,overflow:"auto"}:{},children:g.jsxs(W.Table,{stickyHeader:q!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:B?{"& .MuiTableCell-head":{...B}}:{},...R,children:[g.jsx(W.TableHead,{className:"MBv2_Table_Head",children:g.jsx(W.TableRow,{className:"MBv2_Table_Head_Row",children:ue.map((me,Ve)=>{const Pe=_(xn(me));return g.jsx(W.TableCell,{width:Array.isArray(v)?v[Ve]:"auto",sx:me.tableCellSx??{},children:g.jsx(W.Box,{style:{display:"flex",alignItems:"center"},children:g.jsxs(W.Box,{sx:[Pe&&{"&:hover":{cursor:"pointer",backgroundColor:N.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:Pe?()=>K(xn(me)):void 0,children:[g.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:me.label??Bn(xn(me))}),we(me.tooltip),Pe&&J(xn(me))==="asc"&&g.jsx(ff,{style:{marginLeft:"5px"}}),Pe&&J(xn(me))==="desc"&&g.jsx(y0,{style:{marginLeft:"5px"}}),Pe&&J(xn(me))!=="asc"&&J(xn(me))!=="desc"&&g.jsx(HK,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(me)}`)})})}),g.jsx(W.TableBody,{className:"MBv2_Table_Body",children:ne()??o.map(me=>g.jsxs(X.Fragment,{children:[g.jsx(W.TableRow,{"data-testid":`row-${n(me)}`,className:"MBv2_Table_Body_Row",onClick:()=>ye(me),sx:Se(me),children:ue.map(Ve=>g.jsx(W.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(Ve)}`,children:Bl(Ve,me,pe)},`row-${n(me)}-${xn(Ve)}`))}),u&&g.jsx($A,{colSpan:ue.length,isExpanded:n(me)===P,obj:me,renderExpand:Ve=>u(Ve),reRenderExpand:M})]},n(me)))})]})});return g.jsx(lv,{isLoading:T,children:pe&&!w?Me():Ie()})},x$=t=>{const{fixedLayout:e,checkedKeys:n,setCheckedKeys:r,renderExpand:o,columns:i,expandOnRowClick:s,onRowClick:a,onRowClickObj:l,selectedRowKey:u,highlightSelectedRow:p}=t,f="Table component:";Array.isArray(e)&&(!o&&e.length!==i.length&&console.warn(`${f} Length of "fixedLayout" is not equal to the length of "columns". Got=${e.length}. Expected=${i.length}`),o&&e.length!==i.length+1&&console.warn(`${f} Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),s&&!o&&console.warn(`${f} renderExpand should be defined when expandOnRowClick is defined`),a&&l&&console.warn(`${f} 'onRowClick' and 'onRowClickObj' are both defined. Only one should be defined.`),(n||r)&&o&&console.warn(`${f} checkedKeys/setCheckedKeys & renderExpand cannot both be defined`),n&&!r&&console.warn(`${f} if checkedKeys is defined, setCheckedKeys must also be defined`),!n&&r&&console.warn(`${f} if setCheckedKeys is defined, checkedKeys must also be defined`);const m=i.map(y=>xn(y)),b=m.filter((y,x)=>m.indexOf(y)!==x),v=[...new Set(b)];v.length>0&&console.warn(`${f} duplicate key/fieldName found in 'columns': ${v.join(", ")}. Make sure to define a unique 'key' if you have multiple column definitions with the same 'fieldName'.`),p&&u&&console.warn(`${f} must choose 'highlightSelectedRow' (uncontrolled) or 'selectedRowKey' (controlled)`)},xn=t=>t.key??t.fieldName,S$=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Bl=(t,e,n=!1)=>{const r=S$(e,t.fieldName);return t.render?t.render(r,e,n):r},nI=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:p,sortOrder:f}=e,m=x=>{n(x)},b=x=>{r(parseInt(x.target.value,10))},v=W.useMediaQuery(W.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return g.jsxs(W.Box,{children:[g.jsx(cv,{sortOrder:f,sortField:p,...s}),!o&&!y&&g.jsx(W.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:v?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(x,C)=>m(C),onRowsPerPageChange:b,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},rI=()=>({height:window.innerHeight,width:window.innerWidth}),oI=()=>{const[t,e]=X.useState(rI());return X.useEffect(()=>{const n=()=>{e(rI())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},Tr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=oI(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return g.jsx(W.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...lr({...t},a)})},C$=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return g.jsx(W.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(W.Box,{component:W.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[g.jsxs(W.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),g.jsxs(W.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Tr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Tr,{size:"small",color:"error",startIcon:g.jsx(e0,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},w$=t=>{const{citation:e,anchorEl:n,onClose:r,open:o}=t;return g.jsx(W.Popper,{open:o,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(W.Box,{component:W.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[g.jsxs(W.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",g.jsx("br",{}),g.jsx("b",{children:e.url}),"?"]}),g.jsxs(W.Box,{display:"flex",flexDirection:"row",children:[g.jsx(Tr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(Tr,{size:"small",startIcon:g.jsx(b0,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})};function uv({canLaunchUrl:t,citation:e,asLink:n}){const r=X.useRef(null),[o,i]=X.useState(!1),s=()=>{i(!1)};return!t||e.fileName?null:g.jsxs(g.Fragment,{children:[n?g.jsx(W.Link,{ref:r,component:"button",sx:{cursor:"pointer"},type:"button",onClick:()=>i(!0),children:e.url}):g.jsx(W.Tooltip,{title:"Open URL",children:g.jsx(W.IconButton,{ref:r,color:"primary",onClick:()=>{i(!0)},"data-testid":`citation-table_launch-link-btn-${e.id}`,sx:{visibility:t!=null&&t(e)?"visible":"hidden"},children:g.jsx(b0,{})})}),g.jsx(w$,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function iI({onDownloadAttachment:t,citation:e}){if(!(!t||!e.fileName))return g.jsx(W.Tooltip,{title:"Download",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_download-btn-${e.id}`,children:g.jsx(LK,{})})})}function sI({onPreviewAttachment:t,citation:e}){if(!t||!e.fileName)return;const n=["pdf","png","jpg","jpeg","gif","bmp","svg","webp","mp3","wav","mp4","webm","html","htm","txt","xml","json","csv"],r=e.fileName.split(".").pop();if(!(!r||!n.includes(r)))return g.jsx(W.Tooltip,{title:"View File",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_view-file-btn-${e.id}`,children:g.jsx(b0,{})})})}const dv=(t,e=30)=>ma.truncate(t,{length:e,omission:"..."}),T$=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onViewCitation:l,onViewAttachment:u,onDeleteCitation:p,onDownloadAttachment:f,onPreviewAttachment:m,onSelect:b,getCitationsPaginated:v,selectedIds:y,setSelectedIds:x,onError:C=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:w,addlActions:E,readOnly:I=!1,showCloseBtn:L=!1,canSearch:B=!1}=t,q=!!t.canCreate&&!I,M=!!a&&!!s&&!I,V=!!u&&!!l&&I&&k,j=!!p&&!I,{palette:R}=W.useTheme(),[N,A]=X.useState([]),[P,z]=X.useState(!1),[U,G]=X.useState(!0),[K,J]=X.useState(null),[pe,ue]=X.useState(null),[fe,_]=X.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:B?"":void 0}),te=()=>{z(!1),G(!0),v({pageNo:fe.pageNo,pageSize:fe.pageSize,search:fe.search},y).then(Ie=>(A(Ie.data),_(me=>({...me,totalCount:Ie.totalCount})),Ie)).catch(Ie=>{C(Ie),z(!0),A([])}).finally(()=>G(!1))};X.useEffect(te,[fe.pageNo,fe.pageSize,e,fe.search]);const ce=()=>{ue(null),J(null)},ne=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(qp,{}),children:"Add Citation"}),re=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(JM,{}),children:"Add Attachment"}),le=Ie=>{if(!(!M&&!V)){if(M)return g.jsx(W.Tooltip,{title:"Edit",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>Ie.fileName?a(Ie.id):s(Ie.id),"data-testid":`citation-table_edit-btn-${Ie.id}`,children:g.jsx(FK,{})})});if(V)return g.jsx(W.Tooltip,{title:"View",children:g.jsx(W.IconButton,{color:"primary",onClick:()=>Ie.fileName?u(Ie.id):l(Ie.id),"data-testid":`citation-table_view-btn-${Ie.id}`,children:g.jsx(YK,{})})})}},ye=Ie=>{if(!(!j||I))return g.jsx(W.Tooltip,{title:"Delete",children:g.jsx(W.IconButton,{color:"error",onClick:me=>{ue(Ie),J(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Ie.id}`,children:g.jsx(e0,{})})})},Q=Ie=>g.jsx(uv,{citation:Ie,canLaunchUrl:w}),ee=Ie=>g.jsx(sI,{citation:Ie,onPreviewAttachment:m}),ie=Ie=>g.jsx(iI,{citation:Ie,onDownloadAttachment:f}),Se=V||M||j||w||m||f||E,we=[...lI(R,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Se,render:(Ie,me)=>g.jsxs(W.Box,{display:"flex",flexDirection:"row-reverse",children:[E==null?void 0:E(me),ye(me),le(me),ee(me),Q(me),ie(me)]})}],Ne=X.useCallback(Ie=>{_(me=>({...me,pageNo:0,search:Ie}))},[]),Me=()=>B?g.jsx(QM,{onSearch:Ne}):null;return g.jsxs(Bu,{children:[g.jsxs(W.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(W.Typography,{variant:k?"h6":"h2",children:n}),!T&&q&&g.jsxs(W.Box,{display:"flex",flexDirection:"row",gap:1,children:[ne,re]}),L&&g.jsx(W.IconButton,{onClick:r,children:g.jsx(pf,{})})]}),Me(),g.jsx(nI,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:U,columns:we,data:N,paginationState:fe,onPageChange:Ie=>_(me=>({...me,pageNo:Ie})),onRowsPerPageChange:Ie=>_(me=>({...me,pageSize:Ie,pageNo:0})),errorTableMsg:P?"Failed to load citations.":void 0,retryCallback:te,setCheckedKeys:T?x:void 0,checkedKeys:T?y:void 0}),T&&g.jsxs(W.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[g.jsx(W.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:q&&g.jsxs(g.Fragment,{children:[ne,re]})}),!I&&g.jsxs(W.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[g.jsx(Tr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),g.jsxs(Tr,{variant:"contained",size:"small",onClick:()=>b(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),g.jsx(C$,{citation:pe,anchorEl:K,onDeleteCitation:p,onClose:ce})]})},aI=(t,e)=>{const n=t?dv(e):e,r=n==null?void 0:n.endsWith("...");return g.jsx("span",{style:{wordBreak:"break-all"},children:r?g.jsx(W.Tooltip,{title:e,children:g.jsx("span",{children:n})}):e})},lI=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(W.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(JM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):g.jsx(qp,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>aI(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>aI(!0,n||r.url),isEqual:(n,r)=>n.fileName&&r.fileName?n.fileName===r.fileName:n.url===r.url},{fieldName:"source",hideCol:e},{fieldName:"details",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}];var pv,cI;function k$(){if(cI)return pv;cI=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,k){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=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);pv={Cache:t,split:f,normalizePath:p,setter:function(C){var k=p(C);return l.get(C)||l.set(C,function(w,E){for(var I=0,L=k.length,B=w;I<L-1;){var q=k[I];if(q==="__proto__"||q==="constructor"||q==="prototype")return w;B=B[k[I++]]}B[k[I]]=E})},getter:function(C,k){var T=p(C);return u.get(C)||u.set(C,function(E){for(var I=0,L=T.length;I<L;)if(E!=null||!k)E=E[T[I++]];else return;return E})},join:function(C){return C.reduce(function(k,T){return k+(b(T)||n.test(T)?"["+T+"]":(k?".":"")+T)},"")},forEach:function(C,k,T){m(Array.isArray(C)?C:f(C),k,T)}};function p(C){return a.get(C)||a.set(C,f(C).map(function(k){return k.replace(i,"$2")}))}function f(C){return C.match(e)||[""]}function m(C,k,T){var w=C.length,E,I,L,B;for(I=0;I<w;I++)E=C[I],E&&(x(E)&&(E='"'+E+'"'),B=b(E),L=!B&&/^\d+$/.test(E),k.call(T,E,B,L,I,C))}function b(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function v(C){return C.match(r)&&!C.match(n)}function y(C){return o.test(C)}function x(C){return!b(C)&&(v(C)||y(C))}return pv}var wa=k$(),fv,uI;function O$(){if(uI)return fv;uI=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=p=>p.match(t)||[],n=p=>p[0].toUpperCase()+p.slice(1),r=(p,f)=>e(p).join(f).toLowerCase(),o=p=>e(p).reduce((f,m)=>`${f}${f?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return fv={words:e,upperFirst:n,camelCase:o,pascalCase:p=>n(o(p)),snakeCase:p=>r(p,"_"),kebabCase:p=>r(p,"-"),sentenceCase:p=>n(r(p," ")),titleCase:p=>e(p).map(n).join(" ")},fv}var hv=O$(),Th={exports:{}},dI;function E$(){if(dI)return Th.exports;dI=1,Th.exports=function(o){return t(e(o),o)},Th.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,p=n(i),f=r(o);for(i.forEach(function(b){if(!f.has(b[0])||!f.has(b[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(b,v,y){if(y.has(b)){var x;try{x=", node was:"+JSON.stringify(b)}catch{x=""}throw new Error("Cyclic dependency"+x)}if(!f.has(b))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(b));if(!l[v]){l[v]=!0;var C=p.get(b)||new Set;if(C=Array.from(C),v=C.length){y.add(b);do{var k=C[--v];m(k,f.get(k),y)}while(v);y.delete(b)}a[--s]=b}}}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 Th.exports}var M$=E$();const A$=Kn(M$),I$=Object.prototype.toString,P$=Error.prototype.toString,D$=RegExp.prototype.toString,N$=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",L$=/^Symbol\((.*)\)(.*)$/;function F$(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function pI(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return F$(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return N$.call(t).replace(L$,"Symbol($1)");const r=I$.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+P$.call(t)+"]":r==="RegExp"?D$.call(t):null}function Cs(t,e){let n=pI(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=pI(this[r],e);return i!==null?i:o},2)}function fI(t){return t==null?[]:[].concat(t)}let hI,mI,gI,B$=/\$\{\s*(\w+)\s*\}/g;hI=Symbol.toStringTag;class yI{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[hI]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],fI(e).forEach(i=>{if(fr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}mI=Symbol.hasInstance,gI=Symbol.toStringTag;class fr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(B$,(o,i)=>Cs(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 yI(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[gI]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,fr)}static[mI](e){return yI[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ei={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${Cs(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Cs(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Cs(n,!0)}\``+o}},kr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},V$={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"},mv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},R$={isValue:"${path} field must be ${value}"},kh={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:ei,string:kr,number:V$,date:mv,object:kh,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:R$,tuple:{notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${Cs(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: \`${Cs(n,!0)}\``}return fr.formatError(ei.notType,t)}}});const gv=t=>t&&t.__isYupSchema__;class Oh{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 Oh(e,(a,l)=>{var u;let p=s(...a)?o:i;return(u=p==null?void 0:p(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(!gv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Eh={context:"$",value:"."};class Ta{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Eh.context,this.isValue=this.key[0]===Eh.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Eh.context:this.isValue?Eh.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&wa.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Ta.prototype.__isYupRef=!0;const ka=t=>t==null;function Vl(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:p,params:f,message:m,skipAbsent:b}=t;let{parent:v,context:y,abortEarly:x=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;const k={value:n,parent:v,context:y};function T(V={}){const j=bI(Object.assign({value:n,originalValue:i,label:s.spec.label,path:V.path||r,spec:s.spec,disableStackTrace:V.disableStackTrace||C},f,V.params),k),R=new fr(fr.formatError(V.message||m,j),n,j.path,V.type||u,j.disableStackTrace);return R.params=j,R}const w=x?a:l;let E={path:r,parent:v,type:u,from:o.from,createError:T,resolve(V){return vI(V,k)},options:o,originalValue:i,schema:s};const I=V=>{fr.isError(V)?w(V):V?l(null):w(T())},L=V=>{fr.isError(V)?w(V):a(V)};if(b&&ka(n))return I(!0);let q;try{var M;if(q=p.call(E,n,E),typeof((M=q)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(q).then(I,L)}}catch(V){L(V);return}I(q)}return e.OPTIONS=t,e}function bI(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=vI(t[n],e);return t}function vI(t,e){return Ta.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function z$(t,e,n,r=n){let o,i,s;return e?(wa.forEach(e,(a,l,u)=>{let p=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let f=t.type==="tuple",m=u?parseInt(p,10):0;if(t.innerType||f){if(f&&!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=f?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[p])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[p],t=t.fields[p]}i=p,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class Mh extends Set{describe(){const e=[];for(const n of this.values())e.push(Ta.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new Mh(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Rl(t,e=new Map){if(gv(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=Rl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,Rl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Rl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Rl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function W$(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 q$(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:W$(n)}))}function xI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return q$(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>xI(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 Mh,this._blacklist=new Mh,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(ei.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=Rl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&ka(i))return i;let s=Cs(e),a=Cs(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
|
|
406
406
|
|
|
407
407
|
attempted value: ${s}
|
|
408
408
|
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let p of Object.values(this.internalTests))p&&u.push(p);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,p=>{if(p.length)return o(p,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,p=y=>{o||(o=!0,n(y,s))},f=y=>{o||(o=!0,r(y,s))},m=i.length,b=[];if(!m)return f([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const x=i[y];x(v,p,function(k){k&&(Array.isArray(k)?b.push(...k):b.push(k)),--m<=0&&f(b)})}}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 p=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(f,m,b)=>this.resolve(p)._validate(u,p,m,b)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Rl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=Vl({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=Vl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=ei.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ei.notNull){return this.nullability(!1,e)}required(e=ei.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=ei.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Vl(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=fI(e).map(i=>new Ta(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Oh(o,n):Oh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Vl({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=ei.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Vl({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=ei.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Vl({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,p)=>p.findIndex(f=>f.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?bI(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 fr)return{issues:xI(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}=z$(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 j$=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function H$(t){const e=yv(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 yv(t){var e,n;const r=j$.exec(t);return r?{year:Di(r[1]),month:Di(r[2],1)-1,day:Di(r[3],1),hour:Di(r[4]),minute:Di(r[5]),second:Di(r[6]),millisecond:r[7]?Di(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:Di(r[10]),minuteOffset:Di(r[11])}:null}function Di(t,e=0){return Number(t)||e}let U$=/^[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])?)*$/,K$=/^((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,Y$=/^(?:[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,G$="^\\d{4}-\\d{2}-\\d{2}",J$="\\d{2}:\\d{2}:\\d{2}",Z$="(([+-]\\d{2}(:?\\d{2})?)|Z)",X$=new RegExp(`${G$}T${J$}(\\.\\d+)?${Z$}$`),Q$=t=>ka(t)||t===t.trim(),_$={}.toString();function zl(){return new SI}class SI 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===_$?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||ei.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=kr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=kr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=kr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||kr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=kr.email){return this.matches(U$,{name:"email",message:e,excludeEmptyString:!0})}url(e=kr.url){return this.matches(K$,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=kr.uuid){return this.matches(Y$,{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(X$,{name:"datetime",message:n||kr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||kr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=yv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||kr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=yv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=kr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Q$})}lowercase(e=kr.lowercase){return this.transform(n=>ka(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toLowerCase()})}uppercase(e=kr.uppercase){return this.transform(n=>ka(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toUpperCase()})}}zl.prototype=SI.prototype;let CI=new Date(""),$$=t=>Object.prototype.toString.call(t)==="[object Date]";function bv(){return new Vu}class Vu extends ti{constructor(){super({type:"date",check(e){return $$(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=H$(e),isNaN(e)?Vu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ta.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=mv.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=mv.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)}})}}Vu.INVALID_DATE=CI,bv.prototype=Vu.prototype,bv.INVALID_DATE=CI;function eee(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=wa.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Ta.isRef(a)&&a.isSibling?i(a.path,s):gv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return A$.array(Array.from(r),n).reverse()}function wI(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 TI(t){return(e,n)=>wI(t,e)-wI(t,n)}const tee=(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 Ah(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Ah(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Ah(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Ah)}):"optional"in t?t.optional():t}const nee=(t,e)=>{const n=[...wa.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=wa.getter(wa.join(n),!0)(t);return!!(o&&r in o)};let kI=t=>Object.prototype.toString.call(t)==="[object Object]";function OI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const ree=TI([]);function vv(t){return new EI(t)}class EI extends ti{constructor(e){super({type:"object",check(n){return kI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=ree,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(f=>!this._nodes.includes(f))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),p=!1;for(const f of a){let m=i[f],b=f in o,v=o[f];if(m){let y;u.path=(n.path?`${n.path}.`:"")+f,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,C=x==null?void 0:x.strict;if(x!=null&&x.strip){p=p||f in o;continue}y=!n.__validating||!C?m.cast(v,u):v,y!==void 0&&(l[f]=y)}else b&&!s&&(l[f]=v);(b!==f in l||l[f]!==v)&&(p=!0)}return p?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||!kI(u)){o(l,u);return}s=s||u;let p=[];for(let f of this._nodes){let m=this.fields[f];!m||Ta.isRef(m)||p.push(m.asNestedTest({options:n,key:f,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:p,value:u,originalValue:s,options:n},r,f=>{o(f.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=eee(e,n),r._sortErrors=TI(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 Ah(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=wa.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return nee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(tee)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||kh.exact,test(n){if(n==null)return!0;const r=OI(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=kh.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=OI(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=kh.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(hv.camelCase)}snakeCase(){return this.transformKeys(hv.snakeCase)}constantCase(){return this.transformKeys(e=>hv.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}}vv.prototype=EI.prototype;const oee=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return g.jsx(W.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:g.jsxs(Bu,{component:W.Paper,p:1,boxShadow:9,gap:.25,children:[g.jsx(W.Typography,{variant:"body1",children:"Paste in a preformatted citation"}),g.jsx(W.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),g.jsx(jt.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(aee(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>g.jsxs($o,{flexWrap:"wrap",justifyContent:"flex-end",children:[g.jsx(YM,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:g.jsx(W.Tooltip,{title:"Paste from Clipboard",children:g.jsx(W.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:g.jsx(NK,{})})})}),g.jsxs($o,{children:[g.jsx(Tr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),g.jsx(Tr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},iee=["https://","http://","www."],see=new RegExp(iee.join("|")),aee=t=>{const e=t.replace(/\.\s*$/,"").split("|").map(p=>p.trim()).filter(Boolean),n=e.findIndex(p=>p.match(see)),r=e.findIndex(p=>p.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(p=>/\bSOURCE\b/.test(p.toUpperCase()));let s=[n,r,o].find(p=>p!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Ih(e,l),title:Ih(e,a),url:Ih(e,n),accessedAt:lee(e,r),classification:cee(e,o),details:Ih(e,o)}},Ih=(t,e)=>e<0||e>=t.length?"":t[e],lee=(t,e)=>e<0||e>=t.length?"":S_(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),cee=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",MI=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return g.jsx(Tr,{type:n,disabled:e,size:r,startIcon:e?g.jsx(W.CircularProgress,{size:s,color:"inherit"}):null,...o})},AI=t=>{const{onCancel:e,onViewCitationTable:n,readOnly:r=!1,showViewAllCitationsBtn:o=!1,isLoading:i,onSaveClicked:s}=t;return r&&!o?null:r?g.jsx(W.DialogActions,{sx:{px:0},children:g.jsx(W.Button,{onClick:n,size:"small",variant:"outlined",children:"Back To Table"})}):g.jsxs(W.DialogActions,{sx:{px:0,justifyContent:"space-between"},children:[g.jsx(W.Box,{children:o&&g.jsx(W.Button,{onClick:n,size:"small",variant:"outlined",children:"View All Citations"})}),g.jsxs($o,{children:[g.jsx(W.Button,{onClick:e,variant:"outlined",size:"small",children:"Cancel"}),g.jsx(MI,{size:"small",loading:i,type:"button",onClick:s,children:"Save"})]})]})},uee=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,canLaunchUrl:l}=t,u=X.useRef(null),[p,f]=X.useState(!1),[m,b]=X.useState(!1),v=X.useRef(null),[y,x]=X.useState(!1),[C,k]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});X.useEffect(()=>{i&&k({...i,type:"Url"})},[]);const T={disabled:p,margin:"none",readOnly:s},w=!s;return g.jsxs(W.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs($o,{justifyContent:"space-between",children:[g.jsxs($o,{gap:2,children:[g.jsxs(W.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Citation"]}),w&&g.jsx(W.Button,{variant:"outlined",size:"small",ref:v,onClick:()=>x(!0),children:"Paste & Prefill"})]}),g.jsx(W.IconButton,{onClick:o,children:g.jsx(pf,{})})]}),g.jsx(jt.Formik,{innerRef:u,enableReinitialize:!0,initialValues:C,onSubmit:async E=>{f(!0),e(E).catch(I=>{throw f(!1),I}).finally(()=>f(!1))},validationSchema:vv({title:zl().required("Title is required"),accessedAt:bv().required("Accessed At is required"),url:zl().required("URL is required"),classification:zl().required("Classification is required")}),validateOnBlur:m,validateOnChange:m,children:({submitForm:E,setValues:I,values:L})=>g.jsxs(jt.Form,{autoComplete:"off",children:[g.jsxs(W.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[g.jsx(ki,{...T,name:"title",required:!0}),g.jsx(ki,{...T,name:"source"}),g.jsx(ki,{...T,name:"details",label:"Details (e.g. Source Description)"}),g.jsx(Kf,{...T,name:"accessedAt",required:!0,isDatePicker:!0}),s&&(l!=null&&l(L))?g.jsx(g.Fragment,{children:g.jsx(Ti,{label:"URL / Other Identifier",readOnlyValue:g.jsx(uv,{citation:L,canLaunchUrl:l,asLink:!0}),value:L.url??""})}):g.jsx(ki,{...T,name:"url",label:"URL / Other Identifier",required:!0,endIcon:g.jsx(uv,{citation:L,canLaunchUrl:l})}),g.jsx(KM,{...T,name:"classification",row:!0,required:!0,radios:dee})]}),g.jsx(AI,{isLoading:p,onSaveClicked:()=>{b(!0),E()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n}),g.jsx(oee,{open:y,onGenerateCitation:B=>{I(B,!0)},anchorEl:v.current,onClose:()=>x(!1)})]})})]})},dee=[{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."}],pee=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,onDownloadAttachment:l,onPreviewAttachment:u}=t,p=X.useRef(null),[f,m]=X.useState(!1),[b,v]=X.useState(!1),[y,x]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{i&&x({...i,type:"Attachment",file:void 0})},[]),g.jsxs(W.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(W.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[g.jsxs(W.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Attachment"]}),g.jsx(W.IconButton,{onClick:o,children:g.jsx(pf,{})})]}),g.jsx(jt.Formik,{innerRef:p,enableReinitialize:!0,initialValues:y,validationSchema:vv().shape({title:zl().required("Title is required"),fileName:zl().required("A file is required")}),validateOnBlur:b,validateOnChange:b,onSubmit:async C=>{m(!0),e(C).catch(k=>{throw m(!1),k}).finally(()=>m(!1))},children:({values:C,setFieldValue:k,handleSubmit:T})=>{var E;const w=!s&&!C.id;return X.useEffect(()=>{var I,L;(I=C.file)!=null&&I.name&&k("fileName",(L=C.file)==null?void 0:L.name)},[(E=C.file)==null?void 0:E.name]),g.jsxs(jt.Form,{autoComplete:"off",children:[g.jsx(ki,{name:"title",disabled:f,required:!0,margin:"none",readOnly:s}),g.jsxs(W.Box,{marginTop:w?1:0,children:[g.jsxs($o,{alignItems:"flex-start",children:[w&&g.jsx(OM,{name:"file",errorMode:"hidden"}),g.jsxs($o,{alignItems:"flex-end",children:[g.jsx(ki,{readOnly:!0,name:"fileName",label:w?"":"File Name"}),!w&&g.jsxs($o,{children:[g.jsx(iI,{citation:C,onDownloadAttachment:l}),g.jsx(sI,{citation:C,onPreviewAttachment:u})]})]})]}),g.jsx(yr,{name:"fileName"})]}),g.jsx(AI,{isLoading:f,onSaveClicked:()=>{v(!0),T()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n})]})}})]})},Ru=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...p}=t;if(!e)return null;const f=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",b=()=>{if(s&&f)return g.jsx(W.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return g.jsx(W.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsxs(W.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[g.jsx(W.Box,{children:b()}),g.jsxs(W.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&f)return g.jsx(W.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsx(W.Box,{children:b()})})};return g.jsxs(W.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...p,children:[typeof r=="string"?g.jsx(W.DialogTitle,{className:"MBv2_Modal_Title",children:g.jsxs(W.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&g.jsx(W.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:g.jsx(pf,{})})]})}):r,o&&(typeof o=="string"?g.jsx(W.DialogContent,{className:"MBv2_Modal_Content",children:g.jsx(W.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function fee(t){return Ge("MuiAlert",t)}const II=Ue("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),hee=Be(g.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),mee=Be(g.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),gee=Be(g.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),yee=Be(g.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),bee=Be(g.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),vee=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Le(n||r)}`,`${e}${Le(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ye(i,fee,o)},xee=oe(ps,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Le(n.color||n.severity)}`]]}})(bt(({theme:t})=>{const e=t.palette.mode==="light"?Ws:qa,n=t.palette.mode==="light"?qa:Ws;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),[`& .${II.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}`,[`& .${II.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)}}}))]}})),See=oe("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Cee=oe("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),wee=oe("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),PI={success:g.jsx(hee,{fontSize:"inherit"}),warning:g.jsx(mee,{fontSize:"inherit"}),error:g.jsx(gee,{fontSize:"inherit"}),info:g.jsx(yee,{fontSize:"inherit"})},DI=D.forwardRef(function(e,n){const r=mt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:p={},icon:f,iconMapping:m=PI,onClose:b,role:v="alert",severity:y="success",slotProps:x={},slots:C={},variant:k="standard",...T}=r,w={...r,color:l,severity:y,variant:k,colorSeverity:l||y},E=vee(w),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...p,...x}},[L,B]=At("root",{ref:n,shouldForwardComponentProp:!0,className:ge(E.root,s),elementType:xee,externalForwardedProps:{...I,...T},ownerState:w,additionalProps:{role:v,elevation:0}}),[q,M]=At("icon",{className:E.icon,elementType:See,externalForwardedProps:I,ownerState:w}),[V,j]=At("message",{className:E.message,elementType:Cee,externalForwardedProps:I,ownerState:w}),[R,N]=At("action",{className:E.action,elementType:wee,externalForwardedProps:I,ownerState:w}),[A,P]=At("closeButton",{elementType:Al,externalForwardedProps:I,ownerState:w}),[z,U]=At("closeIcon",{elementType:bee,externalForwardedProps:I,ownerState:w});return g.jsxs(L,{...B,children:[f!==!1?g.jsx(q,{...M,children:f||m[y]||PI[y]}):null,g.jsx(V,{...j,children:i}),o!=null?g.jsx(R,{...N,children:o}):null,o==null&&b?g.jsx(R,{...N,children:g.jsx(A,{size:"small","aria-label":a,title:a,color:"inherit",onClick:b,...P,children:g.jsx(z,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(DI.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const zu=t=>{var b;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=W.useTheme(),u=e?{icon:!1}:{},p=o==="leftBorder"?"standard":o,f=o==="leftBorder"?{...i,borderLeft:`4px solid ${(b=l[r])==null?void 0:b.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return g.jsxs(DI,{severity:r,variant:p,sx:f,slotProps:m,...u,...a,children:[s&&g.jsx(W.Typography,{variant:"h3",children:s}),n]})},NI=t=>g.jsx(zu,{severity:"error",...t}),LI=t=>g.jsx(zu,{severity:"success",...t}),Tee=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return g.jsxs(g.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&g.jsx(NI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&g.jsx(LI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function FI({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onClose:l,initialSelectedIds:u=[],onContentChange:p,onError:f=()=>{},renderAsPopup:m=!1,canSelect:b=!1,tableTitle:v="Attachments & Citations",addlActions:y,canLaunchUrl:x,readOnly:C,canSearch:k=!1}){const[T,w]=X.useState("Insert Citation/Attachment(s)"),[E,I]=X.useState(u),[L,B]=X.useState(void 0),[q,M]=X.useState(void 0),[V,j]=X.useState(!1),[R,N]=X.useState(!1),A=ee=>{M(void 0),w(ee)},[P,z]=X.useState(0);X.useEffect(()=>{p==null||p()},[T,q,p]);const U=(ee=!1)=>{(!m||ee)&&z(ie=>ie+1)},G=(ee,ie)=>{var Me;const Se=typeof((Me=ie.response)==null?void 0:Me.data)=="string"&&ie.response.data,we=typeof ie.message=="string"&&ie.message;M({type:"Error",title:ee,message:Se??we}),f(ie)},K=ee=>M({type:"Success",title:"",message:ee}),J=async ee=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");ee.id?await(n==null?void 0:n(ee).then(()=>{V?l():(A("Insert Citation/Attachment(s)"),U())}).catch(ie=>{G("Failed to update",ie)})):await(e==null?void 0:e(ee).then(ie=>{I([...E,ie.id]),A("Insert Citation/Attachment(s)"),U()}).catch(ie=>{G("Failed to create",ie)}))},pe=r&&(async ee=>r(ee).then(()=>{U(!0),I(E.filter(ie=>ie!==ee)),K("Successfully deleted")}).catch(ie=>G("Failed to delete",ie))),ue=o&&(ee=>{o(ee).then(ie=>{const Se=!!ie.fileName;B(ie),A(Se?"Attachment":"Citation")}).catch(ie=>{G("Failed to load",ie)}).finally(()=>N(!1))}),fe=n&&ue,_=n&&ue,te=i&&(async ee=>i(ee).catch(ie=>{G(`Failed to download ${ee.fileName}`,ie)})),ce=s&&(async ee=>s(ee).catch(ie=>{G(`Failed to view ${ee.fileName}`,ie)})),ne=g.jsx(T$,{refreshKey:P,getCitationsPaginated:(ee,ie)=>t(ee,ie).then(Se=>(p==null||p(),Se)),onCancel:l,onNewCitation:()=>{B(void 0),A("Citation")},onNewAttachment:()=>{B(void 0),A("Attachment")},onEditCitation:fe,onEditAttachment:_,onViewCitation:ue,onViewAttachment:ue,onDeleteCitation:pe,onDownloadAttachment:te,onPreviewAttachment:ce,onSelect:a,setSelectedIds:I,selectedIds:E,onError:f,condenseTable:m,canSelect:b,title:v,addlActions:y,canCreate:!!e,canLaunchUrl:x,readOnly:C,showCloseBtn:m,canSearch:k}),re=g.jsx(uee,{modifyCitation:L,onSave:J,onCancel:()=>V?l():A("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{A("Insert Citation/Attachment(s)"),j(!1)},onClose:()=>m?l():A("Insert Citation/Attachment(s)"),readOnly:C,showViewAllCitationsBtn:C&&!V||!C&&V,canLaunchUrl:x}),le=g.jsx(pee,{onSave:J,onCancel:()=>V?l():A("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{A("Insert Citation/Attachment(s)"),j(!1)},onClose:()=>m?l():A("Insert Citation/Attachment(s)"),modifyCitation:L,readOnly:C,showViewAllCitationsBtn:C&&!V||!C&&V,onDownloadAttachment:te,onPreviewAttachment:ce}),ye=g.jsx(Tee,{alert:q,setAlert:M});X.useEffect(()=>{m&&u.length===1&&ue&&(N(!0),j(!0),ue(u[0]))},[]);const Q=()=>{switch(T){case"Insert Citation/Attachment(s)":return ne;case"Citation":return re;case"Attachment":return le}};return m?g.jsxs(W.Box,{children:[ye,g.jsx(W.Box,{paddingTop:"8px",children:g.jsx(lv,{isLoading:R,children:Q()})})]}):g.jsxs(W.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&ye,g.jsx(W.Box,{paddingTop:"8px",children:ne}),g.jsx(Ru,{open:T!=="Insert Citation/Attachment(s)",children:g.jsxs(W.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[ye,T==="Citation"?re:le]})})]})}function BI({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=(s,a)=>n?t(s,r):e(s,a);return g.jsx(FI,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const kee=W.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 Oee({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:p,...f}){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 b=m==null?void 0:m.storage.citationBubbleMenuHandler,v=b.isOpen,y=b.selectedIds,x=b.selectedNodePos,C=E=>{m&&(E.length===0?m.commands.deleteCitation(x):y.length===0?m.commands.insertCitation({ids:E}):m.commands.updateCitation({ids:E},x))},k=E=>{C(E),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{C(y),m==null||m.commands.closeCitationBubbleMenu()},w=X.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?g.jsx(Cy,{editor:m,open:v,...b.bubbleMenuOptions,...f,children:g.jsx(kee,{children:g.jsx(BI,{getCitationsPaginated:t,getSelectedCitationsPaginated:E=>e(E,y),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onClose:T,initialSelectedIds:y,onContentChange:w,canLaunchUrl:l,readOnly:u,canSearch:p})})}):null}const Eee=()=>cn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function Mee(t){const e=Tt(),n=X.useRef(null);return g.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:g.jsxs(W.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[g.jsx(IK,{fontSize:"small"}),g.jsx(W.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const VI=X.createContext(void 0),RI=()=>{const t=X.useContext(VI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Aee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=RI(),[u,p]=X.useState(s?String(s):""),[f,m]=X.useState([]),b=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const v=a.filter(C=>s.includes(C.id)),y=v.map(C=>dv(C.title,b)).join(", ");p(y),m(v);const x=v.map(C=>C.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(C=>C.id)}),0)},[a,s,l]),f.length!==0)return g.jsx(Ab,{as:"span",...e,"data-testid":"citation-node-component","data-drag-handle":!0,onDragOver:v=>v.preventDefault(),onDrop:()=>{},children:g.jsx(W.Tooltip,{title:g.jsx(W.Box,{className:"citation-tooltip",children:f.map((v,y)=>{var k;const C=!!v.fileName?[v.title,v.fileName]:[v.title,v.source,v.details,(k=v.accessedAt)==null?void 0:k.slice(0,10),v.url,v.classification];return g.jsxs(W.Typography,{variant:"subtitle2",children:[C.filter(Boolean).join(" | "),y<f.length-1&&g.jsx(W.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:g.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Iee=tn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,draggable:!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",wt(t)]},addNodeView(){return Ib(Aee)},addProseMirrorPlugins(){return[new en({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1},appendTransaction(t,e,n){if(!t.some(i=>i.docChanged))return null;let r=n.tr,o=!1;return n.doc.descendants((i,s)=>{if(i.type.name!=="citation")return;const a=s+i.nodeSize,l=n.doc.nodeAt(a);if(l&&l.type===i.type){const u=[...new Set([...i.attrs.ids,...l.attrs.ids])],p=i.type.create({...i.attrs,ids:u});return r.replaceWith(s,a+l.nodeSize,p),o=!0,!1}}),o?r:null}})]},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}}}});function zI({editor:t,canComment:e=!0,onComment:n,commentCount:r,commentResolved:o,...i}){const s=X.useRef(null);if(!n)return null;const a=o?g.jsx(sO,{sx:{width:14,height:14},"data-testid":"resolved-checkmark"}):r,l=o?"success":"primary",u=o?{"& .MuiBadge-badge":{padding:0,height:16,minWidth:16}}:{"& .MuiBadge-badge":{fontSize:14,height:16,minWidth:16}};return e?g.jsx(St,{buttonRef:s,tooltipLabel:"Comments",onClick:()=>{if(!t)return;const{from:p,to:f}=t.state.selection,m=t.state.doc.textBetween(p,f,`
|