@simoncomputing/mui-bueno-v2 0.32.4 → 0.32.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,16 @@ 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.32.5] - 2026-06-23
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- `IconTooltip`, `HelpTooltip`
|
|
19
|
+
- changed `color` prop to use MUI theme colors and added passthrough of `SvgIconProps`
|
|
20
|
+
|
|
21
|
+
- `Table`/`PaginatedTable`
|
|
22
|
+
- replaced `tooltipColor` with `tooltipProps` (ex: `{ color: 'primary' }`)
|
|
23
|
+
|
|
14
24
|
## [0.32.4] - 2026-06-23
|
|
15
25
|
|
|
16
26
|
### Added
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TableProps as MuiTableProps } from '@mui/material';
|
|
1
|
+
import { TableProps as MuiTableProps, SvgIconProps } from '@mui/material';
|
|
2
2
|
import { SystemStyleObject, Theme } from '@mui/system';
|
|
3
3
|
import { TableColumn, SortOrder, TableConfig } from '../../@types';
|
|
4
4
|
import { default as React } from 'react';
|
|
@@ -155,10 +155,10 @@ export type BaseTableProps<T, K> = {
|
|
|
155
155
|
stickyHeader?: string;
|
|
156
156
|
reRenderExpand?: boolean;
|
|
157
157
|
/**
|
|
158
|
-
* Overrides the
|
|
159
|
-
*
|
|
158
|
+
* Overrides the styling for tooltip icon (TableColumn.tooltip).
|
|
159
|
+
* Ex: { color: 'primary' }
|
|
160
160
|
*/
|
|
161
|
-
|
|
161
|
+
tooltipProps?: SvgIconProps;
|
|
162
162
|
};
|
|
163
163
|
export type TableProps<T, K> = BaseTableProps<T, K> & Omit<MuiTableProps, 'stickyHeader'>;
|
|
164
164
|
/**
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { SvgIcon } from '@mui/material';
|
|
2
|
+
import { SvgIconProps } from '@mui/material/SvgIcon';
|
|
2
3
|
export type IconTooltipProps = {
|
|
3
|
-
/**
|
|
4
|
-
* Color of the tooltip (?) icon
|
|
5
|
-
*
|
|
6
|
-
* Note: Make sure to account for dark mode.
|
|
7
|
-
*/
|
|
8
|
-
color?: string;
|
|
9
4
|
/**
|
|
10
5
|
* Text that will display in the tooltip when hovering over the (?) icon.
|
|
11
6
|
*/
|
|
12
7
|
children?: string;
|
|
13
8
|
icon: typeof SvgIcon;
|
|
14
|
-
};
|
|
9
|
+
} & SvgIconProps;
|
|
15
10
|
/**
|
|
16
11
|
* Basic Icon Tooltip. Displays helpful message when user hovers over icon.
|
|
17
12
|
*/
|
|
18
|
-
export declare function IconTooltip({ icon: Icon,
|
|
13
|
+
export declare function IconTooltip({ icon: Icon, children, ...rest }: IconTooltipProps): import("react/jsx-runtime").JSX.Element | null;
|
|
19
14
|
export default IconTooltip;
|
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
|
`,Wce="️",Uce="",fb="";let Cf=null,Sf=null;function qce(t=[]){const e={};Sr.groups=e;const n=new Sr;Cf==null&&(Cf=zE(Lce)),Sf==null&&(Sf=zE(Bce)),Ae(n,"'",Kp),Ae(n,"{",ou),Ae(n,"}",iu),Ae(n,"[",Dp),Ae(n,"]",Ap),Ae(n,"(",Pp),Ae(n,")",Np),Ae(n,"<",$p),Ae(n,">",jp),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,"@",as),Ae(n,"`",Jp),Ae(n,"^",Xp),Ae(n,":",us),Ae(n,",",xx),Ae(n,"$",Zp),Ae(n,".",Bo),Ae(n,"=",Qp),Ae(n,"!",wx),Ae(n,"-",to),Ae(n,"%",su),Ae(n,"|",eh),Ae(n,"+",th),Ae(n,"#",nh),Ae(n,"?",au),Ae(n,'"',Cx),Ae(n,"/",Fo),Ae(n,";",Sx),Ae(n,"~",lu),Ae(n,"_",rh),Ae(n,"\\",Gp),Ae(n,"・",UD);const r=ln(n,xi,bx,{[g0]:!0});ln(r,xi,r);const o=ln(r,vi,HD,{[ru]:!0}),i=ln(r,Ic,WD,{[Vc]:!0}),s=ln(n,vi,Si,{[y0]:!0});ln(s,xi,o),ln(s,vi,s),ln(o,xi,o),ln(o,vi,o);const a=ln(n,Ic,x0,{[b0]:!0});ln(a,vi),ln(a,xi,i),ln(a,Ic,a),ln(i,xi,i),ln(i,vi),ln(i,Ic,i);const l=Ae(n,db,vx,{[lb]:!0}),u=Ae(n,VE,S0,{[lb]:!0}),f=ln(n,ub,S0,{[lb]:!0});Ae(n,fb,f),Ae(u,db,l),Ae(u,fb,f),ln(u,ub,f),Ae(f,VE),Ae(f,db),ln(f,ub,f),Ae(f,fb,f);const p=ln(n,cb,qD,{[zD]:!0});Ae(p,"#"),ln(p,cb,p),Ae(p,Wce,p);const m=Ae(p,Uce);Ae(m,"#"),ln(m,cb,p);const b=[[vi,s],[xi,o]],v=[[vi,null],[Ic,a],[xi,i]];for(let y=0;y<Cf.length;y++)ns(n,Cf[y],w0,Si,b);for(let y=0;y<Sf.length;y++)ns(n,Sf[y],C0,x0,v);aa(w0,{tld:!0,ascii:!0},e),aa(C0,{utld:!0,alpha:!0},e),ns(n,"file",Yf,Si,b),ns(n,"mailto",Yf,Si,b),ns(n,"http",pl,Si,b),ns(n,"https",pl,Si,b),ns(n,"ftp",pl,Si,b),ns(n,"ftps",pl,Si,b),aa(Yf,{scheme:!0,ascii:!0},e),aa(pl,{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]?{[Fce]:!0}:{[Vce]:!0};x.indexOf("-")>=0?k[v0]=!0:vi.test(x)?xi.test(x)?k[ru]=!0:k[y0]=!0:k[g0]=!0,FE(n,x,x,k)}return FE(n,"localhost",_u,{ascii:!0}),n.jd=new Sr(oh),{start:n,tokens:Object.assign({groups:e},KD)}}function YD(t,e){const n=Kce(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 Kce(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 ns(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 zE(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 Ru={defaultProtocol:"http",events:null,format:HE,formatHref:HE,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({},Ru);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:Ru,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]:Ru[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 HE(t){return t}function GD(t,e){this.t="token",this.v=t,this.tk=e}GD.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=Ru.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 GD{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 WE=bm("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),UE=bm("text"),Yce=bm("nl"),Tf=bm("url",{isLink:!0,toHref(t=Ru.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==_u&&t[1].t===us}}),Qr=t=>new Sr(t);function Gce({groups:t}){const e=t.domain.concat([qp,Yp,as,Gp,Jp,Xp,Zp,Qp,to,bx,su,eh,th,nh,Fo,oh,lu,rh]),n=[Kp,us,xx,Bo,wx,su,au,Cx,Sx,$p,jp,ou,iu,Ap,Dp,Pp,Np,Lp,Bp,Fp,Vp,zp,Hp,Wp,Up],r=[qp,Kp,Yp,Gp,Jp,Xp,Zp,Qp,to,ou,iu,su,eh,th,nh,au,Fo,oh,lu,rh],o=Qr(),i=Ae(o,lu);ft(i,r,i),ft(i,t.domain,i);const s=Qr(),a=Qr(),l=Qr();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,as);Ae(i,as,u),Ae(a,as,u),Ae(l,as,u);const f=Ae(i,Bo);ft(f,r,i),ft(f,t.domain,i);const p=Qr();ft(u,t.domain,p),ft(p,t.domain,p);const m=Ae(p,Bo);ft(m,t.domain,p);const b=Qr(WE);ft(m,t.tld,b),ft(m,t.utld,b),Ae(u,_u,b);const v=Ae(p,to);Ae(v,to,v),ft(v,t.domain,p),ft(b,t.domain,p),Ae(b,Bo,m),Ae(b,to,v);const y=Ae(b,us);ft(y,t.numeric,WE);const x=Ae(s,to),C=Ae(s,Bo);Ae(x,to,x),ft(x,t.domain,s),ft(C,r,i),ft(C,t.domain,s);const k=Qr(Tf);ft(C,t.tld,k),ft(C,t.utld,k),ft(k,t.domain,s),ft(k,r,i),Ae(k,Bo,C),Ae(k,to,x),Ae(k,as,u);const T=Ae(k,us),S=Qr(Tf);ft(T,t.numeric,S);const O=Qr(Tf),R=Qr();ft(O,e,O),ft(O,n,R),ft(R,e,O),ft(R,n,R),Ae(k,Fo,O),Ae(S,Fo,O);const P=Ae(a,us),$=Ae(l,us),F=Ae($,Fo),M=Ae(F,Fo);ft(a,t.domain,s),Ae(a,Bo,C),Ae(a,to,x),ft(l,t.domain,s),Ae(l,Bo,C),Ae(l,to,x),ft(P,t.domain,O),Ae(P,Fo,O),Ae(P,au,O),ft(M,t.domain,O),ft(M,e,O),Ae(M,Fo,O);const j=[[ou,iu],[Dp,Ap],[Pp,Np],[$p,jp],[Lp,Bp],[Fp,Vp],[zp,Hp],[Wp,Up]];for(let z=0;z<j.length;z++){const[L,A]=j[z],_=Ae(O,L);Ae(R,L,_),Ae(_,A,O);const I=Qr(Tf);ft(_,e,I);const B=Qr();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,_u,k),Ae(o,vx,Yce),{start:o,tokens:KD}}function Jce(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(UE,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(UE,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 Xce=typeof console<"u"&&console&&console.warn||(()=>{}),Zce="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 Qce(){return Sr.groups={},Ut.scanner=null,Ut.parser=null,Ut.tokenQueue=[],Ut.pluginQueue=[],Ut.customSchemes=[],Ut.initialized=!1,Ut}function qE(t,e=!1){if(Ut.initialized&&Xce(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Zce}`),!/^[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 eue(){Ut.scanner=qce(Ut.customSchemes);for(let t=0;t<Ut.tokenQueue.length;t++)Ut.tokenQueue[t][1]({scanner:Ut.scanner});Ut.parser=Gce(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||eue(),Jce(Ut.parser.start,t,YD(Ut.scanner.start,t))}kx.scan=YD;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 ]",tue=new RegExp(Ex),nue=new RegExp(`${Ex}$`),rue=new RegExp(Ex,"g");function oue(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function iue(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=S7(n.doc,[...e]);if(_7(a).forEach(({newRange:u})=>{const f=k7(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(!nue.test(b))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const b=m.split(tue).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(C=>C.toObject(t.defaultProtocol));if(!oue(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=>{av(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 sue(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 aue(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 Ys(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(rue,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const lue=Mr.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"){qE(t);return}qE(t.scheme,t.optionalSlashes)})},onDestroy(){Qce()},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)=>!!Ys(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=>!!Ys(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=>!!Ys(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=>!!Ys(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=>!!Ys(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[ks({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=>!!Ys(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(iue({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ys(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(sue({type:this.type})),this.options.linkOnPaste&&t.push(aue({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function cue(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=uU(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 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 S=T+x[0].length;return l&&f.test(v.slice(S-1,S+1))&&(x[0]+=" ",S+=1),T<a.pos&&S>=a.pos?{range:{from:T,to:S},query:x[0].slice(n.length),text:x[0]}:null}const uue=new On("suggestion");function due({pluginKey:t=uue,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=cue}){let x;const C=b==null?void 0:b(),k=new on({key:t,view(){return{update:async(T,S)=>{var O,R,P,$,F,M,j;const z=(O=this.key)===null||O===void 0?void 0:O.getState(S),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,pe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:ce=>p({editor:e,range:Y.range,props:ce}),decorationNode:pe,clientRect:pe?()=>{var ce;const{decorationId:le}=(ce=this.key)===null||ce===void 0?void 0:ce.getState(e.state),X=T.dom.querySelector(`[data-decoration-id="${le}"]`);return(X==null?void 0:X.getBoundingClientRect())||null}:null},W&&((P=C==null?void 0:C.onBeforeStart)===null||P===void 0||P.call(C,x)),K&&(($=C==null?void 0:C.onBeforeUpdate)===null||$===void 0||$.call(C,x)),(K||W)&&(x.items=await m({editor:e,query:Y.query})),U&&((F=C==null?void 0:C.onExit)===null||F===void 0||F.call(C,x)),K&&((M=C==null?void 0:C.onUpdate)===null||M===void 0||M.call(C,x)),W&&((j=C==null?void 0:C.onStart)===null||j===void 0||j.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,S,O,R){const{isEditable:P}=e,{composing:$}=e.view,{selection:F}=T,{empty:M,from:j}=F,z={...S};if(z.composing=$,P&&(M||e.view.composing)){(j<S.range.from||j>S.range.to)&&!$&&!S.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:S.active})?(z.active=!0,z.decorationId=S.decorationId?S.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,S){var O;const{active:R,range:P}=k.getState(T.state);return R&&((O=C==null?void 0:C.onKeyDown)===null||O===void 0?void 0:O.call(C,{view:T,event:S,range:P}))||!1},decorations(T){const{active:S,range:O,decorationId:R,query:P}=k.getState(T);if(!S)return null;const $=!(P!=null&&P.length),F=[l];return $&&F.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:F.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function fue({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 XD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>fue({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function KE(t,e){const n=XD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const pue=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=KE(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:KE(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 Ii,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 XD(this).map(due)}}),ZD=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=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),hue=Mr.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()}}}),mue=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]}}),gue=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]}}),yue=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]}}),bue=/^\s*(\[([( |x])?\])\s$/,vue=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[Pl({find:bue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),xue=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()}}}),wue=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")}}}),QD=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});QD.displayName="SuggestionList";const YE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Cue={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 nI(QD,{props:n,editor:n.editor}),e=Ku("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??YE},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))??YE}})},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}}}},Sue=lue.extend({inclusive:!1}),Tue=hue.extend({excludes:"superscript"}),kue=OI.extend({excludes:"subscript"});function Eue({placeholder:t}={}){return J.useMemo(()=>[pte.configure({resizable:!0}),yue,gue,mue,yR,vR,xR,TR,AR,PR,NR,Tue,kue,jR,gR,mR,bR,DR,EI,$R,Sue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),JQ,SR,YQ,wue.configure({types:["heading","paragraph","image"]}),Nce,$ce,jce,WZ,BR.configure({multicolor:!0}),IR,dee,wR,xue,vue.configure({nested:!0}),pue.configure({suggestion:Cue}),ZD.configure({placeholder:t}),RR],[t])}function GE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Oue=t=>{const e=Eue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(TI,{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 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(p)},[p]);const m=J.useRef(null),b=J.useCallback((C,k)=>{var S;const T=(S=m.current)==null?void 0:S.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(O=>{t0({images:O,editor:T,position:k})});else{const O=i(C);t0({images:O,editor:T,position:k})}},[]),v=J.useCallback((C,k,T,S)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=GE(k.dataTransfer.files);if(O.length>0){const P=(R=C.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((C,k,T)=>{if(!k.clipboardData)return!1;const S=GE(k.clipboardData.files);return S.length>0?(b(S),!0):!1},[b]),x=g.jsx(V.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(SI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(Ace,{onUploadFiles:i}),onBlur:()=>{var C,k;return f(((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(Pte,{}),g.jsx(Yte,{})]})})});return g.jsxs(V.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(V.Typography,{...o,children:r}),x]})},JE=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,{})})]})},Yo=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Iu=t=>{const{gap:e=1,...n}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function eA({icon:t,color:e="inherit",children:n}){return n?g.jsx(V.Tooltip,{title:n,children:g.jsx(V.IconButton,{disableTouchRipple:!0,size:"small",children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:e}})})}):null}function tA(t){return g.jsx(eA,{icon:Une,...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:C,retryCallback:k,isLoading:T=!1,disableMobileCards:S=!1,highlightSelectedRow:O=!1,selectedRowColor:R,selectedRowKey:P,headerRowStyle:$={},stickyHeader:F,reRenderExpand:M=!1,expandOnRowClick:j=!1,tooltipColor: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);Mue(t);const U=me=>{me!==f?m&&m(me,"asc"):m&&m(f,p==="asc"?"desc":"asc")},Y=me=>f===me?p:null,pe=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),ce=r.filter(me=>!me.hideCol&&(!pe||!me.hideOnMobile));u&&!pe&&ce.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,$e)=>{const Ie=n($e),gt=I===Ie;return g.jsx(V.IconButton,{"data-testid":"expand-collapse-btn","aria-label":gt?"collapse row":"expand row",size:"small",onClick:()=>Z(Ie),children:gt?g.jsx(Bf,{"data-testid":"collapse-up"}):g.jsx(ib,{"data-testid":"expand-down"})})}}),a&&l&&ce.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,$e)=>{const Ie=n($e);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 le=m!==void 0,X=me=>le?b?b.includes(me):!0:!1,oe=g.jsxs(V.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(qne,{})," ",x]}),fe=g.jsxs(V.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(SM,{color:"error"})," ",C,k&&g.jsx(V.Button,{variant:"text",onClick:k,children:"Retry?"})]}),te=()=>{if(C)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:fe})});if(o.length===0)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:oe})})},re=()=>{if(C)return fe;if(o.length===0)return oe},ue=me=>{O&&K(me)},ge=me=>{const $e=n(me);if((i||s)&&(i==null||i($e),s==null||s(me),ue($e)),u&&j){const Ie=I===$e?void 0:$e;B(Ie),ue(Ie)}},Z=me=>{const $e=I===me?void 0:me;B($e),ue($e)},ee=me=>{if(!u)return;const $e=I===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(V.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>Z(n(me)),children:[$e?g.jsx(Bf,{}):g.jsx(ib,{})," Show"," ",$e?"Less":"More"]}),g.jsx(JE,{colSpan:r.length,isExpanded:n(me)===I,obj:me,renderExpand:Ie=>u(Ie),asMobileCard:!0})]})},ie=R??_,Ce=me=>{const Ie=(O?W:P)===n(me)?ie:"inherit",gt=i||s||j;return{cursor:gt?"pointer":"default",backgroundColor:Ie,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...gt&&{"&:hover":{backgroundColor:Ie===ie?fse(Ie,.1):ie}}}},Se=me=>g.jsx(tA,{color:z,children:me}),De=(me,$e)=>{const Ie=me.find(lt=>lt.key==="MBv2_Checkbox_Column"),gt=ce.filter(lt=>lt.key!=="MBv2_Checkbox_Column");return g.jsxs(Yo,{alignItems:"flex-start",children:[Ie&&g.jsx(Iu,{children:kl(Ie,$e,pe)}),g.jsxs(Iu,{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)),Se(lt.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${wn(lt)}`,style:{paddingLeft:"10px"},children:kl(lt,$e,pe)})]},`row-${n($e)}-${wn(lt)}`))})}),ee($e)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[le&&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:ce.map(me=>{if(X(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(Qne,{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",...Ce(me)},onClick:()=>ge(me),"data-testid":`card-${n(me)}`,children:De(ce,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:$?{"& .MuiTableCell-head":{...$}}:{},...L,children:[g.jsx(V.TableHead,{className:"MBv2_Table_Head",children:g.jsx(V.TableRow,{className:"MBv2_Table_Head_Row",children:ce.map((me,$e)=>{const Ie=X(wn(me));return g.jsx(V.TableCell,{width:Array.isArray(v)?v[$e]:"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))}),Se(me.tooltip),Ie&&Y(wn(me))==="asc"&&g.jsx(Bf,{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(Xne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${wn(me)}`)})})}),g.jsx(V.TableBody,{className:"MBv2_Table_Body",children:te()??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:Ce(me),children:ce.map($e=>g.jsx(V.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${wn($e)}`,children:kl($e,me,pe)},`row-${n(me)}-${wn($e)}`))}),u&&g.jsx(JE,{colSpan:ce.length,isExpanded:n(me)===I,obj:me,renderExpand:$e=>u($e),reRenderExpand:M})]},n(me)))})]})});return g.jsx(Ox,{isLoading:T,children:pe&&!S?Me():Re()})},Mue=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,_ue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),kl=(t,e,n=!1)=>{const r=_ue(e,t.fieldName);return t.render?t.render(r,e,n):r},nA=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,C)=>m(C),onRowsPerPageChange:b,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},XE=()=>({height:window.innerHeight,width:window.innerWidth}),rA=()=>{const[t,e]=J.useState(XE());return J.useEffect(()=>{const n=()=>{e(XE())};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}=rA(),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,...hr({...t},a)})},Rue=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(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(Zv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Iue=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(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(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(Iue,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function oA({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(Hne,{})})})}function iA({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 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:C=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:S,addlActions:O,readOnly:R=!1,showCloseBtn:P=!1,canSearch:$=!1}=t,F=!!t.canCreate&&!R,M=!!a&&!!s&&!R,j=!!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),[pe,ce]=J.useState(null),[le,X]=J.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:$?"":void 0}),oe=()=>{B(!1),K(!0),v({pageNo:le.pageNo,pageSize:le.pageSize,search:le.search},y).then(Re=>(_(Re.data),X(me=>({...me,totalCount:Re.totalCount})),Re)).catch(Re=>{C(Re),B(!0),_([])}).finally(()=>K(!1))};J.useEffect(oe,[le.pageNo,le.pageSize,e,le.search]);const fe=()=>{ce(null),Y(null)},te=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(Kh,{}),children:"Add Citation"}),re=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(LI,{}),children:"Add Attachment"}),ue=Re=>{if(!(!M&&!j)){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(Wne,{})})});if(j)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(ere,{})})})}},ge=Re=>{if(!(!z||R))return g.jsx(V.Tooltip,{title:"Delete",children:g.jsx(V.IconButton,{color:"error",onClick:me=>{ce(Re),Y(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Re.id}`,children:g.jsx(Zv,{})})})},Z=Re=>g.jsx(T0,{citation:Re,canLaunchUrl:S}),ee=Re=>g.jsx(iA,{citation:Re,onPreviewAttachment:m}),ie=Re=>g.jsx(oA,{citation:Re,onDownloadAttachment:p}),Ce=j||M||z||S||m||p||O,Se=[...sA(L,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Ce,render:(Re,me)=>g.jsxs(V.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(me),ge(me),ue(me),ee(me),Z(me),ie(me)]})}],De=J.useCallback(Re=>{X(me=>({...me,pageNo:0,search:Re}))},[]),Me=()=>$?g.jsx(VI,{onSearch:De}):null;return g.jsxs(Iu,{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:[te,re]}),P&&g.jsx(V.IconButton,{onClick:r,children:g.jsx(tm,{})})]}),Me(),g.jsx(nA,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:W,columns:Se,data:A,paginationState:le,onPageChange:Re=>X(me=>({...me,pageNo:Re})),onRowsPerPageChange:Re=>X(me=>({...me,pageSize:Re,pageNo:0})),errorTableMsg:I?"Failed to load citations.":void 0,retryCallback:oe,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:[te,re]})}),!R&&g.jsxs(V.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(Rue,{citation:pe,anchorEl:U,onDeleteCitation:f,onClose:fe})]})},ZE=(t,e)=>{const n=t?Ea.truncate(e,{length:30,omission:"..."}):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})},sA=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(V.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(LI,{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=>ZE(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>ZE(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,QE;function Aue(){if(QE)return hb;QE=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);hb={Cache:t,split:p,normalizePath:f,setter:function(C){var k=f(C);return l.get(C)||l.set(C,function(S,O){for(var R=0,P=k.length,$=S;R<P-1;){var F=k[R];if(F==="__proto__"||F==="constructor"||F==="prototype")return S;$=$[k[R++]]}$[k[R]]=O})},getter:function(C,k){var T=f(C);return u.get(C)||u.set(C,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(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:p(C),k,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(k){return k.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,k,T){var S=C.length,O,R,P,$;for(R=0;R<S;R++)O=C[R],O&&(x(O)&&(O='"'+O+'"'),$=b(O),P=!$&&/^\d+$/.test(O),k.call(T,O,$,P,R,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 hb}var ma=Aue(),mb,eO;function Pue(){if(eO)return mb;eO=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(),kf={exports:{}},tO;function Nue(){if(tO)return kf.exports;tO=1,kf.exports=function(o){return t(e(o),o)},kf.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 C=f.get(b)||new Set;if(C=Array.from(C),v=C.length){y.add(b);do{var k=C[--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 kf.exports}var $ue=Nue();const jue=er($ue),Lue=Object.prototype.toString,Bue=Error.prototype.toString,Fue=RegExp.prototype.toString,Vue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",zue=/^Symbol\((.*)\)(.*)$/;function Hue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function nO(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Hue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Vue.call(t).replace(zue,"Symbol($1)");const r=Lue.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"?Fue.call(t):null}function Ss(t,e){let n=nO(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=nO(this[r],e);return i!==null?i:o},2)}function aA(t){return t==null?[]:[].concat(t)}let lA,cA,uA,Wue=/\$\{\s*(\w+)\s*\}/g;lA=Symbol.toStringTag;class rO{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[lA]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],aA(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}cA=Symbol.hasInstance;uA=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Wue,(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 rO(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[uA]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[cA](e){return rO[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${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}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Uue={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}"},que={isValue:"${path} field must be ${value}"},Gf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Kue={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"},Yue={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 pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:Uue,date:k0,object:Gf,array:Kue,boolean:que,tuple:Yue});const _x=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(!_x(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ef={context:"$",value:"."};class Na{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Ef.context,this.isValue=this.key[0]===Ef.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ef.context:this.isValue?Ef.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ma.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Na.prototype.__isYupRef=!0;const la=t=>t==null;function al(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent: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(j={}){const z=dA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||C},p,j.params),k),L=new pr(pr.formatError(j.message||m,z),n,z.path,j.type||u,z.disableStackTrace);return L.params=z,L}const S=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return fA(j,k)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?S(j):j?l(null):S(T())},P=j=>{pr.isError(j)?S(j):a(j)};if(b&&la(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(j){P(j);return}R(F)}return e.OPTIONS=t,e}function dA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=fA(t[n],e);return t}function fA(t,e){return Na.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Gue(t,e,n,r=n){let o,i,s;return e?(ma.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(Na.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new 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 yl(t,e=new Map){if(_x(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=yl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,yl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(yl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=yl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function Jue(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 Xue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:Jue(n)}))}function pA(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Xue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>pA(o,r))}class ni{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(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=yl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&la(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 eue(){Ut.scanner=qce(Ut.customSchemes);for(let t=0;t<Ut.tokenQueue.length;t++)Ut.tokenQueue[t][1]({scanner:Ut.scanner});Ut.parser=Gce(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||eue(),Jce(Ut.parser.start,t,YD(Ut.scanner.start,t))}kx.scan=YD;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 ]",tue=new RegExp(Ex),nue=new RegExp(`${Ex}$`),rue=new RegExp(Ex,"g");function oue(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function iue(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=S7(n.doc,[...e]);if(_7(a).forEach(({newRange:u})=>{const f=k7(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(!nue.test(b))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const b=m.split(tue).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(C=>C.toObject(t.defaultProtocol));if(!oue(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=>{av(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 sue(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 aue(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 Ys(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(rue,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const lue=Mr.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"){qE(t);return}qE(t.scheme,t.optionalSlashes)})},onDestroy(){Qce()},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)=>!!Ys(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=>!!Ys(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=>!!Ys(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=>!!Ys(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=>!!Ys(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[ks({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=>!!Ys(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(iue({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ys(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(sue({type:this.type})),this.options.linkOnPaste&&t.push(aue({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function cue(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=uU(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 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 S=T+x[0].length;return l&&f.test(v.slice(S-1,S+1))&&(x[0]+=" ",S+=1),T<a.pos&&S>=a.pos?{range:{from:T,to:S},query:x[0].slice(n.length),text:x[0]}:null}const uue=new On("suggestion");function due({pluginKey:t=uue,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=cue}){let x;const C=b==null?void 0:b(),k=new on({key:t,view(){return{update:async(T,S)=>{var O,R,P,$,F,M,j;const z=(O=this.key)===null||O===void 0?void 0:O.getState(S),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,pe=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:ce=>p({editor:e,range:Y.range,props:ce}),decorationNode:pe,clientRect:pe?()=>{var ce;const{decorationId:le}=(ce=this.key)===null||ce===void 0?void 0:ce.getState(e.state),X=T.dom.querySelector(`[data-decoration-id="${le}"]`);return(X==null?void 0:X.getBoundingClientRect())||null}:null},W&&((P=C==null?void 0:C.onBeforeStart)===null||P===void 0||P.call(C,x)),K&&(($=C==null?void 0:C.onBeforeUpdate)===null||$===void 0||$.call(C,x)),(K||W)&&(x.items=await m({editor:e,query:Y.query})),U&&((F=C==null?void 0:C.onExit)===null||F===void 0||F.call(C,x)),K&&((M=C==null?void 0:C.onUpdate)===null||M===void 0||M.call(C,x)),W&&((j=C==null?void 0:C.onStart)===null||j===void 0||j.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,S,O,R){const{isEditable:P}=e,{composing:$}=e.view,{selection:F}=T,{empty:M,from:j}=F,z={...S};if(z.composing=$,P&&(M||e.view.composing)){(j<S.range.from||j>S.range.to)&&!$&&!S.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:S.active})?(z.active=!0,z.decorationId=S.decorationId?S.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,S){var O;const{active:R,range:P}=k.getState(T.state);return R&&((O=C==null?void 0:C.onKeyDown)===null||O===void 0?void 0:O.call(C,{view:T,event:S,range:P}))||!1},decorations(T){const{active:S,range:O,decorationId:R,query:P}=k.getState(T);if(!S)return null;const $=!(P!=null&&P.length),F=[l];return $&&F.push(f),Xt.create(T.doc,[Qn.inline(O.from,O.to,{nodeName:a,class:F.join(" "),"data-decoration-id":R,"data-decoration-content":u})])}}});return k}function fue({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 XD(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>fue({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function KE(t,e){const n=XD(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const pue=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=KE(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:KE(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 Ii,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 XD(this).map(due)}}),ZD=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=Qn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),hue=Mr.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()}}}),mue=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]}}),gue=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]}}),yue=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]}}),bue=/^\s*(\[([( |x])?\])\s$/,vue=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[Pl({find:bue,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),xue=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()}}}),wue=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")}}}),QD=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});QD.displayName="SuggestionList";const YE={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Cue={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 nI(QD,{props:n,editor:n.editor}),e=Ku("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??YE},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))??YE}})},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}}}},Sue=lue.extend({inclusive:!1}),Tue=hue.extend({excludes:"superscript"}),kue=OI.extend({excludes:"subscript"});function Eue({placeholder:t}={}){return J.useMemo(()=>[pte.configure({resizable:!0}),yue,gue,mue,yR,vR,xR,TR,AR,PR,NR,Tue,kue,jR,gR,mR,bR,DR,EI,$R,Sue.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),JQ,SR,YQ,wue.configure({types:["heading","paragraph","image"]}),Nce,$ce,jce,WZ,BR.configure({multicolor:!0}),IR,dee,wR,xue,vue.configure({nested:!0}),pue.configure({suggestion:Cue}),ZD.configure({placeholder:t}),RR],[t])}function GE(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Oue=t=>{const e=Eue({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(TI,{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 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(p)},[p]);const m=J.useRef(null),b=J.useCallback((C,k)=>{var S;const T=(S=m.current)==null?void 0:S.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(O=>{t0({images:O,editor:T,position:k})});else{const O=i(C);t0({images:O,editor:T,position:k})}},[]),v=J.useCallback((C,k,T,S)=>{var R;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=GE(k.dataTransfer.files);if(O.length>0){const P=(R=C.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((C,k,T)=>{if(!k.clipboardData)return!1;const S=GE(k.clipboardData.files);return S.length>0?(b(S),!0):!1},[b]),x=g.jsx(V.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(SI,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(Ace,{onUploadFiles:i}),onBlur:()=>{var C,k;return f(((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(Pte,{}),g.jsx(Yte,{})]})})});return g.jsxs(V.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(V.Typography,{...o,children:r}),x]})},JE=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,{})})]})},Yo=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Iu=t=>{const{gap:e=1,...n}=t;return g.jsx(V.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function eA({icon:t,children:e,...n}){return e?g.jsx(V.Tooltip,{title:e,children:g.jsx(V.IconButton,{disableTouchRipple:!0,size:"small",children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",...n})})}):null}function tA(t){return g.jsx(eA,{icon:Une,...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:C,retryCallback:k,isLoading:T=!1,disableMobileCards:S=!1,highlightSelectedRow:O=!1,selectedRowColor:R,selectedRowKey:P,headerRowStyle:$={},stickyHeader:F,reRenderExpand:M=!1,expandOnRowClick:j=!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);Mue(t);const U=me=>{me!==f?m&&m(me,"asc"):m&&m(f,p==="asc"?"desc":"asc")},Y=me=>f===me?p:null,pe=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),ce=r.filter(me=>!me.hideCol&&(!pe||!me.hideOnMobile));u&&!pe&&ce.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,$e)=>{const Ie=n($e),gt=I===Ie;return g.jsx(V.IconButton,{"data-testid":"expand-collapse-btn","aria-label":gt?"collapse row":"expand row",size:"small",onClick:()=>Z(Ie),children:gt?g.jsx(Bf,{"data-testid":"collapse-up"}):g.jsx(ib,{"data-testid":"expand-down"})})}}),a&&l&&ce.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,$e)=>{const Ie=n($e);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 le=m!==void 0,X=me=>le?b?b.includes(me):!0:!1,oe=g.jsxs(V.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(qne,{})," ",x]}),fe=g.jsxs(V.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(SM,{color:"error"})," ",C,k&&g.jsx(V.Button,{variant:"text",onClick:k,children:"Retry?"})]}),te=()=>{if(C)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:fe})});if(o.length===0)return g.jsx(V.TableRow,{children:g.jsx(V.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:oe})})},re=()=>{if(C)return fe;if(o.length===0)return oe},ue=me=>{O&&K(me)},ge=me=>{const $e=n(me);if((i||s)&&(i==null||i($e),s==null||s(me),ue($e)),u&&j){const Ie=I===$e?void 0:$e;B(Ie),ue(Ie)}},Z=me=>{const $e=I===me?void 0:me;B($e),ue($e)},ee=me=>{if(!u)return;const $e=I===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(V.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>Z(n(me)),children:[$e?g.jsx(Bf,{}):g.jsx(ib,{})," Show"," ",$e?"Less":"More"]}),g.jsx(JE,{colSpan:r.length,isExpanded:n(me)===I,obj:me,renderExpand:Ie=>u(Ie),asMobileCard:!0})]})},ie=R??_,Ce=me=>{const Ie=(O?W:P)===n(me)?ie:"inherit",gt=i||s||j;return{cursor:gt?"pointer":"default",backgroundColor:Ie,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...gt&&{"&:hover":{backgroundColor:Ie===ie?fse(Ie,.1):ie}}}},Se=me=>g.jsx(tA,{...z,children:me}),De=(me,$e)=>{const Ie=me.find(lt=>lt.key==="MBv2_Checkbox_Column"),gt=ce.filter(lt=>lt.key!=="MBv2_Checkbox_Column");return g.jsxs(Yo,{alignItems:"flex-start",children:[Ie&&g.jsx(Iu,{children:kl(Ie,$e,pe)}),g.jsxs(Iu,{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)),Se(lt.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${wn(lt)}`,style:{paddingLeft:"10px"},children:kl(lt,$e,pe)})]},`row-${n($e)}-${wn(lt)}`))})}),ee($e)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[le&&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:ce.map(me=>{if(X(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(Qne,{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",...Ce(me)},onClick:()=>ge(me),"data-testid":`card-${n(me)}`,children:De(ce,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:$?{"& .MuiTableCell-head":{...$}}:{},...L,children:[g.jsx(V.TableHead,{className:"MBv2_Table_Head",children:g.jsx(V.TableRow,{className:"MBv2_Table_Head_Row",children:ce.map((me,$e)=>{const Ie=X(wn(me));return g.jsx(V.TableCell,{width:Array.isArray(v)?v[$e]:"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))}),Se(me.tooltip),Ie&&Y(wn(me))==="asc"&&g.jsx(Bf,{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(Xne,{style:{marginLeft:"5px"}})]})})},`rowHeader-${wn(me)}`)})})}),g.jsx(V.TableBody,{className:"MBv2_Table_Body",children:te()??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:Ce(me),children:ce.map($e=>g.jsx(V.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${wn($e)}`,children:kl($e,me,pe)},`row-${n(me)}-${wn($e)}`))}),u&&g.jsx(JE,{colSpan:ce.length,isExpanded:n(me)===I,obj:me,renderExpand:$e=>u($e),reRenderExpand:M})]},n(me)))})]})});return g.jsx(Ox,{isLoading:T,children:pe&&!S?Me():Re()})},Mue=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,_ue=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),kl=(t,e,n=!1)=>{const r=_ue(e,t.fieldName);return t.render?t.render(r,e,n):r},nA=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,C)=>m(C),onRowsPerPageChange:b,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},XE=()=>({height:window.innerHeight,width:window.innerWidth}),rA=()=>{const[t,e]=J.useState(XE());return J.useEffect(()=>{const n=()=>{e(XE())};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}=rA(),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,...hr({...t},a)})},Rue=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(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(Zv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Iue=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(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(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(Iue,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function oA({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(Hne,{})})})}function iA({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 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:C=()=>{},condenseTable:k=!1,canSelect:T=!1,canLaunchUrl:S,addlActions:O,readOnly:R=!1,showCloseBtn:P=!1,canSearch:$=!1}=t,F=!!t.canCreate&&!R,M=!!a&&!!s&&!R,j=!!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),[pe,ce]=J.useState(null),[le,X]=J.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:$?"":void 0}),oe=()=>{B(!1),K(!0),v({pageNo:le.pageNo,pageSize:le.pageSize,search:le.search},y).then(Re=>(_(Re.data),X(me=>({...me,totalCount:Re.totalCount})),Re)).catch(Re=>{C(Re),B(!0),_([])}).finally(()=>K(!1))};J.useEffect(oe,[le.pageNo,le.pageSize,e,le.search]);const fe=()=>{ce(null),Y(null)},te=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(Kh,{}),children:"Add Citation"}),re=g.jsx(Tr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(LI,{}),children:"Add Attachment"}),ue=Re=>{if(!(!M&&!j)){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(Wne,{})})});if(j)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(ere,{})})})}},ge=Re=>{if(!(!z||R))return g.jsx(V.Tooltip,{title:"Delete",children:g.jsx(V.IconButton,{color:"error",onClick:me=>{ce(Re),Y(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Re.id}`,children:g.jsx(Zv,{})})})},Z=Re=>g.jsx(T0,{citation:Re,canLaunchUrl:S}),ee=Re=>g.jsx(iA,{citation:Re,onPreviewAttachment:m}),ie=Re=>g.jsx(oA,{citation:Re,onDownloadAttachment:p}),Ce=j||M||z||S||m||p||O,Se=[...sA(L,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Ce,render:(Re,me)=>g.jsxs(V.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(me),ge(me),ue(me),ee(me),Z(me),ie(me)]})}],De=J.useCallback(Re=>{X(me=>({...me,pageNo:0,search:Re}))},[]),Me=()=>$?g.jsx(VI,{onSearch:De}):null;return g.jsxs(Iu,{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:[te,re]}),P&&g.jsx(V.IconButton,{onClick:r,children:g.jsx(tm,{})})]}),Me(),g.jsx(nA,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:W,columns:Se,data:A,paginationState:le,onPageChange:Re=>X(me=>({...me,pageNo:Re})),onRowsPerPageChange:Re=>X(me=>({...me,pageSize:Re,pageNo:0})),errorTableMsg:I?"Failed to load citations.":void 0,retryCallback:oe,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:[te,re]})}),!R&&g.jsxs(V.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(Rue,{citation:pe,anchorEl:U,onDeleteCitation:f,onClose:fe})]})},ZE=(t,e)=>{const n=t?Ea.truncate(e,{length:30,omission:"..."}):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})},sA=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(V.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(LI,{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=>ZE(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>ZE(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,QE;function Aue(){if(QE)return hb;QE=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);hb={Cache:t,split:p,normalizePath:f,setter:function(C){var k=f(C);return l.get(C)||l.set(C,function(S,O){for(var R=0,P=k.length,$=S;R<P-1;){var F=k[R];if(F==="__proto__"||F==="constructor"||F==="prototype")return S;$=$[k[R++]]}$[k[R]]=O})},getter:function(C,k){var T=f(C);return u.get(C)||u.set(C,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(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:p(C),k,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(k){return k.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,k,T){var S=C.length,O,R,P,$;for(R=0;R<S;R++)O=C[R],O&&(x(O)&&(O='"'+O+'"'),$=b(O),P=!$&&/^\d+$/.test(O),k.call(T,O,$,P,R,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 hb}var ma=Aue(),mb,eO;function Pue(){if(eO)return mb;eO=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(),kf={exports:{}},tO;function Nue(){if(tO)return kf.exports;tO=1,kf.exports=function(o){return t(e(o),o)},kf.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 C=f.get(b)||new Set;if(C=Array.from(C),v=C.length){y.add(b);do{var k=C[--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 kf.exports}var $ue=Nue();const jue=er($ue),Lue=Object.prototype.toString,Bue=Error.prototype.toString,Fue=RegExp.prototype.toString,Vue=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",zue=/^Symbol\((.*)\)(.*)$/;function Hue(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function nO(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Hue(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Vue.call(t).replace(zue,"Symbol($1)");const r=Lue.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"?Fue.call(t):null}function Ss(t,e){let n=nO(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=nO(this[r],e);return i!==null?i:o},2)}function aA(t){return t==null?[]:[].concat(t)}let lA,cA,uA,Wue=/\$\{\s*(\w+)\s*\}/g;lA=Symbol.toStringTag;class rO{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[lA]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],aA(e).forEach(i=>{if(pr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}cA=Symbol.hasInstance;uA=Symbol.toStringTag;class pr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Wue,(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 rO(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[uA]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,pr)}static[cA](e){return rO[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Vo={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${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}},wr={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Uue={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}"},que={isValue:"${path} field must be ${value}"},Gf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Kue={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"},Yue={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 pr.formatError(Vo.notType,t)}};Object.assign(Object.create(null),{mixed:Vo,string:wr,number:Uue,date:k0,object:Gf,array:Kue,boolean:que,tuple:Yue});const _x=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(!_x(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Ef={context:"$",value:"."};class Na{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===Ef.context,this.isValue=this.key[0]===Ef.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Ef.context:this.isValue?Ef.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&ma.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}Na.prototype.__isYupRef=!0;const la=t=>t==null;function al(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent: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(j={}){const z=dA(Object.assign({value:n,originalValue:i,label:s.spec.label,path:j.path||r,spec:s.spec,disableStackTrace:j.disableStackTrace||C},p,j.params),k),L=new pr(pr.formatError(j.message||m,z),n,z.path,j.type||u,z.disableStackTrace);return L.params=z,L}const S=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(j){return fA(j,k)},options:o,originalValue:i,schema:s};const R=j=>{pr.isError(j)?S(j):j?l(null):S(T())},P=j=>{pr.isError(j)?S(j):a(j)};if(b&&la(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(j){P(j);return}R(F)}return e.OPTIONS=t,e}function dA(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=fA(t[n],e);return t}function fA(t,e){return Na.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function Gue(t,e,n,r=n){let o,i,s;return e?(ma.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(Na.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new 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 yl(t,e=new Map){if(_x(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=yl(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,yl(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(yl(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=yl(o,e)}else throw Error(`Unable to clone ${t}`);return n}function Jue(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 Xue(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:Jue(n)}))}function pA(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return Xue(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>pA(o,r))}class ni{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(Vo.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=yl(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({},n,{value:e})),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&la(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)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):yl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=al({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=al({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Vo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Vo.notNull){return this.nullability(!1,e)}required(e=Vo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Vo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=al(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=aA(e).map(i=>new Na(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=al({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Vo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=al({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Vo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=al({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?dA(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:pA(o)};throw o}}}}}ni.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ni.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Gue(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ni.prototype[t]=ni.prototype.oneOf;for(const t of["not","nope"])ni.prototype[t]=ni.prototype.notOneOf;const Zue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Que(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=Zue.exec(t);return r?{year:wi(r[1]),month:wi(r[2],1)-1,day:wi(r[3],1),hour:wi(r[4]),minute:wi(r[5]),second:wi(r[6]),millisecond:r[7]?wi(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:wi(r[10]),minuteOffset:wi(r[11])}:null}function wi(t,e=0){return Number(t)||e}let ede=/^[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])?)*$/,tde=/^((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,nde=/^(?:[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,rde="^\\d{4}-\\d{2}-\\d{2}",ode="\\d{2}:\\d{2}:\\d{2}",ide="(([+-]\\d{2}(:?\\d{2})?)|Z)",sde=new RegExp(`${rde}T${ode}(\\.\\d+)?${ide}$`),ade=t=>la(t)||t===t.trim(),lde={}.toString();function El(){return new hA}class hA extends ni{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===lde?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Vo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=wr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=wr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=wr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||wr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=wr.email){return this.matches(ede,{name:"email",message:e,excludeEmptyString:!0})}url(e=wr.url){return this.matches(tde,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=wr.uuid){return this.matches(nde,{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(sde,{name:"datetime",message:n||wr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||wr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=E0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||wr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=E0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=wr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:ade})}lowercase(e=wr.lowercase){return this.transform(n=>la(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>la(n)||n===n.toLowerCase()})}uppercase(e=wr.uppercase){return this.transform(n=>la(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>la(n)||n===n.toUpperCase()})}}El.prototype=hA.prototype;let mA=new Date(""),cde=t=>Object.prototype.toString.call(t)==="[object Date]";function Rx(){return new Qu}class Qu extends ni{constructor(){super({type:"date",check(e){return cde(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Que(e),isNaN(e)?Qu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Na.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=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)}})}}Qu.INVALID_DATE=mA;Rx.prototype=Qu.prototype;Rx.INVALID_DATE=mA;function ude(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=ma.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Na.isRef(a)&&a.isSibling?i(a.path,s):_x(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return jue.array(Array.from(r),n).reverse()}function oO(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 gA(t){return(e,n)=>oO(t,e)-oO(t,n)}const dde=(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 Jf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Jf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Jf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Jf)}):"optional"in t?t.optional():t}const fde=(t,e)=>{const n=[...ma.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=ma.getter(ma.join(n),!0)(t);return!!(o&&r in o)};let iO=t=>Object.prototype.toString.call(t)==="[object Object]";function sO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const pde=gA([]);function Ix(t){return new yA(t)}class yA extends ni{constructor(e){super({type:"object",check(n){return iO(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=pde,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 ni?m.spec:void 0,C=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}y=!n.__validating||!C?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||!iO(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Na.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=ude(e,n),r._sortErrors=gA(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 Jf(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=ma.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return fde(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(dde)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Gf.exact,test(n){if(n==null)return!0;const r=sO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Gf.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=sO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Gf.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}}Ix.prototype=yA.prototype;const hde=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(Iu,{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(yde(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>g.jsxs(Yo,{flexWrap:"wrap",justifyContent:"flex-end",children:[g.jsx($I,{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(zne,{})})})}),g.jsxs(Yo,{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"})]})]})})]})})},mde=["https://","http://","www."],gde=new RegExp(mde.join("|")),yde=t=>{const e=t.replace(/\.\s*$/,"").split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.match(gde)),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:Of(e,l),title:Of(e,a),url:Of(e,n),accessedAt:bde(e,r),classification:vde(e,o),details:Of(e,o)}},Of=(t,e)=>e<0||e>=t.length?"":t[e],bde=(t,e)=>e<0||e>=t.length?"":_ce(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),vde=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",bA=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(V.CircularProgress,{size:s,color:"inherit"}):null,...o})},vA=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(Yo,{children:[g.jsx(V.Button,{onClick:e,variant:"outlined",size:"small",children:"Cancel"}),g.jsx(bA,{size:"small",loading:i,type:"button",onClick:s,children:"Save"})]})]})},xde=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),[C,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},S=!s;return g.jsxs(V.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(Yo,{justifyContent:"space-between",children:[g.jsxs(Yo,{gap:2,children:[g.jsxs(V.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Citation"]}),S&&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:C,onSubmit:async O=>{p(!0),e(O).catch(R=>{throw p(!1),R}).finally(()=>p(!1))},validationSchema:Ix({title:El().required("Title is required"),accessedAt:Rx().required("Accessed At is required"),url:El().required("URL is required"),classification:El().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(Ri,{...T,name:"title",required:!0}),g.jsx(Ri,{...T,name:"source"}),g.jsx(Ri,{...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(Vi,{label:"URL / Other Identifier",readOnlyValue:g.jsx(T0,{citation:P,canLaunchUrl:l,asLink:!0}),value:P.url??""})}):g.jsx(Ri,{...T,name:"url",label:"URL / Other Identifier",required:!0,endIcon:g.jsx(T0,{citation:P,canLaunchUrl:l})}),g.jsx(NI,{...T,name:"classification",row:!0,required:!0,radios:wde})]}),g.jsx(vA,{isLoading:f,onSaveClicked:()=>{b(!0),O()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n}),g.jsx(hde,{open:y,onGenerateCitation:$=>{R($,!0)},anchorEl:v.current,onClose:()=>x(!1)})]})})]})},wde=[{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."}],Cde=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:Ix().shape({title:El().required("Title is required"),fileName:El().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 O;const S=!s&&!C.id;return J.useEffect(()=>{var R,P;(R=C.file)!=null&&R.name&&k("fileName",(P=C.file)==null?void 0:P.name)},[(O=C.file)==null?void 0:O.name]),g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsx(Ri,{name:"title",disabled:p,required:!0,margin:"none",readOnly:s}),g.jsxs(V.Box,{marginTop:S?1:0,children:[g.jsxs(Yo,{alignItems:"flex-start",children:[S&&g.jsx(DI,{name:"file",errorMode:"hidden"}),g.jsxs(Yo,{alignItems:"flex-end",children:[g.jsx(Ri,{readOnly:!0,name:"fileName",label:S?"":"File Name"}),!S&&g.jsxs(Yo,{children:[g.jsx(oA,{citation:C,onDownloadAttachment:l}),g.jsx(iA,{citation:C,onPreviewAttachment:u})]})]})]}),g.jsx(_r,{name:"fileName"})]}),g.jsx(vA,{isLoading:p,onSaveClicked:()=>{v(!0),T()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n})]})}})]})},ed=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 Sde(t){return qe("MuiAlert",t)}const aO=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"]),Tde=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"),kde=Ne(g.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),Ede=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"),Ode=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"),Mde=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"),_de=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,Sde,o)},Rde=ne(Rs,{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"?ba:_l,n=t.palette.mode==="light"?_l:ba;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),[`& .${aO.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}`,[`& .${aO.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)}}}))]}})),Ide=ne("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Dde=ne("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),Ade=ne("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),lO={success:g.jsx(Tde,{fontSize:"inherit"}),warning:g.jsx(kde,{fontSize:"inherit"}),error:g.jsx(Ede,{fontSize:"inherit"}),info:g.jsx(Ode,{fontSize:"inherit"})},xA=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=lO,onClose:b,role:v="alert",severity:y="success",slotProps:x={},slots:C={},variant:k="standard",...T}=r,S={...r,color:l,severity:y,variant:k,colorSeverity:l||y},O=_de(S),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...x}},[P,$]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:Rde,externalForwardedProps:{...R,...T},ownerState:S,additionalProps:{role:v,elevation:0}}),[F,M]=Mt("icon",{className:O.icon,elementType:Ide,externalForwardedProps:R,ownerState:S}),[j,z]=Mt("message",{className:O.message,elementType:Dde,externalForwardedProps:R,ownerState:S}),[L,A]=Mt("action",{className:O.action,elementType:Ade,externalForwardedProps:R,ownerState:S}),[_,I]=Mt("closeButton",{elementType:Ql,externalForwardedProps:R,ownerState:S}),[B,W]=Mt("closeIcon",{elementType:Mde,externalForwardedProps:R,ownerState:S});return g.jsxs(P,{...$,children:[p!==!1?g.jsx(F,{...M,children:p||m[y]||lO[y]}):null,g.jsx(j,{...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"&&(xA.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 td=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(xA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&g.jsx(V.Typography,{variant:"h3",children:s}),n]})},wA=t=>g.jsx(td,{severity:"error",...t}),CA=t=>g.jsx(td,{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(wA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&g.jsx(CA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function SA({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:C,canSearch:k=!1}){const[T,S]=J.useState("Insert Citation/Attachment(s)"),[O,R]=J.useState(u),[P,$]=J.useState(void 0),[F,M]=J.useState(void 0),[j,z]=J.useState(!1),[L,A]=J.useState(!1),_=ee=>{M(void 0),S(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 Ce=typeof((Me=ie.response)==null?void 0:Me.data)=="string"&&ie.response.data,Se=typeof ie.message=="string"&&ie.message;M({type:"Error",title:ee,message:Ce??Se}),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(()=>{j?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)}))},pe=r&&(async ee=>r(ee).then(()=>{W(!0),R(O.filter(ie=>ie!==ee)),U("Successfully deleted")}).catch(ie=>K("Failed to delete",ie))),ce=o&&(ee=>{o(ee).then(ie=>{const Ce=!!ie.fileName;$(ie),_(Ce?"Attachment":"Citation")}).catch(ie=>{K("Failed to load",ie)}).finally(()=>A(!1))}),le=n&&ce,X=n&&ce,oe=i&&(async ee=>i(ee).catch(ie=>{K(`Failed to download ${ee.fileName}`,ie)})),fe=s&&(async ee=>s(ee).catch(ie=>{K(`Failed to view ${ee.fileName}`,ie)})),te=g.jsx(Due,{refreshKey:I,getCitationsPaginated:(ee,ie)=>t(ee,ie).then(Ce=>(f==null||f(),Ce)),onCancel:l,onNewCitation:()=>{$(void 0),_("Citation")},onNewAttachment:()=>{$(void 0),_("Attachment")},onEditCitation:le,onEditAttachment:X,onViewCitation:ce,onViewAttachment:ce,onDeleteCitation:pe,onDownloadAttachment:oe,onPreviewAttachment:fe,onSelect:a,setSelectedIds:R,selectedIds:O,onError:p,condenseTable:m,canSelect:b,title:v,addlActions:y,canCreate:!!e,canLaunchUrl:x,readOnly:C,showCloseBtn:m,canSearch:k}),re=g.jsx(xde,{modifyCitation:P,onSave:Y,onCancel:()=>j?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),z(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),readOnly:C,showViewAllCitationsBtn:C&&!j||!C&&j,canLaunchUrl:x}),ue=g.jsx(Cde,{onSave:Y,onCancel:()=>j?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),z(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),modifyCitation:P,readOnly:C,showViewAllCitationsBtn:C&&!j||!C&&j,onDownloadAttachment:oe,onPreviewAttachment:fe}),ge=g.jsx(Pde,{alert:F,setAlert:M});J.useEffect(()=>{m&&u.length===1&&ce&&(A(!0),z(!0),ce(u[0]))},[]);const Z=()=>{switch(T){case"Insert Citation/Attachment(s)":return te;case"Citation":return re;case"Attachment":return ue}};return m?g.jsxs(V.Box,{children:[ge,g.jsx(V.Box,{paddingTop:"8px",children:g.jsx(Ox,{isLoading:L,children:Z()})})]}):g.jsxs(V.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&ge,g.jsx(V.Box,{paddingTop:"8px",children:te}),g.jsx(ed,{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:ue]})})]})}function TA({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=(s,a)=>n?t(s,r):e(s,a);return g.jsx(SA,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const Nde=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 $de({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,C=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=>{C(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{C(y),m==null||m.commands.closeCitationBubbleMenu()},S=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(Nde,{children:g.jsx(TA,{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:S,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const jde=()=>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 Lde(t){const e=kt(),n=J.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(V.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[g.jsx(Bne,{fontSize:"small"}),g.jsx(V.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const kA=J.createContext(void 0),EA=()=>{const t=J.useContext(kA);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}=EA(),[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(C=>s.includes(C.id)),y=v.map(C=>Ea.truncate(C.title,{length:b,omission:"..."})).join(", ");f(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]),p.length!==0)return g.jsx(Uv,{as:"span",...e,"data-testid":"citation-node-component",children:g.jsx(V.Tooltip,{title:g.jsx(V.Box,{className:"citation-tooltip",children:p.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(V.Typography,{variant:"subtitle2",children:[C.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})})})},Fde=rn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",Tt(t)]},addNodeView(){return qv(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}})]},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}}}}),OA=t=>g.jsx(II,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Vde=t=>{const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x=()=>{},placeholder:C="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:S,canSearch:O=!1}=t,R=[LR,ZD.configure({placeholder:C}),jde(),Fde.configure({citationMaxLength:a})],[P,$,F]=Ht.useField({name:e}),{setValue:M}=F,{value:j}=P,{addUpdateCitation:z,deleteCitation:L,batchUpdate:A,citations:_}=EA();J.useEffect(()=>{var oe;const le=(oe=I==null?void 0:I.current)==null?void 0:oe.editor;if(!le)return;le.getHTML()!==j&&setTimeout(()=>{le.commands.setContent(j)},0)},[j]);const I=J.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},W=(le=void 0)=>{var fe,te;const X=((te=(fe=I.current)==null?void 0:fe.editor)==null?void 0:te.getHTML())??"",oe=!X.replace(/<\/?p>|<br>/g,"").trim();M(oe?"":X,le)},K=J.useMemo(()=>Ea.debounce(()=>W(!1),500),[M]),U=Ra(),{showDiff:Y,getPreviousValue:pe}=Ia(),ce=i??U;if(Y){const le=pe(e)??"",X=j,oe=/<citation\s+ids="([^"]*)"><\/citation>/g,fe=(ue,ge)=>{const Z=ge.split(",").map(Number);return`<sup>${_.filter(ee=>Z.includes(ee.id)).map(ee=>ee.title)}</sup>`},te=le.replace(oe,fe),re=X.replace(oe,fe);return g.jsx(Vi,{label:n,value:re,showDiff:!0,diffSnapshot:te,mode:"html"})}return g.jsxs(V.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:ce?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...B[s],display:"flex",flexDirection:"column",width:"100%",children:[g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&g.jsx(V.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&g.jsx(OA,{name:k})]}),g.jsx(SI,{ref:I,extensions:R,content:j,editable:!ce,renderControls:ce?void 0:()=>g.jsx(Fv,{children:g.jsx(Lde,{})}),onBlur:()=>W(),onUpdate:K,RichTextFieldProps:{variant:ce?"standard":"outlined",MenuBarProps:{hide:ce}},children:()=>g.jsx($de,{getCitationsPaginated:(le,X)=>l(le,X).then(oe=>(A(oe.data),oe)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(le=>f(le).then(X=>(z(X),X))),onUpdateCitation:p&&(le=>p(le).then(X=>(z(X),X))),onDeleteCitation:m&&(le=>m(le).then(()=>L(le))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x,canLaunchUrl:S,readOnly:ce,canSearch:O})}),g.jsx(_r,{name:e,id:`${e}-err`,errorMode:T})]})},zde=t=>{const{name:e="submit"}=t;return g.jsx(Tr,{name:e,type:"submit",...t})},Hde=t=>{const{label:e="Return to Top",icon:n=Bf,scrollThresholdPx:r=100}=t,o=V.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return g.jsx(V.Zoom,{in:o,children:g.jsx(V.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:g.jsxs(V.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[g.jsx(n,{fontSize:"medium"}),e]})})})},MA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ko.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return g.jsxs(g.Fragment,{children:[g.jsx(V.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),g.jsx(V.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>g.jsxs(V.MenuItem,{...Hl(p,o),children:[p.icon&&g.jsx(V.ListItemIcon,{children:p.icon}),g.jsx(V.ListItemText,{primary:p.label})]},p.label))})]})},Wde=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=V.useTheme();return g.jsx(V.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:g.jsxs(V.List,{children:[g.jsxs(V.ListItem,{children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Values"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(t,null,2)})]}),g.jsx(V.Divider,{variant:"inset",component:"li"}),g.jsxs(V.ListItem,{id:"testing",children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Errors"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(e,null,2)})]}),g.jsxs(V.ListItem,{children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Status"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Ude=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=rA();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...hr({...t},l)};return g.jsx(V.Stepper,{...u,children:e.map(f=>g.jsx(V.Step,{children:g.jsx(V.StepLabel,{children:f})},f))})},qde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?g.jsx(FI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ht.useField({name:e}),{value:C}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return g.jsxs(V.FormControl,{fullWidth:!0,children:[g.jsx(V.Typography,{...r,children:n}),m&&x.value.length===0?g.jsx(V.Typography,{children:b}):g.jsx(Ht.FieldArray,{name:e,render:T=>g.jsxs("div",{children:[C.map((S,O)=>g.jsx(J.Fragment,{children:g.jsx(Kde,{variant:l,content:g.jsxs(V.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[g.jsxs(V.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==C.length-1&&g.jsx(V.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&g.jsx(V.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&g.jsx(V.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Kde=({variant:t,content:e})=>{switch(t){case"card":return g.jsx(V.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:g.jsx(V.CardContent,{children:e})});case"elevatedCard":return g.jsx(V.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:g.jsx(V.CardContent,{children:e})});case"none":return e}},Yde=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return g.jsx(ed,{actions:[g.jsx(V.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Gde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return g.jsx(ed,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Jde=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return g.jsx(ed,{actions:[g.jsx(V.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),g.jsx(V.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Xde={added:{icon:jne,label:"Added",color:"success"},deleted:{icon:FI,label:"Deleted",color:"error"},modified:{icon:Fne,label:"Modified",color:"info"},unmodified:{label:"Unmodified",color:"default"}},Zde=(t,e)=>g.jsxs(g.Fragment,{children:[g.jsx(V.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:kp},children:g.jsx("s",{children:t})}),g.jsx(V.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:Tp},children:g.jsx("u",{children:e})})]}),Qde=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=kl(s,e,r),l=kl(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??RI.isEqual(a,l))||(o[wn(s)]=Zde(a,l))}return o},_A=(t,e,n,r=!1,o)=>{const i=[],s=[];let a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);a<e.length&&l<n.length;){const u=e[a],f=n[l];if(u.id===f.id){const p=Qde(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?s.push({...f,changeType:"unmodified"}):i.push({...f,changeType:"modified",modifiedDiff:p}),a++,l++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),a++):(i.push({...f,changeType:"added"}),l++)}for(;a<e.length;)i.push({...e[a],changeType:"deleted"}),a++;for(;l<n.length;)i.push({...n[l],changeType:"added"}),l++;return{dataDiff:i,dataUnmodified:s}},RA=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,dataUnmodified:l}=_A(r,e,n,s,o);return{columns:[{fieldName:"changeType",render:f=>{const p=Xde[f];return g.jsx(V.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:g.jsxs(V.Typography,{children:[p.icon&&g.jsx(P0,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[wn(f)])??kl(f,m,s)}}))],data:a,unmodifiedData:l,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return g.jsx(OM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},IA=({columns:t,data:e,unmodifiedData:n=[],emptyTableMsg:r="No changes to display",renderExpand:o,size:i})=>{const[s,a]=J.useState(!1),l=()=>a(!s),u=`${s?"Hide":"Show"} ${n.length} unmodified row${n.length>1?"s":""}`;return g.jsxs(V.Box,{children:[g.jsx(Mx,{columns:t,data:[...e,...s?n:[]],emptyTableMsg:r,renderExpand:o,size:i}),n.length>0&&g.jsx(V.Box,{children:g.jsx(V.Button,{onClick:l,children:u})})]})},efe=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),o="beforeData"in n?RA({...n,isMobileScreen:r}):n;return g.jsx(IA,{...o,size:t.size})},tfe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=V.useTheme(),a=ko.useNavigate();return g.jsxs(V.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[g.jsx(V.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),g.jsxs(V.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[g.jsx(V.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>g.jsx(V.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Hl(l,a),children:l.label},l.label))}),n&&g.jsx(V.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},DA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ko.useLocation(),i=ko.useNavigate(),[s,a]=J.useState(!1),l=(m,b)=>g.jsx(V.MenuList,{children:m.map(v=>g.jsxs(V.MenuItem,{...Hl(v,i,()=>a(!1)),children:[v.icon&&g.jsx(V.ListItemIcon,{children:v.icon}),g.jsx(V.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>g.jsxs(J.Fragment,{children:[l(b,v),v<m.length-1&&g.jsx(V.Divider,{})]},`mobile-drawer-group-${v}`))}return r?g.jsx(V.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&g.jsxs(g.Fragment,{children:[g.jsx(V.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:g.jsx(Yne,{})}),g.jsx(V.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:g.jsx(V.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:g.jsx(V.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},AA=t=>{const{env:e,isProd:n}=t;return n?null:g.jsx(V.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs(V.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},PA=t=>{const{displayName:e,userMenuOptions:n}=t;return g.jsx(MA,{label:e,menuOptions:n,icon:g.jsx(Jne,{})})},vm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=V.useTheme(),a=ko.useNavigate();return g.jsx(V.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>g.jsx(V.Tab,{icon:l.icon,label:l.label,value:u,...Hl(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},NA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&g.jsx(V.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:g.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:r})})},$A=t=>{const{onToggle:e}=t,{palette:n}=V.useTheme(),r=n.mode==="dark";return g.jsx(V.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?g.jsx(BI,{}):g.jsx(jI,{})})},nfe=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:b}=t,v=ko.useNavigate(),y=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),{palette:x}=V.useTheme(),{pathname:C}=ko.useLocation(),k=x.mode==="dark",[T,S]=D.useState(void 0);D.useEffect(()=>{const P=o.findIndex($=>$.path&&C.startsWith($.path));S(P>=0?P:void 0)},[C,o]);const O=s&&g.jsx($A,{onToggle:s}),R=s&&(y||!y&&l)?[{icon:k?g.jsx(BI,{}):g.jsx(jI,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return g.jsxs(V.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&g.jsx(AA,{...e}),u,g.jsxs(V.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[g.jsx(V.Button,{disableRipple:!0,component:ko.Link,to:"/",children:r&&typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),g.jsxs(V.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&g.jsx(DA,{menuOptionLists:[o,a,R],anchor:"right"}),!y&&g.jsxs(g.Fragment,{children:[g.jsx(V.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((P,$)=>g.jsxs(V.Box,{display:"flex",alignItems:"center",children:[$>0&&g.jsx(V.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),g.jsx(V.Button,{variant:"text",sx:{color:"white"},...Hl(P,v),children:g.jsxs(V.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&g.jsx(PA,{displayName:l,userMenuOptions:R})]})]})]}),!y&&g.jsx(NA,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},rfe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ko.useLocation(),o=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&g.jsx(V.Box,{sx:e,children:g.jsx(V.Card,{sx:{height:"100%",width:200},children:g.jsx(vm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},ofe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=V.useTheme();return e.length>0&&g.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},ife=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return g.jsx(kA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},sfe=t=>g.jsx(td,{severity:"info",...t}),afe=t=>g.jsx(td,{severity:"warning",...t}),jA=t=>{const{crumbs:e}=t,n=ko.useNavigate(),r=e.map(o=>({label:o.label,onClick:()=>{var i;o.path?n(o.path):(i=o.onClick)==null||i.call(o)}}));return g.jsx(V.Breadcrumbs,{"aria-label":"breadcrumb",separator:g.jsx(Gne,{}),sx:{marginBottom:2},children:r.map(({label:o,...i},s)=>s<e.length-1?g.jsx(V.Link,{color:"primary",sx:{cursor:"pointer",fontWeight:"600"},underline:"hover",...Hl(i,n),children:o},o):g.jsx(V.Typography,{color:"text.primary",children:o},o))})},lfe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=cfe(r);return g.jsx(V.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:g.jsx(td,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:cO(r),warning:cO(r)},onClose:o,elevation:a,variant:s,children:n?g.jsxs(g.Fragment,{children:[g.jsx(V.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},cfe=t=>t=="logout"?"info":t=="timeout"?"warning":t,cO=t=>{if(t=="timeout")return g.jsx($ne,{});if(t=="logout")return g.jsx(Kne,{})},ufe=t=>{dfe(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=V.useMediaQuery(V.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:g.jsxs(V.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&g.jsx(jA,{crumbs:i}),g.jsxs(V.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[g.jsxs(V.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?g.jsx(V.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&g.jsxs(Tr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[g.jsx(Lne,{style:{marginRight:"0.5rem"}}),n]})]}),s&&g.jsx(V.Box,{width:u?"100%":"50%",children:s})]})]})},dfe=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},ffe=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=V.useMediaQuery(V.useTheme().breakpoints.down("sm"));return g.jsxs(V.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&g.jsx(V.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),g.jsx(V.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,g.jsx(V.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},pfe=t=>{const{title:e="Loading...",message:n}=t;return g.jsxs(V.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[g.jsxs(V.Box,{className:"text-content",children:[g.jsx(V.Typography,{variant:"h1","data-testid":"title",children:e}),n&&g.jsx(V.Typography,{"data-testid":"message",children:n})]}),g.jsx(V.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function hfe({...t}){return g.jsx(SA,{onSelectCitations:()=>{},onClose:()=>{},...t})}const mfe=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return g.jsx(V.Box,{height:n})};exports.AlertModal=Gde;exports.Autocomplete=_I;exports.Breadcrumbs=jA;exports.Button=Tr;exports.Checkbox=II;exports.CheckboxGroup=ane;exports.CitationField=Vde;exports.CitationFieldProvider=ife;exports.CitationManager=hfe;exports.Column=Iu;exports.ConfirmationModal=Yde;exports.DarkModeToggle=$A;exports.DateField=Ip;exports.DateRangeField=Dce;exports.DecisionModal=Jde;exports.Diff=MI;exports.DiffProvider=OM;exports.DiffTable=efe;exports.DiffTableView=IA;exports.Drawer=DA;exports.DynamicAutocomplete=ine;exports.EnvironmentBanner=AA;exports.ErrorAlert=wA;exports.FileList=une;exports.FileUpload=DI;exports.FloatingNavBar=ofe;exports.Footer=tfe;exports.FormDebugger=Wde;exports.Header=nfe;exports.HelpTooltip=tA;exports.IconTooltip=eA;exports.InfoAlert=sfe;exports.LoadingButton=bA;exports.LoadingIndicator=pfe;exports.LoadingOverlay=Ox;exports.Location=Dne;exports.MenuButton=MA;exports.Modal=ed;exports.MultiAutocomplete=sne;exports.NavBar=NA;exports.NotApplicableCheckbox=OA;exports.PageHeader=ufe;exports.PaginatedTable=nA;exports.ProfileMenu=PA;exports.RadioGroup=NI;exports.RangeSlider=Ane;exports.ReadOnly=Vi;exports.ReadOnlyProvider=kM;exports.RepeatableFormGroup=qde;exports.RichTextField=Oue;exports.Row=Yo;exports.ScrollToTop=Hde;exports.SearchField=VI;exports.Select=Pne;exports.SelectableCitationManager=TA;exports.Sidebar=rfe;exports.SingleActionCard=ffe;exports.Snackbar=lfe;exports.Spacer=mfe;exports.Stepper=Ude;exports.Submit=zde;exports.SuccessAlert=CA;exports.Switch=Nne;exports.Table=Mx;exports.Tabs=vm;exports.TextArea=$I;exports.TextField=Ri;exports.TextIcon=P0;exports.ValidationError=_r;exports.WarningAlert=afe;exports.baseCitationTableColumns=sA;exports.buildDiffData=_A;exports.buildTableDiff=RA;exports.commonTheme=In;exports.darkTheme=mz;exports.lightTheme=hz;exports.useDiff=Ia;exports.useReadOnly=Ra;
|
package/dist/index.es.js
CHANGED
|
@@ -59520,8 +59520,8 @@ const Upe = (t) => {
|
|
|
59520
59520
|
const { gap: e = 1, ...n } = t;
|
|
59521
59521
|
return /* @__PURE__ */ x(Ne, { display: "flex", flexDirection: "column", gap: e, ...n });
|
|
59522
59522
|
};
|
|
59523
|
-
function Fde({ icon: t,
|
|
59524
|
-
return
|
|
59523
|
+
function Fde({ icon: t, children: e, ...n }) {
|
|
59524
|
+
return e ? /* @__PURE__ */ x($o, { title: e, children: /* @__PURE__ */ x($n, { disableTouchRipple: !0, size: "small", children: /* @__PURE__ */ x(t, { "data-testid": "MBv2_table-tooltip", fontSize: "small", ...n }) }) }) : null;
|
|
59525
59525
|
}
|
|
59526
59526
|
function Bde(t) {
|
|
59527
59527
|
return /* @__PURE__ */ x(Fde, { icon: noe, ...t });
|
|
@@ -59557,7 +59557,7 @@ const HA = (t) => {
|
|
|
59557
59557
|
stickyHeader: V,
|
|
59558
59558
|
reRenderExpand: M = !1,
|
|
59559
59559
|
expandOnRowClick: L = !1,
|
|
59560
|
-
|
|
59560
|
+
tooltipProps: z = {},
|
|
59561
59561
|
...F
|
|
59562
59562
|
} = t, { palette: A } = Xn(), _ = A.grey[A.mode == "dark" ? 600 : 50], [I, B] = He.useState(void 0), [W, q] = He.useState(
|
|
59563
59563
|
typeof O == "string" || typeof O == "number" ? O : void 0
|
|
@@ -59686,7 +59686,7 @@ const HA = (t) => {
|
|
|
59686
59686
|
}
|
|
59687
59687
|
}
|
|
59688
59688
|
};
|
|
59689
|
-
}, Ce = (he) => /* @__PURE__ */ x(Bde, {
|
|
59689
|
+
}, Ce = (he) => /* @__PURE__ */ x(Bde, { ...z, children: he }), Ie = (he, $e) => {
|
|
59690
59690
|
const Re = he.find((ut) => ut.key === "MBv2_Checkbox_Column"), vt = le.filter((ut) => ut.key !== "MBv2_Checkbox_Column");
|
|
59691
59691
|
return /* @__PURE__ */ Q(Wi, { alignItems: "flex-start", children: [
|
|
59692
59692
|
Re && /* @__PURE__ */ x(Mh, { children: Ll(Re, $e, fe) }),
|
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
|
`,rQ="️",oQ="",rv="";let xh=null,wh=null;function iQ(t=[]){const e={};Tr.groups=e;const n=new Tr;xh==null&&(xh=D2(XZ)),wh==null&&(wh=D2(ZZ)),$e(n,"'",lh),$e(n,"{",Iu),$e(n,"}",Du),$e(n,"[",Kp),$e(n,"]",Yp),$e(n,"(",Gp),$e(n,")",Jp),$e(n,"<",Xp),$e(n,">",Zp),$e(n,"(",Qp),$e(n,")",eh),$e(n,"「",th),$e(n,"」",nh),$e(n,"『",rh),$e(n,"』",oh),$e(n,"<",ih),$e(n,">",sh),$e(n,"&",ah),$e(n,"*",ch),$e(n,"@",xs),$e(n,"`",dh),$e(n,"^",fh),$e(n,":",ws),$e(n,",",J0),$e(n,"$",ph),$e(n,".",Zo),$e(n,"=",hh),$e(n,"!",X0),$e(n,"-",lo),$e(n,"%",Au),$e(n,"|",mh),$e(n,"+",gh),$e(n,"#",yh),$e(n,"?",Pu),$e(n,'"',Z0),$e(n,"/",Qo),$e(n,";",Q0),$e(n,"~",Nu),$e(n,"_",bh),$e(n,"\\",uh),$e(n,"・",E2);const r=mn(n,Ai,K0,{[R0]:!0});mn(r,Ai,r);const o=mn(r,Di,T2,{[Ou]:!0}),i=mn(r,$u,k2,{[Mu]:!0}),s=mn(n,Di,Ii,{[z0]:!0});mn(s,Ai,o),mn(s,Di,s),mn(o,Ai,o),mn(o,Di,o);const a=mn(n,$u,j0,{[V0]:!0});mn(a,Di),mn(a,Ai,i),mn(a,$u,a),mn(i,Ai,i),mn(i,Di),mn(i,$u,i);const l=$e(n,nv,G0,{[W0]:!0}),u=$e(n,_2,Y0,{[W0]:!0}),f=mn(n,tv,Y0,{[W0]:!0});$e(n,rv,f),$e(u,nv,l),$e(u,rv,f),mn(u,tv,f),$e(f,_2),$e(f,nv),mn(f,tv,f),$e(f,rv,f);const p=mn(n,ev,O2,{[S2]:!0});$e(p,"#"),mn(p,ev,p),$e(p,rQ,p);const m=$e(p,oQ);$e(m,"#"),mn(m,ev,p);const b=[[Di,s],[Ai,o]],v=[[Di,null],[$u,a],[Ai,i]];for(let y=0;y<xh.length;y++)Ss(n,xh[y],U0,Ii,b);for(let y=0;y<wh.length;y++)Ss(n,wh[y],q0,j0,v);Sa(U0,{tld:!0,ascii:!0},e),Sa(q0,{utld:!0,alpha:!0},e),Ss(n,"file",qp,Ii,b),Ss(n,"mailto",qp,Ii,b),Ss(n,"http",Ll,Ii,b),Ss(n,"https",Ll,Ii,b),Ss(n,"ftp",Ll,Ii,b),Ss(n,"ftps",Ll,Ii,b),Sa(qp,{scheme:!0,ascii:!0},e),Sa(Ll,{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]?{[QZ]:!0}:{[eQ]:!0};x.indexOf("-")>=0?k[H0]=!0:Di.test(x)?Ai.test(x)?k[Ou]=!0:k[z0]=!0:k[R0]=!0,C2(n,x,x,k)}return C2(n,"localhost",_u,{ascii:!0}),n.jd=new Tr(vh),{start:n,tokens:Object.assign({groups:e},M2)}}function I2(t,e){const n=sQ(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 sQ(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 Tr(r),i.jr=o.slice(),t.j[l]=i),t=i}return i=new Tr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function D2(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 Lu={defaultProtocol:"http",events:null,format:A2,formatHref:A2,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({},Lu);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:Lu,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]:Lu[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 A2(t){return t}function P2(t,e){this.t="token",this.v=t,this.tk=e}P2.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=Lu.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 Sh(t,e){class n extends P2{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 N2=Sh("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),$2=Sh("text"),aQ=Sh("nl"),Ch=Sh("url",{isLink:!0,toHref(t=Lu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==_u&&t[1].t===ws}}),co=t=>new Tr(t);function lQ({groups:t}){const e=t.domain.concat([ah,ch,xs,uh,dh,fh,ph,hh,lo,K0,Au,mh,gh,yh,Qo,vh,Nu,bh]),n=[lh,ws,J0,Zo,X0,Au,Pu,Z0,Q0,Xp,Zp,Iu,Du,Yp,Kp,Gp,Jp,Qp,eh,th,nh,rh,oh,ih,sh],r=[ah,lh,ch,uh,dh,fh,ph,hh,lo,Iu,Du,Au,mh,gh,yh,Pu,Qo,vh,Nu,bh],o=co(),i=$e(o,Nu);pt(i,r,i),pt(i,t.domain,i);const s=co(),a=co(),l=co();pt(o,t.domain,s),pt(o,t.scheme,a),pt(o,t.slashscheme,l),pt(s,r,i),pt(s,t.domain,s);const u=$e(s,xs);$e(i,xs,u),$e(a,xs,u),$e(l,xs,u);const f=$e(i,Zo);pt(f,r,i),pt(f,t.domain,i);const p=co();pt(u,t.domain,p),pt(p,t.domain,p);const m=$e(p,Zo);pt(m,t.domain,p);const b=co(N2);pt(m,t.tld,b),pt(m,t.utld,b),$e(u,_u,b);const v=$e(p,lo);$e(v,lo,v),pt(v,t.domain,p),pt(b,t.domain,p),$e(b,Zo,m),$e(b,lo,v);const y=$e(b,ws);pt(y,t.numeric,N2);const x=$e(s,lo),S=$e(s,Zo);$e(x,lo,x),pt(x,t.domain,s),pt(S,r,i),pt(S,t.domain,s);const k=co(Ch);pt(S,t.tld,k),pt(S,t.utld,k),pt(k,t.domain,s),pt(k,r,i),$e(k,Zo,S),$e(k,lo,x),$e(k,xs,u);const T=$e(k,ws),C=co(Ch);pt(T,t.numeric,C);const O=co(Ch),I=co();pt(O,e,O),pt(O,n,I),pt(I,e,O),pt(I,n,I),$e(k,Qo,O),$e(C,Qo,O);const N=$e(a,ws),L=$e(l,ws),V=$e(L,Qo),M=$e(V,Qo);pt(a,t.domain,s),$e(a,Zo,S),$e(a,lo,x),pt(l,t.domain,s),$e(l,Zo,S),$e(l,lo,x),pt(N,t.domain,O),$e(N,Qo,O),$e(N,Pu,O),pt(M,t.domain,O),pt(M,e,O),$e(M,Qo,O);const B=[[Iu,Du],[Kp,Yp],[Gp,Jp],[Xp,Zp],[Qp,eh],[th,nh],[rh,oh],[ih,sh]];for(let H=0;H<B.length;H++){const[F,P]=B[H],_=$e(O,F);$e(I,F,_),$e(_,P,O);const D=co(Ch);pt(_,e,D);const R=co();pt(_,n),pt(D,e,D),pt(D,n,R),pt(R,e,D),pt(R,n,R),$e(D,P,O),$e(R,P,O)}return $e(o,_u,k),$e(o,G0,aQ),{start:o,tokens:M2}}function cQ(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(iv($2,e,s)),s=[]),o-=m,f-=m;const b=p.t,v=n.slice(o-f,o);i.push(iv(b,e,v))}}return s.length>0&&i.push(iv($2,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 uQ=typeof console<"u"&&console&&console.warn||(()=>{}),dQ="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Kt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function fQ(){return Tr.groups={},Kt.scanner=null,Kt.parser=null,Kt.tokenQueue=[],Kt.pluginQueue=[],Kt.customSchemes=[],Kt.initialized=!1,Kt}function L2(t,e=!1){if(Kt.initialized&&uQ(`linkifyjs: already initialized - will not register custom scheme "${t}" ${dQ}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
403
403
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
404
404
|
2. Cannot start or end with "-"
|
|
405
|
-
3. "-" cannot repeat`);Kt.customSchemes.push([t,e])}function pQ(){Kt.scanner=iQ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=lQ(Kt.scanner.tokens);for(let t=0;t<Kt.pluginQueue.length;t++)Kt.pluginQueue[t][1]({scanner:Kt.scanner,parser:Kt.parser});return Kt.initialized=!0,Kt}function sv(t){return Kt.initialized||pQ(),cQ(Kt.parser.start,t,I2(Kt.scanner.start,t))}sv.scan=I2;function B2(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 ]",hQ=new RegExp(av),mQ=new RegExp(`${av}$`),gQ=new RegExp(av,"g");function yQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function bQ(t){return new en({key:new On("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=YR(n.doc,[...e]);if(e3(a).forEach(({newRange:u})=>{const f=JR(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(!mQ.test(b))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const b=m.split(hQ).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=sv(v).map(S=>S.toObject(t.defaultProtocol));if(!yQ(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=>{Gg(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 vQ(t){return new en({key:new On("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=Yg(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 xQ(t){return new en({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=B2(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(gQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const wQ=xr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){L2(t);return}L2(t.scheme,t.optionalSlashes)})},onDestroy(){fQ()},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",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!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[us({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=B2(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(bQ({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(vQ({type:this.type})),this.options.linkOnPaste&&t.push(xQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function SQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=k3(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 CQ=new On("suggestion");function TQ({pluginKey:t=CQ,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:y=SQ}){let x;const S=b==null?void 0:b(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,L,V,M,B;const H=(O=this.key)===null||O===void 0?void 0:O.getState(C),F=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=H.active&&F.active&&H.range.from!==F.range.from,_=!H.active&&F.active,D=H.active&&!F.active,R=!_&&!D&&H.query!==F.query,j=_||P&&R,K=R||P,U=D||P&&R;if(!j&&!K&&!U)return;const Y=U&&!j?H:F,he=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:ce=>p({editor:e,range:Y.range,props:ce}),decorationNode:he,clientRect:he?()=>{var ce;const{decorationId:le}=(ce=this.key)===null||ce===void 0?void 0:ce.getState(e.state),X=T.dom.querySelector(`[data-decoration-id="${le}"]`);return(X==null?void 0:X.getBoundingClientRect())||null}:null},j&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.call(S,x)),K&&((L=S==null?void 0:S.onBeforeUpdate)===null||L===void 0||L.call(S,x)),(K||j)&&(x.items=await m({editor:e,query:Y.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),j&&((B=S==null?void 0:S.onStart)===null||B===void 0||B.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,I){const{isEditable:N}=e,{composing:L}=e.view,{selection:V}=T,{empty:M,from:B}=V,H={...C};if(H.composing=L,N&&(M||e.view.composing)){(B<C.range.from||B>C.range.to)&&!L&&!C.composing&&(H.active=!1);const F=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;F&&v({editor:e,state:I,range:F.range,isActive:C.active})?(H.active=!0,H.decorationId=C.decorationId?C.decorationId:P,H.range=F.range,H.query=F.query,H.text=F.text):H.active=!1}else H.active=!1;return H.active||(H.decorationId=null,H.range={from:0,to:0},H.query=null,H.text=null),H}},props:{handleKeyDown(T,C){var O;const{active:I,range:N}=k.getState(T.state);return I&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const L=!(N!=null&&N.length),V=[l];return L&&V.push(f),Jt.create(T.doc,[Yn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function kQ({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 F2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>kQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function R2(t,e){const n=F2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const EQ=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",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=R2(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:R2(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 F2(this).map(TQ)}}),z2=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 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&&cf(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Yn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Jt.create(t,o)}}})]}}),OQ=xr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),MQ=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",St(this.options.HTMLAttributes,t),0]}}),_Q=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",St(this.options.HTMLAttributes,t),0]}}),IQ=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}}),DQ=/^\s*(\[([( |x])?\])\s$/,AQ=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",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const 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[ll({find:DQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),PQ=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",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),NQ=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")}}}),V2=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(z.Paper,{elevation:5,children:g.jsx(z.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>g.jsx(z.ListItem,{disablePadding:!0,children:g.jsx(z.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});V2.displayName="SuggestionList";const H2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},$Q={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 yO(V2,{props:n,editor:n.editor}),e=lu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??H2},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))??H2}})},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}}}},LQ=wQ.extend({inclusive:!1}),BQ=OQ.extend({excludes:"superscript"}),FQ=lM.extend({excludes:"subscript"});function RQ({placeholder:t}={}){return J.useMemo(()=>[E7.configure({resizable:!0}),IQ,_Q,MQ,fT,hT,mT,vT,IT,PT,NT,BQ,FQ,LT,cT,lT,pT,_T,aM,$T,LQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),u8,bT,l8,NQ.configure({types:["heading","paragraph","image"]}),YZ,GZ,JZ,i9,WT.configure({multicolor:!0}),MT,k8,gT,PQ,AQ.configure({nested:!0}),EQ.configure({suggestion:$Q}),z2.configure({placeholder:t}),OT],[t])}function W2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const zQ=t=>{const e=RQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(iM,{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=>{ib({images:O,editor:T,position:k})});else{const O=i(S);ib({images:O,editor:T,position:k})}},[]),v=J.useCallback((S,k,T,C)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=W2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return b(O,N),k.preventDefault(),!0}return!1},[b]),y=J.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=W2(k.clipboardData.files);return C.length>0?(b(C),!0):!1},[b]),x=g.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(oM,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(qZ,{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(K7,{}),g.jsx(aU,{})]})})});return g.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(z.Typography,{...o,children:r}),x]})},j2=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(z.Collapse,{in:n,children:u}):g.jsx(z.TableRow,{sx:p,children:g.jsx(z.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:g.jsx(z.Collapse,{in:n,children:u})})})},lv=({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(z.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,g.jsx(z.Box,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,pointerEvents:n?"auto":"none",opacity:n?1:0,transition:"opacity 0.3s ease"},children:g.jsx(z.CircularProgress,{})})]})},ei=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Bu=t=>{const{gap:e=1,...n}=t;return g.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function U2({icon:t,color:e="inherit",children:n}){return n?g.jsx(z.Tooltip,{title:n,children:g.jsx(z.IconButton,{disableTouchRipple:!0,size:"small",children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:e}})})}):null}function q2(t){return g.jsx(U2,{icon:oq,...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: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:I,selectedRowKey:N,headerRowStyle:L={},stickyHeader:V,reRenderExpand:M=!1,expandOnRowClick:B=!1,tooltipColor:H,...F}=t,{palette:P}=z.useTheme(),_=P.grey[P.mode=="dark"?600:50],[D,R]=J.useState(void 0),[j,K]=J.useState(typeof O=="string"||typeof O=="number"?O:void 0);VQ(t);const U=me=>{me!==f?m&&m(me,"asc"):m&&m(f,p==="asc"?"desc":"asc")},Y=me=>f===me?p:null,he=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),ce=r.filter(me=>!me.hideCol&&(!he||!me.hideOnMobile));u&&!he&&ce.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,Be)=>{const De=n(Be),yt=D===De;return g.jsx(z.IconButton,{"data-testid":"expand-collapse-btn","aria-label":yt?"collapse row":"expand row",size:"small",onClick:()=>Z(De),children:yt?g.jsx(pp,{"data-testid":"collapse-up"}):g.jsx(y0,{"data-testid":"expand-down"})})}}),a&&l&&ce.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,Be)=>{const De=n(Be);return g.jsx(z.Checkbox,{onChange:()=>{const yt=a.includes(De);l(yt?a.filter(ct=>ct!==De):[...a,De])},checked:a.includes(De)})}});const le=m!==void 0,X=me=>le?b?b.includes(me):!0:!1,oe=g.jsxs(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(iq,{})," ",x]}),fe=g.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(uw,{color:"error"})," ",S,k&&g.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),ne=()=>{if(S)return g.jsx(z.TableRow,{children:g.jsx(z.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:fe})});if(o.length===0)return g.jsx(z.TableRow,{children:g.jsx(z.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:oe})})},re=()=>{if(S)return fe;if(o.length===0)return oe},ue=me=>{O&&K(me)},ye=me=>{const Be=n(me);if((i||s)&&(i==null||i(Be),s==null||s(me),ue(Be)),u&&B){const De=D===Be?void 0:Be;R(De),ue(De)}},Z=me=>{const Be=D===me?void 0:me;R(Be),ue(Be)},ee=me=>{if(!u)return;const Be=D===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(z.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>Z(n(me)),children:[Be?g.jsx(pp,{}):g.jsx(y0,{})," Show"," ",Be?"Less":"More"]}),g.jsx(j2,{colSpan:r.length,isExpanded:n(me)===D,obj:me,renderExpand:De=>u(De),asMobileCard:!0})]})},ie=I??_,Se=me=>{const De=(O?j:N)===n(me)?ie:"inherit",yt=i||s||B;return{cursor:yt?"pointer":"default",backgroundColor:De,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...yt&&{"&:hover":{backgroundColor:De===ie?kG(De,.1):ie}}}},Ce=me=>g.jsx(q2,{color:H,children:me}),Pe=(me,Be)=>{const De=me.find(ct=>ct.key==="MBv2_Checkbox_Column"),yt=ce.filter(ct=>ct.key!=="MBv2_Checkbox_Column");return g.jsxs(ei,{alignItems:"flex-start",children:[De&&g.jsx(Bu,{children:Bl(De,Be,he)}),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??Ln(xn(ct)),Ce(ct.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(ct)}`,style:{paddingLeft:"10px"},children:Bl(ct,Be,he)})]},`row-${n(Be)}-${xn(ct)}`))})}),ee(Be)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[le&&g.jsxs(g.Fragment,{children:[g.jsxs(z.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[g.jsx(z.TextField,{select:!0,sx:{flexGrow:1},size:"small",value:f??"",label:"Sort By...",onChange:me=>U(me.target.value),fullWidth:!0,children:ce.map(me=>{if(X(xn(me)))return g.jsx(z.MenuItem,{value:xn(me),children:me.label??Ln(xn(me))},`rowHeader-${xn(me)}`)})}),g.jsx(z.IconButton,{onClick:()=>{f&&U(f)},children:g.jsx(fq,{className:`sort-icon-${p}`})})]}),g.jsx(z.Divider,{sx:{margin:"10px 0"}})]}),re()??o.map(me=>g.jsx(z.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:Pe(ce,me)},n(me)))]}),Ie=()=>g.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{tableId:`table-${e}`}:{},className:y,style:V?{maxHeight:V,overflow:"auto"}:{},children:g.jsxs(z.Table,{stickyHeader:V!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:L?{"& .MuiTableCell-head":{...L}}:{},...F,children:[g.jsx(z.TableHead,{className:"MBv2_Table_Head",children:g.jsx(z.TableRow,{className:"MBv2_Table_Head_Row",children:ce.map((me,Be)=>{const De=X(xn(me));return g.jsx(z.TableCell,{width:Array.isArray(v)?v[Be]:"auto",sx:me.tableCellSx??{},children:g.jsx(z.Box,{style:{display:"flex",alignItems:"center"},children:g.jsxs(z.Box,{sx:[De&&{"&:hover":{cursor:"pointer",backgroundColor:P.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:De?()=>U(xn(me)):void 0,children:[g.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:me.label??Ln(xn(me))}),Ce(me.tooltip),De&&Y(xn(me))==="asc"&&g.jsx(pp,{style:{marginLeft:"5px"}}),De&&Y(xn(me))==="desc"&&g.jsx(y0,{style:{marginLeft:"5px"}}),De&&Y(xn(me))!=="asc"&&Y(xn(me))!=="desc"&&g.jsx(uq,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(me)}`)})})}),g.jsx(z.TableBody,{className:"MBv2_Table_Body",children:ne()??o.map(me=>g.jsxs(J.Fragment,{children:[g.jsx(z.TableRow,{"data-testid":`row-${n(me)}`,className:"MBv2_Table_Body_Row",onClick:()=>ye(me),sx:Se(me),children:ce.map(Be=>g.jsx(z.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(Be)}`,children:Bl(Be,me,he)},`row-${n(me)}-${xn(Be)}`))}),u&&g.jsx(j2,{colSpan:ce.length,isExpanded:n(me)===D,obj:me,renderExpand:Be=>u(Be),reRenderExpand:M})]},n(me)))})]})});return g.jsx(lv,{isLoading:T,children:he&&!C?Me():Ie()})},VQ=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=>xn(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)`)},xn=t=>t.key??t.fieldName,HQ=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Bl=(t,e,n=!1)=>{const r=HQ(e,t.fieldName);return t.render?t.render(r,e,n):r},K2=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=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return g.jsxs(z.Box,{children:[g.jsx(cv,{sortOrder:p,sortField:f,...s}),!o&&!y&&g.jsx(z.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}}})]})},Y2=()=>({height:window.innerHeight,width:window.innerWidth}),G2=()=>{const[t,e]=J.useState(Y2());return J.useEffect(()=>{const n=()=>{e(Y2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},kr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=G2(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return g.jsx(z.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...cr({...t},a)})},WQ=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return g.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[g.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),g.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[g.jsx(kr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(kr,{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"})]})]})})},jQ=t=>{const{citation:e,anchorEl:n,onClose:r,open:o}=t;return g.jsx(z.Popper,{open:o,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[g.jsxs(z.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(z.Box,{display:"flex",flexDirection:"row",children:[g.jsx(kr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(kr,{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=J.useRef(null),[o,i]=J.useState(!1),s=()=>{i(!1)};return!t||e.fileName?null:g.jsxs(g.Fragment,{children:[n?g.jsx(z.Link,{ref:r,component:"button",sx:{cursor:"pointer"},type:"button",onClick:()=>i(!0),children:e.url}):g.jsx(z.Tooltip,{title:"Open URL",children:g.jsx(z.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(jQ,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function J2({onDownloadAttachment:t,citation:e}){if(!(!t||!e.fileName))return g.jsx(z.Tooltip,{title:"Download",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_download-btn-${e.id}`,children:g.jsx(nq,{})})})}function X2({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(z.Tooltip,{title:"View File",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_view-file-btn-${e.id}`,children:g.jsx(b0,{})})})}const UQ=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:I=!1,showCloseBtn:N=!1,canSearch:L=!1}=t,V=!!t.canCreate&&!I,M=!!a&&!!s&&!I,B=!!u&&!!l&&I&&k,H=!!f&&!I,{palette:F}=z.useTheme(),[P,_]=J.useState([]),[D,R]=J.useState(!1),[j,K]=J.useState(!0),[U,Y]=J.useState(null),[he,ce]=J.useState(null),[le,X]=J.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:L?"":void 0}),oe=()=>{R(!1),K(!0),v({pageNo:le.pageNo,pageSize:le.pageSize,search:le.search},y).then(Ie=>(_(Ie.data),X(me=>({...me,totalCount:Ie.totalCount})),Ie)).catch(Ie=>{S(Ie),R(!0),_([])}).finally(()=>K(!1))};J.useEffect(oe,[le.pageNo,le.pageSize,e,le.search]);const fe=()=>{ce(null),Y(null)},ne=g.jsx(kr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(Wf,{}),children:"Add Citation"}),re=g.jsx(kr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(RM,{}),children:"Add Attachment"}),ue=Ie=>{if(!(!M&&!B)){if(M)return g.jsx(z.Tooltip,{title:"Edit",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?a(Ie.id):s(Ie.id),"data-testid":`citation-table_edit-btn-${Ie.id}`,children:g.jsx(rq,{})})});if(B)return g.jsx(z.Tooltip,{title:"View",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?u(Ie.id):l(Ie.id),"data-testid":`citation-table_view-btn-${Ie.id}`,children:g.jsx(pq,{})})})}},ye=Ie=>{if(!(!H||I))return g.jsx(z.Tooltip,{title:"Delete",children:g.jsx(z.IconButton,{color:"error",onClick:me=>{ce(Ie),Y(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Ie.id}`,children:g.jsx(e0,{})})})},Z=Ie=>g.jsx(uv,{citation:Ie,canLaunchUrl:C}),ee=Ie=>g.jsx(X2,{citation:Ie,onPreviewAttachment:m}),ie=Ie=>g.jsx(J2,{citation:Ie,onDownloadAttachment:p}),Se=B||M||H||C||m||p||O,Ce=[...Q2(F,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Se,render:(Ie,me)=>g.jsxs(z.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(me),ye(me),ue(me),ee(me),Z(me),ie(me)]})}],Pe=J.useCallback(Ie=>{X(me=>({...me,pageNo:0,search:Ie}))},[]),Me=()=>L?g.jsx(HM,{onSearch:Pe}):null;return g.jsxs(Bu,{children:[g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(z.Typography,{variant:k?"h6":"h2",children:n}),!T&&V&&g.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[ne,re]}),N&&g.jsx(z.IconButton,{onClick:r,children:g.jsx(fp,{})})]}),Me(),g.jsx(K2,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:j,columns:Ce,data:P,paginationState:le,onPageChange:Ie=>X(me=>({...me,pageNo:Ie})),onRowsPerPageChange:Ie=>X(me=>({...me,pageSize:Ie,pageNo:0})),errorTableMsg:D?"Failed to load citations.":void 0,retryCallback:oe,setCheckedKeys:T?x:void 0,checkedKeys:T?y:void 0}),T&&g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[g.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&g.jsxs(g.Fragment,{children:[ne,re]})}),!I&&g.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[g.jsx(kr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),g.jsxs(kr,{variant:"contained",size:"small",onClick:()=>b(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),g.jsx(WQ,{citation:he,anchorEl:U,onDeleteCitation:f,onClose:fe})]})},Z2=(t,e)=>{const n=t?ga.truncate(e,{length:30,omission:"..."}):e,r=n==null?void 0:n.endsWith("...");return g.jsx("span",{style:{wordBreak:"break-all"},children:r?g.jsx(z.Tooltip,{title:e,children:g.jsx("span",{children:n})}):e})},Q2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(RM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):g.jsx(Wf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>Z2(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>Z2(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 dv,eI;function qQ(){if(eI)return dv;eI=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);dv={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var I=0,N=k.length,L=C;I<N-1;){var V=k[I];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;L=L[k[I++]]}L[k[I]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var I=0,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(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,I,N,L;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),L=b(O),N=!L&&/^\d+$/.test(O),k.call(T,O,L,N,I,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 dv}var Ta=qQ(),fv,tI;function KQ(){if(tI)return fv;tI=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 fv={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(" ")},fv}var pv=KQ(),Th={exports:{}},nI;function YQ(){if(nI)return Th.exports;nI=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,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 Th.exports}var GQ=YQ();const JQ=Un(GQ),XQ=Object.prototype.toString,ZQ=Error.prototype.toString,QQ=RegExp.prototype.toString,eee=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",tee=/^Symbol\((.*)\)(.*)$/;function nee(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function rI(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return nee(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return eee.call(t).replace(tee,"Symbol($1)");const r=XQ.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+ZQ.call(t)+"]":r==="RegExp"?QQ.call(t):null}function Cs(t,e){let n=rI(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=rI(this[r],e);return i!==null?i:o},2)}function oI(t){return t==null?[]:[].concat(t)}let iI,sI,aI,ree=/\$\{\s*(\w+)\s*\}/g;iI=Symbol.toStringTag;class lI{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[iI]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],oI(e).forEach(i=>{if(hr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}sI=Symbol.hasInstance,aI=Symbol.toStringTag;class hr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(ree,(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 lI(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[aI]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,hr)}static[sI](e){return lI[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ti={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}},Er={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"},oee={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"},hv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},iee={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:ti,string:Er,number:oee,date:hv,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:iee,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 hr.formatError(ti.notType,t)}}});const mv=t=>t&&t.__isYupSchema__;class Eh{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new Eh(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!mv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Oh={context:"$",value:"."};class ka{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]===Oh.context,this.isValue=this.key[0]===Oh.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Oh.context:this.isValue?Oh.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Ta.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}}ka.prototype.__isYupRef=!0;const Ea=t=>t==null;function Fl(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(B={}){const H=cI(Object.assign({value:n,originalValue:i,label:s.spec.label,path:B.path||r,spec:s.spec,disableStackTrace:B.disableStackTrace||S},p,B.params),k),F=new hr(hr.formatError(B.message||m,H),n,H.path,B.type||u,H.disableStackTrace);return F.params=H,F}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(B){return uI(B,k)},options:o,originalValue:i,schema:s};const I=B=>{hr.isError(B)?C(B):B?l(null):C(T())},N=B=>{hr.isError(B)?C(B):a(B)};if(b&&Ea(n))return I(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(I,N)}}catch(B){N(B);return}I(V)}return e.OPTIONS=t,e}function cI(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=uI(t[n],e);return t}function uI(t,e){return ka.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function see(t,e,n,r=n){let o,i,s;return e?(Ta.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 Mh extends Set{describe(){const e=[];for(const n of this.values())e.push(ka.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(mv(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 aee(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 lee(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:aee(n)}))}function dI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return lee(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>dI(o,r))}class ni{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(ti.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&&Ea(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`);Kt.customSchemes.push([t,e])}function pQ(){Kt.scanner=iQ(Kt.customSchemes);for(let t=0;t<Kt.tokenQueue.length;t++)Kt.tokenQueue[t][1]({scanner:Kt.scanner});Kt.parser=lQ(Kt.scanner.tokens);for(let t=0;t<Kt.pluginQueue.length;t++)Kt.pluginQueue[t][1]({scanner:Kt.scanner,parser:Kt.parser});return Kt.initialized=!0,Kt}function sv(t){return Kt.initialized||pQ(),cQ(Kt.parser.start,t,I2(Kt.scanner.start,t))}sv.scan=I2;function B2(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 ]",hQ=new RegExp(av),mQ=new RegExp(`${av}$`),gQ=new RegExp(av,"g");function yQ(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function bQ(t){return new en({key:new On("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=YR(n.doc,[...e]);if(e3(a).forEach(({newRange:u})=>{const f=JR(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(!mQ.test(b))return;p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")}if(p&&m){const b=m.split(hQ).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=sv(v).map(S=>S.toObject(t.defaultProtocol));if(!yQ(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=>{Gg(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 vQ(t){return new en({key:new On("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=Yg(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 xQ(t){return new en({key:new On("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=B2(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(gQ,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const wQ=xr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){L2(t);return}L2(t.scheme,t.optionalSlashes)})},onDestroy(){fQ()},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",St(this.options.HTMLAttributes,t),0]:["a",St(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!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[us({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=B2(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(bQ({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(vQ({type:this.type})),this.options.linkOnPaste&&t.push(xQ({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});function SQ(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=k3(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 CQ=new On("suggestion");function TQ({pluginKey:t=CQ,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:f="is-empty",command:p=()=>null,items:m=()=>[],render:b=()=>({}),allow:v=()=>!0,findSuggestionMatch:y=SQ}){let x;const S=b==null?void 0:b(),k=new en({key:t,view(){return{update:async(T,C)=>{var O,I,N,L,V,M,B;const H=(O=this.key)===null||O===void 0?void 0:O.getState(C),F=(I=this.key)===null||I===void 0?void 0:I.getState(T.state),P=H.active&&F.active&&H.range.from!==F.range.from,_=!H.active&&F.active,D=H.active&&!F.active,R=!_&&!D&&H.query!==F.query,j=_||P&&R,K=R||P,U=D||P&&R;if(!j&&!K&&!U)return;const Y=U&&!j?H:F,he=T.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);x={editor:e,range:Y.range,query:Y.query,text:Y.text,items:[],command:ce=>p({editor:e,range:Y.range,props:ce}),decorationNode:he,clientRect:he?()=>{var ce;const{decorationId:le}=(ce=this.key)===null||ce===void 0?void 0:ce.getState(e.state),X=T.dom.querySelector(`[data-decoration-id="${le}"]`);return(X==null?void 0:X.getBoundingClientRect())||null}:null},j&&((N=S==null?void 0:S.onBeforeStart)===null||N===void 0||N.call(S,x)),K&&((L=S==null?void 0:S.onBeforeUpdate)===null||L===void 0||L.call(S,x)),(K||j)&&(x.items=await m({editor:e,query:Y.query})),U&&((V=S==null?void 0:S.onExit)===null||V===void 0||V.call(S,x)),K&&((M=S==null?void 0:S.onUpdate)===null||M===void 0||M.call(S,x)),j&&((B=S==null?void 0:S.onStart)===null||B===void 0||B.call(S,x))},destroy:()=>{var T;x&&((T=S==null?void 0:S.onExit)===null||T===void 0||T.call(S,x))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(T,C,O,I){const{isEditable:N}=e,{composing:L}=e.view,{selection:V}=T,{empty:M,from:B}=V,H={...C};if(H.composing=L,N&&(M||e.view.composing)){(B<C.range.from||B>C.range.to)&&!L&&!C.composing&&(H.active=!1);const F=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:V.$from}),P=`id_${Math.floor(Math.random()*4294967295)}`;F&&v({editor:e,state:I,range:F.range,isActive:C.active})?(H.active=!0,H.decorationId=C.decorationId?C.decorationId:P,H.range=F.range,H.query=F.query,H.text=F.text):H.active=!1}else H.active=!1;return H.active||(H.decorationId=null,H.range={from:0,to:0},H.query=null,H.text=null),H}},props:{handleKeyDown(T,C){var O;const{active:I,range:N}=k.getState(T.state);return I&&((O=S==null?void 0:S.onKeyDown)===null||O===void 0?void 0:O.call(S,{view:T,event:C,range:N}))||!1},decorations(T){const{active:C,range:O,decorationId:I,query:N}=k.getState(T);if(!C)return null;const L=!(N!=null&&N.length),V=[l];return L&&V.push(f),Jt.create(T.doc,[Yn.inline(O.from,O.to,{nodeName:a,class:V.join(" "),"data-decoration-id":I,"data-decoration-content":u})])}}});return k}function kQ({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 F2(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>kQ({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function R2(t,e){const n=F2(t),r=n.find(o=>o.char===e);return r||(n.length?n[0]:null)}const EQ=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",St(this.HTMLAttributes,t.HTMLAttributes),`${(r=n==null?void 0:n.char)!==null&&r!==void 0?r:"@"}${(o=e.attrs.label)!==null&&o!==void 0?o:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=R2(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",St({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=St({"data-type":this.name},this.options.HTMLAttributes,e);const o=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof o=="string"?["span",St({"data-type":this.name},this.options.HTMLAttributes,e),o]:o},renderText({node:t}){const e={options:this.options,node:t,suggestion:R2(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 F2(this).map(TQ)}}),z2=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 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&&cf(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Yn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Jt.create(t,o)}}})]}}),OQ=xr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",St(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),MQ=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",St(this.options.HTMLAttributes,t),0]}}),_Q=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",St(this.options.HTMLAttributes,t),0]}}),IQ=tn.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",St(this.options.HTMLAttributes,t),0]}}),DQ=/^\s*(\[([( |x])?\])\s$/,AQ=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",St(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),u=()=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)===null||f===void 0?void 0:f.checkboxLabel)===null||p===void 0?void 0:p.call(f,t,a.checked))||`Task item checkbox for ${t.textContent||"empty task item"}`};return u(),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",f=>f.preventDefault()),a.addEventListener("change",f=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:p}=f.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:m})=>{const 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[ll({find:DQ,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),PQ=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",St(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),NQ=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")}}}),V2=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(z.Paper,{elevation:5,children:g.jsx(z.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>g.jsx(z.ListItem,{disablePadding:!0,children:g.jsx(z.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});V2.displayName="SuggestionList";const H2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},$Q={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 yO(V2,{props:n,editor:n.editor}),e=lu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??H2},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))??H2}})},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}}}},LQ=wQ.extend({inclusive:!1}),BQ=OQ.extend({excludes:"superscript"}),FQ=lM.extend({excludes:"subscript"});function RQ({placeholder:t}={}){return J.useMemo(()=>[E7.configure({resizable:!0}),IQ,_Q,MQ,fT,hT,mT,vT,IT,PT,NT,BQ,FQ,LT,cT,lT,pT,_T,aM,$T,LQ.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),u8,bT,l8,NQ.configure({types:["heading","paragraph","image"]}),YZ,GZ,JZ,i9,WT.configure({multicolor:!0}),MT,k8,gT,PQ,AQ.configure({nested:!0}),EQ.configure({suggestion:$Q}),z2.configure({placeholder:t}),OT],[t])}function W2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const zQ=t=>{const e=RQ({placeholder:"Add your own content here..."});if(t.renderContentOnly)return g.jsx(iM,{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=>{ib({images:O,editor:T,position:k})});else{const O=i(S);ib({images:O,editor:T,position:k})}},[]),v=J.useCallback((S,k,T,C)=>{var I;if(!(k instanceof DragEvent)||!k.dataTransfer)return!1;const O=W2(k.dataTransfer.files);if(O.length>0){const N=(I=S.posAtCoords({left:k.clientX,top:k.clientY}))==null?void 0:I.pos;return b(O,N),k.preventDefault(),!0}return!1},[b]),y=J.useCallback((S,k,T)=>{if(!k.clipboardData)return!1;const C=W2(k.clipboardData.files);return C.length>0?(b(C),!0):!1},[b]),x=g.jsx(z.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:g.jsx(oM,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:v,handlePaste:y},renderControls:s?void 0:()=>g.jsx(qZ,{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(K7,{}),g.jsx(aU,{})]})})});return g.jsxs(z.Box,{display:"flex",flexDirection:"column",children:[r&&g.jsx(z.Typography,{...o,children:r}),x]})},j2=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(z.Collapse,{in:n,children:u}):g.jsx(z.TableRow,{sx:p,children:g.jsx(z.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:g.jsx(z.Collapse,{in:n,children:u})})})},lv=({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(z.Box,{position:"relative","data-testid":`loading-overlay_${t?"active":"inactive"}`,children:[e,g.jsx(z.Box,{sx:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(255,255,255,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,pointerEvents:n?"auto":"none",opacity:n?1:0,transition:"opacity 0.3s ease"},children:g.jsx(z.CircularProgress,{})})]})},ei=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return g.jsx(z.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},Bu=t=>{const{gap:e=1,...n}=t;return g.jsx(z.Box,{display:"flex",flexDirection:"column",gap:e,...n})};function U2({icon:t,children:e,...n}){return e?g.jsx(z.Tooltip,{title:e,children:g.jsx(z.IconButton,{disableTouchRipple:!0,size:"small",children:g.jsx(t,{"data-testid":"MBv2_table-tooltip",fontSize:"small",...n})})}):null}function q2(t){return g.jsx(U2,{icon:oq,...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: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:I,selectedRowKey:N,headerRowStyle:L={},stickyHeader:V,reRenderExpand:M=!1,expandOnRowClick:B=!1,tooltipProps:H={},...F}=t,{palette:P}=z.useTheme(),_=P.grey[P.mode=="dark"?600:50],[D,R]=J.useState(void 0),[j,K]=J.useState(typeof O=="string"||typeof O=="number"?O:void 0);VQ(t);const U=me=>{me!==f?m&&m(me,"asc"):m&&m(f,p==="asc"?"desc":"asc")},Y=me=>f===me?p:null,he=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),ce=r.filter(me=>!me.hideCol&&(!he||!me.hideOnMobile));u&&!he&&ce.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:(me,Be)=>{const De=n(Be),yt=D===De;return g.jsx(z.IconButton,{"data-testid":"expand-collapse-btn","aria-label":yt?"collapse row":"expand row",size:"small",onClick:()=>Z(De),children:yt?g.jsx(pp,{"data-testid":"collapse-up"}):g.jsx(y0,{"data-testid":"expand-down"})})}}),a&&l&&ce.unshift({key:"MBv2_Checkbox_Column",fieldName:"id",label:"",hideOnMobile:!0,render:(me,Be)=>{const De=n(Be);return g.jsx(z.Checkbox,{onChange:()=>{const yt=a.includes(De);l(yt?a.filter(ct=>ct!==De):[...a,De])},checked:a.includes(De)})}});const le=m!==void 0,X=me=>le?b?b.includes(me):!0:!1,oe=g.jsxs(z.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(iq,{})," ",x]}),fe=g.jsxs(z.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[g.jsx(uw,{color:"error"})," ",S,k&&g.jsx(z.Button,{variant:"text",onClick:k,children:"Retry?"})]}),ne=()=>{if(S)return g.jsx(z.TableRow,{children:g.jsx(z.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:fe})});if(o.length===0)return g.jsx(z.TableRow,{children:g.jsx(z.TableCell,{colSpan:r.length,align:"center",sx:{borderBottom:"unset"},children:oe})})},re=()=>{if(S)return fe;if(o.length===0)return oe},ue=me=>{O&&K(me)},ye=me=>{const Be=n(me);if((i||s)&&(i==null||i(Be),s==null||s(me),ue(Be)),u&&B){const De=D===Be?void 0:Be;R(De),ue(De)}},Z=me=>{const Be=D===me?void 0:me;R(Be),ue(Be)},ee=me=>{if(!u)return;const Be=D===n(me);return g.jsxs(g.Fragment,{children:[g.jsxs(z.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>Z(n(me)),children:[Be?g.jsx(pp,{}):g.jsx(y0,{})," Show"," ",Be?"Less":"More"]}),g.jsx(j2,{colSpan:r.length,isExpanded:n(me)===D,obj:me,renderExpand:De=>u(De),asMobileCard:!0})]})},ie=I??_,Se=me=>{const De=(O?j:N)===n(me)?ie:"inherit",yt=i||s||B;return{cursor:yt?"pointer":"default",backgroundColor:De,...u?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...yt&&{"&:hover":{backgroundColor:De===ie?kG(De,.1):ie}}}},Ce=me=>g.jsx(q2,{...H,children:me}),Pe=(me,Be)=>{const De=me.find(ct=>ct.key==="MBv2_Checkbox_Column"),yt=ce.filter(ct=>ct.key!=="MBv2_Checkbox_Column");return g.jsxs(ei,{alignItems:"flex-start",children:[De&&g.jsx(Bu,{children:Bl(De,Be,he)}),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??Ln(xn(ct)),Ce(ct.tooltip)]}),g.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${xn(ct)}`,style:{paddingLeft:"10px"},children:Bl(ct,Be,he)})]},`row-${n(Be)}-${xn(ct)}`))})}),ee(Be)]})]})},Me=()=>g.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[le&&g.jsxs(g.Fragment,{children:[g.jsxs(z.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[g.jsx(z.TextField,{select:!0,sx:{flexGrow:1},size:"small",value:f??"",label:"Sort By...",onChange:me=>U(me.target.value),fullWidth:!0,children:ce.map(me=>{if(X(xn(me)))return g.jsx(z.MenuItem,{value:xn(me),children:me.label??Ln(xn(me))},`rowHeader-${xn(me)}`)})}),g.jsx(z.IconButton,{onClick:()=>{f&&U(f)},children:g.jsx(fq,{className:`sort-icon-${p}`})})]}),g.jsx(z.Divider,{sx:{margin:"10px 0"}})]}),re()??o.map(me=>g.jsx(z.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:Pe(ce,me)},n(me)))]}),Ie=()=>g.jsx(z.TableContainer,{component:z.Card,"data-testid":"mui-table",...e?{tableId:`table-${e}`}:{},className:y,style:V?{maxHeight:V,overflow:"auto"}:{},children:g.jsxs(z.Table,{stickyHeader:V!=="undefined",style:{tableLayout:v?"fixed":"auto"},className:"MBv2_Table",sx:L?{"& .MuiTableCell-head":{...L}}:{},...F,children:[g.jsx(z.TableHead,{className:"MBv2_Table_Head",children:g.jsx(z.TableRow,{className:"MBv2_Table_Head_Row",children:ce.map((me,Be)=>{const De=X(xn(me));return g.jsx(z.TableCell,{width:Array.isArray(v)?v[Be]:"auto",sx:me.tableCellSx??{},children:g.jsx(z.Box,{style:{display:"flex",alignItems:"center"},children:g.jsxs(z.Box,{sx:[De&&{"&:hover":{cursor:"pointer",backgroundColor:P.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:De?()=>U(xn(me)):void 0,children:[g.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},"data-testid":"column-title",children:me.label??Ln(xn(me))}),Ce(me.tooltip),De&&Y(xn(me))==="asc"&&g.jsx(pp,{style:{marginLeft:"5px"}}),De&&Y(xn(me))==="desc"&&g.jsx(y0,{style:{marginLeft:"5px"}}),De&&Y(xn(me))!=="asc"&&Y(xn(me))!=="desc"&&g.jsx(uq,{style:{marginLeft:"5px"}})]})})},`rowHeader-${xn(me)}`)})})}),g.jsx(z.TableBody,{className:"MBv2_Table_Body",children:ne()??o.map(me=>g.jsxs(J.Fragment,{children:[g.jsx(z.TableRow,{"data-testid":`row-${n(me)}`,className:"MBv2_Table_Body_Row",onClick:()=>ye(me),sx:Se(me),children:ce.map(Be=>g.jsx(z.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${xn(Be)}`,children:Bl(Be,me,he)},`row-${n(me)}-${xn(Be)}`))}),u&&g.jsx(j2,{colSpan:ce.length,isExpanded:n(me)===D,obj:me,renderExpand:Be=>u(Be),reRenderExpand:M})]},n(me)))})]})});return g.jsx(lv,{isLoading:T,children:he&&!C?Me():Ie()})},VQ=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=>xn(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)`)},xn=t=>t.key??t.fieldName,HQ=(t,e)=>e.split(".").reduce((n,r)=>{if(n&&typeof n=="object")return n[r]},t),Bl=(t,e,n=!1)=>{const r=HQ(e,t.fieldName);return t.render?t.render(r,e,n):r},K2=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=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return g.jsxs(z.Box,{children:[g.jsx(cv,{sortOrder:p,sortField:f,...s}),!o&&!y&&g.jsx(z.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}}})]})},Y2=()=>({height:window.innerHeight,width:window.innerWidth}),G2=()=>{const[t,e]=J.useState(Y2());return J.useEffect(()=>{const n=()=>{e(Y2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},kr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=G2(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return g.jsx(z.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...cr({...t},a)})},WQ=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return g.jsx(z.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[g.jsxs(z.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),g.jsxs(z.Box,{display:"flex",flexDirection:"row",children:[g.jsx(kr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(kr,{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"})]})]})})},jQ=t=>{const{citation:e,anchorEl:n,onClose:r,open:o}=t;return g.jsx(z.Popper,{open:o,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&g.jsxs(z.Box,{component:z.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[g.jsxs(z.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(z.Box,{display:"flex",flexDirection:"row",children:[g.jsx(kr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),g.jsx(kr,{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=J.useRef(null),[o,i]=J.useState(!1),s=()=>{i(!1)};return!t||e.fileName?null:g.jsxs(g.Fragment,{children:[n?g.jsx(z.Link,{ref:r,component:"button",sx:{cursor:"pointer"},type:"button",onClick:()=>i(!0),children:e.url}):g.jsx(z.Tooltip,{title:"Open URL",children:g.jsx(z.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(jQ,{citation:e,anchorEl:r.current,onClose:s,open:o})]})}function J2({onDownloadAttachment:t,citation:e}){if(!(!t||!e.fileName))return g.jsx(z.Tooltip,{title:"Download",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_download-btn-${e.id}`,children:g.jsx(nq,{})})})}function X2({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(z.Tooltip,{title:"View File",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>t==null?void 0:t(e),"data-testid":`citation-table_view-file-btn-${e.id}`,children:g.jsx(b0,{})})})}const UQ=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:I=!1,showCloseBtn:N=!1,canSearch:L=!1}=t,V=!!t.canCreate&&!I,M=!!a&&!!s&&!I,B=!!u&&!!l&&I&&k,H=!!f&&!I,{palette:F}=z.useTheme(),[P,_]=J.useState([]),[D,R]=J.useState(!1),[j,K]=J.useState(!0),[U,Y]=J.useState(null),[he,ce]=J.useState(null),[le,X]=J.useState({pageNo:0,pageSize:k?5:10,totalCount:0,search:L?"":void 0}),oe=()=>{R(!1),K(!0),v({pageNo:le.pageNo,pageSize:le.pageSize,search:le.search},y).then(Ie=>(_(Ie.data),X(me=>({...me,totalCount:Ie.totalCount})),Ie)).catch(Ie=>{S(Ie),R(!0),_([])}).finally(()=>K(!1))};J.useEffect(oe,[le.pageNo,le.pageSize,e,le.search]);const fe=()=>{ce(null),Y(null)},ne=g.jsx(kr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:o,startIcon:g.jsx(Wf,{}),children:"Add Citation"}),re=g.jsx(kr,{variant:T?"outlined":"contained",size:T?"small":"medium",onClick:i,startIcon:g.jsx(RM,{}),children:"Add Attachment"}),ue=Ie=>{if(!(!M&&!B)){if(M)return g.jsx(z.Tooltip,{title:"Edit",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?a(Ie.id):s(Ie.id),"data-testid":`citation-table_edit-btn-${Ie.id}`,children:g.jsx(rq,{})})});if(B)return g.jsx(z.Tooltip,{title:"View",children:g.jsx(z.IconButton,{color:"primary",onClick:()=>Ie.fileName?u(Ie.id):l(Ie.id),"data-testid":`citation-table_view-btn-${Ie.id}`,children:g.jsx(pq,{})})})}},ye=Ie=>{if(!(!H||I))return g.jsx(z.Tooltip,{title:"Delete",children:g.jsx(z.IconButton,{color:"error",onClick:me=>{ce(Ie),Y(me.currentTarget)},"data-testid":`citation-table_delete-btn-${Ie.id}`,children:g.jsx(e0,{})})})},Z=Ie=>g.jsx(uv,{citation:Ie,canLaunchUrl:C}),ee=Ie=>g.jsx(X2,{citation:Ie,onPreviewAttachment:m}),ie=Ie=>g.jsx(J2,{citation:Ie,onDownloadAttachment:p}),Se=B||M||H||C||m||p||O,Ce=[...Q2(F,k),{fieldName:"id",key:"Action",label:"Action",hideCol:!Se,render:(Ie,me)=>g.jsxs(z.Box,{display:"flex",flexDirection:"row-reverse",children:[O==null?void 0:O(me),ye(me),ue(me),ee(me),Z(me),ie(me)]})}],Pe=J.useCallback(Ie=>{X(me=>({...me,pageNo:0,search:Ie}))},[]),Me=()=>L?g.jsx(HM,{onSearch:Pe}):null;return g.jsxs(Bu,{children:[g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[g.jsx(z.Typography,{variant:k?"h6":"h2",children:n}),!T&&V&&g.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:1,children:[ne,re]}),N&&g.jsx(z.IconButton,{onClick:r,children:g.jsx(fp,{})})]}),Me(),g.jsx(K2,{"data-testid":"citation-table",size:k?"x-small":"medium",isLoading:j,columns:Ce,data:P,paginationState:le,onPageChange:Ie=>X(me=>({...me,pageNo:Ie})),onRowsPerPageChange:Ie=>X(me=>({...me,pageSize:Ie,pageNo:0})),errorTableMsg:D?"Failed to load citations.":void 0,retryCallback:oe,setCheckedKeys:T?x:void 0,checkedKeys:T?y:void 0}),T&&g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",children:[g.jsx(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:V&&g.jsxs(g.Fragment,{children:[ne,re]})}),!I&&g.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[g.jsx(kr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),g.jsxs(kr,{variant:"contained",size:"small",onClick:()=>b(y),children:["Select",y.length>0&&` (${y.length})`]})]})]}),g.jsx(WQ,{citation:he,anchorEl:U,onDeleteCitation:f,onClose:fe})]})},Z2=(t,e)=>{const n=t?ga.truncate(e,{length:30,omission:"..."}):e,r=n==null?void 0:n.endsWith("...");return g.jsx("span",{style:{wordBreak:"break-all"},children:r?g.jsx(z.Tooltip,{title:e,children:g.jsx("span",{children:n})}):e})},Q2=(t,e=!1)=>[{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(n,r)=>g.jsx(z.Tooltip,{title:n?"Attachment":"URL",children:n?g.jsx(RM,{sx:{color:t.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${r.id}`}):g.jsx(Wf,{sx:{color:t.grey[500],marginTop:"6px"},"data-testid":`url-icon-${r.id}`})}),ignoreDiff:!0},{fieldName:"title",render:n=>Z2(e,n)},{fieldName:"fileName",key:"URL/File Name",label:"URL/Other Identifier/File Name",render:(n,r)=>Z2(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 dv,eI;function qQ(){if(eI)return dv;eI=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);dv={Cache:t,split:p,normalizePath:f,setter:function(S){var k=f(S);return l.get(S)||l.set(S,function(C,O){for(var I=0,N=k.length,L=C;I<N-1;){var V=k[I];if(V==="__proto__"||V==="constructor"||V==="prototype")return C;L=L[k[I++]]}L[k[I]]=O})},getter:function(S,k){var T=f(S);return u.get(S)||u.set(S,function(O){for(var I=0,N=T.length;I<N;)if(O!=null||!k)O=O[T[I++]];else return;return O})},join:function(S){return S.reduce(function(k,T){return k+(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,I,N,L;for(I=0;I<C;I++)O=S[I],O&&(x(O)&&(O='"'+O+'"'),L=b(O),N=!L&&/^\d+$/.test(O),k.call(T,O,L,N,I,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 dv}var Ta=qQ(),fv,tI;function KQ(){if(tI)return fv;tI=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 fv={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(" ")},fv}var pv=KQ(),Th={exports:{}},nI;function YQ(){if(nI)return Th.exports;nI=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,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 Th.exports}var GQ=YQ();const JQ=Un(GQ),XQ=Object.prototype.toString,ZQ=Error.prototype.toString,QQ=RegExp.prototype.toString,eee=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",tee=/^Symbol\((.*)\)(.*)$/;function nee(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function rI(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return nee(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return eee.call(t).replace(tee,"Symbol($1)");const r=XQ.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+ZQ.call(t)+"]":r==="RegExp"?QQ.call(t):null}function Cs(t,e){let n=rI(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=rI(this[r],e);return i!==null?i:o},2)}function oI(t){return t==null?[]:[].concat(t)}let iI,sI,aI,ree=/\$\{\s*(\w+)\s*\}/g;iI=Symbol.toStringTag;class lI{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[iI]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],oI(e).forEach(i=>{if(hr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}sI=Symbol.hasInstance,aI=Symbol.toStringTag;class hr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(ree,(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 lI(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[aI]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,hr)}static[sI](e){return lI[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let ti={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}},Er={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"},oee={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"},hv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},iee={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:ti,string:Er,number:oee,date:hv,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:iee,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 hr.formatError(ti.notType,t)}}});const mv=t=>t&&t.__isYupSchema__;class Eh{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new Eh(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!mv(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Oh={context:"$",value:"."};class ka{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]===Oh.context,this.isValue=this.key[0]===Oh.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Oh.context:this.isValue?Oh.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Ta.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}}ka.prototype.__isYupRef=!0;const Ea=t=>t==null;function Fl(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(B={}){const H=cI(Object.assign({value:n,originalValue:i,label:s.spec.label,path:B.path||r,spec:s.spec,disableStackTrace:B.disableStackTrace||S},p,B.params),k),F=new hr(hr.formatError(B.message||m,H),n,H.path,B.type||u,H.disableStackTrace);return F.params=H,F}const C=x?a:l;let O={path:r,parent:v,type:u,from:o.from,createError:T,resolve(B){return uI(B,k)},options:o,originalValue:i,schema:s};const I=B=>{hr.isError(B)?C(B):B?l(null):C(T())},N=B=>{hr.isError(B)?C(B):a(B)};if(b&&Ea(n))return I(!0);let V;try{var M;if(V=f.call(O,n,O),typeof((M=V)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(V).then(I,N)}}catch(B){N(B);return}I(V)}return e.OPTIONS=t,e}function cI(t,e){if(!t)return t;for(const n of Object.keys(t))t[n]=uI(t[n],e);return t}function uI(t,e){return ka.isRef(t)?t.getValue(e.value,e.parent,e.context):t}function see(t,e,n,r=n){let o,i,s;return e?(Ta.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 Mh extends Set{describe(){const e=[];for(const n of this.values())e.push(ka.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(mv(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 aee(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 lee(t,e){const n=e?`${e}.${t.path}`:t.path;return t.errors.map(r=>({message:r,path:aee(n)}))}function dI(t,e){var n;if(!((n=t.inner)!=null&&n.length)&&t.errors.length)return lee(t,e);const r=e?`${e}.${t.path}`:t.path;return t.inner.flatMap(o=>dI(o,r))}class ni{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(ti.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&&Ea(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 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)=>{hr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new hr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw hr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new hr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(hr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(hr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):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=Fl({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=Fl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=ti.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ti.notNull){return this.nullability(!1,e)}required(e=ti.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=ti.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Fl(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=oI(e).map(i=>new ka(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Eh(o,n):Eh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Fl({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=ti.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Fl({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=ti.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Fl({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?cI(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof hr)return{issues:dI(o)};throw o}}}}}ni.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ni.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=see(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ni.prototype[t]=ni.prototype.oneOf;for(const t of["not","nope"])ni.prototype[t]=ni.prototype.notOneOf;const cee=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function uee(t){const e=gv(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 gv(t){var e,n;const r=cee.exec(t);return r?{year:Pi(r[1]),month:Pi(r[2],1)-1,day:Pi(r[3],1),hour:Pi(r[4]),minute:Pi(r[5]),second:Pi(r[6]),millisecond:r[7]?Pi(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:Pi(r[10]),minuteOffset:Pi(r[11])}:null}function Pi(t,e=0){return Number(t)||e}let dee=/^[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])?)*$/,fee=/^((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,pee=/^(?:[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,hee="^\\d{4}-\\d{2}-\\d{2}",mee="\\d{2}:\\d{2}:\\d{2}",gee="(([+-]\\d{2}(:?\\d{2})?)|Z)",yee=new RegExp(`${hee}T${mee}(\\.\\d+)?${gee}$`),bee=t=>Ea(t)||t===t.trim(),vee={}.toString();function zl(){return new fI}class fI extends ni{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===vee?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||ti.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=Er.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=Er.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=Er.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||Er.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=Er.email){return this.matches(dee,{name:"email",message:e,excludeEmptyString:!0})}url(e=Er.url){return this.matches(fee,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=Er.uuid){return this.matches(pee,{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(yee,{name:"datetime",message:n||Er.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||Er.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=gv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||Er.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=gv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=Er.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:bee})}lowercase(e=Er.lowercase){return this.transform(n=>Ea(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ea(n)||n===n.toLowerCase()})}uppercase(e=Er.uppercase){return this.transform(n=>Ea(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ea(n)||n===n.toUpperCase()})}}zl.prototype=fI.prototype;let pI=new Date(""),xee=t=>Object.prototype.toString.call(t)==="[object Date]";function yv(){return new Fu}class Fu extends ni{constructor(){super({type:"date",check(e){return xee(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=uee(e),isNaN(e)?Fu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ka.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=hv.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=hv.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)}})}}Fu.INVALID_DATE=pI,yv.prototype=Fu.prototype,yv.INVALID_DATE=pI;function wee(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Ta.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),ka.isRef(a)&&a.isSibling?i(a.path,s):mv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return JQ.array(Array.from(r),n).reverse()}function hI(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 mI(t){return(e,n)=>hI(t,e)-hI(t,n)}const See=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function _h(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=_h(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=_h(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(_h)}):"optional"in t?t.optional():t}const Cee=(t,e)=>{const n=[...Ta.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Ta.getter(Ta.join(n),!0)(t);return!!(o&&r in o)};let gI=t=>Object.prototype.toString.call(t)==="[object Object]";function yI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Tee=mI([]);function bv(t){return new bI(t)}class bI extends ni{constructor(e){super({type:"object",check(n){return gI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Tee,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 ni?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||!gI(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ka.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=wee(e,n),r._sortErrors=mI(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 _h(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=Ta.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Cee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(See)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||kh.exact,test(n){if(n==null)return!0;const r=yI(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=yI(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(pv.camelCase)}snakeCase(){return this.transformKeys(pv.snakeCase)}constantCase(){return this.transformKeys(e=>pv.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}}bv.prototype=bI.prototype;const kee=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return g.jsx(z.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:g.jsxs(Bu,{component:z.Paper,p:1,boxShadow:9,gap:.25,children:[g.jsx(z.Typography,{variant:"body1",children:"Paste in a preformatted citation"}),g.jsx(z.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(Mee(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>g.jsxs(ei,{flexWrap:"wrap",justifyContent:"flex-end",children:[g.jsx(BM,{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(z.Tooltip,{title:"Paste from Clipboard",children:g.jsx(z.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:g.jsx(tq,{})})})}),g.jsxs(ei,{children:[g.jsx(kr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),g.jsx(kr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},Eee=["https://","http://","www."],Oee=new RegExp(Eee.join("|")),Mee=t=>{const e=t.replace(/\.\s*$/,"").split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.match(Oee)),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:Ih(e,l),title:Ih(e,a),url:Ih(e,n),accessedAt:_ee(e,r),classification:Iee(e,o),details:Ih(e,o)}},Ih=(t,e)=>e<0||e>=t.length?"":t[e],_ee=(t,e)=>e<0||e>=t.length?"":HZ(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),Iee=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",vI=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return g.jsx(kr,{type:n,disabled:e,size:r,startIcon:e?g.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})},xI=t=>{const{onCancel:e,onViewCitationTable:n,readOnly:r=!1,showViewAllCitationsBtn:o=!1,isLoading:i,onSaveClicked:s}=t;return r&&!o?null:r?g.jsx(z.DialogActions,{sx:{px:0},children:g.jsx(z.Button,{onClick:n,size:"small",variant:"outlined",children:"Back To Table"})}):g.jsxs(z.DialogActions,{sx:{px:0,justifyContent:"space-between"},children:[g.jsx(z.Box,{children:o&&g.jsx(z.Button,{onClick:n,size:"small",variant:"outlined",children:"View All Citations"})}),g.jsxs(ei,{children:[g.jsx(z.Button,{onClick:e,variant:"outlined",size:"small",children:"Cancel"}),g.jsx(vI,{size:"small",loading:i,type:"button",onClick:s,children:"Save"})]})]})},Dee=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(z.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(ei,{justifyContent:"space-between",children:[g.jsxs(ei,{gap:2,children:[g.jsxs(z.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Citation"]}),C&&g.jsx(z.Button,{variant:"outlined",size:"small",ref:v,onClick:()=>x(!0),children:"Paste & Prefill"})]}),g.jsx(z.IconButton,{onClick:o,children:g.jsx(fp,{})})]}),g.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:S,onSubmit:async O=>{p(!0),e(O).catch(I=>{throw p(!1),I}).finally(()=>p(!1))},validationSchema:bv({title:zl().required("Title is required"),accessedAt:yv().required("Accessed At is required"),url:zl().required("URL is required"),classification:zl().required("Classification is required")}),validateOnBlur:m,validateOnChange:m,children:({submitForm:O,setValues:I,values:N})=>g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[g.jsx(Ei,{...T,name:"title",required:!0}),g.jsx(Ei,{...T,name:"source"}),g.jsx(Ei,{...T,name:"details",label:"Details (e.g. Source Description)"}),g.jsx(Up,{...T,name:"accessedAt",required:!0,isDatePicker:!0}),s&&(l!=null&&l(N))?g.jsx(g.Fragment,{children:g.jsx(ki,{label:"URL / Other Identifier",readOnlyValue:g.jsx(uv,{citation:N,canLaunchUrl:l,asLink:!0}),value:N.url??""})}):g.jsx(Ei,{...T,name:"url",label:"URL / Other Identifier",required:!0,endIcon:g.jsx(uv,{citation:N,canLaunchUrl:l})}),g.jsx(LM,{...T,name:"classification",row:!0,required:!0,radios:Aee})]}),g.jsx(xI,{isLoading:f,onSaveClicked:()=>{b(!0),O()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n}),g.jsx(kee,{open:y,onGenerateCitation:L=>{I(L,!0)},anchorEl:v.current,onClose:()=>x(!1)})]})})]})},Aee=[{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,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(z.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[g.jsxs(z.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Attachment"]}),g.jsx(z.IconButton,{onClick:o,children:g.jsx(fp,{})})]}),g.jsx(Ht.Formik,{innerRef:f,enableReinitialize:!0,initialValues:y,validationSchema:bv().shape({title:zl().required("Title is required"),fileName:zl().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 I,N;(I=S.file)!=null&&I.name&&k("fileName",(N=S.file)==null?void 0:N.name)},[(O=S.file)==null?void 0:O.name]),g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsx(Ei,{name:"title",disabled:p,required:!0,margin:"none",readOnly:s}),g.jsxs(z.Box,{marginTop:C?1:0,children:[g.jsxs(ei,{alignItems:"flex-start",children:[C&&g.jsx(yM,{name:"file",errorMode:"hidden"}),g.jsxs(ei,{alignItems:"flex-end",children:[g.jsx(Ei,{readOnly:!0,name:"fileName",label:C?"":"File Name"}),!C&&g.jsxs(ei,{children:[g.jsx(J2,{citation:S,onDownloadAttachment:l}),g.jsx(X2,{citation:S,onPreviewAttachment:u})]})]})]}),g.jsx(br,{name:"fileName"})]}),g.jsx(xI,{isLoading:p,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,...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(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return g.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[g.jsx(z.Box,{children:b()}),g.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return g.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsx(z.Box,{children:b()})})};return g.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?g.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&g.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:g.jsx(fp,{})})]})}):r,o&&(typeof o=="string"?g.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:g.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function Nee(t){return Ke("MuiAlert",t)}const wI=je("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),$ee=Le(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"),Lee=Le(g.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),Bee=Le(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"),Fee=Le(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"),Ree=Le(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"),zee=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ne(n||r)}`,`${e}${Ne(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return qe(i,Nee,o)},Vee=te(ps,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ne(n.color||n.severity)}`]]}})(bt(({theme:t})=>{const e=t.palette.mode==="light"?Vs:Ha,n=t.palette.mode==="light"?Ha:Vs;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${wI.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${wI.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),Hee=te("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Wee=te("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),jee=te("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),SI={success:g.jsx($ee,{fontSize:"inherit"}),warning:g.jsx(Lee,{fontSize:"inherit"}),error:g.jsx(Bee,{fontSize:"inherit"}),info:g.jsx(Fee,{fontSize:"inherit"})},CI=A.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=SI,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=zee(C),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[N,L]=_t("root",{ref:n,shouldForwardComponentProp:!0,className:ge(O.root,s),elementType:Vee,externalForwardedProps:{...I,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=_t("icon",{className:O.icon,elementType:Hee,externalForwardedProps:I,ownerState:C}),[B,H]=_t("message",{className:O.message,elementType:Wee,externalForwardedProps:I,ownerState:C}),[F,P]=_t("action",{className:O.action,elementType:jee,externalForwardedProps:I,ownerState:C}),[_,D]=_t("closeButton",{elementType:Il,externalForwardedProps:I,ownerState:C}),[R,j]=_t("closeIcon",{elementType:Ree,externalForwardedProps:I,ownerState:C});return g.jsxs(N,{...L,children:[p!==!1?g.jsx(V,{...M,children:p||m[y]||SI[y]}):null,g.jsx(B,{...H,children:i}),o!=null?g.jsx(F,{...P,children:o}):null,o==null&&b?g.jsx(F,{...P,children:g.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:b,...D,children:g.jsx(R,{fontSize:"small",...j})})}):null]})});process.env.NODE_ENV!=="production"&&(CI.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const zu=t=>{var b;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(b=l[r])==null?void 0:b.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return g.jsxs(CI,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&g.jsx(z.Typography,{variant:"h3",children:s}),n]})},TI=t=>g.jsx(zu,{severity:"error",...t}),kI=t=>g.jsx(zu,{severity:"success",...t}),Uee=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(TI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&g.jsx(kI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function EI({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,I]=J.useState(u),[N,L]=J.useState(void 0),[V,M]=J.useState(void 0),[B,H]=J.useState(!1),[F,P]=J.useState(!1),_=ee=>{M(void 0),C(ee)},[D,R]=J.useState(0);J.useEffect(()=>{f==null||f()},[T,V,f]);const j=(ee=!1)=>{(!m||ee)&&R(ie=>ie+1)},K=(ee,ie)=>{var Me;const Se=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:Se??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(()=>{B?l():(_("Insert Citation/Attachment(s)"),j())}).catch(ie=>{K("Failed to update",ie)})):await(e==null?void 0:e(ee).then(ie=>{I([...O,ie.id]),_("Insert Citation/Attachment(s)"),j()}).catch(ie=>{K("Failed to create",ie)}))},he=r&&(async ee=>r(ee).then(()=>{j(!0),I(O.filter(ie=>ie!==ee)),U("Successfully deleted")}).catch(ie=>K("Failed to delete",ie))),ce=o&&(ee=>{o(ee).then(ie=>{const Se=!!ie.fileName;L(ie),_(Se?"Attachment":"Citation")}).catch(ie=>{K("Failed to load",ie)}).finally(()=>P(!1))}),le=n&&ce,X=n&&ce,oe=i&&(async ee=>i(ee).catch(ie=>{K(`Failed to download ${ee.fileName}`,ie)})),fe=s&&(async ee=>s(ee).catch(ie=>{K(`Failed to view ${ee.fileName}`,ie)})),ne=g.jsx(UQ,{refreshKey:D,getCitationsPaginated:(ee,ie)=>t(ee,ie).then(Se=>(f==null||f(),Se)),onCancel:l,onNewCitation:()=>{L(void 0),_("Citation")},onNewAttachment:()=>{L(void 0),_("Attachment")},onEditCitation:le,onEditAttachment:X,onViewCitation:ce,onViewAttachment:ce,onDeleteCitation:he,onDownloadAttachment:oe,onPreviewAttachment:fe,onSelect:a,setSelectedIds:I,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(Dee,{modifyCitation:N,onSave:Y,onCancel:()=>B?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),H(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),readOnly:S,showViewAllCitationsBtn:S&&!B||!S&&B,canLaunchUrl:x}),ue=g.jsx(Pee,{onSave:Y,onCancel:()=>B?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),H(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),modifyCitation:N,readOnly:S,showViewAllCitationsBtn:S&&!B||!S&&B,onDownloadAttachment:oe,onPreviewAttachment:fe}),ye=g.jsx(Uee,{alert:V,setAlert:M});J.useEffect(()=>{m&&u.length===1&&ce&&(P(!0),H(!0),ce(u[0]))},[]);const Z=()=>{switch(T){case"Insert Citation/Attachment(s)":return ne;case"Citation":return re;case"Attachment":return ue}};return m?g.jsxs(z.Box,{children:[ye,g.jsx(z.Box,{paddingTop:"8px",children:g.jsx(lv,{isLoading:F,children:Z()})})]}):g.jsxs(z.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&ye,g.jsx(z.Box,{paddingTop:"8px",children:ne}),g.jsx(Ru,{open:T!=="Insert Citation/Attachment(s)",children:g.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[ye,T==="Citation"?re:ue]})})]})}function OI({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=(s,a)=>n?t(s,r):e(s,a);return g.jsx(EI,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const qee=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function Kee({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=Ct();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(Sy,{editor:m,open:v,...b.bubbleMenuOptions,...p,children:g.jsx(qee,{children:g.jsx(OI,{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 Yee=()=>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 Gee(t){const e=Ct(),n=J.useRef(null);return g.jsx(Tt,{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(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[g.jsx(ZU,{fontSize:"small"}),g.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const MI=J.createContext(void 0),_I=()=>{const t=J.useContext(MI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Jee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=_I(),[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=>ga.truncate(S.title,{length:b,omission:"..."})).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(Ib,{as:"span",...e,"data-testid":"citation-node-component",children:g.jsx(z.Tooltip,{title:g.jsx(z.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(z.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),y<p.length-1&&g.jsx(z.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})})})},Xee=tn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",St(t)]},addNodeView(){return Db(Jee)},addProseMirrorPlugins(){return[new en({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),II=t=>g.jsx(mM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Zee=t=>{const{name:e,label:n=Ln(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x=()=>{},placeholder:S="Start typing here...",notApplicableName:k,errorMode:T="normal",canLaunchUrl:C,canSearch:O=!1}=t,I=[BT,z2.configure({placeholder:S}),Yee(),Xee.configure({citationMaxLength:a})],[N,L,V]=Ht.useField({name:e}),{setValue:M}=V,{value:B}=N,{addUpdateCitation:H,deleteCitation:F,batchUpdate:P,citations:_}=_I();J.useEffect(()=>{var oe;const le=(oe=D==null?void 0:D.current)==null?void 0:oe.editor;if(!le)return;le.getHTML()!==B&&setTimeout(()=>{le.commands.setContent(B)},0)},[B]);const D=J.useRef(null),R={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},j=(le=void 0)=>{var fe,ne;const X=((ne=(fe=D.current)==null?void 0:fe.editor)==null?void 0:ne.getHTML())??"",oe=!X.replace(/<\/?p>|<br>/g,"").trim();M(oe?"":X,le)},K=J.useMemo(()=>ga.debounce(()=>j(!1),500),[M]),U=Hs(),{showDiff:Y,getPreviousValue:he}=Ws(),ce=i??U;if(Y){const le=he(e)??"",X=B,oe=/<citation\s+ids="([^"]*)"><\/citation>/g,fe=(ue,ye)=>{const Z=ye.split(",").map(Number);return`<sup>${_.filter(ee=>Z.includes(ee.id)).map(ee=>ee.title)}</sup>`},ne=le.replace(oe,fe),re=X.replace(oe,fe);return g.jsx(ki,{label:n,value:re,showDiff:!0,diffSnapshot:ne,mode:"html"})}return g.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:ce?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...R[s],display:"flex",flexDirection:"column",width:"100%",children:[g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&g.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),k&&g.jsx(II,{name:k})]}),g.jsx(oM,{ref:D,extensions:I,content:B,editable:!ce,renderControls:ce?void 0:()=>g.jsx(lb,{children:g.jsx(Gee,{})}),onBlur:()=>j(),onUpdate:K,RichTextFieldProps:{variant:ce?"standard":"outlined",MenuBarProps:{hide:ce}},children:()=>g.jsx(Kee,{getCitationsPaginated:(le,X)=>l(le,X).then(oe=>(P(oe.data),oe)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(le=>f(le).then(X=>(H(X),X))),onUpdateCitation:p&&(le=>p(le).then(X=>(H(X),X))),onDeleteCitation:m&&(le=>m(le).then(()=>F(le))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x,canLaunchUrl:C,readOnly:ce,canSearch:O})}),g.jsx(br,{name:e,id:`${e}-err`,errorMode:T})]})},Qee=t=>{const{name:e="submit"}=t;return g.jsx(kr,{name:e,type:"submit",...t})},ete=t=>{const{label:e="Return to Top",icon:n=pp,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return g.jsx(z.Zoom,{in:o,children:g.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:g.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[g.jsx(n,{fontSize:"medium"}),e]})})})},DI=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=vo.useNavigate(),[i,s]=A.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return g.jsxs(g.Fragment,{children:[g.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),g.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>g.jsxs(z.MenuItem,{...Ba(p,o),children:[p.icon&&g.jsx(z.ListItemIcon,{children:p.icon}),g.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},tte=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=z.useTheme();return g.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:g.jsxs(z.List,{children:[g.jsxs(z.ListItem,{children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(t,null,2)})]}),g.jsx(z.Divider,{variant:"inset",component:"li"}),g.jsxs(z.ListItem,{id:"testing",children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(e,null,2)})]}),g.jsxs(z.ListItem,{children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},nte=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=G2();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...cr({...t},l)};return g.jsx(z.Stepper,{...u,children:e.map(f=>g.jsx(z.Step,{children:g.jsx(z.StepLabel,{children:f})},f))})},rte=t=>{const{name:e,label:n=Ln(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?g.jsx(VM,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ht.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return g.jsxs(z.FormControl,{fullWidth:!0,children:[g.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?g.jsx(z.Typography,{children:b}):g.jsx(Ht.FieldArray,{name:e,render:T=>g.jsxs("div",{children:[S.map((C,O)=>g.jsx(J.Fragment,{children:g.jsx(ote,{variant:l,content:g.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[g.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&g.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&g.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&g.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},ote=({variant:t,content:e})=>{switch(t){case"card":return g.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:g.jsx(z.CardContent,{children:e})});case"elevatedCard":return g.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:g.jsx(z.CardContent,{children:e})});case"none":return e}},ite=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return g.jsx(Ru,{actions:[g.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},ste=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return g.jsx(Ru,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},ate=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return g.jsx(Ru,{actions:[g.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),g.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},lte={added:{icon:JU,label:"Added",color:"success"},deleted:{icon:VM,label:"Deleted",color:"error"},modified:{icon:QU,label:"Modified",color:"info"},unmodified:{label:"Unmodified",color:"default"}},cte=(t,e)=>g.jsxs(g.Fragment,{children:[g.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:up},children:g.jsx("s",{children:t})}),g.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:cp},children:g.jsx("u",{children:e})})]}),ute=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Bl(s,e,r),l=Bl(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??hM.isEqual(a,l))||(o[xn(s)]=cte(a,l))}return o},AI=(t,e,n,r=!1,o)=>{const i=[],s=[];let a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);a<e.length&&l<n.length;){const u=e[a],f=n[l];if(u.id===f.id){const p=ute(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?s.push({...f,changeType:"unmodified"}):i.push({...f,changeType:"modified",modifiedDiff:p}),a++,l++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),a++):(i.push({...f,changeType:"added"}),l++)}for(;a<e.length;)i.push({...e[a],changeType:"deleted"}),a++;for(;l<n.length;)i.push({...n[l],changeType:"added"}),l++;return{dataDiff:i,dataUnmodified:s}},PI=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,dataUnmodified:l}=AI(r,e,n,s,o);return{columns:[{fieldName:"changeType",render:f=>{const p=lte[f];return g.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:g.jsxs(z.Typography,{children:[p.icon&&g.jsx(Um,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[xn(f)])??Bl(f,m,s)}}))],data:a,unmodifiedData:l,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return g.jsx(hw,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},NI=({columns:t,data:e,unmodifiedData:n=[],emptyTableMsg:r="No changes to display",renderExpand:o,size:i})=>{const[s,a]=J.useState(!1),l=()=>a(!s),u=`${s?"Hide":"Show"} ${n.length} unmodified row${n.length>1?"s":""}`;return g.jsxs(z.Box,{children:[g.jsx(cv,{columns:t,data:[...e,...s?n:[]],emptyTableMsg:r,renderExpand:o,size:i}),n.length>0&&g.jsx(z.Box,{children:g.jsx(z.Button,{onClick:l,children:u})})]})},dte=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?PI({...n,isMobileScreen:r}):n;return g.jsx(NI,{...o,size:t.size})},fte=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=vo.useNavigate();return g.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[g.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),g.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[g.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>g.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Ba(l,a),children:l.label},l.label))}),n&&g.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},$I=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=vo.useLocation(),i=vo.useNavigate(),[s,a]=J.useState(!1),l=(m,b)=>g.jsx(z.MenuList,{children:m.map(v=>g.jsxs(z.MenuItem,{...Ba(v,i,()=>a(!1)),children:[v.icon&&g.jsx(z.ListItemIcon,{children:v.icon}),g.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>g.jsxs(J.Fragment,{children:[l(b,v),v<m.length-1&&g.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?g.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&g.jsxs(g.Fragment,{children:[g.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:g.jsx(aq,{})}),g.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:g.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:g.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},LI=t=>{const{env:e,isProd:n}=t;return n?null:g.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},BI=t=>{const{displayName:e,userMenuOptions:n}=t;return g.jsx(DI,{label:e,menuOptions:n,icon:g.jsx(cq,{})})},Dh=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=vo.useNavigate();return g.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>g.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,...Ba(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},FI=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&g.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:g.jsx(Dh,{menuOptions:e,activeTabIdx:n,sx:r})})},RI=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return g.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?g.jsx(zM,{}):g.jsx(FM,{})})},pte=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:b}=t,v=vo.useNavigate(),y=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=vo.useLocation(),k=x.mode==="dark",[T,C]=A.useState(void 0);A.useEffect(()=>{const N=o.findIndex(L=>L.path&&S.startsWith(L.path));C(N>=0?N:void 0)},[S,o]);const O=s&&g.jsx(RI,{onToggle:s}),I=s&&(y||!y&&l)?[{icon:k?g.jsx(zM,{}):g.jsx(FM,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return g.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&g.jsx(LI,{...e}),u,g.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[g.jsx(z.Button,{disableRipple:!0,component:vo.Link,to:"/",children:r&&typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),g.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&g.jsx($I,{menuOptionLists:[o,a,I],anchor:"right"}),!y&&g.jsxs(g.Fragment,{children:[g.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,L)=>g.jsxs(z.Box,{display:"flex",alignItems:"center",children:[L>0&&g.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),g.jsx(z.Button,{variant:"text",sx:{color:"white"},...Ba(N,v),children:g.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&g.jsx(BI,{displayName:l,userMenuOptions:I})]})]})]}),!y&&g.jsx(FI,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},hte=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=vo.useLocation(),o=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&g.jsx(z.Box,{sx:e,children:g.jsx(z.Card,{sx:{height:"100%",width:200},children:g.jsx(Dh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},mte=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&g.jsx(Dh,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},gte=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return g.jsx(MI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},yte=t=>g.jsx(zu,{severity:"info",...t}),bte=t=>g.jsx(zu,{severity:"warning",...t}),zI=t=>{const{crumbs:e}=t,n=vo.useNavigate(),r=e.map(o=>({label:o.label,onClick:()=>{var i;o.path?n(o.path):(i=o.onClick)==null||i.call(o)}}));return g.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:g.jsx(lq,{}),sx:{marginBottom:2},children:r.map(({label:o,...i},s)=>s<e.length-1?g.jsx(z.Link,{color:"primary",sx:{cursor:"pointer",fontWeight:"600"},underline:"hover",...Ba(i,n),children:o},o):g.jsx(z.Typography,{color:"text.primary",children:o},o))})},vte=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=xte(r);return g.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:g.jsx(zu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:VI(r),warning:VI(r)},onClose:o,elevation:a,variant:s,children:n?g.jsxs(g.Fragment,{children:[g.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},xte=t=>t=="logout"?"info":t=="timeout"?"warning":t,VI=t=>{if(t=="timeout")return g.jsx(GU,{});if(t=="logout")return g.jsx(sq,{})},wte=t=>{Ste(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:g.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&g.jsx(zI,{crumbs:i}),g.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[g.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?g.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&g.jsxs(kr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[g.jsx(XU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&g.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},Ste=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},Cte=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return g.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&g.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),g.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,g.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},Tte=t=>{const{title:e="Loading...",message:n}=t;return g.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[g.jsxs(z.Box,{className:"text-content",children:[g.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&g.jsx(z.Typography,{"data-testid":"message",children:n})]}),g.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function kte({...t}){return g.jsx(EI,{onSelectCitations:()=>{},onClose:()=>{},...t})}const Ete=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return g.jsx(z.Box,{height:n})};Ae.AlertModal=ste,Ae.Autocomplete=fM,Ae.Breadcrumbs=zI,Ae.Button=kr,Ae.Checkbox=mM,Ae.CheckboxGroup=xU,Ae.CitationField=Zee,Ae.CitationFieldProvider=gte,Ae.CitationManager=kte,Ae.Column=Bu,Ae.ConfirmationModal=ite,Ae.DarkModeToggle=RI,Ae.DateField=Up,Ae.DateRangeField=UZ,Ae.DecisionModal=ate,Ae.Diff=uM,Ae.DiffProvider=hw,Ae.DiffTable=dte,Ae.DiffTableView=NI,Ae.Drawer=$I,Ae.DynamicAutocomplete=bU,Ae.EnvironmentBanner=LI,Ae.ErrorAlert=TI,Ae.FileList=CU,Ae.FileUpload=yM,Ae.FloatingNavBar=mte,Ae.Footer=fte,Ae.FormDebugger=tte,Ae.Header=pte,Ae.HelpTooltip=q2,Ae.IconTooltip=U2,Ae.InfoAlert=yte,Ae.LoadingButton=vI,Ae.LoadingIndicator=Tte,Ae.LoadingOverlay=lv,Ae.Location=UU,Ae.MenuButton=DI,Ae.Modal=Ru,Ae.MultiAutocomplete=vU,Ae.NavBar=FI,Ae.NotApplicableCheckbox=II,Ae.PageHeader=wte,Ae.PaginatedTable=K2,Ae.ProfileMenu=BI,Ae.RadioGroup=LM,Ae.RangeSlider=qU,Ae.ReadOnly=ki,Ae.ReadOnlyProvider=fw,Ae.RepeatableFormGroup=rte,Ae.RichTextField=zQ,Ae.Row=ei,Ae.ScrollToTop=ete,Ae.SearchField=HM,Ae.Select=KU,Ae.SelectableCitationManager=OI,Ae.Sidebar=hte,Ae.SingleActionCard=Cte,Ae.Snackbar=vte,Ae.Spacer=Ete,Ae.Stepper=nte,Ae.Submit=Qee,Ae.SuccessAlert=kI,Ae.Switch=YU,Ae.Table=cv,Ae.Tabs=Dh,Ae.TextArea=BM,Ae.TextField=Ei,Ae.TextIcon=Um,Ae.ValidationError=br,Ae.WarningAlert=bte,Ae.baseCitationTableColumns=Q2,Ae.buildDiffData=AI,Ae.buildTableDiff=PI,Ae.commonTheme=_n,Ae.darkTheme=WP,Ae.lightTheme=HP,Ae.useDiff=Ws,Ae.useReadOnly=Hs,Object.defineProperty(Ae,Symbol.toStringTag,{value:"Module"})}));
|