@simoncomputing/mui-bueno-v2 0.19.10 → 0.19.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
11
11
  - Minor increment --> singlular/minor changes. Minimal breaking changes.
12
12
  - Patch increment --> singlular/minor changes. Zero breaking changes.
13
13
 
14
+ ## [0.19.11] - 2025-11-05
15
+
16
+ ### Fixed
17
+
18
+ - `CitationField`, `SelectableCitationManager`
19
+ - Fix top-right close button going back to table instead of closing on Attachment/URL detail step.
20
+
14
21
  ## [0.19.10] - 2025-11-04
15
22
 
16
23
  ### Fixed
@@ -3,6 +3,7 @@ export type AttachmentFormProps = {
3
3
  title: string;
4
4
  onSave: (unsavedAttachment: UnsavedAttachmentCitation) => Promise<void>;
5
5
  onCancel: () => void;
6
+ onClose: () => void;
6
7
  modifyCitation: Citation | undefined;
7
8
  /**
8
9
  * If true, file upload is disabled. (Title field is still enabled)
@@ -3,6 +3,7 @@ export type UrlFormProps = {
3
3
  title: string;
4
4
  onSave: (unsavedUrl: UnsavedUrlCitation) => Promise<void>;
5
5
  onCancel: () => void;
6
+ onClose: () => void;
6
7
  modifyCitation: Citation | undefined;
7
8
  readOnly?: boolean;
8
9
  /** If true, shows a close button inline with title. Intended to be used within modals. */
package/dist/index.cjs.js CHANGED
@@ -399,4 +399,4 @@ img.ProseMirror-separator {
399
399
  3. "-" cannot repeat`);Wt.customSchemes.push([t,e])}function Gde(){Wt.scanner=Vde(Wt.customSchemes);for(let t=0;t<Wt.tokenQueue.length;t++)Wt.tokenQueue[t][1]({scanner:Wt.scanner});Wt.parser=Wde(Wt.scanner.tokens);for(let t=0;t<Wt.pluginQueue.length;t++)Wt.pluginQueue[t][1]({scanner:Wt.scanner,parser:Wt.parser});return Wt.initialized=!0,Wt}function $1(t){return Wt.initialized||Gde(),qde(Wt.parser.start,t,QN(Wt.scanner.start,t))}$1.scan=QN;function tj(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new F1(n),o=$1(t),i=[];for(let s=0;s<o.length;s++){const a=o[s];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}function Jde(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Zde(t){return new tn({key:new yn("autolink"),appendTransaction:(e,n,r)=>{const o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=r,a=toe(n.doc,[...e]);if(aoe(a).forEach(({newRange:u})=>{const f=roe(r.doc,u,y=>y.isTextblock);let p,m;if(f.length>1?(p=f[0],m=r.doc.textBetween(p.pos,p.pos+p.node.nodeSize,void 0," ")):f.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(p=f[0],m=r.doc.textBetween(p.pos,u.to,void 0," ")),p&&m){const y=m.split(" ").filter(C=>C!=="");if(y.length<=0)return!1;const b=y[y.length-1],g=p.pos+m.lastIndexOf(b);if(!b)return!1;const S=$1(b).map(C=>C.toObject(t.defaultProtocol));if(!Jde(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:g+C.start+1,to:g+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=>{r1(C.from,C.to,r.doc).some(_=>_.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function Xde(t){return new tn({key:new yn("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||!e.editable)return!1;let s=r.target;const a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(m=>m.nodeName==="A"))return!1;const l=n1(e.state,t.type.name),u=r.target,f=(o=u==null?void 0:u.href)!==null&&o!==void 0?o:l.href,p=(i=u==null?void 0:u.target)!==null&&i!==void 0?i:l.target;return u&&f?(window.open(f,p),!0):!1}}})}function Qde(t){return new tn({key:new yn("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});const l=tj(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!l?!1:t.editor.commands.setMark(t.type,{href:l.href})}}})}const efe=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Ss(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(efe,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const tfe=gr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){i2(t);return}i2(t.scheme,t.optionalSlashes)})},onDestroy(){Yde()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Ss(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ss(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ss(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",bt(this.options.HTMLAttributes,t),0]:["a",bt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ss(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Ss(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ji({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=tj(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ss(s,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(i=>e.push({text:i.value,data:{href:i.href},index:i.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Zde({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!Ss(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Xde({type:this.type})),this.options.linkOnPaste&&t.push(Qde({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),nj=en.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",bt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});function nfe(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Voe(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,y=l?new RegExp(`${p}${u}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${u}[^\\s${m}]*`,"gm"),b=((e=a.nodeBefore)===null||e===void 0?void 0:e.isText)&&a.nodeBefore.text;if(!b)return null;const g=a.pos-b.length,S=Array.from(b.matchAll(y)).pop();if(!S||S.input===void 0||S.index===void 0)return null;const C=S.input.slice(Math.max(0,S.index-1),S.index),_=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!_)return null;const T=g+S.index;let w=T+S[0].length;return l&&f.test(b.slice(w-1,w+1))&&(S[0]+=" ",w+=1),T<a.pos&&w>=a.pos?{range:{from:T,to:w},query:S[0].slice(n.length),text:S[0]}:null}const rfe=new yn("suggestion");function ofe({pluginKey:t=rfe,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:o=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:a="span",decorationClass:l="suggestion",command:u=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:y=nfe}){let b;const g=p==null?void 0:p(),S=new tn({key:t,view(){return{update:async(C,_)=>{var T,w,E,O,N,P,j;const M=(T=this.key)===null||T===void 0?void 0:T.getState(_),R=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),B=M.active&&R.active&&M.range.from!==R.range.from,F=!M.active&&R.active,$=M.active&&!R.active,V=!F&&!$&&M.query!==R.query,L=F||B&&V,W=V||B,q=$||B&&V;if(!L&&!W&&!q)return;const G=q&&!L?M:R,U=C.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);b={editor:e,range:G.range,query:G.query,text:G.text,items:[],command:Z=>u({editor:e,range:G.range,props:Z}),decorationNode:U,clientRect:U?()=>{var Z;const{decorationId:pe}=(Z=this.key)===null||Z===void 0?void 0:Z.getState(e.state),ae=C.dom.querySelector(`[data-decoration-id="${pe}"]`);return(ae==null?void 0:ae.getBoundingClientRect())||null}:null},L&&((E=g==null?void 0:g.onBeforeStart)===null||E===void 0||E.call(g,b)),W&&((O=g==null?void 0:g.onBeforeUpdate)===null||O===void 0||O.call(g,b)),(W||L)&&(b.items=await f({editor:e,query:G.query})),q&&((N=g==null?void 0:g.onExit)===null||N===void 0||N.call(g,b)),W&&((P=g==null?void 0:g.onUpdate)===null||P===void 0||P.call(g,b)),L&&((j=g==null?void 0:g.onStart)===null||j===void 0||j.call(g,b))},destroy:()=>{var C;b&&((C=g==null?void 0:g.onExit)===null||C===void 0||C.call(g,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,T,w){const{isEditable:E}=e,{composing:O}=e.view,{selection:N}=C,{empty:P,from:j}=N,M={..._};if(M.composing=O,E&&(P||e.view.composing)){(j<_.range.from||j>_.range.to)&&!O&&!_.composing&&(M.active=!1);const R=y({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:N.$from}),B=`id_${Math.floor(Math.random()*4294967295)}`;R&&m({editor:e,state:w,range:R.range,isActive:_.active})?(M.active=!0,M.decorationId=_.decorationId?_.decorationId:B,M.range=R.range,M.query=R.query,M.text=R.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,_){var T;const{active:w,range:E}=S.getState(C.state);return w&&((T=g==null?void 0:g.onKeyDown)===null||T===void 0?void 0:T.call(g,{view:C,event:_,range:E}))||!1},decorations(C){const{active:_,range:T,decorationId:w}=S.getState(C);return _?Xt.create(C.doc,[Fn.inline(T.from,T.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const ife=new yn("mention"),sfe=en.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",bt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:ife,command:({editor:t,range:e,props:n})=>{var r,o,i;const s=t.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(i=(o=t.view.dom.ownerDocument.defaultView)===null||o===void 0?void 0:o.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),r=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=bt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",bt({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:o,anchor:i}=r;return o?(e.doc.nodesBetween(i-1,i,(s,a)=>{if(s.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",a,a+s.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[ofe({editor:this.editor,...this.options.suggestion})]}}),afe="listItem",s2="textStyle",a2=/^(\d+)\.\s$/,rj=en.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",bt(this.options.HTMLAttributes,n),0]:["ol",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(afe,this.editor.getAttributes(s2)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ul({find:a2,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ul({find:a2,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(s2)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),oj=en.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),ij=un.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new tn({key:new yn("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!n)return null;const i=this.editor.isEmpty;return t.descendants((s,a)=>{const l=r>=a&&r<=a+s.nodeSize,u=!s.isLeaf&&dh(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Fn.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Xt.create(t,o)}}})]}}),lfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,cfe=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,sj=gr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Gs({find:lfe,type:this.type})]},addPasteRules(){return[Ji({find:cfe,type:this.type})]}}),ufe=gr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),dfe=gr.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),ffe=en.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",bt(this.options.HTMLAttributes,t),0]}}),pfe=en.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",bt(this.options.HTMLAttributes,t),0]}}),hfe=en.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",bt(this.options.HTMLAttributes,t),0]}}),mfe=/^\s*(\[([( |x])?\])\s$/,gfe=en.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",bt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const m=n();if(typeof m!="number")return!1;const y=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...y==null?void 0:y.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=t.attrs.checked,a.checked=t.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:l,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,!0)}}},addInputRules(){return[ul({find:mfe,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),yfe=en.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",bt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),aj=en.create({name:"text",group:"inline"}),bfe=un.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),vfe=gr.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",bt(this.options.HTMLAttributes,t),0]},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),lj=X.forwardRef((t,e)=>{const[n,r]=X.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return X.useEffect(()=>r(0),[t.items]),X.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?v.jsx(D.Paper,{elevation:5,children:v.jsx(D.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(D.ListItem,{disablePadding:!0,children:v.jsx(D.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});lj.displayName="SuggestionList";const l2={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},xfe={items:async({query:t})=>Promise.resolve(["Lea Thompson","Cyndi Lauper","Tom Cruise","Madonna","Jerry Hall","Joan Collins","Winona Ryder","Christina Applegate","Alyssa Milano","Molly Ringwald","Ally Sheedy","Debbie Harry","Olivia Newton-John","Elton John","Michael J. Fox","Axl Rose","Emilio Estevez","Ralph Macchio","Rob Lowe","Jennifer Grey","Mickey Rourke","John Cusack","Matthew Broderick","Justine Bateman","Lisa Bonet","Benicio Monserrate Rafael del Toro Sánchez"].map((e,n)=>({mentionLabel:e,id:n.toString()})).filter(e=>e.mentionLabel.toLowerCase().startsWith(t.toLowerCase())).slice(0,5)),render:()=>{let t,e;return{onStart:n=>{t=new KP(lj,{props:n,editor:n.editor}),e=vu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??l2},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))??l2}})},onKeyDown(n){return n.event.key==="Escape"?(e==null||e.hide(),!0):t!=null&&t.ref?t.ref.onKeyDown(n):!1},onExit(){e==null||e.destroy(),t==null||t.destroy(),e=void 0,t=void 0}}}},Sfe=tfe.extend({inclusive:!1}),Cfe=ufe.extend({excludes:"superscript"}),wfe=dfe.extend({excludes:"subscript"});function Tfe({placeholder:t}={}){return X.useMemo(()=>[Uue.configure({resizable:!0}),hfe,pfe,ffe,DN,NN,jN,$N,nj,rj,oj,Cfe,wfe,aj,IN,AN,PN,UN,vfe,sj,Sfe.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Bse,FN,Lce,bfe.configure({types:["heading","paragraph","image"]}),ide,sde,cde,Nce,vde.configure({multicolor:!0}),qN,Wce,LN,yfe,gfe.configure({nested:!0}),sfe.configure({suggestion:xfe}),ij.configure({placeholder:t}),WN],[t])}function c2(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const _fe=t=>{const e=Tfe({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(ple,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=qt.useField({name:n}),{setValue:f}=u,{value:p}=a;X.useEffect(()=>{var C,_,T;(T=(_=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:_.commands)==null||T.setContent(p)},[p]);const m=X.useRef(null),y=X.useCallback((C,_)=>{var w;const T=(w=m.current)==null?void 0:w.editor;if(!(!T||!i))if(i instanceof Promise)i(C).then(E=>{_v({images:E,editor:T,position:_})});else{const E=i(C);_v({images:E,editor:T,position:_})}},[]),b=X.useCallback((C,_,T,w)=>{var O;if(!(_ instanceof DragEvent)||!_.dataTransfer)return!1;const E=c2(_.dataTransfer.files);if(E.length>0){const N=(O=C.posAtCoords({left:_.clientX,top:_.clientY}))==null?void 0:O.pos;return y(E,N),_.preventDefault(),!0}return!1},[y]),g=X.useCallback((C,_,T)=>{if(!_.clipboardData)return!1;const w=c2(_.clipboardData.files);return w.length>0?(y(w),!0):!1},[y]),S=v.jsx(D.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(QP,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:b,handlePaste:g},renderControls:s?void 0:()=>v.jsx(Kue,{onUploadFiles:i}),onBlur:()=>{var C,_;return f(((_=(C=m.current)==null?void 0:C.editor)==null?void 0:_.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(AP,{}),v.jsx(eN,{})]})})});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(D.Typography,{...o,children:r}),S]})},Bv=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(D.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(D.Box,{className:"text-content",children:[v.jsx(D.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(D.Typography,{"data-testid":"message",children:n})]}),v.jsx(D.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},u2=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1,reRenderExpand:s=!1}=t,[a,l]=X.useState(!1),[u,f]=X.useState(void 0);X.useEffect(()=>{n&&(!a||s)&&(l(!0),f(r(o)))},[n,o]);const p={"&:last-child td":{borderBottom:"unset"}};return i?v.jsx(D.Collapse,{in:n,children:u}):v.jsx(D.TableRow,{sx:p,children:v.jsx(D.TableCell,{sx:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(D.Collapse,{in:n,children:u})})})},cj=t=>{const{id:e,getRowKey:n=Y=>"id"in Y&&(typeof Y.id=="string"||typeof Y.id=="number")?Y.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(Y)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(Y)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:m=!1,className:y,emptyTableMsg:b="No items to display",errorTableMsg:g,retryCallback:S,isLoading:C=!1,disableMobileCards:_=!1,highlightSelectedRow:T=!1,headerRowStyle:w={},stickyHeader:E,reRenderExpand:O=!1,tooltipColor:N,...P}=t,{palette:j}=D.useTheme(),[M,R]=X.useState(void 0),[B,F]=X.useState(void 0);Array.isArray(m)&&(!s&&m.length!==r.length&&console.warn('Table component: Length of "fixedLayout" is not equal to the length of "columns".'),s&&m.length!==r.length+1&&console.warn(`Table component: Length of "fixedLayout" is not equal to the length of "columns"+1. Make sure you're including a percentage for the expand/collapse column AND each column in "columns".`)),s&&i&&console.warn("Table component: renderExpand & onRowClick are both defined. Only one should be defined at a time.");const $=Y=>{Y!==l?f&&f(Y,"asc"):f&&f(l,u==="asc"?"desc":"asc")},V=Y=>l===Y?u:null,L=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),W=L&&a?r.filter(Y=>!(a.includes(Y.fieldName)||Y.hideCol)):r.filter(Y=>!Y.hideCol);s&&!L&&W.unshift({key:"MBv2_Expandable_Column",fieldName:"id",label:"",render:Y=>{const le=M===Y;return v.jsx(D.IconButton,{"data-testid":"expand-collapse-btn","aria-label":le?"collapse row":"expand row",size:"small",onClick:()=>se(Y),children:le?v.jsx(Gd,{"data-testid":"collapse-up"}):v.jsx(ag,{"data-testid":"expand-down"})})}});const q=(Y,le)=>le.split(".").reduce((be,Ce)=>{if(be&&typeof be=="object")return be[Ce]},Y),G=(Y,le)=>{const be=q(le,Y.fieldName);return Y.render?Y.render(be,le,L):be},U=f!==void 0,Z=Y=>U?p?p.includes(Y):!0:!1,pe=v.jsxs(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(h8,{})," ",b]}),ae=v.jsxs(D.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(AR,{color:"error"})," ",g,S&&v.jsx(D.Button,{variant:"text",onClick:S,children:"Retry?"})]}),de=()=>{if(C)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:v.jsx(D.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(Bv,{})})})});if(g)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:ae})});if(o.length===0)return v.jsx(D.TableRow,{children:v.jsx(D.TableCell,{colSpan:r.length,align:"center",children:pe})})},ee=()=>{if(C)return v.jsx(Bv,{});if(g)return ae;if(o.length===0)return pe},he=Y=>{T&&F(Y)},fe=Y=>{i&&(i(Y),he(Y))},se=Y=>{const le=M===Y?void 0:Y;R(le),he(le)},oe=Y=>{if(!s)return;const le=M===n(Y);return v.jsxs(v.Fragment,{children:[v.jsxs(D.Button,{"data-testid":"show-more-less-btn",variant:"text",onClick:()=>se(n(Y)),children:[le?v.jsx(Gd,{}):v.jsx(ag,{})," Show"," ",le?"Less":"More"]}),v.jsx(u2,{colSpan:r.length,isExpanded:n(Y)===M,obj:Y,renderExpand:be=>s(be),asMobileCard:!0})]})},ce=typeof T=="string"?T:j.grey[j.mode=="dark"?600:50],ge=Y=>{const le=B===n(Y)?ce:"inherit";return{cursor:i?"pointer":"default",backgroundColor:le,...s?{"& > td":{borderBottom:"unset"}}:{"&:last-child td":{borderBottom:"unset"}},...i&&{"&:hover":{backgroundColor:le===ce?Xa(le,.1):ce}}}},J=j.grey[j.mode==="dark"?600:400],te=Y=>Y&&v.jsx(D.Tooltip,{title:Y,children:v.jsx(f8,{"data-testid":"MBv2_table-tooltip",fontSize:"small",sx:{color:N??J}})});return L&&!_?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:y,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(D.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:Y=>$(Y.target.value),fullWidth:!0,children:W.map(Y=>{if(Z(Y.fieldName))return v.jsx(D.MenuItem,{value:Y.sortName??Y.fieldName,children:Y.label??Mn(Y.fieldName)},`${Y.key??"rowHeader"}-${Y.fieldName}`)})}),v.jsx(D.IconButton,{onClick:()=>{l&&$(l)},children:v.jsx(w8,{className:`sort-icon-${u}`})})]}),v.jsx(D.Divider,{sx:{margin:"10px 0"}})]}),ee()??o.map(Y=>v.jsxs(D.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",overflowX:"auto",...ge(Y)},onClick:()=>fe(n(Y)),"data-testid":`card-${n(Y)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:W.map(le=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsxs("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${le.fieldName}`,style:{textWrap:"nowrap"},children:[le.label??Mn(le.fieldName),te(le.tooltip)]}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${le.fieldName}`,style:{paddingLeft:"10px"},children:G(le,Y)})]},`${le.key??"row"}-${n(Y)}-${le.fieldName}`))})}),oe(Y)]},n(Y)))]}):v.jsx(D.TableContainer,{component:D.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:y,style:E?{maxHeight:E,overflow:"auto"}:{},children:v.jsxs(D.Table,{stickyHeader:E!=="undefined",style:{tableLayout:m?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...P,children:[v.jsx(D.TableHead,{className:"MBv2_Table_Head",children:v.jsx(D.TableRow,{className:"MBv2_Table_Head_Row",children:W.map((Y,le)=>{const be=Z(Y.fieldName);return v.jsx(D.TableCell,{width:Array.isArray(m)?m[le]:"auto",sx:Y.tableCellSx??{},children:v.jsx(D.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(D.Box,{sx:[be&&{"&:hover":{cursor:"pointer",backgroundColor:j.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:be?()=>$(Y.sortName??Y.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:Y.label??Mn(Y.fieldName)}),te(Y.tooltip),be&&V(Y.fieldName)==="asc"&&v.jsx(Gd,{style:{marginLeft:"5px"}}),be&&V(Y.fieldName)==="desc"&&v.jsx(ag,{style:{marginLeft:"5px"}}),be&&V(Y.fieldName)!=="asc"&&V(Y.fieldName)!=="desc"&&v.jsx(x8,{style:{marginLeft:"5px"}})]})})},`${Y.key??"rowHeader"}-${Y.fieldName}`)})})}),v.jsx(D.TableBody,{className:"MBv2_Table_Body",children:de()??o.map(Y=>v.jsxs(X.Fragment,{children:[v.jsx(D.TableRow,{"data-testid":`row-${n(Y)}`,className:"MBv2_Table_Body_Row",onClick:()=>fe(n(Y)),sx:ge(Y),children:W.map(le=>v.jsx(D.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${le.fieldName}`,children:G(le,Y)},`${le.key??"row"}-${n(Y)}-${le.fieldName}`))}),s&&v.jsx(u2,{colSpan:W.length,isExpanded:n(Y)===M,obj:Y,renderExpand:le=>s(le),reRenderExpand:O})]},n(Y)))})]})})},uj=t=>{const{paginationState:e,onPageChange:n,onRowsPerPageChange:r,hidePaginationControls:o=!1,rowsPerPageOptions:i=[5,10,25],...s}=t,{pageNo:a,pageSize:l,totalCount:u,sortField:f,sortOrder:p}=e,m=S=>{n(S)},y=S=>{r(parseInt(S.target.value,10))},b=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),g=!t.data||t.data&&t.data.length===0;return v.jsxs(D.Box,{children:[v.jsx(cj,{sortOrder:p,sortField:f,...s}),!o&&!g&&v.jsx(D.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:b?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>m(C),onRowsPerPageChange:y,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},d2=()=>({height:window.innerHeight,width:window.innerWidth}),dj=()=>{const[t,e]=X.useState(d2());return X.useEffect(()=>{const n=()=>{e(d2())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},qr=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=dj(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(D.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...er({...t},a)})},kfe=t=>{const{citation:e,anchorEl:n,onClose:r}=t;return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_launch-link-prompt-${e.id}`,flexDirection:"column",alignItems:"end",children:[v.jsxs(D.Typography,{variant:"body2",sx:{wordBreak:"break-all",maxWidth:"350px"},children:["Are you sure you want to go to ",v.jsx("br",{}),v.jsx("b",{children:e.url}),"?"]}),v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:r,"data-testid":`citation-table_launch-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",startIcon:v.jsx(VR,{}),onClick:()=>{window.open(e.url,"_blank","noopener,noreferrer"),r()},"data-testid":`citation-table_launch-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Efe=t=>{const{citation:e,anchorEl:n,onDeleteCitation:r,onClose:o}=t;if(r)return v.jsx(D.Popper,{open:e!==null,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},children:e&&v.jsxs(D.Box,{component:D.Paper,p:1,display:"flex",gap:1,boxShadow:9,"data-testid":`citation-table_delete-prompt-${e.id}`,children:[v.jsxs(D.Typography,{variant:"body2",children:["Are you sure you want to delete this ",e.fileName?"attachment":"citation","?"]}),v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[v.jsx(qr,{size:"small",variant:"text",onClick:o,"data-testid":`citation-table_delete-prompt-${e.id}-noBtn`,children:"No"}),v.jsx(qr,{size:"small",color:"error",startIcon:v.jsx(Zv,{}),onClick:()=>r(e.id).finally(o),"data-testid":`citation-table_delete-prompt-${e.id}-yesBtn`,children:"Yes"})]})]})})},Mfe=t=>{const{refreshKey:e,title:n,onCancel:r,onNewCitation:o,onNewAttachment:i,onEditCitation:s,onEditAttachment:a,onDeleteCitation:l,onDownloadAttachment:u,onSelect:f,getCitationsPaginated:p,selectedIds:m,setSelectedIds:y,onError:b=()=>{},condenseTable:g=!1,canSelect:S=!1,canLaunchUrl:C,addlActions:_,readOnly:T=!1,showCloseBtn:w=!1}=t,E=!!t.canCreate&&!T,O=!!t.canEdit&&!T,N=!!t.canDelete&&!T,{palette:P}=D.useTheme(),[j,M]=X.useState([]),[R,B]=X.useState(!1),[F,$]=X.useState(!0),[V,L]=X.useState(null),[W,q]=X.useState(null),[G,U]=X.useState(null),[Z,pe]=X.useState({pageNo:0,pageSize:g?5:10,totalCount:0}),ae=()=>{B(!1),$(!0),p({pageNo:Z.pageNo,pageSize:Z.pageSize}).then(J=>(M(J.data),pe({...Z,totalCount:J.totalCount}),J)).catch(J=>{b(J),B(!0),M([])}).finally(()=>$(!1))};X.useEffect(ae,[Z.pageNo,Z.pageSize,e]);const de=()=>{q(null),U(null),L(null)},ee=v.jsx(qr,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:o,startIcon:v.jsx(xf,{}),children:"Add Citation"}),he=v.jsx(qr,{variant:S?"outlined":"contained",size:S?"small":"medium",onClick:i,startIcon:v.jsx(vT,{}),children:"Add Attachment"}),fe=J=>{if(!(!O&&!T)&&!(T&&!g))return v.jsx(D.Tooltip,{title:T?"View":"Edit",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>J.fileName?a(J):s(J),"data-testid":`citation-table_edit-btn-${J.id}`,children:T?v.jsx(M8,{}):v.jsx(Gq,{})})})},se=J=>{if(!(!N||T))return v.jsx(D.Tooltip,{title:"Delete",children:v.jsx(D.IconButton,{color:"error",onClick:te=>{q(J),L(te.currentTarget)},"data-testid":`citation-table_delete-btn-${J.id}`,children:v.jsx(Zv,{})})})},oe=J=>!u&&!C?void 0:J.fileName?v.jsx(D.Tooltip,{title:"Download",children:v.jsx(D.IconButton,{color:"primary",onClick:()=>u==null?void 0:u(J),"data-testid":`citation-table_download-btn-${J.id}`,sx:{visibility:u?"visible":"hidden"},children:v.jsx(Yq,{})})}):v.jsx(D.Tooltip,{title:"Open URL",children:v.jsx(D.IconButton,{color:"primary",onClick:Y=>{L(Y.currentTarget),U(J)},"data-testid":`citation-table_launch-link-btn-${J.id}`,sx:{visibility:C!=null&&C(J)?"visible":"hidden"},children:v.jsx(VR,{})})}),ge=[{fieldName:"id",key:"select",label:"",hideCol:!S,render:(J,te)=>v.jsx(D.Checkbox,{"data-testid":`citation-table_checkbox-${J}`,onChange:()=>{const Y=m.includes(te.id);y(Y?m.filter(le=>le!==te.id):[...m,te.id])},checked:m.includes(J),disabled:T})},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:(J,te)=>v.jsx(D.Tooltip,{title:J?"Attachment":"URL",children:J?v.jsx(vT,{sx:{color:P.grey[500],marginTop:"4px"},"data-testid":`attachment-icon-${te.id}`}):v.jsx(xf,{sx:{color:P.grey[500],marginTop:"6px"},"data-testid":`url-icon-${te.id}`})})},{fieldName:"title",tableCellSx:{width:g?"100%":"auto"}},{fieldName:"fileName",key:"URL/File Name",label:"URL/File Name",hideCol:g,render:(J,te)=>v.jsx("span",{style:{wordBreak:"break-all"},children:J||te.url})},{fieldName:"source",hideCol:g},{fieldName:"accessedAt",hideCol:g,render:(J,te)=>{if(!te.fileName)return(J==null?void 0:J.slice(0,10))??""}},{fieldName:"classification",hideCol:g},{fieldName:"id",key:"Action",label:"Action",hideCol:!(T||O||N||C||u||_),render:(J,te)=>v.jsxs(D.Box,{display:"flex",flexDirection:"row",children:[oe(te),fe(te),se(te),_==null?void 0:_(te)]})}];return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingBottom:"10px",children:[v.jsx(D.Typography,{variant:g?"h6":"h2",children:n}),!S&&E&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:1,children:[ee,he]}),w&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Np,{})})]}),v.jsx(uj,{"data-testid":"citation-table",size:g?"x-small":"medium",isLoading:F,columns:ge,data:j,paginationState:Z,onPageChange:J=>pe({...Z,pageNo:J}),onRowsPerPageChange:J=>pe({...Z,pageSize:J,pageNo:0}),errorTableMsg:R?"Failed to load citations.":void 0,retryCallback:ae}),S&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsx(D.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:E&&v.jsxs(v.Fragment,{children:[ee,he]})}),!T&&v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(qr,{variant:"outlined",size:"small",onClick:r,children:"Cancel"}),v.jsxs(qr,{variant:"contained",size:"small",onClick:()=>f(m),children:["Select",m.length>0&&` (${m.length})`]})]})]}),v.jsx(kfe,{citation:G,anchorEl:V,onClose:de}),v.jsx(Efe,{citation:W,anchorEl:V,onDeleteCitation:l,onClose:de})]})},B1=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return v.jsx(qr,{type:n,disabled:e,size:r,startIcon:e?v.jsx(D.CircularProgress,{size:s,color:"inherit"}):null,...o})};var D0,f2;function Ofe(){if(f2)return D0;f2=1;function t(C){this._maxSize=C,this.clear()}t.prototype.clear=function(){this._size=0,this._values=Object.create(null)},t.prototype.get=function(C){return this._values[C]},t.prototype.set=function(C,_){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=_};var e=/[^.^\]^[]+|(?=\[\]|\.\.)/g,n=/^\d+$/,r=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,i=/^\s*(['"]?)(.*?)(\1)\s*$/,s=512,a=new t(s),l=new t(s),u=new t(s);D0={Cache:t,split:p,normalizePath:f,setter:function(C){var _=f(C);return l.get(C)||l.set(C,function(w,E){for(var O=0,N=_.length,P=w;O<N-1;){var j=_[O];if(j==="__proto__"||j==="constructor"||j==="prototype")return w;P=P[_[O++]]}P[_[O]]=E})},getter:function(C,_){var T=f(C);return u.get(C)||u.set(C,function(E){for(var O=0,N=T.length;O<N;)if(E!=null||!_)E=E[T[O++]];else return;return E})},join:function(C){return C.reduce(function(_,T){return _+(y(T)||n.test(T)?"["+T+"]":(_?".":"")+T)},"")},forEach:function(C,_,T){m(Array.isArray(C)?C:p(C),_,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(_){return _.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,_,T){var w=C.length,E,O,N,P;for(O=0;O<w;O++)E=C[O],E&&(S(E)&&(E='"'+E+'"'),P=y(E),N=!P&&/^\d+$/.test(E),_.call(T,E,P,N,O,C))}function y(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function b(C){return C.match(r)&&!C.match(n)}function g(C){return o.test(C)}function S(C){return!y(C)&&(b(C)||g(C))}return D0}var zs=Ofe(),P0,p2;function Rfe(){if(p2)return P0;p2=1;const t=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,e=f=>f.match(t)||[],n=f=>f[0].toUpperCase()+f.slice(1),r=(f,p)=>e(f).join(p).toLowerCase(),o=f=>e(f).reduce((p,m)=>`${p}${p?m[0].toUpperCase()+m.slice(1).toLowerCase():m.toLowerCase()}`,"");return P0={words:e,upperFirst:n,camelCase:o,pascalCase:f=>n(o(f)),snakeCase:f=>r(f,"_"),kebabCase:f=>r(f,"-"),sentenceCase:f=>n(r(f," ")),titleCase:f=>e(f).map(n).join(" ")},P0}var N0=Rfe(),Wd={exports:{}},h2;function Afe(){if(h2)return Wd.exports;h2=1,Wd.exports=function(o){return t(e(o),o)},Wd.exports.array=t;function t(o,i){var s=o.length,a=new Array(s),l={},u=s,f=n(i),p=r(o);for(i.forEach(function(y){if(!p.has(y[0])||!p.has(y[1]))throw new Error("Unknown node. There is an unknown node in the supplied edges.")});u--;)l[u]||m(o[u],u,new Set);return a;function m(y,b,g){if(g.has(y)){var S;try{S=", node was:"+JSON.stringify(y)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(y))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(y));if(!l[b]){l[b]=!0;var C=f.get(y)||new Set;if(C=Array.from(C),b=C.length){g.add(y);do{var _=C[--b];m(_,p.get(_),g)}while(b);g.delete(y)}a[--s]=y}}}function e(o){for(var i=new Set,s=0,a=o.length;s<a;s++){var l=o[s];i.add(l[0]),i.add(l[1])}return Array.from(i)}function n(o){for(var i=new Map,s=0,a=o.length;s<a;s++){var l=o[s];i.has(l[0])||i.set(l[0],new Set),i.has(l[1])||i.set(l[1],new Set),i.get(l[0]).add(l[1])}return i}function r(o){for(var i=new Map,s=0,a=o.length;s<a;s++)i.set(o[s],s);return i}return Wd.exports}var Ife=Afe();const Dfe=or(Ife),Pfe=Object.prototype.toString,Nfe=Error.prototype.toString,jfe=RegExp.prototype.toString,Lfe=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Ffe=/^Symbol\((.*)\)(.*)$/;function $fe(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function m2(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return $fe(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Lfe.call(t).replace(Ffe,"Symbol($1)");const r=Pfe.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+Nfe.call(t)+"]":r==="RegExp"?jfe.call(t):null}function Ui(t,e){let n=m2(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=m2(this[r],e);return i!==null?i:o},2)}function fj(t){return t==null?[]:[].concat(t)}let pj,hj,mj,Bfe=/\$\{\s*(\w+)\s*\}/g;pj=Symbol.toStringTag;class g2{constructor(e,n,r,o){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[pj]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],fj(e).forEach(i=>{if(fr.isError(i)){this.errors.push(...i.errors);const s=i.inner.length?i.inner:[i];this.inner.push(...s)}else this.errors.push(i)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}}hj=Symbol.hasInstance;mj=Symbol.toStringTag;class fr extends Error{static formatError(e,n){const r=n.label||n.path||"this";return n=Object.assign({},n,{path:r,originalPath:n.path}),typeof e=="string"?e.replace(Bfe,(o,i)=>Ui(n[i])):typeof e=="function"?e(n):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,n,r,o,i){const s=new g2(e,n,r,o);if(i)return s;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[mj]="Error",this.name=s.name,this.message=s.message,this.type=s.type,this.value=s.value,this.path=s.path,this.errors=s.errors,this.inner=s.inner,Error.captureStackTrace&&Error.captureStackTrace(this,fr)}static[hj](e){return g2[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let _o={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:n,originalValue:r})=>{const o=r!=null&&r!==n?` (cast from the value \`${Ui(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ui(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ui(n,!0)}\``+o}},ur={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Vfe={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Vv={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},zfe={isValue:"${path} field must be ${value}"},hf={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Hfe={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},Wfe={notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${Ui(n,!0)}\``;if(n.length>o)return`${e} tuple value has too many items, expected a length of ${o} but got ${n.length} for value: \`${Ui(n,!0)}\``}return fr.formatError(_o.notType,t)}};Object.assign(Object.create(null),{mixed:_o,string:ur,number:Vfe,date:Vv,object:hf,array:Hfe,boolean:zfe,tuple:Wfe});const V1=t=>t&&t.__isYupSchema__;class vp{static fromOptions(e,n){if(!n.then&&!n.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:o,otherwise:i}=n,s=typeof r=="function"?r:(...a)=>a.every(l=>l===r);return new vp(e,(a,l)=>{var u;let f=s(...a)?o:i;return(u=f==null?void 0:f(l))!=null?u:l})}constructor(e,n){this.fn=void 0,this.refs=e,this.refs=e,this.fn=n}resolve(e,n){let r=this.refs.map(i=>i.getValue(n==null?void 0:n.value,n==null?void 0:n.parent,n==null?void 0:n.context)),o=this.fn(r,e,n);if(o===void 0||o===e)return e;if(!V1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const qd={context:"$",value:"."};class ra{constructor(e,n={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===qd.context,this.isValue=this.key[0]===qd.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?qd.context:this.isValue?qd.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&zs.getter(this.path,!0),this.map=n.map}getValue(e,n,r){let o=this.isContext?r:this.isValue?e:n;return this.getter&&(o=this.getter(o||{})),this.map&&(o=this.map(o)),o}cast(e,n){return this.getValue(e,n==null?void 0:n.parent,n==null?void 0:n.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}}ra.prototype.__isYupRef=!0;const Ds=t=>t==null;function Da(t){function e({value:n,path:r="",options:o,originalValue:i,schema:s},a,l){const{name:u,test:f,params:p,message:m,skipAbsent:y}=t;let{parent:b,context:g,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function _(R){return ra.isRef(R)?R.getValue(n,b,g):R}function T(R={}){const B=Object.assign({value:n,originalValue:i,label:s.spec.label,path:R.path||r,spec:s.spec,disableStackTrace:R.disableStackTrace||C},p,R.params);for(const $ of Object.keys(B))B[$]=_(B[$]);const F=new fr(fr.formatError(R.message||m,B),n,B.path,R.type||u,B.disableStackTrace);return F.params=B,F}const w=S?a:l;let E={path:r,parent:b,type:u,from:o.from,createError:T,resolve:_,options:o,originalValue:i,schema:s};const O=R=>{fr.isError(R)?w(R):R?l(null):w(T())},N=R=>{fr.isError(R)?w(R):a(R)};if(y&&Ds(n))return O(!0);let j;try{var M;if(j=f.call(E,n,E),typeof((M=j)==null?void 0:M.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${E.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(j).then(O,N)}}catch(R){N(R);return}O(j)}return e.OPTIONS=t,e}function qfe(t,e,n,r=n){let o,i,s;return e?(zs.forEach(e,(a,l,u)=>{let f=l?a.slice(1,a.length-1):a;t=t.resolve({context:r,parent:o,value:n});let p=t.type==="tuple",m=u?parseInt(f,10):0;if(t.innerType||p){if(p&&!u)throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${s}" must contain an index to the tuple element, e.g. "${s}[0]"`);if(n&&m>=n.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${a}, in the path: ${e}. because there is no value at that index. `);o=n,n=n&&n[m],t=p?t.spec.types[m]:t.innerType}if(!u){if(!t.fields||!t.fields[f])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${s} which is a type: "${t.type}")`);o=n,n=n&&n[f],t=t.fields[f]}i=f,s=l?"["+a+"]":"."+a}),{schema:t,parent:o,parentPath:i}):{parent:o,parentPath:e,schema:t}}class xp extends Set{describe(){const e=[];for(const n of this.values())e.push(ra.isRef(n)?n.describe():n);return e}resolveAll(e){let n=[];for(const r of this.values())n.push(e(r));return n}clone(){return new xp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function za(t,e=new Map){if(V1(t)||!t||typeof t!="object")return t;if(e.has(t))return e.get(t);let n;if(t instanceof Date)n=new Date(t.getTime()),e.set(t,n);else if(t instanceof RegExp)n=new RegExp(t),e.set(t,n);else if(Array.isArray(t)){n=new Array(t.length),e.set(t,n);for(let r=0;r<t.length;r++)n[r]=za(t[r],e)}else if(t instanceof Map){n=new Map,e.set(t,n);for(const[r,o]of t.entries())n.set(r,za(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(za(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=za(o,e)}else throw Error(`Unable to clone ${t}`);return n}class jo{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new xp,this._blacklist=new xp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_o.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e==null?void 0:e.spec),this.withMutation(n=>{n.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;const n=Object.create(Object.getPrototypeOf(this));return n.type=this.type,n._typeCheck=this._typeCheck,n._whitelist=this._whitelist.clone(),n._blacklist=this._blacklist.clone(),n.internalTests=Object.assign({},this.internalTests),n.exclusiveTests=Object.assign({},this.exclusiveTests),n.deps=[...this.deps],n.conditions=[...this.conditions],n.tests=[...this.tests],n.transforms=[...this.transforms],n.spec=za(Object.assign({},this.spec,e)),n}label(e){let n=this.clone();return n.spec.label=e,n}meta(...e){if(e.length===0)return this.spec.meta;let n=this.clone();return n.spec.meta=Object.assign(n.spec.meta||{},e[0]),n}withMutation(e){let n=this._mutate;this._mutate=!0;let r=e(this);return this._mutate=n,r}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let n=this,r=e.clone();const o=Object.assign({},n.spec,r.spec);return r.spec=o,r.internalTests=Object.assign({},n.internalTests,r.internalTests),r._whitelist=n._whitelist.merge(e._whitelist,e._blacklist),r._blacklist=n._blacklist.merge(e._blacklist,e._whitelist),r.tests=n.tests,r.exclusiveTests=n.exclusiveTests,r.withMutation(i=>{e.tests.forEach(s=>{i.test(s.OPTIONS)})}),r.transforms=[...n.transforms,...r.transforms],r}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let n=this;if(n.conditions.length){let r=n.conditions;n=n.clone(),n.conditions=[],n=r.reduce((o,i)=>i.resolve(o,e),n),n=n.resolve(e)}return n}resolveOptions(e){var n,r,o,i;return Object.assign({},e,{from:e.from||[],strict:(n=e.strict)!=null?n:this.spec.strict,abortEarly:(r=e.abortEarly)!=null?r:this.spec.abortEarly,recursive:(o=e.recursive)!=null?o:this.spec.recursive,disableStackTrace:(i=e.disableStackTrace)!=null?i:this.spec.disableStackTrace})}cast(e,n={}){let r=this.resolve(Object.assign({value:e},n)),o=n.assert==="ignore-optionality",i=r._cast(e,n);if(n.assert!==!1&&!r.isType(i)){if(o&&Ds(i))return i;let s=Ui(e),a=Ui(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
400
400
 
401
401
  attempted value: ${s}
402
- `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const S=i[g];S(b,f,function(_){_&&(Array.isArray(_)?y.push(..._):y.push(_)),--m<=0&&p(y)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,y)=>this.resolve(f)._validate(u,f,m,y)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):za(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=Da({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=Da({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=_o.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=_o.notNull){return this.nullability(!1,e)}required(e=_o.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=_o.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Da(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=fj(e).map(i=>new ra(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new vp(o,n):vp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Da({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=_o.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Da({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=_o.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Da({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}jo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])jo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=qfe(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])jo.prototype[t]=jo.prototype.oneOf;for(const t of["not","nope"])jo.prototype[t]=jo.prototype.notOneOf;const Ufe=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Kfe(t){const e=zv(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 zv(t){var e,n;const r=Ufe.exec(t);return r?{year:ei(r[1]),month:ei(r[2],1)-1,day:ei(r[3],1),hour:ei(r[4]),minute:ei(r[5]),second:ei(r[6]),millisecond:r[7]?ei(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:ei(r[10]),minuteOffset:ei(r[11])}:null}function ei(t,e=0){return Number(t)||e}let Yfe=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Gfe=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Jfe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Zfe="^\\d{4}-\\d{2}-\\d{2}",Xfe="\\d{2}:\\d{2}:\\d{2}",Qfe="(([+-]\\d{2}(:?\\d{2})?)|Z)",epe=new RegExp(`${Zfe}T${Xfe}(\\.\\d+)?${Qfe}$`),tpe=t=>Ds(t)||t===t.trim(),npe={}.toString();function Ps(){return new gj}class gj extends jo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===npe?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||_o.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=ur.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=ur.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=ur.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||ur.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=ur.email){return this.matches(Yfe,{name:"email",message:e,excludeEmptyString:!0})}url(e=ur.url){return this.matches(Gfe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ur.uuid){return this.matches(Jfe,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let n="",r,o;return e&&(typeof e=="object"?{message:n="",allowOffset:r=!1,precision:o=void 0}=e:n=e),this.matches(epe,{name:"datetime",message:n||ur.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||ur.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=zv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||ur.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=zv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ur.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:tpe})}lowercase(e=ur.lowercase){return this.transform(n=>Ds(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toLowerCase()})}uppercase(e=ur.uppercase){return this.transform(n=>Ds(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toUpperCase()})}}Ps.prototype=gj.prototype;let yj=new Date(""),rpe=t=>Object.prototype.toString.call(t)==="[object Date]";function z1(){return new Cu}class Cu extends jo{constructor(){super({type:"date",check(e){return rpe(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Kfe(e),isNaN(e)?Cu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ra.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=Vv.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=Vv.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)}})}}Cu.INVALID_DATE=yj;z1.prototype=Cu.prototype;z1.INVALID_DATE=yj;function ope(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=zs.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),ra.isRef(a)&&a.isSibling?i(a.path,s):V1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Dfe.array(Array.from(r),n).reverse()}function y2(t,e){let n=1/0;return t.some((r,o)=>{var i;if((i=e.path)!=null&&i.includes(r))return n=o,!0}),n}function bj(t){return(e,n)=>y2(t,e)-y2(t,n)}const ipe=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function mf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=mf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=mf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(mf)}):"optional"in t?t.optional():t}const spe=(t,e)=>{const n=[...zs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=zs.getter(zs.join(n),!0)(t);return!!(o&&r in o)};let b2=t=>Object.prototype.toString.call(t)==="[object Object]";function v2(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const ape=bj([]);function H1(t){return new vj(t)}class vj extends jo{constructor(e){super({type:"object",check(n){return b2(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=ape,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],y=p in o;if(m){let b,g=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:g,context:n.context,parent:l});let S=m instanceof jo?m.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}b=!n.__validating||!C?m.cast(o[p],u):o[p],b!==void 0&&(l[p]=b)}else y&&!s&&(l[p]=o[p]);(y!==p in l||l[p]!==o[p])&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!b2(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ra.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=ope(e,n),r._sortErrors=bj(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return mf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=zs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return spe(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(ipe)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||hf.exact,test(n){if(n==null)return!0;const r=v2(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=hf.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=v2(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=hf.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(N0.camelCase)}snakeCase(){return this.transformKeys(N0.snakeCase)}constantCase(){return this.transformKeys(e=>N0.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}H1.prototype=vj.prototype;const lpe=t=>{const{title:e,onSave:n,onCancel:r,modifyCitation:o,readOnly:i=!1,showCloseBtn:s=!1}=t,a=X.useRef(null),[l,u]=X.useState(!1),[f,p]=X.useState(!1),[m,y]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});X.useEffect(()=>{o&&y({...o,type:"Url"})},[]);const b=()=>{var S,C,_;const g=(C=(S=a==null?void 0:a.current)==null?void 0:S.values)==null?void 0:C.url;g&&((_=a==null?void 0:a.current)==null||_.setFieldValue("url",OP(g)))};return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),s&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Np,{})})]}),v.jsx(qt.Formik,{innerRef:a,enableReinitialize:!0,initialValues:m,onSubmit:async g=>{u(!0),n(g).catch(S=>{throw u(!1),S}).finally(()=>u(!1))},validationSchema:H1({source:Ps().required("Source is required"),title:Ps().required("Title is required"),accessedAt:z1().required("Accessed At is required"),url:Ps().required("URL is required"),classification:Ps().required("Classification is required")}),validateOnBlur:f,validateOnChange:f,children:({handleSubmit:g})=>v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"column",gap:i?1:0,children:[v.jsx(Ns,{name:"source",disabled:l,required:!0,margin:"none",readOnly:i}),v.jsx(Ns,{name:"title",disabled:l,required:!0,margin:"none",readOnly:i}),v.jsx(Of,{name:"accessedAt",disabled:l,required:!0,margin:"none",isDatePicker:!0,readOnly:i}),v.jsx(Ns,{name:"url",label:"URL",disabled:l,required:!0,onBlur:b,margin:"none",readOnly:i}),v.jsx($R,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:i})]}),v.jsx(D.DialogActions,{sx:{px:0},children:i?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(B1,{size:"small",loading:l,type:"button",onClick:()=>{p(!0),g()},children:o?"Update Citation":"Add New Citation"})]})})]})})]})},xj=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return v.jsx(D.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},cpe=t=>{const{title:e,onSave:n,onCancel:r,disableFileUpload:o=!1,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState(!1),[y,b]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{i&&b({...i,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(D.IconButton,{onClick:r,children:v.jsx(Np,{})})]}),v.jsx(qt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,validationSchema:H1().shape({title:Ps().required("Title is required"),fileName:Ps().required("A file is required")}),validateOnBlur:p,validateOnChange:p,onSubmit:async g=>{f(!0),n(g).catch(S=>{throw f(!1),S}).finally(()=>f(!1))},children:({values:g,setFieldValue:S,handleSubmit:C})=>{var _;return X.useEffect(()=>{var T,w;(T=g.file)!=null&&T.name&&S("fileName",(w=g.file)==null?void 0:w.name)},[(_=g.file)==null?void 0:_.name]),v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Ns,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsxs(D.Box,{marginTop:o||s?0:1,children:[v.jsxs(xj,{alignItems:"flex-start",children:[!o&&!s&&v.jsx(PR,{name:"file",errorMode:"hidden"}),v.jsx(Ns,{readOnly:!0,name:"fileName",label:s||o?"File Name":""})]}),v.jsx(yr,{name:"fileName"})]}),v.jsx(D.DialogActions,{sx:{px:0},children:s?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(B1,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),C()},children:i?"Update Attachment":"Upload Attachment"})]})})]})}})]})},wu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",y=()=>{if(s&&p)return v.jsx(D.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},b=()=>{if(i)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(D.Box,{children:y()}),v.jsxs(D.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(D.Box,{children:y()})})};return v.jsxs(D.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(D.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&v.jsx(D.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Np,{})})]})}):r,o&&(typeof o=="string"?v.jsx(D.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(D.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),b()]})};function upe(t){return Ye("MuiAlert",t)}const x2=We("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),dpe=Le(v.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),fpe=Le(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),ppe=Le(v.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),hpe=Le(v.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),mpe=Le(v.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),gpe=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Re(n||r)}`,`${e}${Re(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ke(i,upe,o)},ype=ve(hl,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Re(n.color||n.severity)}`]]}})(It(({theme:t})=>{const e=t.palette.mode==="light"?Xa:Oc,n=t.palette.mode==="light"?Oc:Xa;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${x2.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}`,[`& .${x2.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),bpe=ve("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),vpe=ve("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),xpe=ve("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),S2={success:v.jsx(dpe,{fontSize:"inherit"}),warning:v.jsx(fpe,{fontSize:"inherit"}),error:v.jsx(ppe,{fontSize:"inherit"}),info:v.jsx(hpe,{fontSize:"inherit"})},Sj=A.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=S2,onClose:y,role:b="alert",severity:g="success",slotProps:S={},slots:C={},variant:_="standard",...T}=r,w={...r,color:l,severity:g,variant:_,colorSeverity:l||g},E=gpe(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[N,P]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(E.root,s),elementType:ype,externalForwardedProps:{...O,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[j,M]=Bt("icon",{className:E.icon,elementType:bpe,externalForwardedProps:O,ownerState:w}),[R,B]=Bt("message",{className:E.message,elementType:vpe,externalForwardedProps:O,ownerState:w}),[F,$]=Bt("action",{className:E.action,elementType:xpe,externalForwardedProps:O,ownerState:w}),[V,L]=Bt("closeButton",{elementType:ml,externalForwardedProps:O,ownerState:w}),[W,q]=Bt("closeIcon",{elementType:mpe,externalForwardedProps:O,ownerState:w});return v.jsxs(N,{...P,children:[p!==!1?v.jsx(j,{...M,children:p||m[g]||S2[g]}):null,v.jsx(R,{...B,children:i}),o!=null?v.jsx(F,{...$,children:o}):null,o==null&&y?v.jsx(F,{...$,children:v.jsx(V,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...L,children:v.jsx(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(Sj.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Tu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=D.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(Sj,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(D.Typography,{variant:"h3",children:s}),n]})},Cj=t=>v.jsx(Tu,{severity:"error",...t}),wj=t=>v.jsx(Tu,{severity:"success",...t}),Spe=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(Cj,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(wj,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function Tj({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:s,onCancel:a,initialSelectedIds:l=[],onContentChange:u,onError:f=()=>{},renderAsSelectablePopup:p=!1,addlActions:m,canLaunchUrl:y,readOnly:b}){const[g,S]=X.useState("Insert Citation/Attachment(s)"),[C,_]=X.useState(l),[T,w]=X.useState(void 0),[E,O]=X.useState(void 0),N=ae=>{O(void 0),S(ae)},[P,j]=X.useState(0);X.useEffect(()=>{u==null||u()},[g,E,u]);const M=(ae=!1)=>{(!p||ae)&&j(de=>de+1)},R=(ae,de)=>{var se;const ee=typeof((se=de.response)==null?void 0:se.data)=="string"&&de.response.data,he=typeof de.message=="string"&&de.message;O({type:"Error",title:ae,message:ee??he}),f(de)},B=ae=>O({type:"Success",title:"",message:ae}),F=async ae=>{if(g==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(g==="Edit Citation"||g==="Edit Attachment"){if(ae.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ae).then(()=>{N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to update",ee)}))}else await(e==null?void 0:e(ae).then(ee=>{_([...C,ee.id]),N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to create",ee)}))},$=r&&(async ae=>r(ae).then(()=>{M(!0),_(C.filter(de=>de!==ae)),B("Successfully deleted")}).catch(de=>R("Failed to delete",de))),V=(ae,de)=>{o(ae.id).then(ee=>{w(ee),N(de)}).catch(ee=>{R("Failed to load",ee)})},L=i&&(async ae=>i(ae).catch(de=>{R(`Failed to download ${ae.fileName}`,de)})),W=v.jsx(Mfe,{refreshKey:P,getCitationsPaginated:ae=>t(ae).then(de=>(u==null||u(),de)),onCancel:a,onNewCitation:()=>{w(void 0),N("Add Citation")},onNewAttachment:()=>{w(void 0),N("Add Attachment")},onEditCitation:ae=>V(ae,b?"View Citation":"Edit Citation"),onEditAttachment:ae=>V(ae,b?"View Attachment":"Edit Attachment"),onDeleteCitation:$,onDownloadAttachment:L,onSelect:s,setSelectedIds:_,selectedIds:C,onError:f,condenseTable:p,canSelect:p,title:p&&!b?g:"Attachments & Citations",addlActions:m,canCreate:!!e,canEdit:!!n,canDelete:!!$,canLaunchUrl:y,readOnly:b,showCloseBtn:p}),q=v.jsx(lpe,{modifyCitation:T,onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),title:g,readOnly:g==="View Citation",showCloseBtn:p}),G=v.jsx(cpe,{onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),modifyCitation:T,disableFileUpload:g==="Edit Attachment",title:g,readOnly:g==="View Attachment",showCloseBtn:p}),U=v.jsx(Spe,{alert:E,setAlert:O}),Z=g==="Add Citation"||g==="Edit Citation"||g==="View Citation",pe=g==="Add Attachment"||g==="Edit Attachment"||g==="View Attachment";if(p){let ae=null;return!p||g==="Insert Citation/Attachment(s)"?ae=W:Z?ae=q:pe&&(ae=G),v.jsxs(D.Box,{width:"500px",children:[U,v.jsx(D.Box,{paddingTop:"8px",children:ae})]})}return v.jsxs(D.Box,{width:"100%",children:[g==="Insert Citation/Attachment(s)"&&U,v.jsx(D.Box,{paddingTop:"8px",children:W}),v.jsx(wu,{open:Z||pe,children:v.jsxs(D.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[U,Z?q:G]})})]})}function _j({...t}){return v.jsx(Tj,{renderAsSelectablePopup:!0,...t})}const Cpe=Yt({name:{CitationBubbleMenuTipTap:kj}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function kj({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,readOnly:a,...l}){const{classes:u}=Cpe(),f=vt();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,y=p.selectedIds,b=p.selectedNodePos,g=T=>{f&&(T.length===0?f.commands.deleteCitation(b):y.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},b))},S=T=>{g(T),f==null||f.commands.closeCitationBubbleMenu()},C=()=>{g(y),f==null||f.commands.closeCitationBubbleMenu()},_=X.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?v.jsx(bh,{editor:f,open:m,...p.bubbleMenuOptions,...l,children:v.jsx("div",{className:u.content,children:v.jsx(_j,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:S,onCancel:C,initialSelectedIds:y,onContentChange:_,canLaunchUrl:s,readOnly:a})})}):null}const wpe=un.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(IN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(AN.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(DN.configure(this.options.bulletList)),this.options.code!==!1&&t.push(PN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(NN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(jN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(LN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(FN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push($N.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(gN.configure(this.options.heading)),this.options.history!==!1&&t.push(WN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(qN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(UN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(nj.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(rj.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(oj.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(sj.configure(this.options.strike)),this.options.text!==!1&&t.push(aj.configure(this.options.text)),t}}),Tpe=()=>un.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function _pe(t){const e=vt(),n=X.useRef(null);return v.jsx(mt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(Hq,{fontSize:"small"}),v.jsx(D.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const Ej=X.createContext(void 0),Mj=()=>{const t=X.useContext(Ej);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},kpe=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=Mj(),[u,f]=X.useState(String(s)),[p,m]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const b=a.filter(C=>s.includes(C.id)),g=b.map(C=>vf.truncate(C.title,{length:y,omission:"..."})).join(", ");f(g),m(b);const S=b.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:b.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(x1,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(D.Tooltip,{title:v.jsx(D.Box,{className:"citation-tooltip",children:p.map((b,g)=>{var C;const S=[b.source,b.title,b.fileName,b.url,(C=b.accessedAt)==null?void 0:C.slice(0,10),b.classification];return v.jsxs(D.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),g<p.length-1&&v.jsx(D.Divider,{className:"citation-tooltip-divider"})]},b.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:b=>{b.preventDefault(),b.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Epe=en.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",bt(t)]},addNodeView(){return S1(kpe)},addProseMirrorPlugins(){return[new tn({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),Oj=t=>v.jsx(DR,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Mpe=t=>{const{name:e,label:n=Mn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:y,onError:b=()=>{},placeholder:g="Start typing here...",notApplicableName:S,errorMode:C="normal",canLaunchUrl:_}=t,T=[wpe,ij.configure({placeholder:g}),Tpe(),Epe.configure({citationMaxLength:a})],[w,E,O]=qt.useField({name:e}),{setValue:N}=O,{value:P}=w,{addUpdateCitation:j,deleteCitation:M,batchUpdate:R}=Mj();X.useEffect(()=>{var q;const L=(q=B==null?void 0:B.current)==null?void 0:q.editor;if(!L)return;L.getHTML()!==P&&setTimeout(()=>{L.commands.setContent(P)},0)},[P]);const B=X.useRef(null),F={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},$=()=>{var q,G;const L=((G=(q=B.current)==null?void 0:q.editor)==null?void 0:G.getHTML())??"",W=!L.replace(/<\/?p>|<br>/g,"").trim();N(W?"":L)},V=v.jsxs(D.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...F[s],children:[v.jsx(QP,{ref:B,extensions:T,content:P,editable:!i,renderControls:i?void 0:()=>v.jsx(xh,{children:v.jsx(_pe,{})}),onBlur:$,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(kj,{getCitationsPaginated:L=>l(L).then(W=>(R(W.data),W)),onCreateCitation:u&&(L=>u(L).then(W=>(j(W),W))),onUpdateCitation:f&&(L=>f(L).then(W=>(j(W),W))),onDeleteCitation:p&&(L=>p(L).then(()=>M(L))),getCitationById:m,onDownloadAttachment:y,onError:b,canLaunchUrl:_,readOnly:i})}),v.jsx(yr,{name:e,id:`${e}-err`,errorMode:C})]});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(D.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(Oj,{name:S})]}),V]})},Ope=t=>{const{name:e="submit"}=t;return v.jsx(qr,{name:e,type:"submit",...t})},Rpe=t=>{const{label:e="Return to Top",icon:n=Gd,scrollThresholdPx:r=100}=t,o=D.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(D.Zoom,{in:o,children:v.jsx(D.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(D.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Rj=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ao.useNavigate(),[i,s]=A.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),v.jsx(D.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>v.jsxs(D.MenuItem,{...Xc(p,o),children:[p.icon&&v.jsx(D.ListItemIcon,{children:p.icon}),v.jsx(D.ListItemText,{primary:p.label})]},p.label))})]})},Ape=()=>{const{values:t,errors:e,status:n}=qt.useFormikContext(),{palette:r}=D.useTheme();return v.jsx(D.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(D.List,{children:[v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(D.Divider,{variant:"inset",component:"li"}),v.jsxs(D.ListItem,{id:"testing",children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Ipe=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=dj();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...er({...t},l)};return v.jsx(D.Stepper,{...u,children:e.map(f=>v.jsx(D.Step,{children:v.jsx(D.StepLabel,{children:f})},f))})},Dpe=t=>{const{name:e,label:n=Mn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(S8,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:b=!1,removePosition:g="bottom"}=t,[S]=qt.useField({name:e}),{value:C}=S,_=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(D.FormControl,{fullWidth:!0,children:[v.jsx(D.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(D.Typography,{children:y}):v.jsx(qt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(X.Fragment,{children:v.jsx(Ppe,{variant:l,content:v.jsxs(D.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?_(g):{...g},children:[v.jsxs(D.Box,{width:"100%",children:[i(`${e}.${E}`,E),b&&E!==C.length-1&&v.jsx(D.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(E),children:a})]})})},`${e}-${E}`)),!m&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ppe=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"elevatedCard":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"none":return e}},Npe=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(wu,{actions:[v.jsx(D.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},jpe=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(wu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Lpe=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return v.jsx(wu,{actions:[v.jsx(D.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(D.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Fpe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=D.useTheme(),a=ao.useNavigate();return v.jsxs(D.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(D.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(D.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(D.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>v.jsx(D.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Xc(l,a),children:l.label},l.label))}),n&&v.jsx(D.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},Aj=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ao.useLocation(),i=ao.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>v.jsx(D.MenuList,{children:m.map(b=>v.jsxs(D.MenuItem,{...Xc(b,i,()=>a(!1)),children:[b.icon&&v.jsx(D.ListItemIcon,{children:b.icon}),v.jsx(D.ListItemText,{primary:b.label})]},`mobile-drawer-group-${y}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,b)=>v.jsxs(X.Fragment,{children:[l(y,b),b<m.length-1&&v.jsx(D.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(D.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(D.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(g8,{})}),v.jsx(D.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(D.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(D.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},Ij=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(D.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(D.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},Dj=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(Rj,{label:e,menuOptions:n,icon:v.jsx(b8,{})})},Th=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=D.useTheme(),a=ao.useNavigate();return v.jsx(D.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(D.Tab,{icon:l.icon,label:l.label,value:u,...Xc(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},Pj=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(D.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Th,{menuOptions:e,activeTabIdx:n,sx:r})})},Nj=t=>{const{onToggle:e}=t,{palette:n}=D.useTheme(),r=n.mode==="dark";return v.jsx(D.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(zR,{}):v.jsx(BR,{})})},$pe=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:y}=t,b=ao.useNavigate(),g=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),{palette:S}=D.useTheme(),{pathname:C}=ao.useLocation(),_=S.mode==="dark",[T,w]=A.useState(void 0);A.useEffect(()=>{const N=o.findIndex(P=>P.path&&C.startsWith(P.path));w(N>=0?N:void 0)},[C,o]);const E=s&&v.jsx(Nj,{onToggle:s}),O=s&&(g||!g&&l)?[{icon:_?v.jsx(zR,{}):v.jsx(BR,{}),label:`Switch to ${_?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(D.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(Ij,{...e}),u,v.jsxs(D.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(D.Button,{disableRipple:!0,component:ao.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(D.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&E,g&&v.jsx(Aj,{menuOptionLists:[o,a,O],anchor:"right"}),!g&&v.jsxs(v.Fragment,{children:[v.jsx(D.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,P)=>v.jsxs(D.Box,{display:"flex",alignItems:"center",children:[P>0&&v.jsx(D.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(D.Button,{variant:"text",sx:{color:"white"},...Xc(N,b),children:v.jsxs(D.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&v.jsx(Dj,{displayName:l,userMenuOptions:O})]})]})]}),!g&&v.jsx(Pj,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Bpe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ao.useLocation(),o=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),[i,s]=X.useState(void 0);return X.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&v.jsx(D.Box,{sx:e,children:v.jsx(D.Card,{sx:{height:"100%",width:200},children:v.jsx(Th,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Vpe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=D.useTheme();return e.length>0&&v.jsx(Th,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},zpe=t=>{const{gap:e=1,...n}=t;return v.jsx(D.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Hpe=t=>v.jsx(Tu,{severity:"info",...t}),Wpe=t=>v.jsx(Tu,{severity:"warning",...t}),jj=t=>{const{crumbInfo:e}=t,n=ao.useNavigate();return v.jsx(D.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(y8,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(D.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(D.Typography,{color:"primary",children:r},r))})},qpe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Upe(r);return v.jsx(D.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(Tu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:C2(r),warning:C2(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(D.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Upe=t=>t=="logout"?"info":t=="timeout"?"warning":t,C2=t=>{if(t=="timeout")return v.jsx(Bq,{});if(t=="logout")return v.jsx(m8,{})},Kpe=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(D.Box,{sx:a,children:[i.length>0&&v.jsx(jj,{crumbInfo:i}),v.jsxs(D.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(D.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(D.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(qr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(Vq,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(D.Box,{width:l?"100%":"50%",children:s})]})]})},Ype=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return v.jsxs(D.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(D.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(D.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(D.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Gpe({...t}){return v.jsx(Tj,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Jpe=({children:t,getCitations:e})=>{const[n,r]=X.useState([]),[o,i]=X.useState(!1);X.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(b=>b.id));return[...p.filter(b=>!m.has(b.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(b=>{const g=u.find(S=>S.id===b.id);return g||b}),m=new Set(f.map(b=>b.id)),y=u.filter(b=>!m.has(b.id));return[...p,...y]})},[]),a=X.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=X.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(Ej.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Zpe=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return v.jsx(D.Box,{height:n})};exports.AlertModal=jpe;exports.Autocomplete=IR;exports.Breadcrumbs=jj;exports.Button=qr;exports.Checkbox=DR;exports.CheckboxGroup=bq;exports.CitationField=Mpe;exports.CitationFieldProvider=Jpe;exports.CitationManager=Gpe;exports.Column=zpe;exports.ConfirmationModal=Npe;exports.DarkModeToggle=Nj;exports.DateField=Of;exports.DateRangeField=zQ;exports.DecisionModal=Lpe;exports.Drawer=Aj;exports.DynamicAutocomplete=gq;exports.EnvironmentBanner=Ij;exports.ErrorAlert=Cj;exports.FileList=Sq;exports.FileUpload=PR;exports.FloatingNavBar=Vpe;exports.Footer=Fpe;exports.FormDebugger=Ape;exports.Header=$pe;exports.InfoAlert=Hpe;exports.LoadingButton=B1;exports.LoadingIndicator=Bv;exports.Location=jq;exports.MenuButton=Rj;exports.Modal=wu;exports.MultiAutocomplete=yq;exports.NavBar=Pj;exports.NotApplicableCheckbox=Oj;exports.PageHeader=Kpe;exports.PaginatedTable=uj;exports.ProfileMenu=Dj;exports.RadioGroup=$R;exports.RangeSlider=Lq;exports.RepeatableFormGroup=Dpe;exports.RichTextField=_fe;exports.Row=xj;exports.ScrollToTop=Rpe;exports.SearchField=O8;exports.Select=Fq;exports.SelectableCitationManager=_j;exports.Sidebar=Bpe;exports.SingleActionCard=Ype;exports.Snackbar=qpe;exports.Spacer=Zpe;exports.Stepper=Ipe;exports.Submit=Ope;exports.SuccessAlert=wj;exports.Switch=$q;exports.Table=cj;exports.Tabs=Th;exports.TextField=Ns;exports.ValidationError=yr;exports.WarningAlert=Wpe;exports.commonTheme=Sn;exports.darkTheme=g6;exports.lightTheme=m6;
402
+ `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=g=>{o||(o=!0,n(g,s))},p=g=>{o||(o=!0,r(g,s))},m=i.length,y=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let g=0;g<i.length;g++){const S=i[g];S(b,f,function(_){_&&(Array.isArray(_)?y.push(..._):y.push(_)),--m<=0&&p(y)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,y)=>this.resolve(f)._validate(u,f,m,y)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):za(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=Da({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=Da({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=_o.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=_o.notNull){return this.nullability(!1,e)}required(e=_o.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=_o.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Da(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=fj(e).map(i=>new ra(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new vp(o,n):vp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Da({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=_o.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Da({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=_o.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Da({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.map(l=>({name:l.OPTIONS.name,params:l.OPTIONS.params})).filter((l,u,f)=>f.findIndex(p=>p.name===l.name)===u)}}}jo.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])jo.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=qfe(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])jo.prototype[t]=jo.prototype.oneOf;for(const t of["not","nope"])jo.prototype[t]=jo.prototype.notOneOf;const Ufe=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Kfe(t){const e=zv(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 zv(t){var e,n;const r=Ufe.exec(t);return r?{year:ei(r[1]),month:ei(r[2],1)-1,day:ei(r[3],1),hour:ei(r[4]),minute:ei(r[5]),second:ei(r[6]),millisecond:r[7]?ei(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:ei(r[10]),minuteOffset:ei(r[11])}:null}function ei(t,e=0){return Number(t)||e}let Yfe=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Gfe=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Jfe=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,Zfe="^\\d{4}-\\d{2}-\\d{2}",Xfe="\\d{2}:\\d{2}:\\d{2}",Qfe="(([+-]\\d{2}(:?\\d{2})?)|Z)",epe=new RegExp(`${Zfe}T${Xfe}(\\.\\d+)?${Qfe}$`),tpe=t=>Ds(t)||t===t.trim(),npe={}.toString();function Ps(){return new gj}class gj extends jo{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n,r)=>{if(!r.spec.coerce||r.isType(e)||Array.isArray(e))return e;const o=e!=null&&e.toString?e.toString():e;return o===npe?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||_o.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=ur.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=ur.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=ur.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||ur.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=ur.email){return this.matches(Yfe,{name:"email",message:e,excludeEmptyString:!0})}url(e=ur.url){return this.matches(Gfe,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ur.uuid){return this.matches(Jfe,{name:"uuid",message:e,excludeEmptyString:!1})}datetime(e){let n="",r,o;return e&&(typeof e=="object"?{message:n="",allowOffset:r=!1,precision:o=void 0}=e:n=e),this.matches(epe,{name:"datetime",message:n||ur.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||ur.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=zv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||ur.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=zv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ur.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:tpe})}lowercase(e=ur.lowercase){return this.transform(n=>Ds(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toLowerCase()})}uppercase(e=ur.uppercase){return this.transform(n=>Ds(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ds(n)||n===n.toUpperCase()})}}Ps.prototype=gj.prototype;let yj=new Date(""),rpe=t=>Object.prototype.toString.call(t)==="[object Date]";function z1(){return new Cu}class Cu extends jo{constructor(){super({type:"date",check(e){return rpe(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=Kfe(e),isNaN(e)?Cu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(ra.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=Vv.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=Vv.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)}})}}Cu.INVALID_DATE=yj;z1.prototype=Cu.prototype;z1.INVALID_DATE=yj;function ope(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=zs.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),ra.isRef(a)&&a.isSibling?i(a.path,s):V1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Dfe.array(Array.from(r),n).reverse()}function y2(t,e){let n=1/0;return t.some((r,o)=>{var i;if((i=e.path)!=null&&i.includes(r))return n=o,!0}),n}function bj(t){return(e,n)=>y2(t,e)-y2(t,n)}const ipe=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function mf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=mf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=mf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(mf)}):"optional"in t?t.optional():t}const spe=(t,e)=>{const n=[...zs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=zs.getter(zs.join(n),!0)(t);return!!(o&&r in o)};let b2=t=>Object.prototype.toString.call(t)==="[object Object]";function v2(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const ape=bj([]);function H1(t){return new vj(t)}class vj extends jo{constructor(e){super({type:"object",check(n){return b2(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=ape,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],y=p in o;if(m){let b,g=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:g,context:n.context,parent:l});let S=m instanceof jo?m.spec:void 0,C=S==null?void 0:S.strict;if(S!=null&&S.strip){f=f||p in o;continue}b=!n.__validating||!C?m.cast(o[p],u):o[p],b!==void 0&&(l[p]=b)}else y&&!s&&(l[p]=o[p]);(y!==p in l||l[p]!==o[p])&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!b2(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||ra.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=ope(e,n),r._sortErrors=bj(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return mf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=zs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return spe(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(ipe)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||hf.exact,test(n){if(n==null)return!0;const r=v2(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=hf.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=v2(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=hf.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(N0.camelCase)}snakeCase(){return this.transformKeys(N0.snakeCase)}constantCase(){return this.transformKeys(e=>N0.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}H1.prototype=vj.prototype;const lpe=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,modifyCitation:i,readOnly:s=!1,showCloseBtn:a=!1}=t,l=X.useRef(null),[u,f]=X.useState(!1),[p,m]=X.useState(!1),[y,b]=X.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:""});X.useEffect(()=>{i&&b({...i,type:"Url"})},[]);const g=()=>{var C,_,T;const S=(_=(C=l==null?void 0:l.current)==null?void 0:C.values)==null?void 0:_.url;S&&((T=l==null?void 0:l.current)==null||T.setFieldValue("url",OP(S)))};return v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),a&&v.jsx(D.IconButton,{onClick:o,children:v.jsx(Np,{})})]}),v.jsx(qt.Formik,{innerRef:l,enableReinitialize:!0,initialValues:y,onSubmit:async S=>{f(!0),n(S).catch(C=>{throw f(!1),C}).finally(()=>f(!1))},validationSchema:H1({source:Ps().required("Source is required"),title:Ps().required("Title is required"),accessedAt:z1().required("Accessed At is required"),url:Ps().required("URL is required"),classification:Ps().required("Classification is required")}),validateOnBlur:p,validateOnChange:p,children:({handleSubmit:S})=>v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"column",gap:s?1:0,children:[v.jsx(Ns,{name:"source",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsx(Ns,{name:"title",disabled:u,required:!0,margin:"none",readOnly:s}),v.jsx(Of,{name:"accessedAt",disabled:u,required:!0,margin:"none",isDatePicker:!0,readOnly:s}),v.jsx(Ns,{name:"url",label:"URL",disabled:u,required:!0,onBlur:g,margin:"none",readOnly:s}),v.jsx($R,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],margin:"none",readOnly:s})]}),v.jsx(D.DialogActions,{sx:{px:0},children:s?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(B1,{size:"small",loading:u,type:"button",onClick:()=>{m(!0),S()},children:i?"Update Citation":"Add New Citation"})]})})]})})]})},xj=t=>{const{gap:e=1,alignItems:n="center",...r}=t;return v.jsx(D.Box,{display:"flex",flexDirection:"row",gap:e,alignItems:n,...r})},cpe=t=>{const{title:e,onSave:n,onCancel:r,onClose:o,disableFileUpload:i=!1,modifyCitation:s,readOnly:a=!1,showCloseBtn:l=!1}=t,u=X.useRef(null),[f,p]=X.useState(!1),[m,y]=X.useState(!1),[b,g]=X.useState({type:"Attachment",title:"",file:void 0,fileName:""});return X.useEffect(()=>{s&&g({...s,type:"Attachment",file:void 0})},[]),v.jsxs(v.Fragment,{children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[v.jsx(D.Typography,{variant:"h6",margin:"10px 0",children:e}),l&&v.jsx(D.IconButton,{onClick:o,children:v.jsx(Np,{})})]}),v.jsx(qt.Formik,{innerRef:u,enableReinitialize:!0,initialValues:b,validationSchema:H1().shape({title:Ps().required("Title is required"),fileName:Ps().required("A file is required")}),validateOnBlur:m,validateOnChange:m,onSubmit:async S=>{p(!0),n(S).catch(C=>{throw p(!1),C}).finally(()=>p(!1))},children:({values:S,setFieldValue:C,handleSubmit:_})=>{var T;return X.useEffect(()=>{var w,E;(w=S.file)!=null&&w.name&&C("fileName",(E=S.file)==null?void 0:E.name)},[(T=S.file)==null?void 0:T.name]),v.jsxs(qt.Form,{autoComplete:"off",children:[v.jsx(Ns,{name:"title",disabled:f,required:!0,margin:"none",readOnly:a}),v.jsxs(D.Box,{marginTop:i||a?0:1,children:[v.jsxs(xj,{alignItems:"flex-start",children:[!i&&!a&&v.jsx(PR,{name:"file",errorMode:"hidden"}),v.jsx(Ns,{readOnly:!0,name:"fileName",label:a||i?"File Name":""})]}),v.jsx(yr,{name:"fileName"})]}),v.jsx(D.DialogActions,{sx:{px:0},children:a?v.jsx(D.Button,{onClick:r,size:"small",variant:"contained",children:"Back to Table"}):v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(B1,{size:"small",loading:f,type:"button",onClick:()=>{y(!0),_()},children:s?"Update Attachment":"Upload Attachment"})]})})]})}})]})},wu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",y=()=>{if(s&&p)return v.jsx(D.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},b=()=>{if(i)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(D.Box,{children:y()}),v.jsxs(D.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return v.jsx(D.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(D.Box,{children:y()})})};return v.jsxs(D.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(D.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&v.jsx(D.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(Np,{})})]})}):r,o&&(typeof o=="string"?v.jsx(D.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(D.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),b()]})};function upe(t){return Ye("MuiAlert",t)}const x2=We("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),dpe=Le(v.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),fpe=Le(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),ppe=Le(v.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),hpe=Le(v.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),mpe=Le(v.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),gpe=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Re(n||r)}`,`${e}${Re(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ke(i,upe,o)},ype=ve(hl,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Re(n.color||n.severity)}`]]}})(It(({theme:t})=>{const e=t.palette.mode==="light"?Xa:Oc,n=t.palette.mode==="light"?Oc:Xa;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${x2.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}`,[`& .${x2.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),bpe=ve("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),vpe=ve("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),xpe=ve("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),S2={success:v.jsx(dpe,{fontSize:"inherit"}),warning:v.jsx(fpe,{fontSize:"inherit"}),error:v.jsx(ppe,{fontSize:"inherit"}),info:v.jsx(hpe,{fontSize:"inherit"})},Sj=A.forwardRef(function(e,n){const r=St({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=S2,onClose:y,role:b="alert",severity:g="success",slotProps:S={},slots:C={},variant:_="standard",...T}=r,w={...r,color:l,severity:g,variant:_,colorSeverity:l||g},E=gpe(w),O={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[N,P]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(E.root,s),elementType:ype,externalForwardedProps:{...O,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[j,M]=Bt("icon",{className:E.icon,elementType:bpe,externalForwardedProps:O,ownerState:w}),[R,B]=Bt("message",{className:E.message,elementType:vpe,externalForwardedProps:O,ownerState:w}),[F,$]=Bt("action",{className:E.action,elementType:xpe,externalForwardedProps:O,ownerState:w}),[V,L]=Bt("closeButton",{elementType:ml,externalForwardedProps:O,ownerState:w}),[W,q]=Bt("closeIcon",{elementType:mpe,externalForwardedProps:O,ownerState:w});return v.jsxs(N,{...P,children:[p!==!1?v.jsx(j,{...M,children:p||m[g]||S2[g]}):null,v.jsx(R,{...B,children:i}),o!=null?v.jsx(F,{...$,children:o}):null,o==null&&y?v.jsx(F,{...$,children:v.jsx(V,{size:"small","aria-label":a,title:a,color:"inherit",onClick:y,...L,children:v.jsx(W,{fontSize:"small",...q})})}):null]})});process.env.NODE_ENV!=="production"&&(Sj.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Tu=t=>{var y;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=D.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(y=l[r])==null?void 0:y.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(Sj,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(D.Typography,{variant:"h3",children:s}),n]})},Cj=t=>v.jsx(Tu,{severity:"error",...t}),wj=t=>v.jsx(Tu,{severity:"success",...t}),Spe=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return v.jsxs(v.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&v.jsx(Cj,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&v.jsx(wj,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function Tj({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:s,onCancel:a,initialSelectedIds:l=[],onContentChange:u,onError:f=()=>{},renderAsSelectablePopup:p=!1,addlActions:m,canLaunchUrl:y,readOnly:b}){const[g,S]=X.useState("Insert Citation/Attachment(s)"),[C,_]=X.useState(l),[T,w]=X.useState(void 0),[E,O]=X.useState(void 0),N=ae=>{O(void 0),S(ae)},[P,j]=X.useState(0);X.useEffect(()=>{u==null||u()},[g,E,u]);const M=(ae=!1)=>{(!p||ae)&&j(de=>de+1)},R=(ae,de)=>{var se;const ee=typeof((se=de.response)==null?void 0:se.data)=="string"&&de.response.data,he=typeof de.message=="string"&&de.message;O({type:"Error",title:ae,message:ee??he}),f(de)},B=ae=>O({type:"Success",title:"",message:ae}),F=async ae=>{if(g==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");if(g==="Edit Citation"||g==="Edit Attachment"){if(ae.id===void 0)throw Error("Failed to update citation. Citation is missing id");await(n==null?void 0:n(ae).then(()=>{N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to update",ee)}))}else await(e==null?void 0:e(ae).then(ee=>{_([...C,ee.id]),N("Insert Citation/Attachment(s)"),M()}).catch(ee=>{R("Failed to create",ee)}))},$=r&&(async ae=>r(ae).then(()=>{M(!0),_(C.filter(de=>de!==ae)),B("Successfully deleted")}).catch(de=>R("Failed to delete",de))),V=(ae,de)=>{o(ae.id).then(ee=>{w(ee),N(de)}).catch(ee=>{R("Failed to load",ee)})},L=i&&(async ae=>i(ae).catch(de=>{R(`Failed to download ${ae.fileName}`,de)})),W=v.jsx(Mfe,{refreshKey:P,getCitationsPaginated:ae=>t(ae).then(de=>(u==null||u(),de)),onCancel:a,onNewCitation:()=>{w(void 0),N("Add Citation")},onNewAttachment:()=>{w(void 0),N("Add Attachment")},onEditCitation:ae=>V(ae,b?"View Citation":"Edit Citation"),onEditAttachment:ae=>V(ae,b?"View Attachment":"Edit Attachment"),onDeleteCitation:$,onDownloadAttachment:L,onSelect:s,setSelectedIds:_,selectedIds:C,onError:f,condenseTable:p,canSelect:p,title:p&&!b?g:"Attachments & Citations",addlActions:m,canCreate:!!e,canEdit:!!n,canDelete:!!$,canLaunchUrl:y,readOnly:b,showCloseBtn:p}),q=v.jsx(lpe,{modifyCitation:T,onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:a,title:g,readOnly:g==="View Citation",showCloseBtn:p}),G=v.jsx(cpe,{onSave:F,onCancel:()=>N("Insert Citation/Attachment(s)"),onClose:a,modifyCitation:T,disableFileUpload:g==="Edit Attachment",title:g,readOnly:g==="View Attachment",showCloseBtn:p}),U=v.jsx(Spe,{alert:E,setAlert:O}),Z=g==="Add Citation"||g==="Edit Citation"||g==="View Citation",pe=g==="Add Attachment"||g==="Edit Attachment"||g==="View Attachment";if(p){let ae=null;return!p||g==="Insert Citation/Attachment(s)"?ae=W:Z?ae=q:pe&&(ae=G),v.jsxs(D.Box,{width:"500px",children:[U,v.jsx(D.Box,{paddingTop:"8px",children:ae})]})}return v.jsxs(D.Box,{width:"100%",children:[g==="Insert Citation/Attachment(s)"&&U,v.jsx(D.Box,{paddingTop:"8px",children:W}),v.jsx(wu,{open:Z||pe,children:v.jsxs(D.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[U,Z?q:G]})})]})}function _j({...t}){return v.jsx(Tj,{renderAsSelectablePopup:!0,...t})}const Cpe=Yt({name:{CitationBubbleMenuTipTap:kj}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function kj({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,canLaunchUrl:s,readOnly:a,...l}){const{classes:u}=Cpe(),f=vt();if(f&&!("citationBubbleMenuHandler"in(f==null?void 0:f.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const p=f==null?void 0:f.storage.citationBubbleMenuHandler,m=p.isOpen,y=p.selectedIds,b=p.selectedNodePos,g=T=>{f&&(T.length===0?f.commands.deleteCitation(b):y.length===0?f.commands.insertCitation({ids:T}):f.commands.updateCitation({ids:T},b))},S=T=>{g(T),f==null||f.commands.closeCitationBubbleMenu()},C=()=>{g(y),f==null||f.commands.closeCitationBubbleMenu()},_=X.useCallback(()=>{requestAnimationFrame(()=>{f!=null&&f.view&&f.view.dispatch(f.view.state.tr)})},[f]);return f?v.jsx(bh,{editor:f,open:m,...p.bubbleMenuOptions,...l,children:v.jsx("div",{className:u.content,children:v.jsx(_j,{getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onSelectCitations:S,onCancel:C,initialSelectedIds:y,onContentChange:_,canLaunchUrl:s,readOnly:a})})}):null}const wpe=un.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(IN.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(AN.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(DN.configure(this.options.bulletList)),this.options.code!==!1&&t.push(PN.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(NN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(jN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(LN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(FN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push($N.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(gN.configure(this.options.heading)),this.options.history!==!1&&t.push(WN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(qN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(UN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(nj.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(rj.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(oj.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(sj.configure(this.options.strike)),this.options.text!==!1&&t.push(aj.configure(this.options.text)),t}}),Tpe=()=>un.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function _pe(t){const e=vt(),n=X.useRef(null);return v.jsx(mt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:v.jsxs(D.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(Hq,{fontSize:"small"}),v.jsx(D.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const Ej=X.createContext(void 0),Mj=()=>{const t=X.useContext(Ej);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},kpe=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=Mj(),[u,f]=X.useState(String(s)),[p,m]=X.useState([]),y=r.options.citationMaxLength;if(X.useEffect(()=>{if(!l)return;const b=a.filter(C=>s.includes(C.id)),g=b.map(C=>vf.truncate(C.title,{length:y,omission:"..."})).join(", ");f(g),m(b);const S=b.map(C=>C.id);S.length===0?setTimeout(i,0):S.length!==s.length&&setTimeout(()=>o({ids:b.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return v.jsx(x1,{as:"span",...e,"data-testid":"citation-node-component",children:v.jsx(D.Tooltip,{title:v.jsx(D.Box,{className:"citation-tooltip",children:p.map((b,g)=>{var C;const S=[b.source,b.title,b.fileName,b.url,(C=b.accessedAt)==null?void 0:C.slice(0,10),b.classification];return v.jsxs(D.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),g<p.length-1&&v.jsx(D.Divider,{className:"citation-tooltip-divider"})]},b.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:b=>{b.preventDefault(),b.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},Epe=en.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",bt(t)]},addNodeView(){return S1(kpe)},addProseMirrorPlugins(){return[new tn({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}}),Oj=t=>v.jsx(DR,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Mpe=t=>{const{name:e,label:n=Mn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,onCreateCitation:u,onUpdateCitation:f,onDeleteCitation:p,getCitationById:m,onDownloadAttachment:y,onError:b=()=>{},placeholder:g="Start typing here...",notApplicableName:S,errorMode:C="normal",canLaunchUrl:_}=t,T=[wpe,ij.configure({placeholder:g}),Tpe(),Epe.configure({citationMaxLength:a})],[w,E,O]=qt.useField({name:e}),{setValue:N}=O,{value:P}=w,{addUpdateCitation:j,deleteCitation:M,batchUpdate:R}=Mj();X.useEffect(()=>{var q;const L=(q=B==null?void 0:B.current)==null?void 0:q.editor;if(!L)return;L.getHTML()!==P&&setTimeout(()=>{L.commands.setContent(P)},0)},[P]);const B=X.useRef(null),F={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},$=()=>{var q,G;const L=((G=(q=B.current)==null?void 0:q.editor)==null?void 0:G.getHTML())??"",W=!L.replace(/<\/?p>|<br>/g,"").trim();N(W?"":L)},V=v.jsxs(D.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...F[s],children:[v.jsx(QP,{ref:B,extensions:T,content:P,editable:!i,renderControls:i?void 0:()=>v.jsx(xh,{children:v.jsx(_pe,{})}),onBlur:$,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(kj,{getCitationsPaginated:L=>l(L).then(W=>(R(W.data),W)),onCreateCitation:u&&(L=>u(L).then(W=>(j(W),W))),onUpdateCitation:f&&(L=>f(L).then(W=>(j(W),W))),onDeleteCitation:p&&(L=>p(L).then(()=>M(L))),getCitationById:m,onDownloadAttachment:y,onError:b,canLaunchUrl:_,readOnly:i})}),v.jsx(yr,{name:e,id:`${e}-err`,errorMode:C})]});return v.jsxs(D.Box,{display:"flex",flexDirection:"column",width:"100%",children:[v.jsxs(D.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&v.jsx(D.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),S&&v.jsx(Oj,{name:S})]}),V]})},Ope=t=>{const{name:e="submit"}=t;return v.jsx(qr,{name:e,type:"submit",...t})},Rpe=t=>{const{label:e="Return to Top",icon:n=Gd,scrollThresholdPx:r=100}=t,o=D.useScrollTrigger({threshold:r}),i=X.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(D.Zoom,{in:o,children:v.jsx(D.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(D.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Rj=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=ao.useNavigate(),[i,s]=A.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return v.jsxs(v.Fragment,{children:[v.jsx(D.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),v.jsx(D.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>v.jsxs(D.MenuItem,{...Xc(p,o),children:[p.icon&&v.jsx(D.ListItemIcon,{children:p.icon}),v.jsx(D.ListItemText,{primary:p.label})]},p.label))})]})},Ape=()=>{const{values:t,errors:e,status:n}=qt.useFormikContext(),{palette:r}=D.useTheme();return v.jsx(D.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(D.List,{children:[v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(D.Divider,{variant:"inset",component:"li"}),v.jsxs(D.ListItem,{id:"testing",children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(D.ListItem,{children:[v.jsx(D.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(D.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Ipe=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=dj();let s=!r,a=n;o&&(n&&console.warn("Stepper: Ignoring orientation. isResponsive is set to true, so the orientation is determined automatically based on the window size."),a=i<600?"vertical":"horizontal",a=="vertical"?s=!1:s=!r),n=="vertical"&&!r&&(console.warn("Stepper: ignoring inlineLabel={false}. Must use inline labels when orientation is vertical"),s=!1);const l=["steps","inlineLabel","orientation","isResponsive"],u={alternativeLabel:s,orientation:a,...er({...t},l)};return v.jsx(D.Stepper,{...u,children:e.map(f=>v.jsx(D.Step,{children:v.jsx(D.StepLabel,{children:f})},f))})},Dpe=t=>{const{name:e,label:n=Mn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?v.jsx(S8,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:y="None",showDivider:b=!1,removePosition:g="bottom"}=t,[S]=qt.useField({name:e}),{value:C}=S,_=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(D.FormControl,{fullWidth:!0,children:[v.jsx(D.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(D.Typography,{children:y}):v.jsx(qt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,E)=>v.jsx(X.Fragment,{children:v.jsx(Ppe,{variant:l,content:v.jsxs(D.Box,{"data-testid":"form-group-container",sx:typeof g=="string"?_(g):{...g},children:[v.jsxs(D.Box,{width:"100%",children:[i(`${e}.${E}`,E),b&&E!==C.length-1&&v.jsx(D.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(E),children:a})]})})},`${e}-${E}`)),!m&&v.jsx(D.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ppe=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"elevatedCard":return v.jsx(D.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(D.CardContent,{children:e})});case"none":return e}},Npe=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return v.jsx(wu,{actions:[v.jsx(D.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},jpe=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return v.jsx(wu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},Lpe=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return v.jsx(wu,{actions:[v.jsx(D.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(D.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Fpe=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=D.useTheme(),a=ao.useNavigate();return v.jsxs(D.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(D.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),v.jsxs(D.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(D.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>v.jsx(D.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Xc(l,a),children:l.label},l.label))}),n&&v.jsx(D.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},Aj=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=ao.useLocation(),i=ao.useNavigate(),[s,a]=X.useState(!1),l=(m,y)=>v.jsx(D.MenuList,{children:m.map(b=>v.jsxs(D.MenuItem,{...Xc(b,i,()=>a(!1)),children:[b.icon&&v.jsx(D.ListItemIcon,{children:b.icon}),v.jsx(D.ListItemText,{primary:b.label})]},`mobile-drawer-group-${y}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(y=>y&&y.length>0);return m.length===0?null:m.map((y,b)=>v.jsxs(X.Fragment,{children:[l(y,b),b<m.length-1&&v.jsx(D.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(D.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return X.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(D.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(g8,{})}),v.jsx(D.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(D.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(D.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},Ij=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(D.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(D.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},Dj=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(Rj,{label:e,menuOptions:n,icon:v.jsx(b8,{})})},Th=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=D.useTheme(),a=ao.useNavigate();return v.jsx(D.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(D.Tab,{icon:l.icon,label:l.label,value:u,...Xc(l,a),sx:{alignItems:n=="vertical"?"flex-start":void 0,borderBottom:n=="vertical"?"1px solid":void 0,borderColor:"divider","&.Mui-selected":{backgroundColor:n=="vertical"?s.grey[s.mode=="dark"?800:50]:void 0,color:"inherit"}}},l.label))})},Pj=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(D.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Th,{menuOptions:e,activeTabIdx:n,sx:r})})},Nj=t=>{const{onToggle:e}=t,{palette:n}=D.useTheme(),r=n.mode==="dark";return v.jsx(D.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(zR,{}):v.jsx(BR,{})})},$pe=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:y}=t,b=ao.useNavigate(),g=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),{palette:S}=D.useTheme(),{pathname:C}=ao.useLocation(),_=S.mode==="dark",[T,w]=A.useState(void 0);A.useEffect(()=>{const N=o.findIndex(P=>P.path&&C.startsWith(P.path));w(N>=0?N:void 0)},[C,o]);const E=s&&v.jsx(Nj,{onToggle:s}),O=s&&(g||!g&&l)?[{icon:_?v.jsx(zR,{}):v.jsx(BR,{}),label:`Switch to ${_?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(D.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(Ij,{...e}),u,v.jsxs(D.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(D.Button,{disableRipple:!0,component:ao.Link,to:"/",children:r&&typeof r=="string"?v.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),v.jsxs(D.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!g&&E,g&&v.jsx(Aj,{menuOptionLists:[o,a,O],anchor:"right"}),!g&&v.jsxs(v.Fragment,{children:[v.jsx(D.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,P)=>v.jsxs(D.Box,{display:"flex",alignItems:"center",children:[P>0&&v.jsx(D.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(D.Button,{variant:"text",sx:{color:"white"},...Xc(N,b),children:v.jsxs(D.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&v.jsx(Dj,{displayName:l,userMenuOptions:O})]})]})]}),!g&&v.jsx(Pj,{featureMenuOptions:o,activeTabIdx:T,sx:y})]})},Bpe=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=ao.useLocation(),o=D.useMediaQuery(D.useTheme().breakpoints.down("sm")),[i,s]=X.useState(void 0);return X.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&v.jsx(D.Box,{sx:e,children:v.jsx(D.Card,{sx:{height:"100%",width:200},children:v.jsx(Th,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Vpe=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=D.useTheme();return e.length>0&&v.jsx(Th,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},zpe=t=>{const{gap:e=1,...n}=t;return v.jsx(D.Box,{display:"flex",flexDirection:"column",gap:e,...n})},Hpe=t=>v.jsx(Tu,{severity:"info",...t}),Wpe=t=>v.jsx(Tu,{severity:"warning",...t}),jj=t=>{const{crumbInfo:e}=t,n=ao.useNavigate();return v.jsx(D.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(y8,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(D.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(D.Typography,{color:"primary",children:r},r))})},qpe=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=Upe(r);return v.jsx(D.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(Tu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:C2(r),warning:C2(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(D.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Upe=t=>t=="logout"?"info":t=="timeout"?"warning":t,C2=t=>{if(t=="timeout")return v.jsx(Bq,{});if(t=="logout")return v.jsx(m8,{})},Kpe=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return r&&o.toString()==='() => alert("Not implemented yet")'&&console.warn('PageHeader: "showAddButton" is true but "onAdd" is not defined.'),v.jsxs(D.Box,{sx:a,children:[i.length>0&&v.jsx(jj,{crumbInfo:i}),v.jsxs(D.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(D.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:l||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?v.jsx(D.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(qr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(Vq,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(D.Box,{width:l?"100%":"50%",children:s})]})]})},Ype=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=D.useMediaQuery(D.useTheme().breakpoints.down("sm"));return v.jsxs(D.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(D.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),v.jsx(D.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(D.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})};function Gpe({...t}){return v.jsx(Tj,{onSelectCitations:()=>{},onCancel:()=>{},renderAsSelectablePopup:!1,...t})}const Jpe=({children:t,getCitations:e})=>{const[n,r]=X.useState([]),[o,i]=X.useState(!1);X.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(b=>b.id));return[...p.filter(b=>!m.has(b.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=X.useCallback(u=>{r(f=>{const p=f.map(b=>{const g=u.find(S=>S.id===b.id);return g||b}),m=new Set(f.map(b=>b.id)),y=u.filter(b=>!m.has(b.id));return[...p,...y]})},[]),a=X.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=X.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return v.jsx(Ej.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Zpe=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return v.jsx(D.Box,{height:n})};exports.AlertModal=jpe;exports.Autocomplete=IR;exports.Breadcrumbs=jj;exports.Button=qr;exports.Checkbox=DR;exports.CheckboxGroup=bq;exports.CitationField=Mpe;exports.CitationFieldProvider=Jpe;exports.CitationManager=Gpe;exports.Column=zpe;exports.ConfirmationModal=Npe;exports.DarkModeToggle=Nj;exports.DateField=Of;exports.DateRangeField=zQ;exports.DecisionModal=Lpe;exports.Drawer=Aj;exports.DynamicAutocomplete=gq;exports.EnvironmentBanner=Ij;exports.ErrorAlert=Cj;exports.FileList=Sq;exports.FileUpload=PR;exports.FloatingNavBar=Vpe;exports.Footer=Fpe;exports.FormDebugger=Ape;exports.Header=$pe;exports.InfoAlert=Hpe;exports.LoadingButton=B1;exports.LoadingIndicator=Bv;exports.Location=jq;exports.MenuButton=Rj;exports.Modal=wu;exports.MultiAutocomplete=yq;exports.NavBar=Pj;exports.NotApplicableCheckbox=Oj;exports.PageHeader=Kpe;exports.PaginatedTable=uj;exports.ProfileMenu=Dj;exports.RadioGroup=$R;exports.RangeSlider=Lq;exports.RepeatableFormGroup=Dpe;exports.RichTextField=_fe;exports.Row=xj;exports.ScrollToTop=Rpe;exports.SearchField=O8;exports.Select=Fq;exports.SelectableCitationManager=_j;exports.Sidebar=Bpe;exports.SingleActionCard=Ype;exports.Snackbar=qpe;exports.Spacer=Zpe;exports.Stepper=Ipe;exports.Submit=Ope;exports.SuccessAlert=wj;exports.Switch=$q;exports.Table=cj;exports.Tabs=Th;exports.TextField=Ns;exports.ValidationError=yr;exports.WarningAlert=Wpe;exports.commonTheme=Sn;exports.darkTheme=g6;exports.lightTheme=m6;