@simoncomputing/mui-bueno-v2 0.14.9 → 0.14.10

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,12 @@ 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.14.10] - 2025-07-03
15
+
16
+ ### Fixed
17
+
18
+ - `CitationField`: Updated citation tooltip to include URL. NOTE: The URL is readonly (not clickable).
19
+
14
20
  ## [0.14.9] - 2025-07-03
15
21
 
16
22
  ### Added
package/dist/index.cjs.js CHANGED
@@ -399,4 +399,4 @@ img.ProseMirror-separator {
399
399
  3. "-" cannot repeat`);Ht.customSchemes.push([t,e])}function sle(){Ht.scanner=Xae(Ht.customSchemes);for(let t=0;t<Ht.tokenQueue.length;t++)Ht.tokenQueue[t][1]({scanner:Ht.scanner});Ht.parser=tle(Ht.scanner.tokens);for(let t=0;t<Ht.pluginQueue.length;t++)Ht.pluginQueue[t][1]({scanner:Ht.scanner,parser:Ht.parser});return Ht.initialized=!0,Ht}function I1(t){return Ht.initialized||sle(),nle(Ht.parser.start,t,bN(Ht.scanner.start,t))}I1.scan=bN;function xN(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 A1(n),o=I1(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 ale(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function lle(t){return new en({key:new gn("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=fee(n.doc,[...e]);if(bee(a).forEach(({newRange:u})=>{const f=hee(r.doc,u,g=>g.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 g=m.split(" ").filter(C=>C!=="");if(g.length<=0)return!1;const b=g[g.length-1],y=p.pos+m.lastIndexOf(b);if(!b)return!1;const S=I1(b).map(C=>C.toObject(t.defaultProtocol));if(!ale(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:y+C.start+1,to:y+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{Gx(C.from,C.to,r.doc).some(E=>E.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function cle(t){return new en({key:new gn("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=Yx(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 ule(t){return new en({key:new gn("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=xN(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 dle=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function bs(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(dle,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const fle=mr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){GR(t);return}GR(t.scheme,t.optionalSlashes)})},onDestroy(){ile()},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)=>!!bs(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=>!!bs(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=>!!bs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",yt(this.options.HTMLAttributes,t),0]:["a",yt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!bs(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=>!!bs(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[Ki({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=xN(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!bs(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(lle({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!bs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(cle({type:this.type})),this.options.linkOnPaste&&t.push(ule({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),SN=Qt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",yt(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 ple(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=Xee(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,g=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 y=a.pos-b.length,S=Array.from(b.matchAll(g)).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),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!E)return null;const T=y+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 hle=new gn("suggestion");function mle({pluginKey:t=hle,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:g=ple}){let b;const y=p==null?void 0:p(),S=new en({key:t,view(){return{update:async(C,E)=>{var T,w,k,R,_,P,N;const O=(T=this.key)===null||T===void 0?void 0:T.getState(E),A=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),L=O.active&&A.active&&O.range.from!==A.range.from,z=!O.active&&A.active,V=O.active&&!A.active,$=!z&&!V&&O.query!==A.query,F=z||L&&$,W=$||L,U=V||L&&$;if(!F&&!W&&!U)return;const G=U&&!F?O:A,Y=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:Y,clientRect:Y?()=>{var Z;const{decorationId:me}=(Z=this.key)===null||Z===void 0?void 0:Z.getState(e.state),fe=C.dom.querySelector(`[data-decoration-id="${me}"]`);return(fe==null?void 0:fe.getBoundingClientRect())||null}:null},F&&((k=y==null?void 0:y.onBeforeStart)===null||k===void 0||k.call(y,b)),W&&((R=y==null?void 0:y.onBeforeUpdate)===null||R===void 0||R.call(y,b)),(W||F)&&(b.items=await f({editor:e,query:G.query})),U&&((_=y==null?void 0:y.onExit)===null||_===void 0||_.call(y,b)),W&&((P=y==null?void 0:y.onUpdate)===null||P===void 0||P.call(y,b)),F&&((N=y==null?void 0:y.onStart)===null||N===void 0||N.call(y,b))},destroy:()=>{var C;b&&((C=y==null?void 0:y.onExit)===null||C===void 0||C.call(y,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,E,T,w){const{isEditable:k}=e,{composing:R}=e.view,{selection:_}=C,{empty:P,from:N}=_,O={...E};if(O.composing=R,k&&(P||e.view.composing)){(N<E.range.from||N>E.range.to)&&!R&&!E.composing&&(O.active=!1);const A=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:_.$from}),L=`id_${Math.floor(Math.random()*4294967295)}`;A&&m({editor:e,state:w,range:A.range,isActive:E.active})?(O.active=!0,O.decorationId=E.decorationId?E.decorationId:L,O.range=A.range,O.query=A.query,O.text=A.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(C,E){var T;const{active:w,range:k}=S.getState(C.state);return w&&((T=y==null?void 0:y.onKeyDown)===null||T===void 0?void 0:T.call(y,{view:C,event:E,range:k}))||!1},decorations(C){const{active:E,range:T,decorationId:w}=S.getState(C);return E?Zt.create(C.doc,[Ln.inline(T.from,T.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const gle=new gn("mention"),yle=Qt.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",yt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:gle,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",yt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=yt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",yt({"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[mle({editor:this.editor,...this.options.suggestion})]}}),ble="listItem",JR="textStyle",ZR=/^(\d+)\.\s$/,CN=Qt.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",yt(this.options.HTMLAttributes,n),0]:["ol",yt(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(ble,this.editor.getAttributes(JR)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=sl({find:ZR,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=sl({find:ZR,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(JR)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),wN=Qt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),TN=cn.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new en({key:new gn("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&&nh(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=Ln.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}),Zt.create(t,o)}}})]}}),vle=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,xle=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,EN=mr.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",yt(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[Ws({find:vle,type:this.type})]},addPasteRules(){return[Ki({find:xle,type:this.type})]}}),Sle=mr.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",yt(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()}}}),Cle=mr.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",yt(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()}}}),wle=Qt.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",yt(this.options.HTMLAttributes,t),0]}}),Tle=Qt.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",yt(this.options.HTMLAttributes,t),0]}}),Ele=Qt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}}),Mle=/^\s*(\[([( |x])?\])\s$/,kle=Qt.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",yt(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 g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.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[sl({find:Mle,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),Ole=Qt.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",yt(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()}}}),MN=Qt.create({name:"text",group:"inline"}),Rle=cn.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{const e=t.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign?{style:`text-align: ${t.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(n=>e.updateAttributes(n,{textAlign:t})).every(n=>n):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},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")}}}),Ale=mr.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",yt(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()}}}),kN=J.forwardRef((t,e)=>{const[n,r]=J.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return J.useEffect(()=>r(0),[t.items]),J.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?v.jsx(j.Paper,{elevation:5,children:v.jsx(j.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(j.ListItem,{disablePadding:!0,children:v.jsx(j.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});kN.displayName="SuggestionList";const XR={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Ile={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 f_(kN,{props:n,editor:n.editor}),e=mu("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??XR},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))??XR}})},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}}}},Dle=fle.extend({inclusive:!1}),Ple=Sle.extend({excludes:"superscript"}),_le=Cle.extend({excludes:"subscript"});function Nle({placeholder:t}={}){return J.useMemo(()=>[rae.configure({resizable:!0}),Ele,Tle,wle,X_,eN,tN,oN,SN,CN,wN,Ple,_le,MN,Z_,J_,Q_,dN,Ale,EN,Dle.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),Zne,rN,Yie,Rle.configure({types:["heading","paragraph","image"]}),gae,yae,xae,Uie,Aae.configure({multicolor:!0}),uN,tse,nN,Ole,kle.configure({nested:!0}),yle.configure({suggestion:Ile}),TN.configure({placeholder:t}),cN],[t])}function QR(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Lle=t=>{const e=Nle({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(Toe,{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]=Wt.useField({name:n}),{setValue:f}=u,{value:p}=a;J.useEffect(()=>{var C,E,T;(T=(E=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:E.commands)==null||T.setContent(p)},[p]);const m=J.useRef(null),g=J.useCallback((C,E)=>{var w;const T=(w=m.current)==null?void 0:w.editor;if(T)if(i instanceof Promise)i(C).then(k=>{g0({images:k,editor:T,position:E})});else{const k=i(C);g0({images:k,editor:T,position:E})}},[]),b=J.useCallback((C,E,T,w)=>{var R;if(!(E instanceof DragEvent)||!E.dataTransfer)return!1;const k=QR(E.dataTransfer.files);if(k.length>0){const _=(R=C.posAtCoords({left:E.clientX,top:E.clientY}))==null?void 0:R.pos;return g(k,_),E.preventDefault(),!0}return!1},[g]),y=J.useCallback((C,E,T)=>{if(!E.clipboardData)return!1;const w=QR(E.clipboardData.files);return w.length>0?(g(w),!0):!1},[g]),S=v.jsx(j.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(b_,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:b,handlePaste:y},renderControls:s?void 0:()=>v.jsx(oae,{onUploadFiles:i}),onBlur:()=>{var C,E;return f(((E=(C=m.current)==null?void 0:C.editor)==null?void 0:E.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(JP,{}),v.jsx(v_,{})]})})});return v.jsxs(j.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(j.Typography,{...o,children:r}),S]})},I0=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(j.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(j.Box,{className:"text-content",children:[v.jsx(j.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(j.Typography,{"data-testid":"message",children:n})]}),v.jsx(j.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},eA=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1}=t,[s,a]=J.useState(!1),[l,u]=J.useState(void 0);return J.useEffect(()=>{n&&!s&&(a(!0),u(r(o)))},[n]),i?v.jsx(j.Box,{children:v.jsx(j.Collapse,{in:n,children:l})}):v.jsx(j.TableRow,{children:v.jsx(j.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(j.Collapse,{in:n,children:l})})})},ON=t=>{const{id:e,getRowKey:n=K=>"id"in K&&(typeof K.id=="string"||typeof K.id=="number")?K.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(K)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(K)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:m=!1,className:g,emptyTableMsg:b="No items to display",errorTableMsg:y,retryCallback:S,isLoading:C=!1,disableMobileCards:E=!1,highlightSelectedRow:T=!1,headerRowStyle:w={},stickyHeader:k,...R}=t,{palette:_}=j.useTheme(),[P,N]=J.useState(void 0),[O,A]=J.useState(void 0);Array.isArray(m)&&m.length!==r.length&&console.error('Table component: Length of "fixedLayout" is not equal to the length of "columns".');const L=K=>{K!==l?f&&f(K,"asc"):f&&f(l,u==="asc"?"desc":"asc")},z=K=>l===K?u:null,V=j.useMediaQuery(j.useTheme().breakpoints.down("sm")),$=V&&a?r.filter(K=>!a.includes(K.fieldName)):r,F=(K,Q)=>Q.split(".").reduce((ie,he)=>{if(ie&&typeof ie=="object")return ie[he]},K),W=(K,Q)=>{const ie=F(Q,K.fieldName);return K.render?K.render(ie,Q,V):ie},U=f!==void 0,G=K=>U?p?p.includes(K):!0:!1,Y=v.jsxs(j.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(E6,{})," ",b]}),Z=v.jsxs(j.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(ZA,{color:"error"})," ",y,S&&v.jsx(j.Button,{variant:"text",onClick:S,children:"Retry?"})]}),me=()=>{if(C)return v.jsx(j.TableRow,{children:v.jsx(j.TableCell,{colSpan:r.length,align:"center",children:v.jsx(j.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(I0,{})})})});if(y)return v.jsx(j.TableRow,{children:v.jsx(j.TableCell,{colSpan:r.length,align:"center",children:Z})});if(o.length===0)return v.jsx(j.TableRow,{children:v.jsx(j.TableCell,{colSpan:r.length,align:"center",children:Y})})},fe=()=>{if(C)return v.jsx(I0,{});if(y)return Z;if(o.length===0)return Y},pe=K=>{T&&A(K)},re=K=>{if(i&&(i(K),pe(K)),s){const Q=P===K?void 0:K;N(Q),pe(Q)}},ue=typeof T=="string"?T:_.grey[_.mode=="dark"?600:50],ae=K=>{const Q=O===n(K)?ue:"inherit";return{cursor:i||s?"pointer":"default",backgroundColor:Q,...i&&{"&:hover":{backgroundColor:Q===ue?Ya(Q,.1):ue}}}};return V&&!E?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:g,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(j.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(j.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:K=>L(K.target.value),fullWidth:!0,children:$.map(K=>{if(G(K.fieldName))return v.jsx(j.MenuItem,{value:K.sortName??K.fieldName,children:K.label??Mn(K.fieldName)},`${K.key??"rowHeader"}-${K.fieldName}`)})}),v.jsx(j.IconButton,{onClick:()=>{l&&L(l)},children:v.jsx(N6,{className:`sort-icon-${u}`})})]}),v.jsx(j.Divider,{sx:{margin:"10px 0"}})]}),fe()??o.map(K=>v.jsxs(j.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",...ae(K)},onClick:()=>re(n(K)),"data-testid":`card-${n(K)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:$.map(Q=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsx("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Q.fieldName}`,children:Q.label??Mn(Q.fieldName)}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Q.fieldName}`,style:{paddingLeft:"10px"},children:W(Q,K)})]},`${Q.key??"row"}-${n(K)}-${Q.fieldName}`))})}),s&&v.jsx(eA,{colSpan:r.length,isExpanded:n(K)===P,obj:K,renderExpand:Q=>s(Q),asMobileCard:!0})]},n(K)))]}):v.jsx(j.TableContainer,{component:j.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:k?{maxHeight:k,overflow:"auto"}:{},children:v.jsxs(j.Table,{stickyHeader:k!=="undefined",style:{tableLayout:m?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...R,children:[v.jsx(j.TableHead,{className:"MBv2_Table_Head",children:v.jsx(j.TableRow,{className:"MBv2_Table_Head_Row",children:$.map((K,Q)=>{const ie=G(K.fieldName);return v.jsx(j.TableCell,{width:Array.isArray(m)?m[Q]:"auto",children:v.jsx(j.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(j.Box,{sx:[ie&&{"&:hover":{cursor:"pointer",backgroundColor:_.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:ie?()=>L(K.sortName??K.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:K.label??Mn(K.fieldName)}),ie&&z(K.fieldName)==="asc"&&v.jsx(sI,{style:{marginLeft:"5px"}}),ie&&z(K.fieldName)==="desc"&&v.jsx(M6,{style:{marginLeft:"5px"}}),ie&&z(K.fieldName)!=="asc"&&z(K.fieldName)!=="desc"&&v.jsx(D6,{style:{marginLeft:"5px"}})]})})},`${K.key??"rowHeader"}-${K.fieldName}`)})})}),v.jsx(j.TableBody,{className:"MBv2_Table_Body",children:me()??o.map(K=>v.jsxs(J.Fragment,{children:[v.jsx(j.TableRow,{"data-testid":`row-${n(K)}`,className:"MBv2_Table_Body_Row",onClick:()=>re(n(K)),sx:ae(K),children:$.map(Q=>v.jsx(j.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Q.fieldName}`,children:W(Q,K)},`${Q.key??"row"}-${n(K)}-${Q.fieldName}`))}),s&&v.jsx(eA,{colSpan:r.length,isExpanded:n(K)===P,obj:K,renderExpand:Q=>s(Q)})]},n(K)))})]})})},RN=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)},g=S=>{r(parseInt(S.target.value,10))},b=j.useMediaQuery(j.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return v.jsxs(j.Box,{children:[v.jsx(ON,{sortOrder:p,sortField:f,...s}),!o&&!y&&v.jsx(j.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:b?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>m(C),onRowsPerPageChange:g,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},jle=t=>{const{onCancel:e,onNewCitation:n,onNewAttachment:r,onEditCitation:o,onEditAttachment:i,onSelect:s,fetchExistingCitations:a,selectedIds:l,toggleCheckbox:u,onError:f=()=>{}}=t,[p,m]=J.useState([]),[g,b]=J.useState(!1),[y,S]=J.useState(!0),[C,E]=J.useState({pageNo:0,pageSize:5,totalCount:0}),T=()=>{b(!1),S(!0),a({pageNo:C.pageNo,pageSize:C.pageSize}).then(w=>{m(w.data),E({...C,totalCount:w.totalCount})}).catch(w=>{f(w),b(!0),m([])}).finally(()=>S(!1))};return J.useEffect(()=>{T()},[C.pageNo,C.pageSize]),v.jsxs(v.Fragment,{children:[v.jsx(RN,{"data-testid":"citation-table",size:"x-small",isLoading:y,columns:[{fieldName:"id",key:"select",label:"",render:(w,k)=>v.jsx(j.Checkbox,{"data-testid":`citation-table_checkbox-${w}`,onChange:()=>u(k),checked:l.includes(w)})},{fieldName:"title"},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:w=>w?"Attachment":"Citation"},{fieldName:"id",key:"Action",label:"Action",render:(w,k)=>v.jsx(j.IconButton,{color:"primary",onClick:()=>k.fileName?i(k):o(k),"data-testid":`citation-table_edit-btn-${w}`,children:v.jsx(a6,{})})}],data:p,paginationState:C,onPageChange:w=>E({...C,pageNo:w}),onRowsPerPageChange:w=>E({...C,pageSize:w,pageNo:0}),fixedLayout:["60px","auto","auto","120px"],errorTableMsg:g?"Failed to load citations.":void 0,retryCallback:T}),v.jsxs(j.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsxs(j.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(j.Button,{variant:"outlined",size:"small",onClick:n,startIcon:v.jsx(H0,{}),children:"Add Citation"}),v.jsx(j.Button,{variant:"outlined",size:"small",onClick:r,startIcon:v.jsx(e6,{}),children:"Add Attachment"})]}),v.jsxs(j.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(j.Button,{variant:"outlined",size:"small",onClick:e,children:"Cancel"}),v.jsxs(j.Button,{variant:"contained",size:"small",onClick:()=>s(l),children:["Select",l.length>0&&` (${l.length})`]})]})]})]})},tA=()=>({height:window.innerHeight,width:window.innerWidth}),AN=()=>{const[t,e]=J.useState(tA());return J.useEffect(()=>{const n=()=>{e(tA())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},D1=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=AN(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(j.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...Xn({...t},a)})},IN=t=>{const{name:e="submit"}=t;return v.jsx(D1,{name:e,type:"submit",...t})},$le=t=>{const{id:e,onSave:n,onCancel:r,getCitationById:o,setError:i}=t,s=J.useRef(null),[a,l]=J.useState(!0),[u,f]=J.useState({source:"",title:"",accessedAt:null,url:"",classification:""});J.useEffect(()=>{if(e===void 0){l(!1);return}o(e).then(m=>{f(m),l(!1)}).catch(m=>{l(!1),i({title:"Failed to retrieve citation",err:m})})},[]);const p=()=>{var g,b,y;const m=(b=(g=s==null?void 0:s.current)==null?void 0:g.values)==null?void 0:b.url;m&&((y=s==null?void 0:s.current)==null||y.setFieldValue("url",YP(m)))};return v.jsx(Wt.Formik,{innerRef:s,enableReinitialize:!0,initialValues:u,onSubmit:async m=>{l(!0),n(m).catch(g=>{l(!1),i({title:`Failed to ${e===void 0?"save":"update"} citation`,err:g})}).finally(()=>l(!1))},children:v.jsxs(Wt.Form,{autoComplete:"off",children:[v.jsx(Fa,{name:"source",disabled:a,required:!0,margin:"none"}),v.jsx(Fa,{name:"title",disabled:a,required:!0,margin:"none"}),v.jsx(Sf,{name:"accessedAt",disabled:a,required:!0,margin:"none",isDatePicker:!0}),v.jsx(Fa,{name:"url",disabled:a,required:!0,onBlur:p,margin:"none"}),v.jsx(oI,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source"},{label:"Proprietary Source",value:"Proprietary Source"}],margin:"none"}),v.jsxs(j.DialogActions,{sx:{px:0},children:[v.jsx(j.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(IN,{color:"primary",variant:"contained",size:"small",disabled:a,children:e?"Update Citation":"Add New Citation"})]})]})})};var Tv,nA;function Fle(){if(nA)return Tv;nA=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,E){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=E};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);Tv={Cache:t,split:p,normalizePath:f,setter:function(C){var E=f(C);return l.get(C)||l.set(C,function(w,k){for(var R=0,_=E.length,P=w;R<_-1;){var N=E[R];if(N==="__proto__"||N==="constructor"||N==="prototype")return w;P=P[E[R++]]}P[E[R]]=k})},getter:function(C,E){var T=f(C);return u.get(C)||u.set(C,function(k){for(var R=0,_=T.length;R<_;)if(k!=null||!E)k=k[T[R++]];else return;return k})},join:function(C){return C.reduce(function(E,T){return E+(g(T)||n.test(T)?"["+T+"]":(E?".":"")+T)},"")},forEach:function(C,E,T){m(Array.isArray(C)?C:p(C),E,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(E){return E.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,E,T){var w=C.length,k,R,_,P;for(R=0;R<w;R++)k=C[R],k&&(S(k)&&(k='"'+k+'"'),P=g(k),_=!P&&/^\d+$/.test(k),E.call(T,k,P,_,R,C))}function g(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function b(C){return C.match(r)&&!C.match(n)}function y(C){return o.test(C)}function S(C){return!g(C)&&(b(C)||y(C))}return Tv}var js=Fle(),Ev,rA;function Ble(){if(rA)return Ev;rA=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 Ev={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(" ")},Ev}var Mv=Ble(),$d={exports:{}},oA;function Vle(){if(oA)return $d.exports;oA=1,$d.exports=function(o){return t(e(o),o)},$d.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(g){if(!p.has(g[0])||!p.has(g[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(g,b,y){if(y.has(g)){var S;try{S=", node was:"+JSON.stringify(g)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(g))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(g));if(!l[b]){l[b]=!0;var C=f.get(g)||new Set;if(C=Array.from(C),b=C.length){y.add(g);do{var E=C[--b];m(E,p.get(E),y)}while(b);y.delete(g)}a[--s]=g}}}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 $d.exports}var zle=Vle();const Hle=rr(zle),Wle=Object.prototype.toString,qle=Error.prototype.toString,Ule=RegExp.prototype.toString,Kle=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",Yle=/^Symbol\((.*)\)(.*)$/;function Gle(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function iA(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return Gle(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return Kle.call(t).replace(Yle,"Symbol($1)");const r=Wle.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+qle.call(t)+"]":r==="RegExp"?Ule.call(t):null}function Hi(t,e){let n=iA(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=iA(this[r],e);return i!==null?i:o},2)}function DN(t){return t==null?[]:[].concat(t)}let PN,_N,NN,Jle=/\$\{\s*(\w+)\s*\}/g;PN=Symbol.toStringTag;class sA{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[PN]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],DN(e).forEach(i=>{if(dr.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]}}_N=Symbol.hasInstance;NN=Symbol.toStringTag;class dr 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(Jle,(o,i)=>Hi(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 sA(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[NN]="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,dr)}static[_N](e){return sA[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Co={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 \`${Hi(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Hi(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Hi(n,!0)}\``+o}},cr={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"},Zle={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"},D0={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Xle={isValue:"${path} field must be ${value}"},af={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"},Qle={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"},ece={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: \`${Hi(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: \`${Hi(n,!0)}\``}return dr.formatError(Co.notType,t)}};Object.assign(Object.create(null),{mixed:Co,string:cr,number:Zle,date:D0,object:af,array:Qle,boolean:Xle,tuple:ece});const P1=t=>t&&t.__isYupSchema__;class dp{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 dp(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(!P1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const Fd={context:"$",value:"."};class Xs{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]===Fd.context,this.isValue=this.key[0]===Fd.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?Fd.context:this.isValue?Fd.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&js.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}}Xs.prototype.__isYupRef=!0;const As=t=>t==null;function Oa(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:g}=t;let{parent:b,context:y,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function E(A){return Xs.isRef(A)?A.getValue(n,b,y):A}function T(A={}){const L=Object.assign({value:n,originalValue:i,label:s.spec.label,path:A.path||r,spec:s.spec,disableStackTrace:A.disableStackTrace||C},p,A.params);for(const V of Object.keys(L))L[V]=E(L[V]);const z=new dr(dr.formatError(A.message||m,L),n,L.path,A.type||u,L.disableStackTrace);return z.params=L,z}const w=S?a:l;let k={path:r,parent:b,type:u,from:o.from,createError:T,resolve:E,options:o,originalValue:i,schema:s};const R=A=>{dr.isError(A)?w(A):A?l(null):w(T())},_=A=>{dr.isError(A)?w(A):a(A)};if(g&&As(n))return R(!0);let N;try{var O;if(N=f.call(k,n,k),typeof((O=N)==null?void 0:O.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${k.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(N).then(R,_)}}catch(A){_(A);return}R(N)}return e.OPTIONS=t,e}function tce(t,e,n,r=n){let o,i,s;return e?(js.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 fp extends Set{describe(){const e=[];for(const n of this.values())e.push(Xs.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 fp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function ja(t,e=new Map){if(P1(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]=ja(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,ja(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(ja(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=ja(o,e)}else throw Error(`Unable to clone ${t}`);return n}class Po{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 fp,this._blacklist=new fp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Co.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=ja(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&&As(i))return i;let s=Hi(e),a=Hi(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=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,g=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const S=i[y];S(b,f,function(E){E&&(Array.isArray(E)?g.push(...E):g.push(E)),--m<=0&&p(g)})}}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,g)=>this.resolve(f)._validate(u,f,m,g)}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)=>{dr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new dr(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 dr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new dr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(dr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(dr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):ja(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=Oa({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=Oa({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Co.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Co.notNull){return this.nullability(!1,e)}required(e=Co.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=Co.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Oa(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=DN(e).map(i=>new Xs(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new dp(o,n):dp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Oa({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=Co.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Oa({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=Co.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Oa({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)}}}Po.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])Po.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=tce(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])Po.prototype[t]=Po.prototype.oneOf;for(const t of["not","nope"])Po.prototype[t]=Po.prototype.notOneOf;const nce=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function rce(t){const e=P0(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 P0(t){var e,n;const r=nce.exec(t);return r?{year:Zo(r[1]),month:Zo(r[2],1)-1,day:Zo(r[3],1),hour:Zo(r[4]),minute:Zo(r[5]),second:Zo(r[6]),millisecond:r[7]?Zo(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:Zo(r[10]),minuteOffset:Zo(r[11])}:null}function Zo(t,e=0){return Number(t)||e}let oce=/^[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])?)*$/,ice=/^((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,sce=/^(?:[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,ace="^\\d{4}-\\d{2}-\\d{2}",lce="\\d{2}:\\d{2}:\\d{2}",cce="(([+-]\\d{2}(:?\\d{2})?)|Z)",uce=new RegExp(`${ace}T${lce}(\\.\\d+)?${cce}$`),dce=t=>As(t)||t===t.trim(),fce={}.toString();function _0(){return new LN}class LN extends Po{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===fce?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Co.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=cr.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=cr.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=cr.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||cr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=cr.email){return this.matches(oce,{name:"email",message:e,excludeEmptyString:!0})}url(e=cr.url){return this.matches(ice,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=cr.uuid){return this.matches(sce,{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(uce,{name:"datetime",message:n||cr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||cr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=P0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||cr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=P0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=cr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:dce})}lowercase(e=cr.lowercase){return this.transform(n=>As(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>As(n)||n===n.toLowerCase()})}uppercase(e=cr.uppercase){return this.transform(n=>As(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>As(n)||n===n.toUpperCase()})}}_0.prototype=LN.prototype;let pce=new Date(""),hce=t=>Object.prototype.toString.call(t)==="[object Date]";class mh extends Po{constructor(){super({type:"date",check(e){return hce(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=rce(e),isNaN(e)?mh.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Xs.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=D0.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=D0.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)}})}}mh.INVALID_DATE=pce;mh.prototype;function mce(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=js.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),Xs.isRef(a)&&a.isSibling?i(a.path,s):P1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Hle.array(Array.from(r),n).reverse()}function aA(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 jN(t){return(e,n)=>aA(t,e)-aA(t,n)}const gce=(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 lf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=lf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=lf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(lf)}):"optional"in t?t.optional():t}const yce=(t,e)=>{const n=[...js.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=js.getter(js.join(n),!0)(t);return!!(o&&r in o)};let lA=t=>Object.prototype.toString.call(t)==="[object Object]";function cA(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const bce=jN([]);function $N(t){return new FN(t)}class FN extends Po{constructor(e){super({type:"object",check(n){return lA(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=bce,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],g=p in o;if(m){let b,y=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:y,context:n.context,parent:l});let S=m instanceof Po?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 g&&!s&&(l[p]=o[p]);(g!==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||!lA(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Xs.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=mce(e,n),r._sortErrors=jN(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 lf(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=js.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return yce(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(gce)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||af.exact,test(n){if(n==null)return!0;const r=cA(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=af.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=cA(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=af.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(Mv.camelCase)}snakeCase(){return this.transformKeys(Mv.snakeCase)}constantCase(){return this.transformKeys(e=>Mv.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}}$N.prototype=FN.prototype;const vce=t=>{const{id:e,onSave:n,onCancel:r,getCitationById:o,disableFileUpload:i=!1,setError:s}=t,a=J.useRef(null),[l,u]=J.useState(!0),[f,p]=J.useState({title:"",file:void 0,fileName:""});return J.useEffect(()=>{if(e===void 0){u(!1);return}o(e).then(m=>{p({...m,file:void 0}),u(!1)}).catch(m=>{u(!1),s({title:"Failed to retrieve attachment",err:m})})},[]),v.jsx(Wt.Formik,{innerRef:a,enableReinitialize:!0,initialValues:f,validationSchema:$N().shape({title:_0().required("Title is required"),fileName:_0().required("A file is required")}),onSubmit:async m=>{u(!0),n(m).catch(g=>{u(!1),s({title:`Failed to ${e===void 0?"save":"update"} attachment`,err:g})}).finally(()=>u(!1))},children:({values:m,setFieldValue:g})=>{var b;return J.useEffect(()=>{var y,S;(y=m.file)!=null&&y.name&&g("fileName",(S=m.file)==null?void 0:S.name)},[(b=m.file)==null?void 0:b.name]),v.jsxs(Wt.Form,{autoComplete:"off",children:[v.jsx(Fa,{name:"title",disabled:l,required:!0,margin:"none"}),v.jsxs(j.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(QA,{name:"file",readOnly:i}),m.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:m.fileName}),v.jsx(Qn,{name:"fileName",id:"fileName-err"})]}),v.jsxs(j.DialogActions,{sx:{px:0},children:[v.jsx(j.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(j.Button,{type:"submit",color:"primary",variant:"contained",size:"small",disabled:l,children:e?"Update Attachment":"Add New Attachment"})]})]})}})};function xce(t){return Ke("MuiAlert",t)}const uA=He("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),Sce=Fe(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"),Cce=Fe(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),wce=Fe(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"),Tce=Fe(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"),Ece=Fe(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"),Mce=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 Ue(i,xce,o)},kce=ye(ul,{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"?Ya:Ec,n=t.palette.mode==="light"?Ec:Ya;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Vn(["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),[`& .${uA.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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}`,[`& .${uA.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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)}}}))]}})),Oce=ye("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Rce=ye("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),Ace=ye("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),dA={success:v.jsx(Sce,{fontSize:"inherit"}),warning:v.jsx(Cce,{fontSize:"inherit"}),error:v.jsx(wce,{fontSize:"inherit"}),info:v.jsx(Tce,{fontSize:"inherit"})},BN=D.forwardRef(function(e,n){const r=xt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=dA,onClose:g,role:b="alert",severity:y="success",slotProps:S={},slots:C={},variant:E="standard",...T}=r,w={...r,color:l,severity:y,variant:E,colorSeverity:l||y},k=Mce(w),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[_,P]=Ft("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(k.root,s),elementType:kce,externalForwardedProps:{...R,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[N,O]=Ft("icon",{className:k.icon,elementType:Oce,externalForwardedProps:R,ownerState:w}),[A,L]=Ft("message",{className:k.message,elementType:Rce,externalForwardedProps:R,ownerState:w}),[z,V]=Ft("action",{className:k.action,elementType:Ace,externalForwardedProps:R,ownerState:w}),[$,F]=Ft("closeButton",{elementType:dl,externalForwardedProps:R,ownerState:w}),[W,U]=Ft("closeIcon",{elementType:Ece,externalForwardedProps:R,ownerState:w});return v.jsxs(_,{...P,children:[p!==!1?v.jsx(N,{...O,children:p||m[y]||dA[y]}):null,v.jsx(A,{...L,children:i}),o!=null?v.jsx(z,{...V,children:o}):null,o==null&&g?v.jsx(z,{...V,children:v.jsx($,{size:"small","aria-label":a,title:a,color:"inherit",onClick:g,...F,children:v.jsx(W,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(BN.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 bu=t=>{var g;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=j.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(g=l[r])==null?void 0:g.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(BN,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(j.Typography,{variant:"h3",children:s}),n]})},VN=t=>v.jsx(bu,{severity:"error",...t});function zN({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:i,onCancel:s,initialSelectedIds:a=[],onContentUpdate:l,onError:u=()=>{}}){const[f,p]=J.useState("Insert Citation/Attachment(s)"),[m,g]=J.useState(a),[b,y]=J.useState(void 0),[S,C]=J.useState(void 0);J.useEffect(()=>l==null?void 0:l(),[f,m]),J.useEffect(()=>C(void 0),[f]),J.useEffect(()=>{S&&u(S.err)},[S]);const E=async k=>{if(f==="Edit Citation"){if(k.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(k).then(()=>p("Insert Citation/Attachment(s)")).catch(R=>C({title:"Failed to update citation",err:R}))}else f==="Add Citation"&&await e(k).then(R=>{g([...m,R.id]),p("Insert Citation/Attachment(s)")}).catch(R=>C({title:"Failed to create citation",err:R}))},T=async k=>{if(f==="Edit Attachment"){if(k.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(k).then(()=>p("Insert Citation/Attachment(s)")).catch(R=>C({title:"Failed to update attachment",err:R}))}else f==="Add Attachment"&&await o(k).then(R=>{g([...m,R.id]),p("Insert Citation/Attachment(s)")}).catch(R=>C({title:"Failed to upload attachment",err:R}))};let w=null;return f==="Insert Citation/Attachment(s)"?w=v.jsx(jle,{fetchExistingCitations:t,onCancel:s,onNewCitation:()=>{y(void 0),p("Add Citation")},onNewAttachment:()=>{y(void 0),p("Add Attachment")},onEditCitation:k=>{y(k.id),p("Edit Citation")},onEditAttachment:k=>{y(k.id),p("Edit Attachment")},onSelect:i,selectedIds:m,toggleCheckbox:k=>{const R=m.includes(k.id);g(R?m.filter(_=>_!==k.id):[...m,k.id])},onError:u}):f==="Add Citation"||f==="Edit Citation"?w=v.jsx($le,{id:b,onSave:E,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,setError:C}):(f==="Add Attachment"||f==="Edit Attachment")&&(w=v.jsx(vce,{id:b,onSave:T,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,disableFileUpload:f==="Edit Attachment",setError:C})),v.jsxs(j.Box,{width:"500px",children:[v.jsx(j.Typography,{variant:"h6",children:f}),S&&v.jsx(VN,{"data-testid":"citation-menu-error",onClose:()=>C(void 0),children:S.title}),v.jsx(j.Box,{paddingTop:"8px",children:w})]})}const Ice=Kt({name:{CitationBubbleMenuTipTap:HN}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function HN({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,...i}){const{classes:s}=Ice(),a=bt();if(!(a!=null&&a.isEditable))return null;if(!("citationBubbleMenuHandler"in a.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const l=a.storage.citationBubbleMenuHandler,u=l.isOpen,f=l.selectedIds,p=l.selectedNodePos,m=()=>{!a||!p||a.chain().focus().deleteRange({from:p,to:p+1}).run()},g=E=>{a&&a.chain().focus().insertContent({type:"citation",attrs:{ids:E}}).run()},b=E=>{!a||!p||a.chain().focus().command(({tr:T})=>{const w=p,k=T.doc.nodeAt(w);return k?(T.setNodeMarkup(w,void 0,{...k.attrs,ids:E}),!0):!1}).run()},y=E=>{E.length===0?m():f.length===0?g(E):b(E)},S=E=>{y(E),a.commands.closeCitationBubbleMenu()},C=()=>{y(f),a.commands.closeCitationBubbleMenu()};return v.jsx(ch,{editor:a,open:u,...l.bubbleMenuOptions,...i,children:v.jsx("div",{className:s.content,children:v.jsx(zN,{fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:S,onCancel:C,initialSelectedIds:f,onContentUpdate:()=>{requestAnimationFrame(()=>{a!=null&&a.view&&a.view.dispatch(a.view.state.tr)})}})})})}const Dce=cn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(Z_.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(J_.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(X_.configure(this.options.bulletList)),this.options.code!==!1&&t.push(Q_.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(eN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(tN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(nN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(rN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(oN.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(N_.configure(this.options.heading)),this.options.history!==!1&&t.push(cN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(uN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(dN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(SN.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(CN.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(wN.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(EN.configure(this.options.strike)),this.options.text!==!1&&t.push(MN.configure(this.options.text)),t}}),Pce=()=>cn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:void 0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=e!==void 0?o.nodeAt(e):void 0,s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return n.getAttributes,r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=void 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 _ce(t){const e=bt(),n=J.useRef(null);return v.jsx(ht,{buttonRef:n,tooltipLabel:"Insert Citation",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(j.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(t6,{fontSize:"small"}),v.jsx(j.Typography,{variant:"body2",children:"Insert Citation"})]})})}const WN=J.createContext(void 0),qN=()=>{const t=J.useContext(WN);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Nce=({node:t,HTMLAttributes:e,selected:n,extension:r})=>{const o=t.attrs.ids||[],{citations:i}=qN(),[s,a]=J.useState(String(o)),[l,u]=J.useState([]),f=r.options.citationMaxLength;return J.useEffect(()=>{const p=i.filter(g=>o.includes(g.id)),m=p.map(g=>ff.truncate(g.title,{length:f,omission:"..."})).join(", ");a(m),u(p)},[i,o]),v.jsx(f1,{as:"span",...e,children:v.jsx(j.Tooltip,{title:v.jsx(j.Box,{className:"citation-tooltip",children:l.map((p,m)=>{var b;const g=[p.source,p.title,p.fileName,(b=p.accessedAt)==null?void 0:b.slice(0,10),p.classification];return v.jsxs(j.Typography,{variant:"subtitle2",children:[g.filter(Boolean).join(" | "),m<l.length-1&&v.jsx(j.Divider,{className:"citation-tooltip-divider"})]},p.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:p=>{p.preventDefault(),p.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:s})})})},Lce=Qt.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",yt(t)]},addNodeView(){return p1(Nce)},addProseMirrorPlugins(){return[new en({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]}}),jce=t=>{const{name:e,label:n=Mn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,fetchExistingCitations:l,onCreateCitation:u,onUpdateCitation:f,getCitationById:p,onStoreAttachment:m,onError:g=()=>{}}=t,b=[Dce,TN.configure({placeholder:"Start typing here..."}),Pce(),Lce.configure({citationMaxLength:a})],[y,S,C]=Wt.useField({name:e}),{setValue:E}=C,{value:T}=y,{resync:w,addUpdateCitation:k}=qN();J.useEffect(()=>{var O,A;T!==((A=(O=R==null?void 0:R.current)==null?void 0:O.editor)==null?void 0:A.getHTML())&&setTimeout(()=>{var L,z,V;(V=(z=(L=R==null?void 0:R.current)==null?void 0:L.editor)==null?void 0:z.commands)==null||V.setContent(T),w()},0)},[T]),J.useEffect(()=>{T&&setTimeout(()=>{var O,A,L;(L=(A=(O=R==null?void 0:R.current)==null?void 0:O.editor)==null?void 0:A.commands)==null||L.setContent(T),w()},0)},[]);const R=J.useRef(null),_={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},P=()=>{var L,z;const O=((z=(L=R.current)==null?void 0:L.editor)==null?void 0:z.getHTML())??"<p></p>",A=!O.replace(/<\/?p>|<br>/g,"").trim();E(A?"<p></p>":O)},N=v.jsxs(j.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},..._[s],children:[v.jsx(b_,{ref:R,extensions:b,content:T,editable:!i,renderControls:i?void 0:()=>v.jsx(dh,{children:v.jsx(_ce,{})}),onBlur:P,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(HN,{fetchExistingCitations:l,onCreateCitation:O=>u(O).then(A=>(k(A),A)),onUpdateCitation:O=>f(O).then(A=>(k(A),A)),getCitationById:p,onStoreAttachment:m,onError:g})}),v.jsx(Qn,{name:e,id:`${e}-err`})]});return v.jsxs(j.Box,{display:"flex",flexDirection:"column",width:"100%",children:[!r&&v.jsx(j.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),N]})},$ce=t=>{const{label:e="Return to Top",icon:n=sI,scrollThresholdPx:r=100}=t,o=j.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(j.Zoom,{in:o,children:v.jsx(j.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(j.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Fce=()=>{const{values:t,errors:e,status:n}=Wt.useFormikContext(),{palette:r}=j.useTheme();return v.jsx(j.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(j.List,{children:[v.jsxs(j.ListItem,{children:[v.jsx(j.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(j.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(j.Divider,{variant:"inset",component:"li"}),v.jsxs(j.ListItem,{id:"testing",children:[v.jsx(j.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(j.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(j.ListItem,{children:[v.jsx(j.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(j.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Bce=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=AN();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,...Xn({...t},l)};return v.jsx(j.Stepper,{...u,children:e.map(f=>v.jsx(j.Step,{children:v.jsx(j.StepLabel,{children:f})},f))})},Vce=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(P6,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:g="None",showDivider:b=!1,removePosition:y="bottom"}=t,[S]=Wt.useField({name:e}),{value:C}=S,E=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(j.FormControl,{fullWidth:!0,children:[v.jsx(j.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(j.Typography,{children:g}):v.jsx(Wt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,k)=>v.jsx(J.Fragment,{children:v.jsx(zce,{variant:l,content:v.jsxs(j.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?E(y):{...y},children:[v.jsxs(j.Box,{width:"100%",children:[i(`${e}.${k}`,k),b&&k!==C.length-1&&v.jsx(j.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(j.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(k),children:a})]})})},`${e}-${k}`)),!m&&v.jsx(j.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},zce=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(j.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(j.CardContent,{children:e})});case"elevatedCard":return v.jsx(j.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(j.CardContent,{children:e})});case"none":return e}},_1=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s="Cancel",closeButtonPosition:a="bottom",closeButtonProps:l={color:"primary",variant:"text"},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=()=>{if(a!=="top")return v.jsx(j.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},m=()=>i?v.jsx(j.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(j.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(j.Box,{children:p()}),v.jsxs(j.Box,{display:"flex",gap:".25rem",children:[...i]})]})}):v.jsx(j.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(j.Box,{children:p()})});return v.jsxs(j.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(j.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(j.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,a!=="bottom"&&v.jsx(j.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(o6,{})})]})}):r,o&&(typeof o=="string"?v.jsx(j.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(j.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),m()]})},Hce=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeButtonProps:o={},...i}=t;return v.jsx(_1,{actions:[v.jsx(j.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],...i})},Wce=t=>{const{closeBtnLabel:e="OK",closeButtonProps:n={color:"primary",variant:"contained"}}=t;return v.jsx(_1,{closeBtnLabel:e,closeButtonProps:n,...t})},qce=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},...a}=t;return v.jsx(_1,{actions:[v.jsx(j.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(j.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],...a})},Uce=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=j.useTheme(),a=oo.useNavigate();return v.jsxs(j.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(j.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(j.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(j.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(j.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Yc(l,a),children:l.label},l.label))}),n&&v.jsx(j.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},UN=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=oo.useLocation(),i=oo.useNavigate(),[s,a]=J.useState(!1),l=(m,g)=>v.jsx(j.MenuList,{children:m.map(b=>v.jsxs(j.MenuItem,{...Yc(b,i,()=>a(!1)),children:[b.icon&&v.jsx(j.ListItemIcon,{children:b.icon}),v.jsx(j.ListItemText,{primary:b.label})]},`mobile-drawer-group-${g}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(g=>g&&g.length>0);return m.length===0?null:m.map((g,b)=>v.jsxs(J.Fragment,{children:[l(g,b),b<m.length-1&&v.jsx(j.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(j.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(j.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(O6,{})}),v.jsx(j.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(j.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(j.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},KN=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(j.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(j.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},YN=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=oo.useNavigate(),[i,s]=D.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(j.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(j.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(j.MenuItem,{...Yc(f,o),children:[f.icon&&v.jsx(j.ListItemIcon,{children:f.icon}),v.jsx(j.ListItemText,{primary:f.label})]},f.label))})]})},GN=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(YN,{label:e,menuOptions:n,icon:v.jsx(A6,{})})},gh=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}=j.useTheme(),a=oo.useNavigate();return v.jsx(j.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(j.Tab,{icon:l.icon,label:l.label,value:u,...Yc(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))})},JN=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(j.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(gh,{menuOptions:e,activeTabIdx:n,sx:r})})},ZN=t=>{const{onToggle:e}=t,{palette:n}=j.useTheme(),r=n.mode==="dark";return v.jsx(j.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(aI,{}):v.jsx(iI,{})})},Kce=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:g}=t,b=oo.useNavigate(),y=j.useMediaQuery(j.useTheme().breakpoints.down("sm")),{palette:S}=j.useTheme(),{pathname:C}=oo.useLocation(),E=S.mode==="dark",[T,w]=D.useState(void 0);D.useEffect(()=>{const _=o.findIndex(P=>P.path&&C.startsWith(P.path));w(_>=0?_:void 0)},[C,o]);const k=s&&v.jsx(ZN,{onToggle:s}),R=s&&(y||!y&&l)?[{icon:E?v.jsx(aI,{}):v.jsx(iI,{}),label:`Switch to ${E?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(j.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(KN,{...e}),u,v.jsxs(j.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(j.Button,{disableRipple:!0,component:oo.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(j.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&k,y&&v.jsx(UN,{menuOptionLists:[o,a,R],anchor:"right"}),!y&&v.jsxs(v.Fragment,{children:[v.jsx(j.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((_,P)=>v.jsxs(j.Box,{display:"flex",alignItems:"center",children:[P>0&&v.jsx(j.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(j.Button,{variant:"text",sx:{color:"white"},...Yc(_,b),children:v.jsxs(j.Box,{display:"flex",gap:"3px",alignItems:"center",children:[_.icon,_.label]})})]},_.label))}),p,l&&v.jsx(GN,{displayName:l,userMenuOptions:R})]})]})]}),!y&&v.jsx(JN,{featureMenuOptions:o,activeTabIdx:T,sx:g})]})},Yce=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=oo.useLocation(),o=j.useMediaQuery(j.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&v.jsx(j.Box,{sx:e,children:v.jsx(j.Card,{sx:{height:"100%",width:200},children:v.jsx(gh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Gce=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=j.useTheme();return e.length>0&&v.jsx(gh,{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}})},Jce=t=>v.jsx(bu,{severity:"success",...t}),Zce=t=>v.jsx(bu,{severity:"info",...t}),Xce=t=>v.jsx(bu,{severity:"warning",...t}),XN=t=>{const{crumbInfo:e}=t,n=oo.useNavigate();return v.jsx(j.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(R6,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(j.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(j.Typography,{color:"primary",children:r},r))})},Qce=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=eue(r);return v.jsx(j.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(bu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:fA(r),warning:fA(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(j.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},eue=t=>t=="logout"?"info":t=="timeout"?"warning":t,fA=t=>{if(t=="timeout")return v.jsx(ZH,{});if(t=="logout")return v.jsx(k6,{})},tue=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=j.useMediaQuery(j.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(j.Box,{sx:a,children:[i.length>0&&v.jsx(XN,{crumbInfo:i}),v.jsxs(j.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(j.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(j.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(D1,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(XH,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(j.Box,{width:l?"100%":"50%",children:s})]})]})},nue=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=j.useMediaQuery(j.useTheme().breakpoints.down("sm"));return v.jsxs(j.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(j.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(j.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(j.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},rue=({children:t,fetchExistingCitations:e})=>{const[n,r]=J.useState([]),o=J.useCallback(async()=>{const s=await e();r(a=>{const l=new Set(a.map(f=>f.id));return[...a.filter(f=>!l.has(f.id)),...s]})},[e]),i=J.useCallback(s=>{const a=n.findIndex(l=>l.id===s.id);r(a!==-1?l=>{const u=[...l];return u[a]=s,u}:[...n,s])},[n]);return v.jsx(WN.Provider,{value:{citations:n,resync:o,addUpdateCitation:i},children:t})};exports.AlertModal=Wce;exports.Autocomplete=XA;exports.Breadcrumbs=XN;exports.Button=D1;exports.Checkbox=OH;exports.CheckboxGroup=RH;exports.CitationField=jce;exports.CitationFieldProvider=rue;exports.CitationMenu=zN;exports.ConfirmationModal=Hce;exports.DarkModeToggle=ZN;exports.DateField=Sf;exports.DateRangeField=QG;exports.DecisionModal=qce;exports.Drawer=UN;exports.DynamicAutocomplete=MH;exports.EnvironmentBanner=KN;exports.Error=Qn;exports.ErrorAlert=VN;exports.FileList=DH;exports.FileUpload=QA;exports.FloatingNavBar=Gce;exports.Footer=Uce;exports.FormDebugger=Fce;exports.Header=Kce;exports.InfoAlert=Zce;exports.LoadingIndicator=I0;exports.Location=KH;exports.MenuButton=YN;exports.MultiAutocomplete=kH;exports.NavBar=JN;exports.PageHeader=tue;exports.PaginatedTable=RN;exports.ProfileMenu=GN;exports.RadioGroup=oI;exports.RangeSlider=YH;exports.RepeatableFormGroup=Vce;exports.RichTextField=Lle;exports.ScrollToTop=$ce;exports.SearchField=B6;exports.Select=GH;exports.Sidebar=Yce;exports.SingleActionCard=nue;exports.Snackbar=Qce;exports.Stepper=Bce;exports.Submit=IN;exports.SuccessAlert=Jce;exports.Switch=JH;exports.Table=ON;exports.Tabs=gh;exports.TextField=Fa;exports.WarningAlert=Xce;
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=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,g=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const S=i[y];S(b,f,function(E){E&&(Array.isArray(E)?g.push(...E):g.push(E)),--m<=0&&p(g)})}}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,g)=>this.resolve(f)._validate(u,f,m,g)}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)=>{dr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new dr(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 dr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new dr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(dr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(dr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):ja(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=Oa({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=Oa({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Co.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Co.notNull){return this.nullability(!1,e)}required(e=Co.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=Co.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Oa(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=DN(e).map(i=>new Xs(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new dp(o,n):dp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Oa({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=Co.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Oa({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=Co.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Oa({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)}}}Po.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])Po.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=tce(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])Po.prototype[t]=Po.prototype.oneOf;for(const t of["not","nope"])Po.prototype[t]=Po.prototype.notOneOf;const nce=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function rce(t){const e=P0(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 P0(t){var e,n;const r=nce.exec(t);return r?{year:Zo(r[1]),month:Zo(r[2],1)-1,day:Zo(r[3],1),hour:Zo(r[4]),minute:Zo(r[5]),second:Zo(r[6]),millisecond:r[7]?Zo(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:Zo(r[10]),minuteOffset:Zo(r[11])}:null}function Zo(t,e=0){return Number(t)||e}let oce=/^[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])?)*$/,ice=/^((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,sce=/^(?:[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,ace="^\\d{4}-\\d{2}-\\d{2}",lce="\\d{2}:\\d{2}:\\d{2}",cce="(([+-]\\d{2}(:?\\d{2})?)|Z)",uce=new RegExp(`${ace}T${lce}(\\.\\d+)?${cce}$`),dce=t=>As(t)||t===t.trim(),fce={}.toString();function _0(){return new LN}class LN extends Po{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===fce?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Co.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=cr.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=cr.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=cr.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||cr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=cr.email){return this.matches(oce,{name:"email",message:e,excludeEmptyString:!0})}url(e=cr.url){return this.matches(ice,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=cr.uuid){return this.matches(sce,{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(uce,{name:"datetime",message:n||cr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||cr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=P0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||cr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=P0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=cr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:dce})}lowercase(e=cr.lowercase){return this.transform(n=>As(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>As(n)||n===n.toLowerCase()})}uppercase(e=cr.uppercase){return this.transform(n=>As(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>As(n)||n===n.toUpperCase()})}}_0.prototype=LN.prototype;let pce=new Date(""),hce=t=>Object.prototype.toString.call(t)==="[object Date]";class mh extends Po{constructor(){super({type:"date",check(e){return hce(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=rce(e),isNaN(e)?mh.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Xs.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=D0.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=D0.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)}})}}mh.INVALID_DATE=pce;mh.prototype;function mce(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=js.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),Xs.isRef(a)&&a.isSibling?i(a.path,s):P1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return Hle.array(Array.from(r),n).reverse()}function aA(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 jN(t){return(e,n)=>aA(t,e)-aA(t,n)}const gce=(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 lf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=lf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=lf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(lf)}):"optional"in t?t.optional():t}const yce=(t,e)=>{const n=[...js.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=js.getter(js.join(n),!0)(t);return!!(o&&r in o)};let lA=t=>Object.prototype.toString.call(t)==="[object Object]";function cA(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const bce=jN([]);function $N(t){return new FN(t)}class FN extends Po{constructor(e){super({type:"object",check(n){return lA(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=bce,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],g=p in o;if(m){let b,y=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:y,context:n.context,parent:l});let S=m instanceof Po?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 g&&!s&&(l[p]=o[p]);(g!==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||!lA(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Xs.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=mce(e,n),r._sortErrors=jN(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 lf(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=js.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return yce(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(gce)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||af.exact,test(n){if(n==null)return!0;const r=cA(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=af.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=cA(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=af.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(Mv.camelCase)}snakeCase(){return this.transformKeys(Mv.snakeCase)}constantCase(){return this.transformKeys(e=>Mv.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}}$N.prototype=FN.prototype;const vce=t=>{const{id:e,onSave:n,onCancel:r,getCitationById:o,disableFileUpload:i=!1,setError:s}=t,a=J.useRef(null),[l,u]=J.useState(!0),[f,p]=J.useState({title:"",file:void 0,fileName:""});return J.useEffect(()=>{if(e===void 0){u(!1);return}o(e).then(m=>{p({...m,file:void 0}),u(!1)}).catch(m=>{u(!1),s({title:"Failed to retrieve attachment",err:m})})},[]),v.jsx(Wt.Formik,{innerRef:a,enableReinitialize:!0,initialValues:f,validationSchema:$N().shape({title:_0().required("Title is required"),fileName:_0().required("A file is required")}),onSubmit:async m=>{u(!0),n(m).catch(g=>{u(!1),s({title:`Failed to ${e===void 0?"save":"update"} attachment`,err:g})}).finally(()=>u(!1))},children:({values:m,setFieldValue:g})=>{var b;return J.useEffect(()=>{var y,S;(y=m.file)!=null&&y.name&&g("fileName",(S=m.file)==null?void 0:S.name)},[(b=m.file)==null?void 0:b.name]),v.jsxs(Wt.Form,{autoComplete:"off",children:[v.jsx(Fa,{name:"title",disabled:l,required:!0,margin:"none"}),v.jsxs(j.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(QA,{name:"file",readOnly:i}),m.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:m.fileName}),v.jsx(Qn,{name:"fileName",id:"fileName-err"})]}),v.jsxs(j.DialogActions,{sx:{px:0},children:[v.jsx(j.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(j.Button,{type:"submit",color:"primary",variant:"contained",size:"small",disabled:l,children:e?"Update Attachment":"Add New Attachment"})]})]})}})};function xce(t){return Ke("MuiAlert",t)}const uA=He("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),Sce=Fe(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"),Cce=Fe(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),wce=Fe(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"),Tce=Fe(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"),Ece=Fe(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"),Mce=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 Ue(i,xce,o)},kce=ye(ul,{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"?Ya:Ec,n=t.palette.mode==="light"?Ec:Ya;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Vn(["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),[`& .${uA.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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}`,[`& .${uA.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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)}}}))]}})),Oce=ye("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Rce=ye("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),Ace=ye("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),dA={success:v.jsx(Sce,{fontSize:"inherit"}),warning:v.jsx(Cce,{fontSize:"inherit"}),error:v.jsx(wce,{fontSize:"inherit"}),info:v.jsx(Tce,{fontSize:"inherit"})},BN=D.forwardRef(function(e,n){const r=xt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=dA,onClose:g,role:b="alert",severity:y="success",slotProps:S={},slots:C={},variant:E="standard",...T}=r,w={...r,color:l,severity:y,variant:E,colorSeverity:l||y},k=Mce(w),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[_,P]=Ft("root",{ref:n,shouldForwardComponentProp:!0,className:Pe(k.root,s),elementType:kce,externalForwardedProps:{...R,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[N,O]=Ft("icon",{className:k.icon,elementType:Oce,externalForwardedProps:R,ownerState:w}),[A,L]=Ft("message",{className:k.message,elementType:Rce,externalForwardedProps:R,ownerState:w}),[z,V]=Ft("action",{className:k.action,elementType:Ace,externalForwardedProps:R,ownerState:w}),[$,F]=Ft("closeButton",{elementType:dl,externalForwardedProps:R,ownerState:w}),[W,U]=Ft("closeIcon",{elementType:Ece,externalForwardedProps:R,ownerState:w});return v.jsxs(_,{...P,children:[p!==!1?v.jsx(N,{...O,children:p||m[y]||dA[y]}):null,v.jsx(A,{...L,children:i}),o!=null?v.jsx(z,{...V,children:o}):null,o==null&&g?v.jsx(z,{...V,children:v.jsx($,{size:"small","aria-label":a,title:a,color:"inherit",onClick:g,...F,children:v.jsx(W,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(BN.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 bu=t=>{var g;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=j.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(g=l[r])==null?void 0:g.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(BN,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(j.Typography,{variant:"h3",children:s}),n]})},VN=t=>v.jsx(bu,{severity:"error",...t});function zN({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:i,onCancel:s,initialSelectedIds:a=[],onContentUpdate:l,onError:u=()=>{}}){const[f,p]=J.useState("Insert Citation/Attachment(s)"),[m,g]=J.useState(a),[b,y]=J.useState(void 0),[S,C]=J.useState(void 0);J.useEffect(()=>l==null?void 0:l(),[f,m]),J.useEffect(()=>C(void 0),[f]),J.useEffect(()=>{S&&u(S.err)},[S]);const E=async k=>{if(f==="Edit Citation"){if(k.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(k).then(()=>p("Insert Citation/Attachment(s)")).catch(R=>C({title:"Failed to update citation",err:R}))}else f==="Add Citation"&&await e(k).then(R=>{g([...m,R.id]),p("Insert Citation/Attachment(s)")}).catch(R=>C({title:"Failed to create citation",err:R}))},T=async k=>{if(f==="Edit Attachment"){if(k.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(k).then(()=>p("Insert Citation/Attachment(s)")).catch(R=>C({title:"Failed to update attachment",err:R}))}else f==="Add Attachment"&&await o(k).then(R=>{g([...m,R.id]),p("Insert Citation/Attachment(s)")}).catch(R=>C({title:"Failed to upload attachment",err:R}))};let w=null;return f==="Insert Citation/Attachment(s)"?w=v.jsx(jle,{fetchExistingCitations:t,onCancel:s,onNewCitation:()=>{y(void 0),p("Add Citation")},onNewAttachment:()=>{y(void 0),p("Add Attachment")},onEditCitation:k=>{y(k.id),p("Edit Citation")},onEditAttachment:k=>{y(k.id),p("Edit Attachment")},onSelect:i,selectedIds:m,toggleCheckbox:k=>{const R=m.includes(k.id);g(R?m.filter(_=>_!==k.id):[...m,k.id])},onError:u}):f==="Add Citation"||f==="Edit Citation"?w=v.jsx($le,{id:b,onSave:E,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,setError:C}):(f==="Add Attachment"||f==="Edit Attachment")&&(w=v.jsx(vce,{id:b,onSave:T,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,disableFileUpload:f==="Edit Attachment",setError:C})),v.jsxs(j.Box,{width:"500px",children:[v.jsx(j.Typography,{variant:"h6",children:f}),S&&v.jsx(VN,{"data-testid":"citation-menu-error",onClose:()=>C(void 0),children:S.title}),v.jsx(j.Box,{paddingTop:"8px",children:w})]})}const Ice=Kt({name:{CitationBubbleMenuTipTap:HN}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function HN({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,...i}){const{classes:s}=Ice(),a=bt();if(!(a!=null&&a.isEditable))return null;if(!("citationBubbleMenuHandler"in a.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const l=a.storage.citationBubbleMenuHandler,u=l.isOpen,f=l.selectedIds,p=l.selectedNodePos,m=()=>{!a||!p||a.chain().focus().deleteRange({from:p,to:p+1}).run()},g=E=>{a&&a.chain().focus().insertContent({type:"citation",attrs:{ids:E}}).run()},b=E=>{!a||!p||a.chain().focus().command(({tr:T})=>{const w=p,k=T.doc.nodeAt(w);return k?(T.setNodeMarkup(w,void 0,{...k.attrs,ids:E}),!0):!1}).run()},y=E=>{E.length===0?m():f.length===0?g(E):b(E)},S=E=>{y(E),a.commands.closeCitationBubbleMenu()},C=()=>{y(f),a.commands.closeCitationBubbleMenu()};return v.jsx(ch,{editor:a,open:u,...l.bubbleMenuOptions,...i,children:v.jsx("div",{className:s.content,children:v.jsx(zN,{fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:S,onCancel:C,initialSelectedIds:f,onContentUpdate:()=>{requestAnimationFrame(()=>{a!=null&&a.view&&a.view.dispatch(a.view.state.tr)})}})})})}const Dce=cn.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(Z_.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(J_.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(X_.configure(this.options.bulletList)),this.options.code!==!1&&t.push(Q_.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(eN.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(tN.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(nN.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(rN.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(oN.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(N_.configure(this.options.heading)),this.options.history!==!1&&t.push(cN.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(uN.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(dN.configure(this.options.italic)),this.options.listItem!==!1&&t.push(SN.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(CN.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(wN.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(EN.configure(this.options.strike)),this.options.text!==!1&&t.push(MN.configure(this.options.text)),t}}),Pce=()=>cn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:void 0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=e!==void 0?o.nodeAt(e):void 0,s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return n.getAttributes,r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=void 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 _ce(t){const e=bt(),n=J.useRef(null);return v.jsx(ht,{buttonRef:n,tooltipLabel:"Insert Citation",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(j.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(t6,{fontSize:"small"}),v.jsx(j.Typography,{variant:"body2",children:"Insert Citation"})]})})}const WN=J.createContext(void 0),qN=()=>{const t=J.useContext(WN);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Nce=({node:t,HTMLAttributes:e,selected:n,extension:r})=>{const o=t.attrs.ids||[],{citations:i}=qN(),[s,a]=J.useState(String(o)),[l,u]=J.useState([]),f=r.options.citationMaxLength;return J.useEffect(()=>{const p=i.filter(g=>o.includes(g.id)),m=p.map(g=>ff.truncate(g.title,{length:f,omission:"..."})).join(", ");a(m),u(p)},[i,o]),v.jsx(f1,{as:"span",...e,children:v.jsx(j.Tooltip,{title:v.jsx(j.Box,{className:"citation-tooltip",children:l.map((p,m)=>{var b;const g=[p.source,p.title,p.fileName,p.url,(b=p.accessedAt)==null?void 0:b.slice(0,10),p.classification];return v.jsxs(j.Typography,{variant:"subtitle2",children:[g.filter(Boolean).join(" | "),m<l.length-1&&v.jsx(j.Divider,{className:"citation-tooltip-divider"})]},p.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:p=>{p.preventDefault(),p.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:s})})})},Lce=Qt.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",yt(t)]},addNodeView(){return p1(Nce)},addProseMirrorPlugins(){return[new en({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]}}),jce=t=>{const{name:e,label:n=Mn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,fetchExistingCitations:l,onCreateCitation:u,onUpdateCitation:f,getCitationById:p,onStoreAttachment:m,onError:g=()=>{}}=t,b=[Dce,TN.configure({placeholder:"Start typing here..."}),Pce(),Lce.configure({citationMaxLength:a})],[y,S,C]=Wt.useField({name:e}),{setValue:E}=C,{value:T}=y,{resync:w,addUpdateCitation:k}=qN();J.useEffect(()=>{var O,A;T!==((A=(O=R==null?void 0:R.current)==null?void 0:O.editor)==null?void 0:A.getHTML())&&setTimeout(()=>{var L,z,V;(V=(z=(L=R==null?void 0:R.current)==null?void 0:L.editor)==null?void 0:z.commands)==null||V.setContent(T),w()},0)},[T]),J.useEffect(()=>{T&&setTimeout(()=>{var O,A,L;(L=(A=(O=R==null?void 0:R.current)==null?void 0:O.editor)==null?void 0:A.commands)==null||L.setContent(T),w()},0)},[]);const R=J.useRef(null),_={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},P=()=>{var L,z;const O=((z=(L=R.current)==null?void 0:L.editor)==null?void 0:z.getHTML())??"<p></p>",A=!O.replace(/<\/?p>|<br>/g,"").trim();E(A?"<p></p>":O)},N=v.jsxs(j.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},..._[s],children:[v.jsx(b_,{ref:R,extensions:b,content:T,editable:!i,renderControls:i?void 0:()=>v.jsx(dh,{children:v.jsx(_ce,{})}),onBlur:P,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(HN,{fetchExistingCitations:l,onCreateCitation:O=>u(O).then(A=>(k(A),A)),onUpdateCitation:O=>f(O).then(A=>(k(A),A)),getCitationById:p,onStoreAttachment:m,onError:g})}),v.jsx(Qn,{name:e,id:`${e}-err`})]});return v.jsxs(j.Box,{display:"flex",flexDirection:"column",width:"100%",children:[!r&&v.jsx(j.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),N]})},$ce=t=>{const{label:e="Return to Top",icon:n=sI,scrollThresholdPx:r=100}=t,o=j.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(j.Zoom,{in:o,children:v.jsx(j.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(j.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Fce=()=>{const{values:t,errors:e,status:n}=Wt.useFormikContext(),{palette:r}=j.useTheme();return v.jsx(j.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(j.List,{children:[v.jsxs(j.ListItem,{children:[v.jsx(j.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(j.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(j.Divider,{variant:"inset",component:"li"}),v.jsxs(j.ListItem,{id:"testing",children:[v.jsx(j.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(j.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(j.ListItem,{children:[v.jsx(j.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(j.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Bce=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=AN();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,...Xn({...t},l)};return v.jsx(j.Stepper,{...u,children:e.map(f=>v.jsx(j.Step,{children:v.jsx(j.StepLabel,{children:f})},f))})},Vce=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(P6,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:g="None",showDivider:b=!1,removePosition:y="bottom"}=t,[S]=Wt.useField({name:e}),{value:C}=S,E=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(j.FormControl,{fullWidth:!0,children:[v.jsx(j.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(j.Typography,{children:g}):v.jsx(Wt.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,k)=>v.jsx(J.Fragment,{children:v.jsx(zce,{variant:l,content:v.jsxs(j.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?E(y):{...y},children:[v.jsxs(j.Box,{width:"100%",children:[i(`${e}.${k}`,k),b&&k!==C.length-1&&v.jsx(j.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(j.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(k),children:a})]})})},`${e}-${k}`)),!m&&v.jsx(j.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},zce=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(j.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(j.CardContent,{children:e})});case"elevatedCard":return v.jsx(j.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(j.CardContent,{children:e})});case"none":return e}},_1=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s="Cancel",closeButtonPosition:a="bottom",closeButtonProps:l={color:"primary",variant:"text"},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=()=>{if(a!=="top")return v.jsx(j.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},m=()=>i?v.jsx(j.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(j.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(j.Box,{children:p()}),v.jsxs(j.Box,{display:"flex",gap:".25rem",children:[...i]})]})}):v.jsx(j.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(j.Box,{children:p()})});return v.jsxs(j.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(j.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(j.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,a!=="bottom"&&v.jsx(j.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(o6,{})})]})}):r,o&&(typeof o=="string"?v.jsx(j.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(j.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),m()]})},Hce=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeButtonProps:o={},...i}=t;return v.jsx(_1,{actions:[v.jsx(j.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],...i})},Wce=t=>{const{closeBtnLabel:e="OK",closeButtonProps:n={color:"primary",variant:"contained"}}=t;return v.jsx(_1,{closeBtnLabel:e,closeButtonProps:n,...t})},qce=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},...a}=t;return v.jsx(_1,{actions:[v.jsx(j.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(j.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],...a})},Uce=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=j.useTheme(),a=oo.useNavigate();return v.jsxs(j.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(j.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(j.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(j.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(j.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...Yc(l,a),children:l.label},l.label))}),n&&v.jsx(j.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},UN=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=oo.useLocation(),i=oo.useNavigate(),[s,a]=J.useState(!1),l=(m,g)=>v.jsx(j.MenuList,{children:m.map(b=>v.jsxs(j.MenuItem,{...Yc(b,i,()=>a(!1)),children:[b.icon&&v.jsx(j.ListItemIcon,{children:b.icon}),v.jsx(j.ListItemText,{primary:b.label})]},`mobile-drawer-group-${g}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(g=>g&&g.length>0);return m.length===0?null:m.map((g,b)=>v.jsxs(J.Fragment,{children:[l(g,b),b<m.length-1&&v.jsx(j.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(j.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(j.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(O6,{})}),v.jsx(j.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(j.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(j.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},KN=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(j.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(j.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},YN=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=oo.useNavigate(),[i,s]=D.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(j.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(j.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(j.MenuItem,{...Yc(f,o),children:[f.icon&&v.jsx(j.ListItemIcon,{children:f.icon}),v.jsx(j.ListItemText,{primary:f.label})]},f.label))})]})},GN=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(YN,{label:e,menuOptions:n,icon:v.jsx(A6,{})})},gh=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}=j.useTheme(),a=oo.useNavigate();return v.jsx(j.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(j.Tab,{icon:l.icon,label:l.label,value:u,...Yc(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))})},JN=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(j.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(gh,{menuOptions:e,activeTabIdx:n,sx:r})})},ZN=t=>{const{onToggle:e}=t,{palette:n}=j.useTheme(),r=n.mode==="dark";return v.jsx(j.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(aI,{}):v.jsx(iI,{})})},Kce=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:g}=t,b=oo.useNavigate(),y=j.useMediaQuery(j.useTheme().breakpoints.down("sm")),{palette:S}=j.useTheme(),{pathname:C}=oo.useLocation(),E=S.mode==="dark",[T,w]=D.useState(void 0);D.useEffect(()=>{const _=o.findIndex(P=>P.path&&C.startsWith(P.path));w(_>=0?_:void 0)},[C,o]);const k=s&&v.jsx(ZN,{onToggle:s}),R=s&&(y||!y&&l)?[{icon:E?v.jsx(aI,{}):v.jsx(iI,{}),label:`Switch to ${E?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(j.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(KN,{...e}),u,v.jsxs(j.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(j.Button,{disableRipple:!0,component:oo.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(j.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&k,y&&v.jsx(UN,{menuOptionLists:[o,a,R],anchor:"right"}),!y&&v.jsxs(v.Fragment,{children:[v.jsx(j.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((_,P)=>v.jsxs(j.Box,{display:"flex",alignItems:"center",children:[P>0&&v.jsx(j.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(j.Button,{variant:"text",sx:{color:"white"},...Yc(_,b),children:v.jsxs(j.Box,{display:"flex",gap:"3px",alignItems:"center",children:[_.icon,_.label]})})]},_.label))}),p,l&&v.jsx(GN,{displayName:l,userMenuOptions:R})]})]})]}),!y&&v.jsx(JN,{featureMenuOptions:o,activeTabIdx:T,sx:g})]})},Yce=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=oo.useLocation(),o=j.useMediaQuery(j.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&v.jsx(j.Box,{sx:e,children:v.jsx(j.Card,{sx:{height:"100%",width:200},children:v.jsx(gh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Gce=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=j.useTheme();return e.length>0&&v.jsx(gh,{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}})},Jce=t=>v.jsx(bu,{severity:"success",...t}),Zce=t=>v.jsx(bu,{severity:"info",...t}),Xce=t=>v.jsx(bu,{severity:"warning",...t}),XN=t=>{const{crumbInfo:e}=t,n=oo.useNavigate();return v.jsx(j.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(R6,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(j.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(j.Typography,{color:"primary",children:r},r))})},Qce=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=eue(r);return v.jsx(j.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:v.jsx(bu,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:fA(r),warning:fA(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(j.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},eue=t=>t=="logout"?"info":t=="timeout"?"warning":t,fA=t=>{if(t=="timeout")return v.jsx(ZH,{});if(t=="logout")return v.jsx(k6,{})},tue=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=j.useMediaQuery(j.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(j.Box,{sx:a,children:[i.length>0&&v.jsx(XN,{crumbInfo:i}),v.jsxs(j.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(j.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(j.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(D1,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(XH,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(j.Box,{width:l?"100%":"50%",children:s})]})]})},nue=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=j.useMediaQuery(j.useTheme().breakpoints.down("sm"));return v.jsxs(j.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(j.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(j.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(j.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},rue=({children:t,fetchExistingCitations:e})=>{const[n,r]=J.useState([]),o=J.useCallback(async()=>{const s=await e();r(a=>{const l=new Set(a.map(f=>f.id));return[...a.filter(f=>!l.has(f.id)),...s]})},[e]),i=J.useCallback(s=>{const a=n.findIndex(l=>l.id===s.id);r(a!==-1?l=>{const u=[...l];return u[a]=s,u}:[...n,s])},[n]);return v.jsx(WN.Provider,{value:{citations:n,resync:o,addUpdateCitation:i},children:t})};exports.AlertModal=Wce;exports.Autocomplete=XA;exports.Breadcrumbs=XN;exports.Button=D1;exports.Checkbox=OH;exports.CheckboxGroup=RH;exports.CitationField=jce;exports.CitationFieldProvider=rue;exports.CitationMenu=zN;exports.ConfirmationModal=Hce;exports.DarkModeToggle=ZN;exports.DateField=Sf;exports.DateRangeField=QG;exports.DecisionModal=qce;exports.Drawer=UN;exports.DynamicAutocomplete=MH;exports.EnvironmentBanner=KN;exports.Error=Qn;exports.ErrorAlert=VN;exports.FileList=DH;exports.FileUpload=QA;exports.FloatingNavBar=Gce;exports.Footer=Uce;exports.FormDebugger=Fce;exports.Header=Kce;exports.InfoAlert=Zce;exports.LoadingIndicator=I0;exports.Location=KH;exports.MenuButton=YN;exports.MultiAutocomplete=kH;exports.NavBar=JN;exports.PageHeader=tue;exports.PaginatedTable=RN;exports.ProfileMenu=GN;exports.RadioGroup=oI;exports.RangeSlider=YH;exports.RepeatableFormGroup=Vce;exports.RichTextField=Lle;exports.ScrollToTop=$ce;exports.SearchField=B6;exports.Select=GH;exports.Sidebar=Yce;exports.SingleActionCard=nue;exports.Snackbar=Qce;exports.Stepper=Bce;exports.Submit=IN;exports.SuccessAlert=Jce;exports.Switch=JH;exports.Table=ON;exports.Tabs=gh;exports.TextField=Fa;exports.WarningAlert=Xce;
package/dist/index.es.js CHANGED
@@ -59227,6 +59227,7 @@ const $L = gu(void 0), FL = () => {
59227
59227
  p.source,
59228
59228
  p.title,
59229
59229
  p.fileName,
59230
+ p.url,
59230
59231
  (b = p.accessedAt) == null ? void 0 : b.slice(0, 10),
59231
59232
  p.classification
59232
59233
  ];
package/dist/index.umd.js CHANGED
@@ -400,4 +400,4 @@ img.ProseMirror-separator {
400
400
  3. "-" cannot repeat`);Ut.customSchemes.push([t,e])}function See(){Ut.scanner=pee(Ut.customSchemes);for(let t=0;t<Ut.tokenQueue.length;t++)Ut.tokenQueue[t][1]({scanner:Ut.scanner});Ut.parser=gee(Ut.scanner.tokens);for(let t=0;t<Ut.pluginQueue.length;t++)Ut.pluginQueue[t][1]({scanner:Ut.scanner,parser:Ut.parser});return Ut.initialized=!0,Ut}function d1(t){return Ut.initialized||See(),yee(Ut.parser.start,t,TP(Ut.scanner.start,t))}d1.scan=TP;function DP(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 c1(n),o=d1(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 Cee(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function wee(t){return new Qt({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=B7(n.doc,[...e]);if(q7(a).forEach(({newRange:u})=>{const f=z7(r.doc,u,g=>g.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 g=m.split(" ").filter(C=>C!=="");if(g.length<=0)return!1;const b=g[g.length-1],y=p.pos+m.lastIndexOf(b);if(!b)return!1;const S=d1(b).map(C=>C.toObject(t.defaultProtocol));if(!Cee(S))return!1;S.filter(C=>C.isLink).map(C=>({...C,from:y+C.start+1,to:y+C.end+1})).filter(C=>r.schema.marks.code?!r.doc.rangeHasMark(C.from,C.to,r.schema.marks.code):!0).filter(C=>t.validate(C.value)).filter(C=>t.shouldAutoLink(C.value)).forEach(C=>{Qg(C.from,C.to,r.doc).some(E=>E.mark.type===t.type)||s.addMark(C.from,C.to,t.type.create({href:C.href}))})}}),!!s.steps.length)return s}})}function Tee(t){return new Qt({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=Xg(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 Eee(t){return new Qt({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=DP(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 Mee=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function zs(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(Mee,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const Oee=lr.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"){IP(t);return}IP(t.scheme,t.optionalSlashes)})},onDestroy(){xee()},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)=>!!zs(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=>!!zs(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=>!!zs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",gt(this.options.HTMLAttributes,t),0]:["a",gt(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!zs(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=>!!zs(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[Ri({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,o=DP(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!zs(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(wee({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!zs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Tee({type:this.type})),this.options.linkOnPaste&&t.push(Eee({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),PP=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",gt(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 kee(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:a}=t,l=r&&!o,u=mK(n),f=new RegExp(`\\s${u}$`),p=s?"^":"",m=o?"":u,g=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 y=a.pos-b.length,S=Array.from(b.matchAll(g)).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),E=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(C);if(i!==null&&!E)return null;const T=y+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 Aee=new yn("suggestion");function Iee({pluginKey:t=Aee,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:g=kee}){let b;const y=p==null?void 0:p(),S=new Qt({key:t,view(){return{update:async(C,E)=>{var T,w,O,A,N,_,L;const k=(T=this.key)===null||T===void 0?void 0:T.getState(E),I=(w=this.key)===null||w===void 0?void 0:w.getState(C.state),$=k.active&&I.active&&k.range.from!==I.range.from,H=!k.active&&I.active,z=k.active&&!I.active,R=!H&&!z&&k.query!==I.query,B=H||$&&R,W=R||$,U=z||$&&R;if(!B&&!W&&!U)return;const G=U&&!B?k:I,Y=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:Y,clientRect:Y?()=>{var Z;const{decorationId:me}=(Z=this.key)===null||Z===void 0?void 0:Z.getState(e.state),fe=C.dom.querySelector(`[data-decoration-id="${me}"]`);return(fe==null?void 0:fe.getBoundingClientRect())||null}:null},B&&((O=y==null?void 0:y.onBeforeStart)===null||O===void 0||O.call(y,b)),W&&((A=y==null?void 0:y.onBeforeUpdate)===null||A===void 0||A.call(y,b)),(W||B)&&(b.items=await f({editor:e,query:G.query})),U&&((N=y==null?void 0:y.onExit)===null||N===void 0||N.call(y,b)),W&&((_=y==null?void 0:y.onUpdate)===null||_===void 0||_.call(y,b)),B&&((L=y==null?void 0:y.onStart)===null||L===void 0||L.call(y,b))},destroy:()=>{var C;b&&((C=y==null?void 0:y.onExit)===null||C===void 0||C.call(y,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,E,T,w){const{isEditable:O}=e,{composing:A}=e.view,{selection:N}=C,{empty:_,from:L}=N,k={...E};if(k.composing=A,O&&(_||e.view.composing)){(L<E.range.from||L>E.range.to)&&!A&&!E.composing&&(k.active=!1);const I=g({char:n,allowSpaces:r,allowToIncludeChar:o,allowedPrefixes:i,startOfLine:s,$position:N.$from}),$=`id_${Math.floor(Math.random()*4294967295)}`;I&&m({editor:e,state:w,range:I.range,isActive:E.active})?(k.active=!0,k.decorationId=E.decorationId?E.decorationId:$,k.range=I.range,k.query=I.query,k.text=I.text):k.active=!1}else k.active=!1;return k.active||(k.decorationId=null,k.range={from:0,to:0},k.query=null,k.text=null),k}},props:{handleKeyDown(C,E){var T;const{active:w,range:O}=S.getState(C.state);return w&&((T=y==null?void 0:y.onKeyDown)===null||T===void 0?void 0:T.call(y,{view:C,event:E,range:O}))||!1},decorations(C){const{active:E,range:T,decorationId:w}=S.getState(C);return E?Jt.create(C.doc,[_n.inline(T.from,T.to,{nodeName:a,class:l,"data-decoration-id":w})]):null}}});return S}const Dee=new yn("mention"),Pee=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",gt(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:Dee,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",gt({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=gt({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:n,node:t});return typeof r=="string"?["span",gt({"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[Iee({editor:this.editor,...this.options.suggestion})]}}),_ee="listItem",_P="textStyle",NP=/^(\d+)\.\s$/,LP=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",gt(this.options.HTMLAttributes,n),0]:["ol",gt(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(_ee,this.editor.getAttributes(_P)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=za({find:NP,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=za({find:NP,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(_P)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),$P=en.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",gt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),FP=on.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Qt({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&&mf(s);if((l||!this.options.showOnlyCurrent)&&u){const f=[this.options.emptyNodeClass];i&&f.push(this.options.emptyEditorClass);const p=_n.node(a,a+s.nodeSize,{class:f.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});o.push(p)}return this.options.includeChildren}),Jt.create(t,o)}}})]}}),Nee=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Lee=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,RP=lr.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",gt(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[Ps({find:Nee,type:this.type})]},addPasteRules(){return[Ri({find:Lee,type:this.type})]}}),$ee=lr.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",gt(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()}}}),Fee=lr.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",gt(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()}}}),Ree=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",gt(this.options.HTMLAttributes,t),0]}}),Bee=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",gt(this.options.HTMLAttributes,t),0]}}),Vee=en.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",gt(this.options.HTMLAttributes,t),0]}}),zee=/^\s*(\[([( |x])?\])\s$/,Hee=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",gt(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 g=p.doc.nodeAt(m);return p.setNodeMarkup(m,void 0,{...g==null?void 0:g.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[za({find:zee,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),jee=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",gt(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()}}}),BP=en.create({name:"text",group:"inline"}),Wee=on.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")}}}),qee=lr.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",gt(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()}}}),VP=J.forwardRef((t,e)=>{const[n,r]=J.useState(0),o=l=>{if(l>=t.items.length)return;const u=t.items[l],f={id:u.id,label:u.mentionLabel};t.command(f)},i=()=>{r((n+t.items.length-1)%t.items.length)},s=()=>{r((n+1)%t.items.length)},a=()=>{o(n)};return J.useEffect(()=>r(0),[t.items]),J.useImperativeHandle(e,()=>({onKeyDown:({event:l})=>l.key==="ArrowUp"?(i(),!0):l.key==="ArrowDown"?(s(),!0):l.key==="Enter"?(a(),!0):!1})),t.items.length>0?v.jsx(F.Paper,{elevation:5,children:v.jsx(F.List,{dense:!0,sx:{overflow:"hidden"},children:t.items.map((l,u)=>v.jsx(F.ListItem,{disablePadding:!0,children:v.jsx(F.ListItemButton,{selected:u===n,onClick:()=>o(u),children:l.mentionLabel})},l.id))})}):null});VP.displayName="SuggestionList";const zP={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0,toJSON(){return{}}},Uee={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 K2(VP,{props:n,editor:n.editor}),e=Bc("body",{getReferenceClientRect:()=>{var r;return((r=n.clientRect)==null?void 0:r.call(n))??zP},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))??zP}})},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}}}},Kee=Oee.extend({inclusive:!1}),Yee=$ee.extend({excludes:"superscript"}),Gee=Fee.extend({excludes:"subscript"});function Jee({placeholder:t}={}){return J.useMemo(()=>[bQ.configure({resizable:!0}),Vee,Bee,Ree,eP,nP,rP,sP,PP,LP,$P,Yee,Gee,BP,ZD,JD,tP,mP,qee,RP,Kee.configure({autolink:!0,linkOnPaste:!0,openOnClick:!1}),hG,iP,uX,Wee.configure({types:["heading","paragraph","image"]}),DQ,PQ,LQ,lX,qQ.configure({multicolor:!0}),hP,yX,oP,jee,Hee.configure({nested:!0}),Pee.configure({suggestion:Uee}),FP.configure({placeholder:t}),pP],[t])}function HP(t){return Array.from(t).filter(e=>(e.type||"").toLowerCase().startsWith("image/"))}const Zee=t=>{const e=Jee({placeholder:"Add your own content here..."});if(t.renderContentOnly)return v.jsx(VJ,{content:t.renderContentOnly,extensions:e});const{name:n,label:r,labelProps:o={fontSize:"0.9em",color:"#808080",fontWeight:"400"},onUploadFiles:i,readOnly:s=!1}=t,[a,l,u]=Ht.useField({name:n}),{setValue:f}=u,{value:p}=a;J.useEffect(()=>{var C,E,T;(T=(E=(C=m==null?void 0:m.current)==null?void 0:C.editor)==null?void 0:E.commands)==null||T.setContent(p)},[p]);const m=J.useRef(null),g=J.useCallback((C,E)=>{var w;const T=(w=m.current)==null?void 0:w.editor;if(T)if(i instanceof Promise)i(C).then(O=>{A0({images:O,editor:T,position:E})});else{const O=i(C);A0({images:O,editor:T,position:E})}},[]),b=J.useCallback((C,E,T,w)=>{var A;if(!(E instanceof DragEvent)||!E.dataTransfer)return!1;const O=HP(E.dataTransfer.files);if(O.length>0){const N=(A=C.posAtCoords({left:E.clientX,top:E.clientY}))==null?void 0:A.pos;return g(O,N),E.preventDefault(),!0}return!1},[g]),y=J.useCallback((C,E,T)=>{if(!E.clipboardData)return!1;const w=HP(E.clipboardData.files);return w.length>0?(g(w),!0):!1},[g]),S=v.jsx(F.Box,{sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:s?0:50}}},children:v.jsx(Q2,{ref:m,extensions:e,content:p,editable:!s,editorProps:{handleDrop:b,handlePaste:y},renderControls:s?void 0:()=>v.jsx(vQ,{onUploadFiles:i}),onBlur:()=>{var C,E;return f(((E=(C=m.current)==null?void 0:C.editor)==null?void 0:E.getHTML())??"")},RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:s}},children:()=>v.jsxs(v.Fragment,{children:[v.jsx(g2,{}),v.jsx(eD,{})]})})});return v.jsxs(F.Box,{display:"flex",flexDirection:"column",children:[r&&v.jsx(F.Typography,{...o,children:r}),S]})},f1=t=>{const{title:e="Loading...",message:n}=t;return v.jsxs(F.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[v.jsxs(F.Box,{className:"text-content",children:[v.jsx(F.Typography,{variant:"h1","data-testid":"title",children:e}),n&&v.jsx(F.Typography,{"data-testid":"message",children:n})]}),v.jsx(F.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})},jP=t=>{const{colSpan:e,isExpanded:n,renderExpand:r,obj:o,asMobileCard:i=!1}=t,[s,a]=J.useState(!1),[l,u]=J.useState(void 0);return J.useEffect(()=>{n&&!s&&(a(!0),u(r(o)))},[n]),i?v.jsx(F.Box,{children:v.jsx(F.Collapse,{in:n,children:l})}):v.jsx(F.TableRow,{children:v.jsx(F.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:e,children:v.jsx(F.Collapse,{in:n,children:l})})})},WP=t=>{const{id:e,getRowKey:n=K=>"id"in K&&(typeof K.id=="string"||typeof K.id=="number")?K.id:(console.warn(`Table: "id: string | number" not found in ${JSON.stringify(K)}. Please implement the Table.getRowKey prop so Table knows how to uniquely identify this row.`),JSON.stringify(K)),columns:r,data:o=[],onRowClick:i,renderExpand:s,hideColumnsOnMobile:a=[],sortField:l,sortOrder:u,onSortChange:f,allowSortCols:p,fixedLayout:m=!1,className:g,emptyTableMsg:b="No items to display",errorTableMsg:y,retryCallback:S,isLoading:C=!1,disableMobileCards:E=!1,highlightSelectedRow:T=!1,headerRowStyle:w={},stickyHeader:O,...A}=t,{palette:N}=F.useTheme(),[_,L]=J.useState(void 0),[k,I]=J.useState(void 0);Array.isArray(m)&&m.length!==r.length&&console.error('Table component: Length of "fixedLayout" is not equal to the length of "columns".');const $=K=>{K!==l?f&&f(K,"asc"):f&&f(l,u==="asc"?"desc":"asc")},H=K=>l===K?u:null,z=F.useMediaQuery(F.useTheme().breakpoints.down("sm")),R=z&&a?r.filter(K=>!a.includes(K.fieldName)):r,B=(K,Q)=>Q.split(".").reduce((ie,he)=>{if(ie&&typeof ie=="object")return ie[he]},K),W=(K,Q)=>{const ie=B(Q,K.fieldName);return K.render?K.render(ie,Q,z):ie},U=f!==void 0,G=K=>U?p?p.includes(K):!0:!1,Y=v.jsxs(F.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(XB,{})," ",b]}),Z=v.jsxs(F.Box,{"data-testid":"table-fetch-error-msg",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:[v.jsx(sC,{color:"error"})," ",y,S&&v.jsx(F.Button,{variant:"text",onClick:S,children:"Retry?"})]}),me=()=>{if(C)return v.jsx(F.TableRow,{children:v.jsx(F.TableCell,{colSpan:r.length,align:"center",children:v.jsx(F.Box,{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"row",children:v.jsx(f1,{})})})});if(y)return v.jsx(F.TableRow,{children:v.jsx(F.TableCell,{colSpan:r.length,align:"center",children:Z})});if(o.length===0)return v.jsx(F.TableRow,{children:v.jsx(F.TableCell,{colSpan:r.length,align:"center",children:Y})})},fe=()=>{if(C)return v.jsx(f1,{});if(y)return Z;if(o.length===0)return Y},pe=K=>{T&&I(K)},re=K=>{if(i&&(i(K),pe(K)),s){const Q=_===K?void 0:K;L(Q),pe(Q)}},ue=typeof T=="string"?T:N.grey[N.mode=="dark"?600:50],ae=K=>{const Q=k===n(K)?ue:"inherit";return{cursor:i||s?"pointer":"default",backgroundColor:Q,...i&&{"&:hover":{backgroundColor:Q===ue?na(Q,.1):ue}}}};return z&&!E?v.jsxs("div",{...e?{id:`mobile-table-${e}`}:{},className:g,"data-testid":"mui-table-mobile",children:[U&&v.jsxs(v.Fragment,{children:[v.jsxs(F.Box,{display:"flex",className:"MBv2_Table_Stack_Sort",children:[v.jsx(F.TextField,{select:!0,sx:{flexGrow:1},id:"demo-simple-select",size:"small",value:l??"",label:"Sort By...",onChange:K=>$(K.target.value),fullWidth:!0,children:R.map(K=>{if(G(K.fieldName))return v.jsx(F.MenuItem,{value:K.sortName??K.fieldName,children:K.label??Cn(K.fieldName)},`${K.key??"rowHeader"}-${K.fieldName}`)})}),v.jsx(F.IconButton,{onClick:()=>{l&&$(l)},children:v.jsx(l5,{className:`sort-icon-${u}`})})]}),v.jsx(F.Divider,{sx:{margin:"10px 0"}})]}),fe()??o.map(K=>v.jsxs(F.Card,{className:"MBv2_Table_Stack_Container",sx:{margin:"5px 0",padding:"5px",...ae(K)},onClick:()=>re(n(K)),"data-testid":`card-${n(K)}`,children:[v.jsx("table",{className:"MBv2_Table_Stack",children:v.jsx("tbody",{className:"MBv2_Table_Stack_Body",children:R.map(Q=>v.jsxs("tr",{className:"MBv2_Table_Stack_Row",children:[v.jsx("td",{className:`MBv2_Table_Stack_Cell_Label MBv2_Table_Stack_Col_${Q.fieldName}`,children:Q.label??Cn(Q.fieldName)}),v.jsx("td",{className:`MBv2_Table_Stack_Cell_Value MBv2_Table_Stack_Val_${Q.fieldName}`,style:{paddingLeft:"10px"},children:W(Q,K)})]},`${Q.key??"row"}-${n(K)}-${Q.fieldName}`))})}),s&&v.jsx(jP,{colSpan:r.length,isExpanded:n(K)===_,obj:K,renderExpand:Q=>s(Q),asMobileCard:!0})]},n(K)))]}):v.jsx(F.TableContainer,{component:F.Card,"data-testid":"mui-table",...e?{id:`table-${e}`}:{},className:g,style:O?{maxHeight:O,overflow:"auto"}:{},children:v.jsxs(F.Table,{stickyHeader:O!=="undefined",style:{tableLayout:m?"fixed":"auto"},className:"MBv2_Table",sx:w?{"& .MuiTableCell-head":{...w}}:{},...A,children:[v.jsx(F.TableHead,{className:"MBv2_Table_Head",children:v.jsx(F.TableRow,{className:"MBv2_Table_Head_Row",children:R.map((K,Q)=>{const ie=G(K.fieldName);return v.jsx(F.TableCell,{width:Array.isArray(m)?m[Q]:"auto",children:v.jsx(F.Box,{style:{display:"flex",alignItems:"center"},children:v.jsxs(F.Box,{sx:[ie&&{"&:hover":{cursor:"pointer",backgroundColor:N.mode==="dark"?"#222222":"#ededed",borderRadius:2}}],style:{display:"flex",alignItems:"center",padding:"5px",paddingLeft:"6px",marginLeft:"-6px"},onClick:ie?()=>$(K.sortName??K.fieldName):void 0,children:[v.jsx("strong",{className:"MBv2_Table_Col_Label",style:{wordBreak:"normal"},children:K.label??Cn(K.fieldName)}),ie&&H(K.fieldName)==="asc"&&v.jsx(_C,{style:{marginLeft:"5px"}}),ie&&H(K.fieldName)==="desc"&&v.jsx(QB,{style:{marginLeft:"5px"}}),ie&&H(K.fieldName)!=="asc"&&H(K.fieldName)!=="desc"&&v.jsx(i5,{style:{marginLeft:"5px"}})]})})},`${K.key??"rowHeader"}-${K.fieldName}`)})})}),v.jsx(F.TableBody,{className:"MBv2_Table_Body",children:me()??o.map(K=>v.jsxs(J.Fragment,{children:[v.jsx(F.TableRow,{"data-testid":`row-${n(K)}`,className:"MBv2_Table_Body_Row",onClick:()=>re(n(K)),sx:ae(K),children:R.map(Q=>v.jsx(F.TableCell,{className:`MBv2_Table_Body_Cell MBv2_Table_Body_Col_${Q.fieldName}`,children:W(Q,K)},`${Q.key??"row"}-${n(K)}-${Q.fieldName}`))}),s&&v.jsx(jP,{colSpan:r.length,isExpanded:n(K)===_,obj:K,renderExpand:Q=>s(Q)})]},n(K)))})]})})},qP=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)},g=S=>{r(parseInt(S.target.value,10))},b=F.useMediaQuery(F.useTheme().breakpoints.down("sm")),y=!t.data||t.data&&t.data.length===0;return v.jsxs(F.Box,{children:[v.jsx(WP,{sortOrder:p,sortField:f,...s}),!o&&!y&&v.jsx(F.TablePagination,{"data-testid":"pagination-controls",component:"div",rowsPerPageOptions:b?[]:i,count:u,rowsPerPage:l,page:a,onPageChange:(S,C)=>m(C),onRowsPerPageChange:g,sx:{flexGrow:1,marginRight:{xs:0,md:15}}})]})},Xee=t=>{const{onCancel:e,onNewCitation:n,onNewAttachment:r,onEditCitation:o,onEditAttachment:i,onSelect:s,fetchExistingCitations:a,selectedIds:l,toggleCheckbox:u,onError:f=()=>{}}=t,[p,m]=J.useState([]),[g,b]=J.useState(!1),[y,S]=J.useState(!0),[C,E]=J.useState({pageNo:0,pageSize:5,totalCount:0}),T=()=>{b(!1),S(!0),a({pageNo:C.pageNo,pageSize:C.pageSize}).then(w=>{m(w.data),E({...C,totalCount:w.totalCount})}).catch(w=>{f(w),b(!0),m([])}).finally(()=>S(!1))};return J.useEffect(()=>{T()},[C.pageNo,C.pageSize]),v.jsxs(v.Fragment,{children:[v.jsx(qP,{"data-testid":"citation-table",size:"x-small",isLoading:y,columns:[{fieldName:"id",key:"select",label:"",render:(w,O)=>v.jsx(F.Checkbox,{"data-testid":`citation-table_checkbox-${w}`,onChange:()=>u(O),checked:l.includes(w)})},{fieldName:"title"},{fieldName:"fileName",key:"CitationOrAttachment",label:"Type",render:w=>w?"Attachment":"Citation"},{fieldName:"id",key:"Action",label:"Action",render:(w,O)=>v.jsx(F.IconButton,{color:"primary",onClick:()=>O.fileName?i(O):o(O),"data-testid":`citation-table_edit-btn-${w}`,children:v.jsx(NB,{})})}],data:p,paginationState:C,onPageChange:w=>E({...C,pageNo:w}),onRowsPerPageChange:w=>E({...C,pageSize:w,pageNo:0}),fixedLayout:["60px","auto","auto","120px"],errorTableMsg:g?"Failed to load citations.":void 0,retryCallback:T}),v.jsxs(F.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",marginTop:"20px",children:[v.jsxs(F.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(F.Button,{variant:"outlined",size:"small",onClick:n,startIcon:v.jsx(tm,{}),children:"Add Citation"}),v.jsx(F.Button,{variant:"outlined",size:"small",onClick:r,startIcon:v.jsx(OB,{}),children:"Add Attachment"})]}),v.jsxs(F.Box,{display:"flex",flexDirection:"row",gap:".25rem",children:[v.jsx(F.Button,{variant:"outlined",size:"small",onClick:e,children:"Cancel"}),v.jsxs(F.Button,{variant:"contained",size:"small",onClick:()=>s(l),children:["Select",l.length>0&&` (${l.length})`]})]})]})]})},UP=()=>({height:window.innerHeight,width:window.innerWidth}),KP=()=>{const[t,e]=J.useState(UP());return J.useEffect(()=>{const n=()=>{e(UP())};return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t},p1=t=>{const{name:e="button",color:n="primary",fullWidthOnMobile:r=!0,type:o="button",variant:i="contained"}=t,{width:s}=KP(),a=["locationInBar","closeDialog","fullWidthOnMobile"],l=r&&s<600;return v.jsx(F.Button,{role:"button",name:e,color:n,variant:i,type:o,fullWidth:t.fullWidth?!0:l,...Yn({...t},a)})},YP=t=>{const{name:e="submit"}=t;return v.jsx(p1,{name:e,type:"submit",...t})},Qee=t=>{const{id:e,onSave:n,onCancel:r,getCitationById:o,setError:i}=t,s=J.useRef(null),[a,l]=J.useState(!0),[u,f]=J.useState({source:"",title:"",accessedAt:null,url:"",classification:""});J.useEffect(()=>{if(e===void 0){l(!1);return}o(e).then(m=>{f(m),l(!1)}).catch(m=>{l(!1),i({title:"Failed to retrieve citation",err:m})})},[]);const p=()=>{var g,b,y;const m=(b=(g=s==null?void 0:s.current)==null?void 0:g.values)==null?void 0:b.url;m&&((y=s==null?void 0:s.current)==null||y.setFieldValue("url",e2(m)))};return v.jsx(Ht.Formik,{innerRef:s,enableReinitialize:!0,initialValues:u,onSubmit:async m=>{l(!0),n(m).catch(g=>{l(!1),i({title:`Failed to ${e===void 0?"save":"update"} citation`,err:g})}).finally(()=>l(!1))},children:v.jsxs(Ht.Form,{autoComplete:"off",children:[v.jsx(la,{name:"source",disabled:a,required:!0,margin:"none"}),v.jsx(la,{name:"title",disabled:a,required:!0,margin:"none"}),v.jsx(Dd,{name:"accessedAt",disabled:a,required:!0,margin:"none",isDatePicker:!0}),v.jsx(la,{name:"url",disabled:a,required:!0,onBlur:p,margin:"none"}),v.jsx(DC,{row:!0,name:"classification",required:!0,radios:[{label:"Public Source",value:"Public Source"},{label:"Proprietary Source",value:"Proprietary Source"}],margin:"none"}),v.jsxs(F.DialogActions,{sx:{px:0},children:[v.jsx(F.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(YP,{color:"primary",variant:"contained",size:"small",disabled:a,children:e?"Update Citation":"Add New Citation"})]})]})})};var h1,GP;function ete(){if(GP)return h1;GP=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,E){return this._size>=this._maxSize&&this.clear(),C in this._values||this._size++,this._values[C]=E};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);h1={Cache:t,split:p,normalizePath:f,setter:function(C){var E=f(C);return l.get(C)||l.set(C,function(w,O){for(var A=0,N=E.length,_=w;A<N-1;){var L=E[A];if(L==="__proto__"||L==="constructor"||L==="prototype")return w;_=_[E[A++]]}_[E[A]]=O})},getter:function(C,E){var T=f(C);return u.get(C)||u.set(C,function(O){for(var A=0,N=T.length;A<N;)if(O!=null||!E)O=O[T[A++]];else return;return O})},join:function(C){return C.reduce(function(E,T){return E+(g(T)||n.test(T)?"["+T+"]":(E?".":"")+T)},"")},forEach:function(C,E,T){m(Array.isArray(C)?C:p(C),E,T)}};function f(C){return a.get(C)||a.set(C,p(C).map(function(E){return E.replace(i,"$2")}))}function p(C){return C.match(e)||[""]}function m(C,E,T){var w=C.length,O,A,N,_;for(A=0;A<w;A++)O=C[A],O&&(S(O)&&(O='"'+O+'"'),_=g(O),N=!_&&/^\d+$/.test(O),E.call(T,O,_,N,A,C))}function g(C){return typeof C=="string"&&C&&["'",'"'].indexOf(C.charAt(0))!==-1}function b(C){return C.match(r)&&!C.match(n)}function y(C){return o.test(C)}function S(C){return!g(C)&&(b(C)||y(C))}return h1}var Hs=ete(),m1,JP;function tte(){if(JP)return m1;JP=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 m1={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(" ")},m1}var g1=tte(),xp={exports:{}},ZP;function nte(){if(ZP)return xp.exports;ZP=1,xp.exports=function(o){return t(e(o),o)},xp.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(g){if(!p.has(g[0])||!p.has(g[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(g,b,y){if(y.has(g)){var S;try{S=", node was:"+JSON.stringify(g)}catch{S=""}throw new Error("Cyclic dependency"+S)}if(!p.has(g))throw new Error("Found unknown node. Make sure to provided all involved nodes. Unknown node: "+JSON.stringify(g));if(!l[b]){l[b]=!0;var C=f.get(g)||new Set;if(C=Array.from(C),b=C.length){y.add(g);do{var E=C[--b];m(E,p.get(E),y)}while(b);y.delete(g)}a[--s]=g}}}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 xp.exports}var rte=nte();const ote=Gn(rte),ite=Object.prototype.toString,ste=Error.prototype.toString,ate=RegExp.prototype.toString,lte=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",cte=/^Symbol\((.*)\)(.*)$/;function ute(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function XP(t,e=!1){if(t==null||t===!0||t===!1)return""+t;const n=typeof t;if(n==="number")return ute(t);if(n==="string")return e?`"${t}"`:t;if(n==="function")return"[Function "+(t.name||"anonymous")+"]";if(n==="symbol")return lte.call(t).replace(cte,"Symbol($1)");const r=ite.call(t).slice(8,-1);return r==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):r==="Error"||t instanceof Error?"["+ste.call(t)+"]":r==="RegExp"?ate.call(t):null}function Ki(t,e){let n=XP(t,e);return n!==null?n:JSON.stringify(t,function(r,o){let i=XP(this[r],e);return i!==null?i:o},2)}function QP(t){return t==null?[]:[].concat(t)}let e_,t_,n_,dte=/\$\{\s*(\w+)\s*\}/g;e_=Symbol.toStringTag;class r_{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[e_]="Error",this.name="ValidationError",this.value=n,this.path=r,this.type=o,this.errors=[],this.inner=[],QP(e).forEach(i=>{if(ur.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]}}t_=Symbol.hasInstance,n_=Symbol.toStringTag;class ur 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(dte,(o,i)=>Ki(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 r_(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[n_]="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,ur)}static[t_](e){return r_[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}}let Po={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 \`${Ki(r,!0)}\`).`:".";return e!=="mixed"?`${t} must be a \`${e}\` type, but the final value was: \`${Ki(n,!0)}\``+o:`${t} must match the configured type. The validated value was: \`${Ki(n,!0)}\``+o}},dr={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"},fte={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"},y1={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},pte={isValue:"${path} field must be ${value}"},Sp={noUnknown:"${path} field has unspecified keys: ${unknown}",exact:"${path} object contains unknown properties: ${properties}"};Object.assign(Object.create(null),{mixed:Po,string:dr,number:fte,date:y1,object:Sp,array:{min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},boolean:pte,tuple:{notType:t=>{const{path:e,value:n,spec:r}=t,o=r.types.length;if(Array.isArray(n)){if(n.length<o)return`${e} tuple value has too few items, expected a length of ${o} but got ${n.length} for value: \`${Ki(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: \`${Ki(n,!0)}\``}return ur.formatError(Po.notType,t)}}});const b1=t=>t&&t.__isYupSchema__;class Cp{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 Cp(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(!b1(o))throw new TypeError("conditions must return a schema object");return o.resolve(n)}}const wp={context:"$",value:"."};class js{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]===wp.context,this.isValue=this.key[0]===wp.value,this.isSibling=!this.isContext&&!this.isValue;let r=this.isContext?wp.context:this.isValue?wp.value:"";this.path=this.key.slice(r.length),this.getter=this.path&&Hs.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}}js.prototype.__isYupRef=!0;const Ws=t=>t==null;function Xa(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:g}=t;let{parent:b,context:y,abortEarly:S=s.spec.abortEarly,disableStackTrace:C=s.spec.disableStackTrace}=o;function E(I){return js.isRef(I)?I.getValue(n,b,y):I}function T(I={}){const $=Object.assign({value:n,originalValue:i,label:s.spec.label,path:I.path||r,spec:s.spec,disableStackTrace:I.disableStackTrace||C},p,I.params);for(const z of Object.keys($))$[z]=E($[z]);const H=new ur(ur.formatError(I.message||m,$),n,$.path,I.type||u,$.disableStackTrace);return H.params=$,H}const w=S?a:l;let O={path:r,parent:b,type:u,from:o.from,createError:T,resolve:E,options:o,originalValue:i,schema:s};const A=I=>{ur.isError(I)?w(I):I?l(null):w(T())},N=I=>{ur.isError(I)?w(I):a(I)};if(g&&Ws(n))return A(!0);let L;try{var k;if(L=f.call(O,n,O),typeof((k=L)==null?void 0:k.then)=="function"){if(o.sync)throw new Error(`Validation test of type: "${O.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(L).then(A,N)}}catch(I){N(I);return}A(L)}return e.OPTIONS=t,e}function hte(t,e,n,r=n){let o,i,s;return e?(Hs.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 Tp extends Set{describe(){const e=[];for(const n of this.values())e.push(js.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 Tp(this.values())}merge(e,n){const r=this.clone();return e.forEach(o=>r.add(o)),n.forEach(o=>r.delete(o)),r}}function Qa(t,e=new Map){if(b1(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]=Qa(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,Qa(o,e))}else if(t instanceof Set){n=new Set,e.set(t,n);for(const r of t)n.add(Qa(r,e))}else if(t instanceof Object){n={},e.set(t,n);for(const[r,o]of Object.entries(t))n[r]=Qa(o,e)}else throw Error(`Unable to clone ${t}`);return n}class _o{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 Tp,this._blacklist=new Tp,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(Po.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=Qa(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&&Ws(i))return i;let s=Ki(e),a=Ki(i);throw new TypeError(`The value of ${n.path||"field"} could not be cast to a value that satisfies the schema type: "${r.type}".
401
401
 
402
402
  attempted value: ${s}
403
- `+(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=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,g=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const S=i[y];S(b,f,function(E){E&&(Array.isArray(E)?g.push(...E):g.push(E)),--m<=0&&p(g)})}}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,g)=>this.resolve(f)._validate(u,f,m,g)}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)=>{ur.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new ur(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 ur.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new ur(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(ur.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(ur.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Qa(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=Xa({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=Xa({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Po.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Po.notNull){return this.nullability(!1,e)}required(e=Po.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=Po.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Xa(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=QP(e).map(i=>new js(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Cp(o,n):Cp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Xa({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=Po.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Xa({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=Po.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Xa({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)}}}_o.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])_o.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=hte(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])_o.prototype[t]=_o.prototype.oneOf;for(const t of["not","nope"])_o.prototype[t]=_o.prototype.notOneOf;const mte=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function gte(t){const e=v1(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 v1(t){var e,n;const r=mte.exec(t);return r?{year:ni(r[1]),month:ni(r[2],1)-1,day:ni(r[3],1),hour:ni(r[4]),minute:ni(r[5]),second:ni(r[6]),millisecond:r[7]?ni(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:ni(r[10]),minuteOffset:ni(r[11])}:null}function ni(t,e=0){return Number(t)||e}let yte=/^[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])?)*$/,bte=/^((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,vte=/^(?:[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,xte="^\\d{4}-\\d{2}-\\d{2}",Ste="\\d{2}:\\d{2}:\\d{2}",Cte="(([+-]\\d{2}(:?\\d{2})?)|Z)",wte=new RegExp(`${xte}T${Ste}(\\.\\d+)?${Cte}$`),Tte=t=>Ws(t)||t===t.trim(),Ete={}.toString();function x1(){return new o_}class o_ extends _o{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===Ete?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Po.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=dr.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=dr.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=dr.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||dr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=dr.email){return this.matches(yte,{name:"email",message:e,excludeEmptyString:!0})}url(e=dr.url){return this.matches(bte,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=dr.uuid){return this.matches(vte,{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(wte,{name:"datetime",message:n||dr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||dr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=v1(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||dr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=v1(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=dr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Tte})}lowercase(e=dr.lowercase){return this.transform(n=>Ws(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ws(n)||n===n.toLowerCase()})}uppercase(e=dr.uppercase){return this.transform(n=>Ws(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ws(n)||n===n.toUpperCase()})}}x1.prototype=o_.prototype;let Mte=new Date(""),Ote=t=>Object.prototype.toString.call(t)==="[object Date]";class Ep extends _o{constructor(){super({type:"date",check(e){return Ote(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=gte(e),isNaN(e)?Ep.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(js.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=y1.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=y1.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)}})}}Ep.INVALID_DATE=Mte,Ep.prototype;function kte(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Hs.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),js.isRef(a)&&a.isSibling?i(a.path,s):b1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return ote.array(Array.from(r),n).reverse()}function i_(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 s_(t){return(e,n)=>i_(t,e)-i_(t,n)}const Ate=(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 Mp(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Mp(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Mp(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Mp)}):"optional"in t?t.optional():t}const Ite=(t,e)=>{const n=[...Hs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Hs.getter(Hs.join(n),!0)(t);return!!(o&&r in o)};let a_=t=>Object.prototype.toString.call(t)==="[object Object]";function l_(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Dte=s_([]);function c_(t){return new u_(t)}class u_ extends _o{constructor(e){super({type:"object",check(n){return a_(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Dte,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],g=p in o;if(m){let b,y=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:y,context:n.context,parent:l});let S=m instanceof _o?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 g&&!s&&(l[p]=o[p]);(g!==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||!a_(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||js.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=kte(e,n),r._sortErrors=s_(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 Mp(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=Hs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Ite(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Ate)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Sp.exact,test(n){if(n==null)return!0;const r=l_(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Sp.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=l_(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Sp.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(g1.camelCase)}snakeCase(){return this.transformKeys(g1.snakeCase)}constantCase(){return this.transformKeys(e=>g1.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}}c_.prototype=u_.prototype;const Pte=t=>{const{id:e,onSave:n,onCancel:r,getCitationById:o,disableFileUpload:i=!1,setError:s}=t,a=J.useRef(null),[l,u]=J.useState(!0),[f,p]=J.useState({title:"",file:void 0,fileName:""});return J.useEffect(()=>{if(e===void 0){u(!1);return}o(e).then(m=>{p({...m,file:void 0}),u(!1)}).catch(m=>{u(!1),s({title:"Failed to retrieve attachment",err:m})})},[]),v.jsx(Ht.Formik,{innerRef:a,enableReinitialize:!0,initialValues:f,validationSchema:c_().shape({title:x1().required("Title is required"),fileName:x1().required("A file is required")}),onSubmit:async m=>{u(!0),n(m).catch(g=>{u(!1),s({title:`Failed to ${e===void 0?"save":"update"} attachment`,err:g})}).finally(()=>u(!1))},children:({values:m,setFieldValue:g})=>{var b;return J.useEffect(()=>{var y,S;(y=m.file)!=null&&y.name&&g("fileName",(S=m.file)==null?void 0:S.name)},[(b=m.file)==null?void 0:b.name]),v.jsxs(Ht.Form,{autoComplete:"off",children:[v.jsx(la,{name:"title",disabled:l,required:!0,margin:"none"}),v.jsxs(F.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(uC,{name:"file",readOnly:i}),m.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:m.fileName}),v.jsx(Jn,{name:"fileName",id:"fileName-err"})]}),v.jsxs(F.DialogActions,{sx:{px:0},children:[v.jsx(F.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(F.Button,{type:"submit",color:"primary",variant:"contained",size:"small",disabled:l,children:e?"Update Attachment":"Add New Attachment"})]})]})}})};function _te(t){return Ue("MuiAlert",t)}const d_=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"]),Nte=Be(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"),Lte=Be(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),$te=Be(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"),Fte=Be(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"),Rte=Be(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"),Bte=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ae(n||r)}`,`${e}${Ae(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return qe(i,_te,o)},Vte=ye(ha,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ae(n.color||n.severity)}`]]}})(Dt(({theme:t})=>{const e=t.palette.mode==="light"?na:Ml,n=t.palette.mode==="light"?Ml:na;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Vn(["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),[`& .${d_.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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}`,[`& .${d_.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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)}}}))]}})),zte=ye("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Hte=ye("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),jte=ye("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),f_={success:v.jsx(Nte,{fontSize:"inherit"}),warning:v.jsx(Lte,{fontSize:"inherit"}),error:v.jsx($te,{fontSize:"inherit"}),info:v.jsx(Fte,{fontSize:"inherit"})},p_=P.forwardRef(function(e,n){const r=xt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=f_,onClose:g,role:b="alert",severity:y="success",slotProps:S={},slots:C={},variant:E="standard",...T}=r,w={...r,color:l,severity:y,variant:E,colorSeverity:l||y},O=Bte(w),A={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[N,_]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:_e(O.root,s),elementType:Vte,externalForwardedProps:{...A,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[L,k]=Bt("icon",{className:O.icon,elementType:zte,externalForwardedProps:A,ownerState:w}),[I,$]=Bt("message",{className:O.message,elementType:Hte,externalForwardedProps:A,ownerState:w}),[H,z]=Bt("action",{className:O.action,elementType:jte,externalForwardedProps:A,ownerState:w}),[R,B]=Bt("closeButton",{elementType:ba,externalForwardedProps:A,ownerState:w}),[W,U]=Bt("closeIcon",{elementType:Rte,externalForwardedProps:A,ownerState:w});return v.jsxs(N,{..._,children:[p!==!1?v.jsx(L,{...k,children:p||m[y]||f_[y]}):null,v.jsx(I,{...$,children:i}),o!=null?v.jsx(H,{...z,children:o}):null,o==null&&g?v.jsx(H,{...z,children:v.jsx(R,{size:"small","aria-label":a,title:a,color:"inherit",onClick:g,...B,children:v.jsx(W,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(p_.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 g;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=F.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(g=l[r])==null?void 0:g.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(p_,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(F.Typography,{variant:"h3",children:s}),n]})},h_=t=>v.jsx(tu,{severity:"error",...t});function m_({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:i,onCancel:s,initialSelectedIds:a=[],onContentUpdate:l,onError:u=()=>{}}){const[f,p]=J.useState("Insert Citation/Attachment(s)"),[m,g]=J.useState(a),[b,y]=J.useState(void 0),[S,C]=J.useState(void 0);J.useEffect(()=>l==null?void 0:l(),[f,m]),J.useEffect(()=>C(void 0),[f]),J.useEffect(()=>{S&&u(S.err)},[S]);const E=async O=>{if(f==="Edit Citation"){if(O.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(O).then(()=>p("Insert Citation/Attachment(s)")).catch(A=>C({title:"Failed to update citation",err:A}))}else f==="Add Citation"&&await e(O).then(A=>{g([...m,A.id]),p("Insert Citation/Attachment(s)")}).catch(A=>C({title:"Failed to create citation",err:A}))},T=async O=>{if(f==="Edit Attachment"){if(O.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(O).then(()=>p("Insert Citation/Attachment(s)")).catch(A=>C({title:"Failed to update attachment",err:A}))}else f==="Add Attachment"&&await o(O).then(A=>{g([...m,A.id]),p("Insert Citation/Attachment(s)")}).catch(A=>C({title:"Failed to upload attachment",err:A}))};let w=null;return f==="Insert Citation/Attachment(s)"?w=v.jsx(Xee,{fetchExistingCitations:t,onCancel:s,onNewCitation:()=>{y(void 0),p("Add Citation")},onNewAttachment:()=>{y(void 0),p("Add Attachment")},onEditCitation:O=>{y(O.id),p("Edit Citation")},onEditAttachment:O=>{y(O.id),p("Edit Attachment")},onSelect:i,selectedIds:m,toggleCheckbox:O=>{const A=m.includes(O.id);g(A?m.filter(N=>N!==O.id):[...m,O.id])},onError:u}):f==="Add Citation"||f==="Edit Citation"?w=v.jsx(Qee,{id:b,onSave:E,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,setError:C}):(f==="Add Attachment"||f==="Edit Attachment")&&(w=v.jsx(Pte,{id:b,onSave:T,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,disableFileUpload:f==="Edit Attachment",setError:C})),v.jsxs(F.Box,{width:"500px",children:[v.jsx(F.Typography,{variant:"h6",children:f}),S&&v.jsx(h_,{"data-testid":"citation-menu-error",onClose:()=>C(void 0),children:S.title}),v.jsx(F.Box,{paddingTop:"8px",children:w})]})}const Wte=qt({name:{CitationBubbleMenuTipTap:g_}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function g_({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,...i}){const{classes:s}=Wte(),a=yt();if(!(a!=null&&a.isEditable))return null;if(!("citationBubbleMenuHandler"in a.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const l=a.storage.citationBubbleMenuHandler,u=l.isOpen,f=l.selectedIds,p=l.selectedNodePos,m=()=>{!a||!p||a.chain().focus().deleteRange({from:p,to:p+1}).run()},g=E=>{a&&a.chain().focus().insertContent({type:"citation",attrs:{ids:E}}).run()},b=E=>{!a||!p||a.chain().focus().command(({tr:T})=>{const w=p,O=T.doc.nodeAt(w);return O?(T.setNodeMarkup(w,void 0,{...O.attrs,ids:E}),!0):!1}).run()},y=E=>{E.length===0?m():f.length===0?g(E):b(E)},S=E=>{y(E),a.commands.closeCitationBubbleMenu()},C=()=>{y(f),a.commands.closeCitationBubbleMenu()};return v.jsx(Ef,{editor:a,open:u,...l.bubbleMenuOptions,...i,children:v.jsx("div",{className:s.content,children:v.jsx(m_,{fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:S,onCancel:C,initialSelectedIds:f,onContentUpdate:()=>{requestAnimationFrame(()=>{a!=null&&a.view&&a.view.dispatch(a.view.state.tr)})}})})})}const qte=on.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(ZD.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(JD.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(eP.configure(this.options.bulletList)),this.options.code!==!1&&t.push(tP.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(nP.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(rP.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(oP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(iP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(sP.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(CD.configure(this.options.heading)),this.options.history!==!1&&t.push(pP.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(hP.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(mP.configure(this.options.italic)),this.options.listItem!==!1&&t.push(PP.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(LP.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push($P.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(RP.configure(this.options.strike)),this.options.text!==!1&&t.push(BP.configure(this.options.text)),t}}),Ute=()=>on.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:void 0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=e!==void 0?o.nodeAt(e):void 0,s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return n.getAttributes,r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=void 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 Kte(t){const e=yt(),n=J.useRef(null);return v.jsx(ht,{buttonRef:n,tooltipLabel:"Insert Citation",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(F.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(kB,{fontSize:"small"}),v.jsx(F.Typography,{variant:"body2",children:"Insert Citation"})]})})}const y_=J.createContext(void 0),b_=()=>{const t=J.useContext(y_);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Yte=({node:t,HTMLAttributes:e,selected:n,extension:r})=>{const o=t.attrs.ids||[],{citations:i}=b_(),[s,a]=J.useState(String(o)),[l,u]=J.useState([]),f=r.options.citationMaxLength;return J.useEffect(()=>{const p=i.filter(g=>o.includes(g.id)),m=p.map(g=>ju.truncate(g.title,{length:f,omission:"..."})).join(", ");a(m),u(p)},[i,o]),v.jsx(f0,{as:"span",...e,children:v.jsx(F.Tooltip,{title:v.jsx(F.Box,{className:"citation-tooltip",children:l.map((p,m)=>{var b;const g=[p.source,p.title,p.fileName,(b=p.accessedAt)==null?void 0:b.slice(0,10),p.classification];return v.jsxs(F.Typography,{variant:"subtitle2",children:[g.filter(Boolean).join(" | "),m<l.length-1&&v.jsx(F.Divider,{className:"citation-tooltip-divider"})]},p.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:p=>{p.preventDefault(),p.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:s})})})},Gte=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",gt(t)]},addNodeView(){return p0(Yte)},addProseMirrorPlugins(){return[new Qt({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]}}),Jte=t=>{const{name:e,label:n=Cn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,fetchExistingCitations:l,onCreateCitation:u,onUpdateCitation:f,getCitationById:p,onStoreAttachment:m,onError:g=()=>{}}=t,b=[qte,FP.configure({placeholder:"Start typing here..."}),Ute(),Gte.configure({citationMaxLength:a})],[y,S,C]=Ht.useField({name:e}),{setValue:E}=C,{value:T}=y,{resync:w,addUpdateCitation:O}=b_();J.useEffect(()=>{var k,I;T!==((I=(k=A==null?void 0:A.current)==null?void 0:k.editor)==null?void 0:I.getHTML())&&setTimeout(()=>{var $,H,z;(z=(H=($=A==null?void 0:A.current)==null?void 0:$.editor)==null?void 0:H.commands)==null||z.setContent(T),w()},0)},[T]),J.useEffect(()=>{T&&setTimeout(()=>{var k,I,$;($=(I=(k=A==null?void 0:A.current)==null?void 0:k.editor)==null?void 0:I.commands)==null||$.setContent(T),w()},0)},[]);const A=J.useRef(null),N={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},_=()=>{var $,H;const k=((H=($=A.current)==null?void 0:$.editor)==null?void 0:H.getHTML())??"<p></p>",I=!k.replace(/<\/?p>|<br>/g,"").trim();E(I?"<p></p>":k)},L=v.jsxs(F.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...N[s],children:[v.jsx(Q2,{ref:A,extensions:b,content:T,editable:!i,renderControls:i?void 0:()=>v.jsx(Af,{children:v.jsx(Kte,{})}),onBlur:_,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(g_,{fetchExistingCitations:l,onCreateCitation:k=>u(k).then(I=>(O(I),I)),onUpdateCitation:k=>f(k).then(I=>(O(I),I)),getCitationById:p,onStoreAttachment:m,onError:g})}),v.jsx(Jn,{name:e,id:`${e}-err`})]});return v.jsxs(F.Box,{display:"flex",flexDirection:"column",width:"100%",children:[!r&&v.jsx(F.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),L]})},Zte=t=>{const{label:e="Return to Top",icon:n=_C,scrollThresholdPx:r=100}=t,o=F.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(F.Zoom,{in:o,children:v.jsx(F.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(F.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Xte=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=F.useTheme();return v.jsx(F.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(F.List,{children:[v.jsxs(F.ListItem,{children:[v.jsx(F.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(F.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(F.Divider,{variant:"inset",component:"li"}),v.jsxs(F.ListItem,{id:"testing",children:[v.jsx(F.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(F.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(F.ListItem,{children:[v.jsx(F.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(F.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Qte=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=KP();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,...Yn({...t},l)};return v.jsx(F.Stepper,{...u,children:e.map(f=>v.jsx(F.Step,{children:v.jsx(F.StepLabel,{children:f})},f))})},ene=t=>{const{name:e,label:n=Cn(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(s5,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:g="None",showDivider:b=!1,removePosition:y="bottom"}=t,[S]=Ht.useField({name:e}),{value:C}=S,E=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(F.FormControl,{fullWidth:!0,children:[v.jsx(F.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(F.Typography,{children:g}):v.jsx(Ht.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,O)=>v.jsx(J.Fragment,{children:v.jsx(tne,{variant:l,content:v.jsxs(F.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?E(y):{...y},children:[v.jsxs(F.Box,{width:"100%",children:[i(`${e}.${O}`,O),b&&O!==C.length-1&&v.jsx(F.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(F.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&v.jsx(F.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},tne=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(F.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(F.CardContent,{children:e})});case"elevatedCard":return v.jsx(F.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(F.CardContent,{children:e})});case"none":return e}},S1=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s="Cancel",closeButtonPosition:a="bottom",closeButtonProps:l={color:"primary",variant:"text"},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=()=>{if(a!=="top")return v.jsx(F.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},m=()=>i?v.jsx(F.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(F.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(F.Box,{children:p()}),v.jsxs(F.Box,{display:"flex",gap:".25rem",children:[...i]})]})}):v.jsx(F.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(F.Box,{children:p()})});return v.jsxs(F.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(F.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(F.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,a!=="bottom"&&v.jsx(F.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(DB,{})})]})}):r,o&&(typeof o=="string"?v.jsx(F.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(F.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),m()]})},nne=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeButtonProps:o={},...i}=t;return v.jsx(S1,{actions:[v.jsx(F.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],...i})},rne=t=>{const{closeBtnLabel:e="OK",closeButtonProps:n={color:"primary",variant:"contained"}}=t;return v.jsx(S1,{closeBtnLabel:e,closeButtonProps:n,...t})},one=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},...a}=t;return v.jsx(S1,{actions:[v.jsx(F.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(F.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],...a})},ine=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=F.useTheme(),a=Xr.useNavigate();return v.jsxs(F.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(F.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(F.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(F.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(F.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...gl(l,a),children:l.label},l.label))}),n&&v.jsx(F.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},v_=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=Xr.useLocation(),i=Xr.useNavigate(),[s,a]=J.useState(!1),l=(m,g)=>v.jsx(F.MenuList,{children:m.map(b=>v.jsxs(F.MenuItem,{...gl(b,i,()=>a(!1)),children:[b.icon&&v.jsx(F.ListItemIcon,{children:b.icon}),v.jsx(F.ListItemText,{primary:b.label})]},`mobile-drawer-group-${g}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(g=>g&&g.length>0);return m.length===0?null:m.map((g,b)=>v.jsxs(J.Fragment,{children:[l(g,b),b<m.length-1&&v.jsx(F.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(F.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(F.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(t5,{})}),v.jsx(F.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(F.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(F.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},x_=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(F.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(F.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},S_=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=Xr.useNavigate(),[i,s]=P.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(F.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(F.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(F.MenuItem,{...gl(f,o),children:[f.icon&&v.jsx(F.ListItemIcon,{children:f.icon}),v.jsx(F.ListItemText,{primary:f.label})]},f.label))})]})},C_=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(S_,{label:e,menuOptions:n,icon:v.jsx(r5,{})})},Op=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}=F.useTheme(),a=Xr.useNavigate();return v.jsx(F.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(F.Tab,{icon:l.icon,label:l.label,value:u,...gl(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))})},w_=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(F.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Op,{menuOptions:e,activeTabIdx:n,sx:r})})},T_=t=>{const{onToggle:e}=t,{palette:n}=F.useTheme(),r=n.mode==="dark";return v.jsx(F.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(NC,{}):v.jsx(PC,{})})},sne=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:g}=t,b=Xr.useNavigate(),y=F.useMediaQuery(F.useTheme().breakpoints.down("sm")),{palette:S}=F.useTheme(),{pathname:C}=Xr.useLocation(),E=S.mode==="dark",[T,w]=P.useState(void 0);P.useEffect(()=>{const N=o.findIndex(_=>_.path&&C.startsWith(_.path));w(N>=0?N:void 0)},[C,o]);const O=s&&v.jsx(T_,{onToggle:s}),A=s&&(y||!y&&l)?[{icon:E?v.jsx(NC,{}):v.jsx(PC,{}),label:`Switch to ${E?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(F.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(x_,{...e}),u,v.jsxs(F.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(F.Button,{disableRipple:!0,component:Xr.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(F.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&v.jsx(v_,{menuOptionLists:[o,a,A],anchor:"right"}),!y&&v.jsxs(v.Fragment,{children:[v.jsx(F.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,_)=>v.jsxs(F.Box,{display:"flex",alignItems:"center",children:[_>0&&v.jsx(F.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(F.Button,{variant:"text",sx:{color:"white"},...gl(N,b),children:v.jsxs(F.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&v.jsx(C_,{displayName:l,userMenuOptions:A})]})]})]}),!y&&v.jsx(w_,{featureMenuOptions:o,activeTabIdx:T,sx:g})]})},ane=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=Xr.useLocation(),o=F.useMediaQuery(F.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&v.jsx(F.Box,{sx:e,children:v.jsx(F.Card,{sx:{height:"100%",width:200},children:v.jsx(Op,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},lne=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=F.useTheme();return e.length>0&&v.jsx(Op,{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}})},cne=t=>v.jsx(tu,{severity:"success",...t}),une=t=>v.jsx(tu,{severity:"info",...t}),dne=t=>v.jsx(tu,{severity:"warning",...t}),E_=t=>{const{crumbInfo:e}=t,n=Xr.useNavigate();return v.jsx(F.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(n5,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(F.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(F.Typography,{color:"primary",children:r},r))})},fne=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=pne(r);return v.jsx(F.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:M_(r),warning:M_(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(F.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},pne=t=>t=="logout"?"info":t=="timeout"?"warning":t,M_=t=>{if(t=="timeout")return v.jsx(TB,{});if(t=="logout")return v.jsx(e5,{})},hne=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=F.useMediaQuery(F.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(F.Box,{sx:a,children:[i.length>0&&v.jsx(E_,{crumbInfo:i}),v.jsxs(F.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(F.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(F.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(p1,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(EB,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(F.Box,{width:l?"100%":"50%",children:s})]})]})},mne=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=F.useMediaQuery(F.useTheme().breakpoints.down("sm"));return v.jsxs(F.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(F.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(F.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(F.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},gne=({children:t,fetchExistingCitations:e})=>{const[n,r]=J.useState([]),o=J.useCallback(async()=>{const s=await e();r(a=>{const l=new Set(a.map(f=>f.id));return[...a.filter(f=>!l.has(f.id)),...s]})},[e]),i=J.useCallback(s=>{const a=n.findIndex(l=>l.id===s.id);r(a!==-1?l=>{const u=[...l];return u[a]=s,u}:[...n,s])},[n]);return v.jsx(y_.Provider,{value:{citations:n,resync:o,addUpdateCitation:i},children:t})};Ne.AlertModal=rne,Ne.Autocomplete=aC,Ne.Breadcrumbs=E_,Ne.Button=p1,Ne.Checkbox=tB,Ne.CheckboxGroup=nB,Ne.CitationField=Jte,Ne.CitationFieldProvider=gne,Ne.CitationMenu=m_,Ne.ConfirmationModal=nne,Ne.DarkModeToggle=T_,Ne.DateField=Dd,Ne.DateRangeField=Mq,Ne.DecisionModal=one,Ne.Drawer=v_,Ne.DynamicAutocomplete=QR,Ne.EnvironmentBanner=x_,Ne.Error=Jn,Ne.ErrorAlert=h_,Ne.FileList=iB,Ne.FileUpload=uC,Ne.FloatingNavBar=lne,Ne.Footer=ine,Ne.FormDebugger=Xte,Ne.Header=sne,Ne.InfoAlert=une,Ne.LoadingIndicator=f1,Ne.Location=xB,Ne.MenuButton=S_,Ne.MultiAutocomplete=eB,Ne.NavBar=w_,Ne.PageHeader=hne,Ne.PaginatedTable=qP,Ne.ProfileMenu=C_,Ne.RadioGroup=DC,Ne.RangeSlider=SB,Ne.RepeatableFormGroup=ene,Ne.RichTextField=Zee,Ne.ScrollToTop=Zte,Ne.SearchField=p5,Ne.Select=CB,Ne.Sidebar=ane,Ne.SingleActionCard=mne,Ne.Snackbar=fne,Ne.Stepper=Qte,Ne.Submit=YP,Ne.SuccessAlert=cne,Ne.Switch=wB,Ne.Table=WP,Ne.Tabs=Op,Ne.TextField=la,Ne.WarningAlert=dne,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});
403
+ `+(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=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,g=[];if(!m)return p([]);let b={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const S=i[y];S(b,f,function(E){E&&(Array.isArray(E)?g.push(...E):g.push(E)),--m<=0&&p(g)})}}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,g)=>this.resolve(f)._validate(u,f,m,g)}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)=>{ur.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new ur(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 ur.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new ur(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(ur.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(ur.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Qa(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=Xa({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=Xa({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Po.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Po.notNull){return this.nullability(!1,e)}required(e=Po.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=Po.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Xa(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=QP(e).map(i=>new js(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Cp(o,n):Cp.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Xa({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=Po.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Xa({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=Po.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Xa({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)}}}_o.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])_o.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=hte(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])_o.prototype[t]=_o.prototype.oneOf;for(const t of["not","nope"])_o.prototype[t]=_o.prototype.notOneOf;const mte=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function gte(t){const e=v1(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 v1(t){var e,n;const r=mte.exec(t);return r?{year:ni(r[1]),month:ni(r[2],1)-1,day:ni(r[3],1),hour:ni(r[4]),minute:ni(r[5]),second:ni(r[6]),millisecond:r[7]?ni(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:ni(r[10]),minuteOffset:ni(r[11])}:null}function ni(t,e=0){return Number(t)||e}let yte=/^[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])?)*$/,bte=/^((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,vte=/^(?:[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,xte="^\\d{4}-\\d{2}-\\d{2}",Ste="\\d{2}:\\d{2}:\\d{2}",Cte="(([+-]\\d{2}(:?\\d{2})?)|Z)",wte=new RegExp(`${xte}T${Ste}(\\.\\d+)?${Cte}$`),Tte=t=>Ws(t)||t===t.trim(),Ete={}.toString();function x1(){return new o_}class o_ extends _o{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===Ete?e:o})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Po.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=dr.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=dr.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=dr.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||dr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=dr.email){return this.matches(yte,{name:"email",message:e,excludeEmptyString:!0})}url(e=dr.url){return this.matches(bte,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=dr.uuid){return this.matches(vte,{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(wte,{name:"datetime",message:n||dr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||dr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=v1(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||dr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=v1(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=dr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Tte})}lowercase(e=dr.lowercase){return this.transform(n=>Ws(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ws(n)||n===n.toLowerCase()})}uppercase(e=dr.uppercase){return this.transform(n=>Ws(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>Ws(n)||n===n.toUpperCase()})}}x1.prototype=o_.prototype;let Mte=new Date(""),Ote=t=>Object.prototype.toString.call(t)==="[object Date]";class Ep extends _o{constructor(){super({type:"date",check(e){return Ote(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n,r)=>!r.spec.coerce||r.isType(e)||e===null?e:(e=gte(e),isNaN(e)?Ep.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(js.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=y1.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=y1.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)}})}}Ep.INVALID_DATE=Mte,Ep.prototype;function kte(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Hs.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),js.isRef(a)&&a.isSibling?i(a.path,s):b1(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return ote.array(Array.from(r),n).reverse()}function i_(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 s_(t){return(e,n)=>i_(t,e)-i_(t,n)}const Ate=(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 Mp(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Mp(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Mp(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Mp)}):"optional"in t?t.optional():t}const Ite=(t,e)=>{const n=[...Hs.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Hs.getter(Hs.join(n),!0)(t);return!!(o&&r in o)};let a_=t=>Object.prototype.toString.call(t)==="[object Object]";function l_(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Dte=s_([]);function c_(t){return new u_(t)}class u_ extends _o{constructor(e){super({type:"object",check(n){return a_(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Dte,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],g=p in o;if(m){let b,y=o[p];u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:y,context:n.context,parent:l});let S=m instanceof _o?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 g&&!s&&(l[p]=o[p]);(g!==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||!a_(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||js.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=kte(e,n),r._sortErrors=s_(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 Mp(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=Hs.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Ite(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Ate)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Sp.exact,test(n){if(n==null)return!0;const r=l_(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Sp.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=l_(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Sp.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(g1.camelCase)}snakeCase(){return this.transformKeys(g1.snakeCase)}constantCase(){return this.transformKeys(e=>g1.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}}c_.prototype=u_.prototype;const Pte=t=>{const{id:e,onSave:n,onCancel:r,getCitationById:o,disableFileUpload:i=!1,setError:s}=t,a=J.useRef(null),[l,u]=J.useState(!0),[f,p]=J.useState({title:"",file:void 0,fileName:""});return J.useEffect(()=>{if(e===void 0){u(!1);return}o(e).then(m=>{p({...m,file:void 0}),u(!1)}).catch(m=>{u(!1),s({title:"Failed to retrieve attachment",err:m})})},[]),v.jsx(Ht.Formik,{innerRef:a,enableReinitialize:!0,initialValues:f,validationSchema:c_().shape({title:x1().required("Title is required"),fileName:x1().required("A file is required")}),onSubmit:async m=>{u(!0),n(m).catch(g=>{u(!1),s({title:`Failed to ${e===void 0?"save":"update"} attachment`,err:g})}).finally(()=>u(!1))},children:({values:m,setFieldValue:g})=>{var b;return J.useEffect(()=>{var y,S;(y=m.file)!=null&&y.name&&g("fileName",(S=m.file)==null?void 0:S.name)},[(b=m.file)==null?void 0:b.name]),v.jsxs(Ht.Form,{autoComplete:"off",children:[v.jsx(la,{name:"title",disabled:l,required:!0,margin:"none"}),v.jsxs(F.Box,{display:"flex",flexDirection:"row",alignItems:"flex-start",children:[v.jsx(uC,{name:"file",readOnly:i}),m.fileName&&v.jsx("span",{style:{margin:"6px 0 0 10px"},children:m.fileName}),v.jsx(Jn,{name:"fileName",id:"fileName-err"})]}),v.jsxs(F.DialogActions,{sx:{px:0},children:[v.jsx(F.Button,{onClick:r,variant:"outlined",size:"small",children:"Cancel"}),v.jsx(F.Button,{type:"submit",color:"primary",variant:"contained",size:"small",disabled:l,children:e?"Update Attachment":"Add New Attachment"})]})]})}})};function _te(t){return Ue("MuiAlert",t)}const d_=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"]),Nte=Be(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"),Lte=Be(v.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),$te=Be(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"),Fte=Be(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"),Rte=Be(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"),Bte=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ae(n||r)}`,`${e}${Ae(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return qe(i,_te,o)},Vte=ye(ha,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ae(n.color||n.severity)}`]]}})(Dt(({theme:t})=>{const e=t.palette.mode==="light"?na:Ml,n=t.palette.mode==="light"?Ml:na;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Vn(["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),[`& .${d_.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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}`,[`& .${d_.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Vn(["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)}}}))]}})),zte=ye("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),Hte=ye("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),jte=ye("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),f_={success:v.jsx(Nte,{fontSize:"inherit"}),warning:v.jsx(Lte,{fontSize:"inherit"}),error:v.jsx($te,{fontSize:"inherit"}),info:v.jsx(Fte,{fontSize:"inherit"})},p_=P.forwardRef(function(e,n){const r=xt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=f_,onClose:g,role:b="alert",severity:y="success",slotProps:S={},slots:C={},variant:E="standard",...T}=r,w={...r,color:l,severity:y,variant:E,colorSeverity:l||y},O=Bte(w),A={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...S}},[N,_]=Bt("root",{ref:n,shouldForwardComponentProp:!0,className:_e(O.root,s),elementType:Vte,externalForwardedProps:{...A,...T},ownerState:w,additionalProps:{role:b,elevation:0}}),[L,k]=Bt("icon",{className:O.icon,elementType:zte,externalForwardedProps:A,ownerState:w}),[I,$]=Bt("message",{className:O.message,elementType:Hte,externalForwardedProps:A,ownerState:w}),[H,z]=Bt("action",{className:O.action,elementType:jte,externalForwardedProps:A,ownerState:w}),[R,B]=Bt("closeButton",{elementType:ba,externalForwardedProps:A,ownerState:w}),[W,U]=Bt("closeIcon",{elementType:Rte,externalForwardedProps:A,ownerState:w});return v.jsxs(N,{..._,children:[p!==!1?v.jsx(L,{...k,children:p||m[y]||f_[y]}):null,v.jsx(I,{...$,children:i}),o!=null?v.jsx(H,{...z,children:o}):null,o==null&&g?v.jsx(H,{...z,children:v.jsx(R,{size:"small","aria-label":a,title:a,color:"inherit",onClick:g,...B,children:v.jsx(W,{fontSize:"small",...U})})}):null]})});process.env.NODE_ENV!=="production"&&(p_.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 g;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=F.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(g=l[r])==null?void 0:g.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return v.jsxs(p_,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&v.jsx(F.Typography,{variant:"h3",children:s}),n]})},h_=t=>v.jsx(tu,{severity:"error",...t});function m_({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:i,onCancel:s,initialSelectedIds:a=[],onContentUpdate:l,onError:u=()=>{}}){const[f,p]=J.useState("Insert Citation/Attachment(s)"),[m,g]=J.useState(a),[b,y]=J.useState(void 0),[S,C]=J.useState(void 0);J.useEffect(()=>l==null?void 0:l(),[f,m]),J.useEffect(()=>C(void 0),[f]),J.useEffect(()=>{S&&u(S.err)},[S]);const E=async O=>{if(f==="Edit Citation"){if(O.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(O).then(()=>p("Insert Citation/Attachment(s)")).catch(A=>C({title:"Failed to update citation",err:A}))}else f==="Add Citation"&&await e(O).then(A=>{g([...m,A.id]),p("Insert Citation/Attachment(s)")}).catch(A=>C({title:"Failed to create citation",err:A}))},T=async O=>{if(f==="Edit Attachment"){if(O.id===void 0)throw Error("Failed to update citation. Citation is missing id");await n(O).then(()=>p("Insert Citation/Attachment(s)")).catch(A=>C({title:"Failed to update attachment",err:A}))}else f==="Add Attachment"&&await o(O).then(A=>{g([...m,A.id]),p("Insert Citation/Attachment(s)")}).catch(A=>C({title:"Failed to upload attachment",err:A}))};let w=null;return f==="Insert Citation/Attachment(s)"?w=v.jsx(Xee,{fetchExistingCitations:t,onCancel:s,onNewCitation:()=>{y(void 0),p("Add Citation")},onNewAttachment:()=>{y(void 0),p("Add Attachment")},onEditCitation:O=>{y(O.id),p("Edit Citation")},onEditAttachment:O=>{y(O.id),p("Edit Attachment")},onSelect:i,selectedIds:m,toggleCheckbox:O=>{const A=m.includes(O.id);g(A?m.filter(N=>N!==O.id):[...m,O.id])},onError:u}):f==="Add Citation"||f==="Edit Citation"?w=v.jsx(Qee,{id:b,onSave:E,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,setError:C}):(f==="Add Attachment"||f==="Edit Attachment")&&(w=v.jsx(Pte,{id:b,onSave:T,onCancel:()=>p("Insert Citation/Attachment(s)"),getCitationById:r,disableFileUpload:f==="Edit Attachment",setError:C})),v.jsxs(F.Box,{width:"500px",children:[v.jsx(F.Typography,{variant:"h6",children:f}),S&&v.jsx(h_,{"data-testid":"citation-menu-error",onClose:()=>C(void 0),children:S.title}),v.jsx(F.Box,{paddingTop:"8px",children:w})]})}const Wte=qt({name:{CitationBubbleMenuTipTap:g_}})(t=>({content:{padding:t.spacing(1.5,2,.5),backgroundColor:"#f9f9f9"}}));function g_({fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,...i}){const{classes:s}=Wte(),a=yt();if(!(a!=null&&a.isEditable))return null;if(!("citationBubbleMenuHandler"in a.storage))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const l=a.storage.citationBubbleMenuHandler,u=l.isOpen,f=l.selectedIds,p=l.selectedNodePos,m=()=>{!a||!p||a.chain().focus().deleteRange({from:p,to:p+1}).run()},g=E=>{a&&a.chain().focus().insertContent({type:"citation",attrs:{ids:E}}).run()},b=E=>{!a||!p||a.chain().focus().command(({tr:T})=>{const w=p,O=T.doc.nodeAt(w);return O?(T.setNodeMarkup(w,void 0,{...O.attrs,ids:E}),!0):!1}).run()},y=E=>{E.length===0?m():f.length===0?g(E):b(E)},S=E=>{y(E),a.commands.closeCitationBubbleMenu()},C=()=>{y(f),a.commands.closeCitationBubbleMenu()};return v.jsx(Ef,{editor:a,open:u,...l.bubbleMenuOptions,...i,children:v.jsx("div",{className:s.content,children:v.jsx(m_,{fetchExistingCitations:t,onCreateCitation:e,onUpdateCitation:n,getCitationById:r,onStoreAttachment:o,onSelectCitations:S,onCancel:C,initialSelectedIds:f,onContentUpdate:()=>{requestAnimationFrame(()=>{a!=null&&a.view&&a.view.dispatch(a.view.state.tr)})}})})})}const qte=on.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(ZD.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(JD.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(eP.configure(this.options.bulletList)),this.options.code!==!1&&t.push(tP.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(nP.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(rP.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(oP.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(iP.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(sP.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(CD.configure(this.options.heading)),this.options.history!==!1&&t.push(pP.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(hP.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(mP.configure(this.options.italic)),this.options.listItem!==!1&&t.push(PP.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(LP.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push($P.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(RP.configure(this.options.strike)),this.options.text!==!1&&t.push(BP.configure(this.options.text)),t}}),Ute=()=>on.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:void 0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=e!==void 0?o.nodeAt(e):void 0,s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return n.getAttributes,r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=void 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 Kte(t){const e=yt(),n=J.useRef(null);return v.jsx(ht,{buttonRef:n,tooltipLabel:"Insert Citation",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(F.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[v.jsx(kB,{fontSize:"small"}),v.jsx(F.Typography,{variant:"body2",children:"Insert Citation"})]})})}const y_=J.createContext(void 0),b_=()=>{const t=J.useContext(y_);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Yte=({node:t,HTMLAttributes:e,selected:n,extension:r})=>{const o=t.attrs.ids||[],{citations:i}=b_(),[s,a]=J.useState(String(o)),[l,u]=J.useState([]),f=r.options.citationMaxLength;return J.useEffect(()=>{const p=i.filter(g=>o.includes(g.id)),m=p.map(g=>ju.truncate(g.title,{length:f,omission:"..."})).join(", ");a(m),u(p)},[i,o]),v.jsx(f0,{as:"span",...e,children:v.jsx(F.Tooltip,{title:v.jsx(F.Box,{className:"citation-tooltip",children:l.map((p,m)=>{var b;const g=[p.source,p.title,p.fileName,p.url,(b=p.accessedAt)==null?void 0:b.slice(0,10),p.classification];return v.jsxs(F.Typography,{variant:"subtitle2",children:[g.filter(Boolean).join(" | "),m<l.length-1&&v.jsx(F.Divider,{className:"citation-tooltip-divider"})]},p.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:v.jsx("a",{href:"#",onClick:p=>{p.preventDefault(),p.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:s})})})},Gte=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",gt(t)]},addNodeView(){return p0(Yte)},addProseMirrorPlugins(){return[new Qt({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]}}),Jte=t=>{const{name:e,label:n=Cn(e),hideLabel:r=!1,required:o=!1,readOnly:i=!1,margin:s="dense",citationMaxLength:a=24,fetchExistingCitations:l,onCreateCitation:u,onUpdateCitation:f,getCitationById:p,onStoreAttachment:m,onError:g=()=>{}}=t,b=[qte,FP.configure({placeholder:"Start typing here..."}),Ute(),Gte.configure({citationMaxLength:a})],[y,S,C]=Ht.useField({name:e}),{setValue:E}=C,{value:T}=y,{resync:w,addUpdateCitation:O}=b_();J.useEffect(()=>{var k,I;T!==((I=(k=A==null?void 0:A.current)==null?void 0:k.editor)==null?void 0:I.getHTML())&&setTimeout(()=>{var $,H,z;(z=(H=($=A==null?void 0:A.current)==null?void 0:$.editor)==null?void 0:H.commands)==null||z.setContent(T),w()},0)},[T]),J.useEffect(()=>{T&&setTimeout(()=>{var k,I,$;($=(I=(k=A==null?void 0:A.current)==null?void 0:k.editor)==null?void 0:I.commands)==null||$.setContent(T),w()},0)},[]);const A=J.useRef(null),N={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},_=()=>{var $,H;const k=((H=($=A.current)==null?void 0:$.editor)==null?void 0:H.getHTML())??"<p></p>",I=!k.replace(/<\/?p>|<br>/g,"").trim();E(I?"<p></p>":k)},L=v.jsxs(F.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:i?0:50}}},...N[s],children:[v.jsx(Q2,{ref:A,extensions:b,content:T,editable:!i,renderControls:i?void 0:()=>v.jsx(Af,{children:v.jsx(Kte,{})}),onBlur:_,RichTextFieldProps:{variant:"outlined",MenuBarProps:{hide:i}},children:()=>v.jsx(g_,{fetchExistingCitations:l,onCreateCitation:k=>u(k).then(I=>(O(I),I)),onUpdateCitation:k=>f(k).then(I=>(O(I),I)),getCitationById:p,onStoreAttachment:m,onError:g})}),v.jsx(Jn,{name:e,id:`${e}-err`})]});return v.jsxs(F.Box,{display:"flex",flexDirection:"column",width:"100%",children:[!r&&v.jsx(F.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),L]})},Zte=t=>{const{label:e="Return to Top",icon:n=_C,scrollThresholdPx:r=100}=t,o=F.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return v.jsx(F.Zoom,{in:o,children:v.jsx(F.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:v.jsxs(F.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[v.jsx(n,{fontSize:"medium"}),e]})})})},Xte=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=F.useTheme();return v.jsx(F.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:v.jsxs(F.List,{children:[v.jsxs(F.ListItem,{children:[v.jsx(F.Typography,{display:"block",variant:"h6",children:"Values"}),v.jsx("br",{}),v.jsx(F.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(t,null,2)})]}),v.jsx(F.Divider,{variant:"inset",component:"li"}),v.jsxs(F.ListItem,{id:"testing",children:[v.jsx(F.Typography,{display:"block",variant:"h6",children:"Errors"}),v.jsx("br",{}),v.jsx(F.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(e,null,2)})]}),v.jsxs(F.ListItem,{children:[v.jsx(F.Typography,{display:"block",variant:"h6",children:"Status"}),v.jsx("br",{}),v.jsx(F.Divider,{variant:"inset"}),v.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Qte=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=KP();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,...Yn({...t},l)};return v.jsx(F.Stepper,{...u,children:e.map(f=>v.jsx(F.Step,{children:v.jsx(F.StepLabel,{children:f})},f))})},ene=t=>{const{name:e,label:n=Cn(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(s5,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:g="None",showDivider:b=!1,removePosition:y="bottom"}=t,[S]=Ht.useField({name:e}),{value:C}=S,E=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return v.jsxs(F.FormControl,{fullWidth:!0,children:[v.jsx(F.Typography,{...r,children:n}),m&&S.value.length===0?v.jsx(F.Typography,{children:g}):v.jsx(Ht.FieldArray,{name:e,render:T=>v.jsxs("div",{children:[C.map((w,O)=>v.jsx(J.Fragment,{children:v.jsx(tne,{variant:l,content:v.jsxs(F.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?E(y):{...y},children:[v.jsxs(F.Box,{width:"100%",children:[i(`${e}.${O}`,O),b&&O!==C.length-1&&v.jsx(F.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&v.jsx(F.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&v.jsx(F.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},tne=({variant:t,content:e})=>{switch(t){case"card":return v.jsx(F.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:v.jsx(F.CardContent,{children:e})});case"elevatedCard":return v.jsx(F.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:v.jsx(F.CardContent,{children:e})});case"none":return e}},S1=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s="Cancel",closeButtonPosition:a="bottom",closeButtonProps:l={color:"primary",variant:"text"},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=()=>{if(a!=="top")return v.jsx(F.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},m=()=>i?v.jsx(F.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsxs(F.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[v.jsx(F.Box,{children:p()}),v.jsxs(F.Box,{display:"flex",gap:".25rem",children:[...i]})]})}):v.jsx(F.DialogActions,{className:"MBv2_Modal_Actions",children:v.jsx(F.Box,{children:p()})});return v.jsxs(F.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?v.jsx(F.DialogTitle,{className:"MBv2_Modal_Title",children:v.jsxs(F.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,a!=="bottom"&&v.jsx(F.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:v.jsx(DB,{})})]})}):r,o&&(typeof o=="string"?v.jsx(F.DialogContent,{className:"MBv2_Modal_Content",children:v.jsx(F.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),m()]})},nne=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeButtonProps:o={},...i}=t;return v.jsx(S1,{actions:[v.jsx(F.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],...i})},rne=t=>{const{closeBtnLabel:e="OK",closeButtonProps:n={color:"primary",variant:"contained"}}=t;return v.jsx(S1,{closeBtnLabel:e,closeButtonProps:n,...t})},one=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},...a}=t;return v.jsx(S1,{actions:[v.jsx(F.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),v.jsx(F.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],...a})},ine=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=F.useTheme(),a=Xr.useNavigate();return v.jsxs(F.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[v.jsx(F.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(F.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[v.jsx(F.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(F.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...gl(l,a),children:l.label},l.label))}),n&&v.jsx(F.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},v_=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=Xr.useLocation(),i=Xr.useNavigate(),[s,a]=J.useState(!1),l=(m,g)=>v.jsx(F.MenuList,{children:m.map(b=>v.jsxs(F.MenuItem,{...gl(b,i,()=>a(!1)),children:[b.icon&&v.jsx(F.ListItemIcon,{children:b.icon}),v.jsx(F.ListItemText,{primary:b.label})]},`mobile-drawer-group-${g}-item-${b.path}`))}),f=(()=>{if(e){const m=e.filter(g=>g&&g.length>0);return m.length===0?null:m.map((g,b)=>v.jsxs(J.Fragment,{children:[l(g,b),b<m.length-1&&v.jsx(F.Divider,{})]},`mobile-drawer-group-${b}`))}return r?v.jsx(F.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&v.jsxs(v.Fragment,{children:[v.jsx(F.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:v.jsx(t5,{})}),v.jsx(F.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:v.jsx(F.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:v.jsx(F.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},x_=t=>{const{env:e,isProd:n}=t;return n?null:v.jsx(F.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:v.jsxs(F.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},S_=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=Xr.useNavigate(),[i,s]=P.useState(null),a=!!i,l=f=>{s(f.currentTarget)},u=()=>{s(null)};return n.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(F.Button,{startIcon:r,variant:"outlined",color:"inherit",sx:{minWidth:0,padding:1},onClick:l,children:e}),v.jsx(F.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(f=>v.jsxs(F.MenuItem,{...gl(f,o),children:[f.icon&&v.jsx(F.ListItemIcon,{children:f.icon}),v.jsx(F.ListItemText,{primary:f.label})]},f.label))})]})},C_=t=>{const{displayName:e,userMenuOptions:n}=t;return v.jsx(S_,{label:e,menuOptions:n,icon:v.jsx(r5,{})})},Op=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}=F.useTheme(),a=Xr.useNavigate();return v.jsx(F.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>v.jsx(F.Tab,{icon:l.icon,label:l.label,value:u,...gl(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))})},w_=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&v.jsx(F.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:v.jsx(Op,{menuOptions:e,activeTabIdx:n,sx:r})})},T_=t=>{const{onToggle:e}=t,{palette:n}=F.useTheme(),r=n.mode==="dark";return v.jsx(F.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?v.jsx(NC,{}):v.jsx(PC,{})})},sne=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:g}=t,b=Xr.useNavigate(),y=F.useMediaQuery(F.useTheme().breakpoints.down("sm")),{palette:S}=F.useTheme(),{pathname:C}=Xr.useLocation(),E=S.mode==="dark",[T,w]=P.useState(void 0);P.useEffect(()=>{const N=o.findIndex(_=>_.path&&C.startsWith(_.path));w(N>=0?N:void 0)},[C,o]);const O=s&&v.jsx(T_,{onToggle:s}),A=s&&(y||!y&&l)?[{icon:E?v.jsx(NC,{}):v.jsx(PC,{}),label:`Switch to ${E?"Light":"Dark"} mode`,onClick:s},...i]:i;return v.jsxs(F.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&v.jsx(x_,{...e}),u,v.jsxs(F.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[v.jsx(F.Button,{disableRipple:!0,component:Xr.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(F.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&v.jsx(v_,{menuOptionLists:[o,a,A],anchor:"right"}),!y&&v.jsxs(v.Fragment,{children:[v.jsx(F.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,_)=>v.jsxs(F.Box,{display:"flex",alignItems:"center",children:[_>0&&v.jsx(F.Typography,{className:"quickLink-divider",color:S.primary.contrastText,children:"|"}),v.jsx(F.Button,{variant:"text",sx:{color:"white"},...gl(N,b),children:v.jsxs(F.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&v.jsx(C_,{displayName:l,userMenuOptions:A})]})]})]}),!y&&v.jsx(w_,{featureMenuOptions:o,activeTabIdx:T,sx:g})]})},ane=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=Xr.useLocation(),o=F.useMediaQuery(F.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&v.jsx(F.Box,{sx:e,children:v.jsx(F.Card,{sx:{height:"100%",width:200},children:v.jsx(Op,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},lne=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=F.useTheme();return e.length>0&&v.jsx(Op,{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}})},cne=t=>v.jsx(tu,{severity:"success",...t}),une=t=>v.jsx(tu,{severity:"info",...t}),dne=t=>v.jsx(tu,{severity:"warning",...t}),E_=t=>{const{crumbInfo:e}=t,n=Xr.useNavigate();return v.jsx(F.Breadcrumbs,{"aria-label":"breadcrumb",separator:v.jsx(n5,{color:"primary"}),sx:{marginBottom:2},children:e.map(({label:r,path:o},i)=>o&&i<e.length-1?v.jsx(F.Link,{color:"primary",sx:{cursor:"pointer"},onClick:()=>n(o),children:r},r):v.jsx(F.Typography,{color:"primary",children:r},r))})},fne=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i=8e3,variant:s="leftBorder",elevation:a=6}=t,l=pne(r);return v.jsx(F.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:M_(r),warning:M_(r)},onClose:o,elevation:a,variant:s,children:n?v.jsxs(v.Fragment,{children:[v.jsx(F.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},pne=t=>t=="logout"?"info":t=="timeout"?"warning":t,M_=t=>{if(t=="timeout")return v.jsx(TB,{});if(t=="logout")return v.jsx(e5,{})},hne=t=>{const{title:e,createButtonLabel:n,showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a}=t,l=F.useMediaQuery(F.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(F.Box,{sx:a,children:[i.length>0&&v.jsx(E_,{crumbInfo:i}),v.jsxs(F.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:l?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[v.jsxs(F.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(F.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&v.jsxs(p1,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[v.jsx(EB,{style:{marginRight:"0.5rem"}}),n]})]}),s&&v.jsx(F.Box,{width:l?"100%":"50%",children:s})]})]})},mne=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=F.useMediaQuery(F.useTheme().breakpoints.down("sm"));return v.jsxs(F.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&v.jsx(F.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(F.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,v.jsx(F.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},gne=({children:t,fetchExistingCitations:e})=>{const[n,r]=J.useState([]),o=J.useCallback(async()=>{const s=await e();r(a=>{const l=new Set(a.map(f=>f.id));return[...a.filter(f=>!l.has(f.id)),...s]})},[e]),i=J.useCallback(s=>{const a=n.findIndex(l=>l.id===s.id);r(a!==-1?l=>{const u=[...l];return u[a]=s,u}:[...n,s])},[n]);return v.jsx(y_.Provider,{value:{citations:n,resync:o,addUpdateCitation:i},children:t})};Ne.AlertModal=rne,Ne.Autocomplete=aC,Ne.Breadcrumbs=E_,Ne.Button=p1,Ne.Checkbox=tB,Ne.CheckboxGroup=nB,Ne.CitationField=Jte,Ne.CitationFieldProvider=gne,Ne.CitationMenu=m_,Ne.ConfirmationModal=nne,Ne.DarkModeToggle=T_,Ne.DateField=Dd,Ne.DateRangeField=Mq,Ne.DecisionModal=one,Ne.Drawer=v_,Ne.DynamicAutocomplete=QR,Ne.EnvironmentBanner=x_,Ne.Error=Jn,Ne.ErrorAlert=h_,Ne.FileList=iB,Ne.FileUpload=uC,Ne.FloatingNavBar=lne,Ne.Footer=ine,Ne.FormDebugger=Xte,Ne.Header=sne,Ne.InfoAlert=une,Ne.LoadingIndicator=f1,Ne.Location=xB,Ne.MenuButton=S_,Ne.MultiAutocomplete=eB,Ne.NavBar=w_,Ne.PageHeader=hne,Ne.PaginatedTable=qP,Ne.ProfileMenu=C_,Ne.RadioGroup=DC,Ne.RangeSlider=SB,Ne.RepeatableFormGroup=ene,Ne.RichTextField=Zee,Ne.ScrollToTop=Zte,Ne.SearchField=p5,Ne.Select=CB,Ne.Sidebar=ane,Ne.SingleActionCard=mne,Ne.Snackbar=fne,Ne.Stepper=Qte,Ne.Submit=YP,Ne.SuccessAlert=cne,Ne.Switch=wB,Ne.Table=WP,Ne.Tabs=Op,Ne.TextField=la,Ne.WarningAlert=dne,Object.defineProperty(Ne,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simoncomputing/mui-bueno-v2",
3
3
  "private": false,
4
- "version": "0.14.9",
4
+ "version": "0.14.10",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
7
7
  "module": "./dist/index.es.js",