@simoncomputing/mui-bueno-v2 0.34.1 → 0.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
11
11
|
- Minor increment --> singlular/minor changes. Minimal breaking changes.
|
|
12
12
|
- Patch increment --> singlular/minor changes. Zero breaking changes.
|
|
13
13
|
|
|
14
|
+
## [0.34.2] - 2026-07-07
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `CitationField`
|
|
19
|
+
- Required field asterisks will not display when in read-only mode
|
|
20
|
+
|
|
14
21
|
## [0.34.1] - 2026-07-06
|
|
15
22
|
|
|
16
23
|
### Added
|
package/dist/index.cjs.js
CHANGED
|
@@ -405,4 +405,4 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
405
405
|
|
|
406
406
|
attempted value: ${s}
|
|
407
407
|
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,b=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const x=i[y];x(v,f,function(k){k&&(Array.isArray(k)?b.push(...k):b.push(k)),--m<=0&&p(b)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,b)=>this.resolve(f)._validate(u,f,m,b)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{fr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new fr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw fr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new fr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(fr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(fr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):gl(n)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,n){const r=this.clone({nullable:e});return r.internalTests.nullable=sl({message:n,name:"nullable",test(o){return o===null?this.schema.spec.nullable:!0}}),r}optionality(e,n){const r=this.clone({optional:e});return r.internalTests.optionality=sl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=Fo.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=Fo.notNull){return this.nullability(!1,e)}required(e=Fo.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=Fo.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=sl(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=qD(e).map(i=>new Pa(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new ih(o,n):ih.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=sl({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=Fo.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=sl({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=Fo.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=sl({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?JD(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof fr)return{issues:ZD(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=Oue(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const Rue=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Iue(t){const e=E0(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let n=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(n=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(n=0-n)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+n,e.second,e.millisecond)}function E0(t){var e,n;const r=Rue.exec(t);return r?{year:xi(r[1]),month:xi(r[2],1)-1,day:xi(r[3],1),hour:xi(r[4]),minute:xi(r[5]),second:xi(r[6]),millisecond:r[7]?xi(r[7].substring(0,3)):0,precision:(e=(n=r[7])==null?void 0:n.length)!=null?e:void 0,z:r[8]||void 0,plusMinus:r[9]||void 0,hourOffset:xi(r[10]),minuteOffset:xi(r[11])}:null}function xi(t,e=0){return Number(t)||e}let Due=/^[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])?)*$/,Aue=/^((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,Pue=/^(?:[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,Nue="^\\d{4}-\\d{2}-\\d{2}",jue="\\d{2}:\\d{2}:\\d{2}",$ue="(([+-]\\d{2}(:?\\d{2})?)|Z)",Lue=new RegExp(`${Nue}T${jue}(\\.\\d+)?${$ue}$`),Bue=t=>la(t)||t===t.trim(),Fue={}.toString();function kl(){return new QD}class QD extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===Fue?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||Fo.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=xr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=xr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=xr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||xr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=xr.email){return this.matches(Due,{name:"email",message:e,excludeEmptyString:!0})}url(e=xr.url){return this.matches(Aue,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=xr.uuid){return this.matches(Pue,{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(Lue,{name:"datetime",message:n||xr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||xr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=E0(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||xr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=E0(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=xr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:Bue})}lowercase(e=xr.lowercase){return this.transform(n=>la(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>la(n)||n===n.toLowerCase()})}uppercase(e=xr.uppercase){return this.transform(n=>la(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>la(n)||n===n.toUpperCase()})}}kl.prototype=QD.prototype;let eA=new Date(""),Vue=t=>Object.prototype.toString.call(t)==="[object Date]";function Rx(){return new Zu}class Zu extends ti{constructor(){super({type:"date",check(e){return Vue(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=Iue(e),isNaN(e)?Zu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Pa.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=k0.min){let r=this.prepareParam(e,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(o){return o>=this.resolve(r)}})}max(e,n=k0.max){let r=this.prepareParam(e,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(o){return o<=this.resolve(r)}})}}Zu.INVALID_DATE=eA;Rx.prototype=Zu.prototype;Rx.INVALID_DATE=eA;function zue(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=ma.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Pa.isRef(a)&&a.isSibling?i(a.path,s):_x(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return mue.array(Array.from(r),n).reverse()}function iO(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 tA(t){return(e,n)=>iO(t,e)-iO(t,n)}const Hue=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function Gf(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=Gf(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=Gf(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(Gf)}):"optional"in t?t.optional():t}const Wue=(t,e)=>{const n=[...ma.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=ma.getter(ma.join(n),!0)(t);return!!(o&&r in o)};let sO=t=>Object.prototype.toString.call(t)==="[object Object]";function aO(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const Uue=tA([]);function Ix(t){return new nA(t)}class nA extends ti{constructor(e){super({type:"object",check(n){return sO(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=Uue,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],b=p in o,v=o[p];if(m){let y;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,C=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}y=!n.__validating||!C?m.cast(v,u):v,y!==void 0&&(l[p]=y)}else b&&!s&&(l[p]=v);(b!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!sO(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Pa.isRef(m)||f.push(m.asNestedTest({options:n,key:p,parent:u,parentPath:n.path,originalParent:s}))}this.runTests({tests:f,value:u,originalValue:s,options:n},r,p=>{o(p.sort(this._sortErrors).concat(l),u)})})}clone(e){const n=super.clone(e);return n.fields=Object.assign({},this.fields),n._nodes=this._nodes,n._excludedEdges=this._excludedEdges,n._sortErrors=this._sortErrors,n}concat(e){let n=super.concat(e),r=n.fields;for(let[o,i]of Object.entries(this.fields)){const s=r[o];r[o]=s===void 0?i:s}return n.withMutation(o=>o.setFields(r,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if("default"in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let n={};return this._nodes.forEach(r=>{var o;const i=this.fields[r];let s=e;(o=s)!=null&&o.value&&(s=Object.assign({},s,{parent:s.value,value:s.value[r]})),n[r]=i&&"getDefault"in i?i.getDefault(s):void 0}),n}setFields(e,n){let r=this.clone();return r.fields=e,r._nodes=zue(e,n),r._sortErrors=tA(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return Gf(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=ma.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return Wue(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(Hue)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||Yf.exact,test(n){if(n==null)return!0;const r=aO(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=Yf.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=aO(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=Yf.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(gb.camelCase)}snakeCase(){return this.transformKeys(gb.snakeCase)}constantCase(){return this.transformKeys(e=>gb.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}Ix.prototype=nA.prototype;const que=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return g.jsx(V.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:g.jsxs(Ru,{component:V.Paper,p:1,boxShadow:9,gap:.25,children:[g.jsx(V.Typography,{variant:"body1",children:"Paste in a preformatted citation"}),g.jsx(V.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),g.jsx(Ht.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(Gue(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>g.jsxs(Ko,{flexWrap:"wrap",justifyContent:"flex-end",children:[g.jsx(wI,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:g.jsx(V.Tooltip,{title:"Paste from Clipboard",children:g.jsx(V.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:g.jsx(vne,{})})})}),g.jsxs(Ko,{children:[g.jsx(Sr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),g.jsx(Sr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},Kue=["https://","http://","www."],Yue=new RegExp(Kue.join("|")),Gue=t=>{const e=t.replace(/\.\s*$/,"").split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.match(Yue)),r=e.findIndex(f=>f.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(f=>/\bSOURCE\b/.test(f.toUpperCase()));let s=[n,r,o].find(f=>f!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Ef(e,l),title:Ef(e,a),url:Ef(e,n),accessedAt:Jue(e,r),classification:Xue(e,o),details:Ef(e,o)}},Ef=(t,e)=>e<0||e>=t.length?"":t[e],Jue=(t,e)=>e<0||e>=t.length?"":ace(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),Xue=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",rA=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return g.jsx(Sr,{type:n,disabled:e,size:r,startIcon:e?g.jsx(V.CircularProgress,{size:s,color:"inherit"}):null,...o})},oA=t=>{const{onCancel:e,onViewCitationTable:n,readOnly:r=!1,showViewAllCitationsBtn:o=!1,isLoading:i,onSaveClicked:s}=t;return r&&!o?null:r?g.jsx(V.DialogActions,{sx:{px:0},children:g.jsx(V.Button,{onClick:n,size:"small",variant:"outlined",children:"Back To Table"})}):g.jsxs(V.DialogActions,{sx:{px:0,justifyContent:"space-between"},children:[g.jsx(V.Box,{children:o&&g.jsx(V.Button,{onClick:n,size:"small",variant:"outlined",children:"View All Citations"})}),g.jsxs(Ko,{children:[g.jsx(V.Button,{onClick:e,variant:"outlined",size:"small",children:"Cancel"}),g.jsx(rA,{size:"small",loading:i,type:"button",onClick:s,children:"Save"})]})]})},Zue=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,canLaunchUrl:l}=t,u=J.useRef(null),[f,p]=J.useState(!1),[m,b]=J.useState(!1),v=J.useRef(null),[y,x]=J.useState(!1),[C,k]=J.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});J.useEffect(()=>{i&&k({...i,type:"Url"})},[]);const T={disabled:f,margin:"none",readOnly:s},S=!s;return g.jsxs(V.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(Ko,{justifyContent:"space-between",children:[g.jsxs(Ko,{gap:2,children:[g.jsxs(V.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Citation"]}),S&&g.jsx(V.Button,{variant:"outlined",size:"small",ref:v,onClick:()=>x(!0),children:"Paste & Prefill"})]}),g.jsx(V.IconButton,{onClick:o,children:g.jsx(tm,{})})]}),g.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:C,onSubmit:async O=>{p(!0),e(O).catch(R=>{throw p(!1),R}).finally(()=>p(!1))},validationSchema:Ix({title:kl().required("Title is required"),accessedAt:Rx().required("Accessed At is required"),url:kl().required("URL is required"),classification:kl().required("Classification is required")}),validateOnBlur:m,validateOnChange:m,children:({submitForm:O,setValues:R,values:P})=>g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsxs(V.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[g.jsx(_i,{...T,name:"title",required:!0}),g.jsx(_i,{...T,name:"source"}),g.jsx(_i,{...T,name:"details",label:"Details (e.g. Source Description)"}),g.jsx(Ip,{...T,name:"accessedAt",required:!0,isDatePicker:!0}),s&&(l!=null&&l(P))?g.jsx(g.Fragment,{children:g.jsx(Fi,{label:"URL / Other Identifier",readOnlyValue:g.jsx(T0,{citation:P,canLaunchUrl:l,asLink:!0}),value:P.url??""})}):g.jsx(_i,{...T,name:"url",label:"URL / Other Identifier",required:!0,endIcon:g.jsx(T0,{citation:P,canLaunchUrl:l})}),g.jsx(xI,{...T,name:"classification",row:!0,required:!0,radios:Que})]}),g.jsx(oA,{isLoading:f,onSaveClicked:()=>{b(!0),O()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n}),g.jsx(que,{open:y,onGenerateCitation:j=>{R(j,!0)},anchorEl:v.current,onClose:()=>x(!1)})]})})]})},Que=[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],ede=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,onDownloadAttachment:l,onPreviewAttachment:u}=t,f=J.useRef(null),[p,m]=J.useState(!1),[b,v]=J.useState(!1),[y,x]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{i&&x({...i,type:"Attachment",file:void 0})},[]),g.jsxs(V.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(V.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[g.jsxs(V.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Attachment"]}),g.jsx(V.IconButton,{onClick:o,children:g.jsx(tm,{})})]}),g.jsx(Ht.Formik,{innerRef:f,enableReinitialize:!0,initialValues:y,validationSchema:Ix().shape({title:kl().required("Title is required"),fileName:kl().required("A file is required")}),validateOnBlur:b,validateOnChange:b,onSubmit:async C=>{m(!0),e(C).catch(k=>{throw m(!1),k}).finally(()=>m(!1))},children:({values:C,setFieldValue:k,handleSubmit:T})=>{var O;const S=!s&&!C.id;return J.useEffect(()=>{var R,P;(R=C.file)!=null&&R.name&&k("fileName",(P=C.file)==null?void 0:P.name)},[(O=C.file)==null?void 0:O.name]),g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsx(_i,{name:"title",disabled:p,required:!0,margin:"none",readOnly:s}),g.jsxs(V.Box,{marginTop:S?1:0,children:[g.jsxs(Ko,{alignItems:"flex-start",children:[S&&g.jsx(yI,{name:"file",errorMode:"hidden"}),g.jsxs(Ko,{alignItems:"flex-end",children:[g.jsx(_i,{readOnly:!0,name:"fileName",label:S?"":"File Name"}),!S&&g.jsxs(Ko,{children:[g.jsx(HD,{citation:C,onDownloadAttachment:l}),g.jsx(WD,{citation:C,onPreviewAttachment:u})]})]})]}),g.jsx(Mr,{name:"fileName"})]}),g.jsx(oA,{isLoading:p,onSaveClicked:()=>{v(!0),T()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n})]})}})]})},Qu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",b=()=>{if(s&&p)return g.jsx(V.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return g.jsx(V.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[g.jsx(V.Box,{children:b()}),g.jsxs(V.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return g.jsx(V.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsx(V.Box,{children:b()})})};return g.jsxs(V.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?g.jsx(V.DialogTitle,{className:"MBv2_Modal_Title",children:g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&g.jsx(V.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:g.jsx(tm,{})})]})}):r,o&&(typeof o=="string"?g.jsx(V.DialogContent,{className:"MBv2_Modal_Content",children:g.jsx(V.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function tde(t){return qe("MuiAlert",t)}const lO=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"]),nde=Ne(g.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),rde=Ne(g.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),ode=Ne(g.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),ide=Ne(g.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),sde=Ne(g.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),ade=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Pe(n||r)}`,`${e}${Pe(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return Ue(i,tde,o)},lde=oe(Rs,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Pe(n.color||n.severity)}`]]}})(vt(({theme:t})=>{const e=t.palette.mode==="light"?ba:Ml,n=t.palette.mode==="light"?Ml:ba;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Ln(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${lO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${lO.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Ln(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),cde=oe("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),ude=oe("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),dde=oe("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),cO={success:g.jsx(nde,{fontSize:"inherit"}),warning:g.jsx(rde,{fontSize:"inherit"}),error:g.jsx(ode,{fontSize:"inherit"}),info:g.jsx(ide,{fontSize:"inherit"})},iA=D.forwardRef(function(e,n){const r=mt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=cO,onClose:b,role:v="alert",severity:y="success",slotProps:x={},slots:C={},variant:k="standard",...T}=r,S={...r,color:l,severity:y,variant:k,colorSeverity:l||y},O=ade(S),R={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...C},slotProps:{...f,...x}},[P,j]=Mt("root",{ref:n,shouldForwardComponentProp:!0,className:ye(O.root,s),elementType:lde,externalForwardedProps:{...R,...T},ownerState:S,additionalProps:{role:v,elevation:0}}),[F,M]=Mt("icon",{className:O.icon,elementType:cde,externalForwardedProps:R,ownerState:S}),[$,z]=Mt("message",{className:O.message,elementType:ude,externalForwardedProps:R,ownerState:S}),[L,A]=Mt("action",{className:O.action,elementType:dde,externalForwardedProps:R,ownerState:S}),[_,I]=Mt("closeButton",{elementType:Zl,externalForwardedProps:R,ownerState:S}),[B,W]=Mt("closeIcon",{elementType:sde,externalForwardedProps:R,ownerState:S});return g.jsxs(P,{...j,children:[p!==!1?g.jsx(F,{...M,children:p||m[y]||cO[y]}):null,g.jsx($,{...z,children:i}),o!=null?g.jsx(L,{...A,children:o}):null,o==null&&b?g.jsx(L,{...A,children:g.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:b,...I,children:g.jsx(B,{fontSize:"small",...W})})}):null]})});process.env.NODE_ENV!=="production"&&(iA.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const ed=t=>{var b;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=V.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(b=l[r])==null?void 0:b.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return g.jsxs(iA,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&g.jsx(V.Typography,{variant:"h3",children:s}),n]})},sA=t=>g.jsx(ed,{severity:"error",...t}),aA=t=>g.jsx(ed,{severity:"success",...t}),fde=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return g.jsxs(g.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&g.jsx(sA,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&g.jsx(aA,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function lA({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onClose:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:b=!1,tableTitle:v="Attachments & Citations",addlActions:y,canLaunchUrl:x,readOnly:C,canSearch:k=!1}){const[T,S]=J.useState("Insert Citation/Attachment(s)"),[O,R]=J.useState(u),[P,j]=J.useState(void 0),[F,M]=J.useState(void 0),[$,z]=J.useState(!1),[L,A]=J.useState(!1),_=ee=>{M(void 0),S(ee)},[I,B]=J.useState(0);J.useEffect(()=>{f==null||f()},[T,F,f]);const W=(ee=!1)=>{(!m||ee)&&B(ie=>ie+1)},K=(ee,ie)=>{var Me;const we=typeof((Me=ie.response)==null?void 0:Me.data)=="string"&&ie.response.data,Se=typeof ie.message=="string"&&ie.message;M({type:"Error",title:ee,message:we??Se}),p(ie)},U=ee=>M({type:"Success",title:"",message:ee}),Y=async ee=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");ee.id?await(n==null?void 0:n(ee).then(()=>{$?l():(_("Insert Citation/Attachment(s)"),W())}).catch(ie=>{K("Failed to update",ie)})):await(e==null?void 0:e(ee).then(ie=>{R([...O,ie.id]),_("Insert Citation/Attachment(s)"),W()}).catch(ie=>{K("Failed to create",ie)}))},fe=r&&(async ee=>r(ee).then(()=>{W(!0),R(O.filter(ie=>ie!==ee)),U("Successfully deleted")}).catch(ie=>K("Failed to delete",ie))),ue=o&&(ee=>{o(ee).then(ie=>{const we=!!ie.fileName;j(ie),_(we?"Attachment":"Citation")}).catch(ie=>{K("Failed to load",ie)}).finally(()=>A(!1))}),pe=n&&ue,Z=n&&ue,te=i&&(async ee=>i(ee).catch(ie=>{K(`Failed to download ${ee.fileName}`,ie)})),ce=s&&(async ee=>s(ee).catch(ie=>{K(`Failed to view ${ee.fileName}`,ie)})),ne=g.jsx(uue,{refreshKey:I,getCitationsPaginated:(ee,ie)=>t(ee,ie).then(we=>(f==null||f(),we)),onCancel:l,onNewCitation:()=>{j(void 0),_("Citation")},onNewAttachment:()=>{j(void 0),_("Attachment")},onEditCitation:pe,onEditAttachment:Z,onViewCitation:ue,onViewAttachment:ue,onDeleteCitation:fe,onDownloadAttachment:te,onPreviewAttachment:ce,onSelect:a,setSelectedIds:R,selectedIds:O,onError:p,condenseTable:m,canSelect:b,title:v,addlActions:y,canCreate:!!e,canLaunchUrl:x,readOnly:C,showCloseBtn:m,canSearch:k}),re=g.jsx(Zue,{modifyCitation:P,onSave:Y,onCancel:()=>$?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),z(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),readOnly:C,showViewAllCitationsBtn:C&&!$||!C&&$,canLaunchUrl:x}),le=g.jsx(ede,{onSave:Y,onCancel:()=>$?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),z(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),modifyCitation:P,readOnly:C,showViewAllCitationsBtn:C&&!$||!C&&$,onDownloadAttachment:te,onPreviewAttachment:ce}),ge=g.jsx(fde,{alert:F,setAlert:M});J.useEffect(()=>{m&&u.length===1&&ue&&(A(!0),z(!0),ue(u[0]))},[]);const X=()=>{switch(T){case"Insert Citation/Attachment(s)":return ne;case"Citation":return re;case"Attachment":return le}};return m?g.jsxs(V.Box,{children:[ge,g.jsx(V.Box,{paddingTop:"8px",children:g.jsx(Ox,{isLoading:L,children:X()})})]}):g.jsxs(V.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&ge,g.jsx(V.Box,{paddingTop:"8px",children:ne}),g.jsx(Qu,{open:T!=="Insert Citation/Attachment(s)",children:g.jsxs(V.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[ge,T==="Citation"?re:le]})})]})}function cA({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=(s,a)=>n?t(s,r):e(s,a);return g.jsx(lA,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const pde=V.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function hde({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:f,...p}){const m=kt();if(m&&!("citationBubbleMenuHandler"in(m==null?void 0:m.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const b=m==null?void 0:m.storage.citationBubbleMenuHandler,v=b.isOpen,y=b.selectedIds,x=b.selectedNodePos,C=O=>{m&&(O.length===0?m.commands.deleteCitation(x):y.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{C(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{C(y),m==null||m.commands.closeCitationBubbleMenu()},S=J.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?g.jsx(wv,{editor:m,open:v,...b.bubbleMenuOptions,...p,children:g.jsx(pde,{children:g.jsx(cA,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,y),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onClose:T,initialSelectedIds:y,onContentChange:S,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const mde=()=>gn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function gde(t){const e=kt(),n=J.useRef(null);return g.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:g.jsxs(V.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[g.jsx(gne,{fontSize:"small"}),g.jsx(V.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const uA=J.createContext(void 0),dA=()=>{const t=J.useContext(uA);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},yde=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=dA(),[u,f]=J.useState(s?String(s):""),[p,m]=J.useState([]),b=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const v=a.filter(C=>s.includes(C.id)),y=v.map(C=>Es.truncate(C.title,{length:b,omission:"..."})).join(", ");f(y),m(v);const x=v.map(C=>C.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(C=>C.id)}),0)},[a,s,l]),p.length!==0)return g.jsx(Wv,{as:"span",...e,"data-testid":"citation-node-component",children:g.jsx(V.Tooltip,{title:g.jsx(V.Box,{className:"citation-tooltip",children:p.map((v,y)=>{var k;const C=!!v.fileName?[v.title,v.fileName]:[v.title,v.source,v.details,(k=v.accessedAt)==null?void 0:k.slice(0,10),v.url,v.classification];return g.jsxs(V.Typography,{variant:"subtitle2",children:[C.filter(Boolean).join(" | "),y<p.length-1&&g.jsx(V.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:g.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},bde=rn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",Tt(t)]},addNodeView(){return Uv(yde)},addProseMirrorPlugins(){return[new on({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}});function uO({editor:t,canComment:e=!0,onComment:n,commentCount:r,commentResolved:o,...i}){const s=J.useRef(null);if(!n)return null;const a=o?g.jsx(t2,{sx:{width:14,height:14},"data-testid":"resolved-checkmark"}):r,l=o?"success":"primary",u=o?{"& .MuiBadge-badge":{padding:0,height:16,minWidth:16}}:{"& .MuiBadge-badge":{fontSize:14,height:16,minWidth:16}};return e?g.jsx(wt,{buttonRef:s,tooltipLabel:"Comments",onClick:()=>{if(!t)return;const{from:f,to:p}=t.state.selection,m=t.state.doc.textBetween(f,p,`
|
|
408
|
-
`).trim();n(m)},...i,children:g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:g.jsx(V.Badge,{"data-testid":"comment-button-badge",badgeContent:a,color:l,sx:u,children:g.jsx(Mne,{sx:{fontSize:"22px"}})})})}):null}const vde=t=>{var Z;const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x=()=>{},placeholder:C="Start typing here...",errorMode:k="normal",canLaunchUrl:T,canSearch:S=!1,redoUndo:O=!1}=t,R=[gR.configure({code:!1,codeBlock:!1,heading:!1,blockquote:!1,horizontalRule:!1,strike:!1}),Jv,$D.configure({placeholder:C}),mde(),bde.configure({citationMaxLength:a})],[P,j,F]=Ht.useField({name:e}),{setValue:M}=F,{value:$}=P,{addUpdateCitation:z,deleteCitation:L,batchUpdate:A,citations:_}=dA();J.useEffect(()=>{var ne;const te=(ne=I==null?void 0:I.current)==null?void 0:ne.editor;if(!te)return;te.getHTML()!==$&&setTimeout(()=>{te.commands.setContent($)},0)},[$]);const I=J.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},W=(te=void 0)=>{var re,le;const ce=((le=(re=I.current)==null?void 0:re.editor)==null?void 0:le.getHTML())??"",ne=!ce.replace(/<\/?p>|<br>/g,"").trim();M(ne?"":ce,te)},K=J.useMemo(()=>Es.debounce(()=>W(!1),500),[M]),U=_a(),{showDiff:Y,getPreviousValue:fe}=Ra(),ue=i??U;if(Y){const te=fe(e)??"",ce=$,ne=/<citation\s+ids="([^"]*)"><\/citation>/g,re=(X,ee)=>{const ie=ee.split(",").map(Number);return`<sup>${_.filter(we=>ie.includes(we.id)).map(we=>we.title)}</sup>`},le=te.replace(ne,re),ge=ce.replace(ne,re);return g.jsx(Fi,{label:n,value:ge,showDiff:!0,diffSnapshot:le,mode:"html"})}const pe=Es.pick(t,["canComment","onComment","commentCount","commentResolved"]);return g.jsxs(V.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:ue?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...B[s],display:"flex",flexDirection:"column",width:"100%",children:[g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&g.jsx(V.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),i&&g.jsx(uO,{...pe,editor:(Z=I==null?void 0:I.current)==null?void 0:Z.editor})]}),g.jsx(cI,{ref:I,extensions:R,content:$,editable:!ue,renderControls:()=>{var te;return g.jsxs(xp,{justifyContent:"space-between",children:[g.jsxs(xp,{children:[g.jsx(gde,{}),g.jsx(In,{}),g.jsx(p2,{}),g.jsx(b2,{}),g.jsx(w2,{}),g.jsx(In,{}),g.jsx(v2,{}),g.jsx(h2,{})]}),g.jsx(uO,{...pe,editor:(te=I==null?void 0:I.current)==null?void 0:te.editor})]})},onBlur:()=>W(),onUpdate:K,RichTextFieldProps:{variant:ue?"standard":"outlined",MenuBarProps:{hide:ue},footer:O&&g.jsxs(V.Stack,{direction:"row",spacing:2,sx:{borderTop:te=>`1px solid ${te.palette.divider}`,p:1},children:[g.jsx(C2,{}),g.jsx(x2,{})]})},children:()=>g.jsx(hde,{getCitationsPaginated:(te,ce)=>l(te,ce).then(ne=>(A(ne.data),ne)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(te=>f(te).then(ce=>(z(ce),ce))),onUpdateCitation:p&&(te=>p(te).then(ce=>(z(ce),ce))),onDeleteCitation:m&&(te=>m(te).then(()=>L(te))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x,canLaunchUrl:T,readOnly:ue,canSearch:S})}),g.jsx(Mr,{name:e,id:`${e}-err`,errorMode:k})]})},xde=t=>g.jsx(gI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),wde=t=>{const{name:e="submit"}=t;return g.jsx(Sr,{name:e,type:"submit",...t})},Cde=t=>{const{label:e="Return to Top",icon:n=Lf,scrollThresholdPx:r=100}=t,o=V.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return g.jsx(V.Zoom,{in:o,children:g.jsx(V.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:g.jsxs(V.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[g.jsx(n,{fontSize:"medium"}),e]})})})},fA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=To.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return g.jsxs(g.Fragment,{children:[g.jsx(V.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),g.jsx(V.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>g.jsxs(V.MenuItem,{...zl(p,o),children:[p.icon&&g.jsx(V.ListItemIcon,{children:p.icon}),g.jsx(V.ListItemText,{primary:p.label})]},p.label))})]})},Sde=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=V.useTheme();return g.jsx(V.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:g.jsxs(V.List,{children:[g.jsxs(V.ListItem,{children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Values"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(t,null,2)})]}),g.jsx(V.Divider,{variant:"inset",component:"li"}),g.jsxs(V.ListItem,{id:"testing",children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Errors"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(e,null,2)})]}),g.jsxs(V.ListItem,{children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Status"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Tde=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=zD();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,...pr({...t},l)};return g.jsx(V.Stepper,{...u,children:e.map(f=>g.jsx(V.Step,{children:g.jsx(V.StepLabel,{children:f})},f))})},kde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?g.jsx(kI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ht.useField({name:e}),{value:C}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return g.jsxs(V.FormControl,{fullWidth:!0,children:[g.jsx(V.Typography,{...r,children:n}),m&&x.value.length===0?g.jsx(V.Typography,{children:b}):g.jsx(Ht.FieldArray,{name:e,render:T=>g.jsxs("div",{children:[C.map((S,O)=>g.jsx(J.Fragment,{children:g.jsx(Ede,{variant:l,content:g.jsxs(V.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[g.jsxs(V.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==C.length-1&&g.jsx(V.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&g.jsx(V.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&g.jsx(V.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ede=({variant:t,content:e})=>{switch(t){case"card":return g.jsx(V.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:g.jsx(V.CardContent,{children:e})});case"elevatedCard":return g.jsx(V.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:g.jsx(V.CardContent,{children:e})});case"none":return e}},Ode=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return g.jsx(Qu,{actions:[g.jsx(V.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Mde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return g.jsx(Qu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},_de=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return g.jsx(Qu,{actions:[g.jsx(V.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),g.jsx(V.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Rde={added:{icon:hne,label:"Added",color:"success"},deleted:{icon:kI,label:"Deleted",color:"error"},modified:{icon:yne,label:"Modified",color:"info"},unmodified:{label:"Unmodified",color:"default"}},Ide=(t,e)=>g.jsxs(g.Fragment,{children:[g.jsx(V.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:kp},children:g.jsx("s",{children:t})}),g.jsx(V.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:Tp},children:g.jsx("u",{children:e})})]}),Dde=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Tl(s,e,r),l=Tl(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??mI.isEqual(a,l))||(o[wn(s)]=Ide(a,l))}return o},pA=(t,e,n,r=!1,o)=>{const i=[],s=[];let a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);a<e.length&&l<n.length;){const u=e[a],f=n[l];if(u.id===f.id){const p=Dde(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?s.push({...f,changeType:"unmodified"}):i.push({...f,changeType:"modified",modifiedDiff:p}),a++,l++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),a++):(i.push({...f,changeType:"added"}),l++)}for(;a<e.length;)i.push({...e[a],changeType:"deleted"}),a++;for(;l<n.length;)i.push({...n[l],changeType:"added"}),l++;return{dataDiff:i,dataUnmodified:s}},hA=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,dataUnmodified:l}=pA(r,e,n,s,o);return{columns:[{fieldName:"changeType",render:f=>{const p=Rde[f];return g.jsx(V.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:g.jsxs(V.Typography,{children:[p.icon&&g.jsx(P0,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[wn(f)])??Tl(f,m,s)}}))],data:a,unmodifiedData:l,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return g.jsx(iM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},mA=({columns:t,data:e,unmodifiedData:n=[],emptyTableMsg:r="No changes to display",renderExpand:o,size:i})=>{const[s,a]=J.useState(!1),l=()=>a(!s),u=`${s?"Hide":"Show"} ${n.length} unmodified row${n.length>1?"s":""}`;return g.jsxs(V.Box,{children:[g.jsx(Mx,{columns:t,data:[...e,...s?n:[]],emptyTableMsg:r,renderExpand:o,size:i}),n.length>0&&g.jsx(V.Box,{children:g.jsx(V.Button,{onClick:l,children:u})})]})},Ade=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),o="beforeData"in n?hA({...n,isMobileScreen:r}):n;return g.jsx(mA,{...o,size:t.size})},Pde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=V.useTheme(),a=To.useNavigate();return g.jsxs(V.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[g.jsx(V.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),g.jsxs(V.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[g.jsx(V.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>g.jsx(V.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...zl(l,a),children:l.label},l.label))}),n&&g.jsx(V.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},gA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=To.useLocation(),i=To.useNavigate(),[s,a]=J.useState(!1),l=(m,b)=>g.jsx(V.MenuList,{children:m.map(v=>g.jsxs(V.MenuItem,{...zl(v,i,()=>a(!1)),children:[v.icon&&g.jsx(V.ListItemIcon,{children:v.icon}),g.jsx(V.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>g.jsxs(J.Fragment,{children:[l(b,v),v<m.length-1&&g.jsx(V.Divider,{})]},`mobile-drawer-group-${v}`))}return r?g.jsx(V.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&g.jsxs(g.Fragment,{children:[g.jsx(V.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:g.jsx(kne,{})}),g.jsx(V.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:g.jsx(V.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:g.jsx(V.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},yA=t=>{const{env:e,isProd:n}=t;return n?null:g.jsx(V.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs(V.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},bA=t=>{const{displayName:e,userMenuOptions:n}=t;return g.jsx(fA,{label:e,menuOptions:n,icon:g.jsx(One,{})})},vm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=V.useTheme(),a=To.useNavigate();return g.jsx(V.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>g.jsx(V.Tab,{icon:l.icon,label:l.label,value:u,...zl(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))})},vA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&g.jsx(V.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:g.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:r})})},xA=t=>{const{onToggle:e}=t,{palette:n}=V.useTheme(),r=n.mode==="dark";return g.jsx(V.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?g.jsx(TI,{}):g.jsx(CI,{})})},Nde=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:b}=t,v=To.useNavigate(),y=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),{palette:x}=V.useTheme(),{pathname:C}=To.useLocation(),k=x.mode==="dark",[T,S]=D.useState(void 0);D.useEffect(()=>{const P=o.findIndex(j=>j.path&&C.startsWith(j.path));S(P>=0?P:void 0)},[C,o]);const O=s&&g.jsx(xA,{onToggle:s}),R=s&&(y||!y&&l)?[{icon:k?g.jsx(TI,{}):g.jsx(CI,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return g.jsxs(V.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&g.jsx(yA,{...e}),u,g.jsxs(V.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[g.jsx(V.Button,{disableRipple:!0,component:To.Link,to:"/",children:r&&typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),g.jsxs(V.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&g.jsx(gA,{menuOptionLists:[o,a,R],anchor:"right"}),!y&&g.jsxs(g.Fragment,{children:[g.jsx(V.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((P,j)=>g.jsxs(V.Box,{display:"flex",alignItems:"center",children:[j>0&&g.jsx(V.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),g.jsx(V.Button,{variant:"text",sx:{color:"white"},...zl(P,v),children:g.jsxs(V.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&g.jsx(bA,{displayName:l,userMenuOptions:R})]})]})]}),!y&&g.jsx(vA,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},jde=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=To.useLocation(),o=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&g.jsx(V.Box,{sx:e,children:g.jsx(V.Card,{sx:{height:"100%",width:200},children:g.jsx(vm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},$de=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=V.useTheme();return e.length>0&&g.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},Lde=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return g.jsx(uA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Bde=t=>g.jsx(ed,{severity:"info",...t}),Fde=t=>g.jsx(ed,{severity:"warning",...t}),wA=t=>{const{crumbs:e}=t,n=To.useNavigate(),r=e.map(o=>({label:o.label,onClick:()=>{var i;o.path?n(o.path):(i=o.onClick)==null||i.call(o)}}));return g.jsx(V.Breadcrumbs,{"aria-label":"breadcrumb",separator:g.jsx(Ene,{}),sx:{marginBottom:2},children:r.map(({label:o,...i},s)=>s<e.length-1?g.jsx(V.Link,{color:"primary",sx:{cursor:"pointer",fontWeight:"600"},underline:"hover",...zl(i,n),children:o},o):g.jsx(V.Typography,{color:"text.primary",children:o},o))})},Vde=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=zde(r);return g.jsx(V.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:g.jsx(ed,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:dO(r),warning:dO(r)},onClose:o,elevation:a,variant:s,children:n?g.jsxs(g.Fragment,{children:[g.jsx(V.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},zde=t=>t=="logout"?"info":t=="timeout"?"warning":t,dO=t=>{if(t=="timeout")return g.jsx(pne,{});if(t=="logout")return g.jsx(Tne,{})},Hde=t=>{Wde(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=V.useMediaQuery(V.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:g.jsxs(V.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&g.jsx(wA,{crumbs:i}),g.jsxs(V.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[g.jsxs(V.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?g.jsx(V.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&g.jsxs(Sr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[g.jsx(mne,{style:{marginRight:"0.5rem"}}),n]})]}),s&&g.jsx(V.Box,{width:u?"100%":"50%",children:s})]})]})},Wde=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},Ude=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=V.useMediaQuery(V.useTheme().breakpoints.down("sm"));return g.jsxs(V.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&g.jsx(V.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),g.jsx(V.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,g.jsx(V.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},qde=t=>{const{title:e="Loading...",message:n}=t;return g.jsxs(V.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[g.jsxs(V.Box,{className:"text-content",children:[g.jsx(V.Typography,{variant:"h1","data-testid":"title",children:e}),n&&g.jsx(V.Typography,{"data-testid":"message",children:n})]}),g.jsx(V.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function Kde({...t}){return g.jsx(lA,{onSelectCitations:()=>{},onClose:()=>{},...t})}const Yde=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return g.jsx(V.Box,{height:n})};exports.AlertModal=Mde;exports.Autocomplete=hI;exports.Breadcrumbs=wA;exports.Button=Sr;exports.Checkbox=gI;exports.CheckboxGroup=Lte;exports.CitationField=vde;exports.CitationFieldProvider=Lde;exports.CitationManager=Kde;exports.Column=Ru;exports.ConfirmationModal=Ode;exports.DarkModeToggle=xA;exports.DateField=Ip;exports.DateRangeField=uce;exports.DecisionModal=_de;exports.Diff=pI;exports.DiffProvider=iM;exports.DiffTable=Ade;exports.DiffTableView=mA;exports.Drawer=gA;exports.DynamicAutocomplete=jte;exports.EnvironmentBanner=yA;exports.ErrorAlert=sA;exports.FileList=Vte;exports.FileUpload=yI;exports.FloatingNavBar=$de;exports.Footer=Pde;exports.FormDebugger=Sde;exports.Header=Nde;exports.HelpTooltip=FD;exports.IconTooltip=BD;exports.InfoAlert=Bde;exports.LoadingButton=rA;exports.LoadingIndicator=qde;exports.LoadingOverlay=Ox;exports.Location=cne;exports.MenuButton=fA;exports.Modal=Qu;exports.MultiAutocomplete=$te;exports.NavBar=vA;exports.NotApplicableCheckbox=xde;exports.PageHeader=Hde;exports.PaginatedTable=VD;exports.ProfileMenu=bA;exports.RadioGroup=xI;exports.RangeSlider=une;exports.ReadOnly=Fi;exports.ReadOnlyProvider=rM;exports.RepeatableFormGroup=kde;exports.RichTextField=iue;exports.Row=Ko;exports.ScrollToTop=Cde;exports.SearchField=EI;exports.Select=dne;exports.SelectableCitationManager=cA;exports.Sidebar=jde;exports.SingleActionCard=Ude;exports.Snackbar=Vde;exports.Spacer=Yde;exports.Stepper=Tde;exports.Submit=wde;exports.SuccessAlert=aA;exports.Switch=fne;exports.Table=Mx;exports.Tabs=vm;exports.TextArea=wI;exports.TextField=_i;exports.TextIcon=P0;exports.ValidationError=Mr;exports.WarningAlert=Fde;exports.baseCitationTableColumns=UD;exports.buildDiffData=pA;exports.buildTableDiff=hA;exports.createAppTheme=e4;exports.useDiff=Ra;exports.useReadOnly=_a;
|
|
408
|
+
`).trim();n(m)},...i,children:g.jsx(V.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:g.jsx(V.Badge,{"data-testid":"comment-button-badge",badgeContent:a,color:l,sx:u,children:g.jsx(Mne,{sx:{fontSize:"22px"}})})})}):null}const vde=t=>{var Z;const{name:e,label:n=Fn(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x=()=>{},placeholder:C="Start typing here...",errorMode:k="normal",canLaunchUrl:T,canSearch:S=!1,redoUndo:O=!1}=t,R=[gR.configure({code:!1,codeBlock:!1,heading:!1,blockquote:!1,horizontalRule:!1,strike:!1}),Jv,$D.configure({placeholder:C}),mde(),bde.configure({citationMaxLength:a})],[P,j,F]=Ht.useField({name:e}),{setValue:M}=F,{value:$}=P,{addUpdateCitation:z,deleteCitation:L,batchUpdate:A,citations:_}=dA();J.useEffect(()=>{var ne;const te=(ne=I==null?void 0:I.current)==null?void 0:ne.editor;if(!te)return;te.getHTML()!==$&&setTimeout(()=>{te.commands.setContent($)},0)},[$]);const I=J.useRef(null),B={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},W=(te=void 0)=>{var re,le;const ce=((le=(re=I.current)==null?void 0:re.editor)==null?void 0:le.getHTML())??"",ne=!ce.replace(/<\/?p>|<br>/g,"").trim();M(ne?"":ce,te)},K=J.useMemo(()=>Es.debounce(()=>W(!1),500),[M]),U=_a(),{showDiff:Y,getPreviousValue:fe}=Ra(),ue=i??U;if(Y){const te=fe(e)??"",ce=$,ne=/<citation\s+ids="([^"]*)"><\/citation>/g,re=(X,ee)=>{const ie=ee.split(",").map(Number);return`<sup>${_.filter(we=>ie.includes(we.id)).map(we=>we.title)}</sup>`},le=te.replace(ne,re),ge=ce.replace(ne,re);return g.jsx(Fi,{label:n,value:ge,showDiff:!0,diffSnapshot:le,mode:"html"})}const pe=Es.pick(t,["canComment","onComment","commentCount","commentResolved"]);return g.jsxs(V.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:ue?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...B[s],display:"flex",flexDirection:"column",width:"100%",children:[g.jsxs(V.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&g.jsx(V.InputLabel,{htmlFor:`citation-field_${e}`,required:!i&&o,children:n}),i&&g.jsx(uO,{...pe,editor:(Z=I==null?void 0:I.current)==null?void 0:Z.editor})]}),g.jsx(cI,{ref:I,extensions:R,content:$,editable:!ue,renderControls:()=>{var te;return g.jsxs(xp,{justifyContent:"space-between",children:[g.jsxs(xp,{children:[g.jsx(gde,{}),g.jsx(In,{}),g.jsx(p2,{}),g.jsx(b2,{}),g.jsx(w2,{}),g.jsx(In,{}),g.jsx(v2,{}),g.jsx(h2,{})]}),g.jsx(uO,{...pe,editor:(te=I==null?void 0:I.current)==null?void 0:te.editor})]})},onBlur:()=>W(),onUpdate:K,RichTextFieldProps:{variant:ue?"standard":"outlined",MenuBarProps:{hide:ue},footer:O&&g.jsxs(V.Stack,{direction:"row",spacing:2,sx:{borderTop:te=>`1px solid ${te.palette.divider}`,p:1},children:[g.jsx(C2,{}),g.jsx(x2,{})]})},children:()=>g.jsx(hde,{getCitationsPaginated:(te,ce)=>l(te,ce).then(ne=>(A(ne.data),ne)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(te=>f(te).then(ce=>(z(ce),ce))),onUpdateCitation:p&&(te=>p(te).then(ce=>(z(ce),ce))),onDeleteCitation:m&&(te=>m(te).then(()=>L(te))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x,canLaunchUrl:T,readOnly:ue,canSearch:S})}),g.jsx(Mr,{name:e,id:`${e}-err`,errorMode:k})]})},xde=t=>g.jsx(gI,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),wde=t=>{const{name:e="submit"}=t;return g.jsx(Sr,{name:e,type:"submit",...t})},Cde=t=>{const{label:e="Return to Top",icon:n=Lf,scrollThresholdPx:r=100}=t,o=V.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return g.jsx(V.Zoom,{in:o,children:g.jsx(V.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:g.jsxs(V.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[g.jsx(n,{fontSize:"medium"}),e]})})})},fA=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=To.useNavigate(),[i,s]=D.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return g.jsxs(g.Fragment,{children:[g.jsx(V.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),g.jsx(V.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>g.jsxs(V.MenuItem,{...zl(p,o),children:[p.icon&&g.jsx(V.ListItemIcon,{children:p.icon}),g.jsx(V.ListItemText,{primary:p.label})]},p.label))})]})},Sde=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=V.useTheme();return g.jsx(V.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:g.jsxs(V.List,{children:[g.jsxs(V.ListItem,{children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Values"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(t,null,2)})]}),g.jsx(V.Divider,{variant:"inset",component:"li"}),g.jsxs(V.ListItem,{id:"testing",children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Errors"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(e,null,2)})]}),g.jsxs(V.ListItem,{children:[g.jsx(V.Typography,{display:"block",variant:"h6",children:"Status"}),g.jsx("br",{}),g.jsx(V.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},Tde=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=zD();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,...pr({...t},l)};return g.jsx(V.Stepper,{...u,children:e.map(f=>g.jsx(V.Step,{children:g.jsx(V.StepLabel,{children:f})},f))})},kde=t=>{const{name:e,label:n=Fn(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?g.jsx(kI,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ht.useField({name:e}),{value:C}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return g.jsxs(V.FormControl,{fullWidth:!0,children:[g.jsx(V.Typography,{...r,children:n}),m&&x.value.length===0?g.jsx(V.Typography,{children:b}):g.jsx(Ht.FieldArray,{name:e,render:T=>g.jsxs("div",{children:[C.map((S,O)=>g.jsx(J.Fragment,{children:g.jsx(Ede,{variant:l,content:g.jsxs(V.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[g.jsxs(V.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==C.length-1&&g.jsx(V.Divider,{"data-testid":"divider"})]}),!m&&C.length>(p?0:1)&&g.jsx(V.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&g.jsx(V.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Ede=({variant:t,content:e})=>{switch(t){case"card":return g.jsx(V.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:g.jsx(V.CardContent,{children:e})});case"elevatedCard":return g.jsx(V.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:g.jsx(V.CardContent,{children:e})});case"none":return e}},Ode=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return g.jsx(Qu,{actions:[g.jsx(V.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Mde=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return g.jsx(Qu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},_de=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return g.jsx(Qu,{actions:[g.jsx(V.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),g.jsx(V.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Rde={added:{icon:hne,label:"Added",color:"success"},deleted:{icon:kI,label:"Deleted",color:"error"},modified:{icon:yne,label:"Modified",color:"info"},unmodified:{label:"Unmodified",color:"default"}},Ide=(t,e)=>g.jsxs(g.Fragment,{children:[g.jsx(V.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:kp},children:g.jsx("s",{children:t})}),g.jsx(V.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:Tp},children:g.jsx("u",{children:e})})]}),Dde=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Tl(s,e,r),l=Tl(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??mI.isEqual(a,l))||(o[wn(s)]=Ide(a,l))}return o},pA=(t,e,n,r=!1,o)=>{const i=[],s=[];let a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);a<e.length&&l<n.length;){const u=e[a],f=n[l];if(u.id===f.id){const p=Dde(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?s.push({...f,changeType:"unmodified"}):i.push({...f,changeType:"modified",modifiedDiff:p}),a++,l++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),a++):(i.push({...f,changeType:"added"}),l++)}for(;a<e.length;)i.push({...e[a],changeType:"deleted"}),a++;for(;l<n.length;)i.push({...n[l],changeType:"added"}),l++;return{dataDiff:i,dataUnmodified:s}},hA=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,dataUnmodified:l}=pA(r,e,n,s,o);return{columns:[{fieldName:"changeType",render:f=>{const p=Rde[f];return g.jsx(V.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:g.jsxs(V.Typography,{children:[p.icon&&g.jsx(P0,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[wn(f)])??Tl(f,m,s)}}))],data:a,unmodifiedData:l,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return g.jsx(iM,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},mA=({columns:t,data:e,unmodifiedData:n=[],emptyTableMsg:r="No changes to display",renderExpand:o,size:i})=>{const[s,a]=J.useState(!1),l=()=>a(!s),u=`${s?"Hide":"Show"} ${n.length} unmodified row${n.length>1?"s":""}`;return g.jsxs(V.Box,{children:[g.jsx(Mx,{columns:t,data:[...e,...s?n:[]],emptyTableMsg:r,renderExpand:o,size:i}),n.length>0&&g.jsx(V.Box,{children:g.jsx(V.Button,{onClick:l,children:u})})]})},Ade=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),o="beforeData"in n?hA({...n,isMobileScreen:r}):n;return g.jsx(mA,{...o,size:t.size})},Pde=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=V.useTheme(),a=To.useNavigate();return g.jsxs(V.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[g.jsx(V.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),g.jsxs(V.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[g.jsx(V.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>g.jsx(V.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...zl(l,a),children:l.label},l.label))}),n&&g.jsx(V.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},gA=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=To.useLocation(),i=To.useNavigate(),[s,a]=J.useState(!1),l=(m,b)=>g.jsx(V.MenuList,{children:m.map(v=>g.jsxs(V.MenuItem,{...zl(v,i,()=>a(!1)),children:[v.icon&&g.jsx(V.ListItemIcon,{children:v.icon}),g.jsx(V.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>g.jsxs(J.Fragment,{children:[l(b,v),v<m.length-1&&g.jsx(V.Divider,{})]},`mobile-drawer-group-${v}`))}return r?g.jsx(V.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&g.jsxs(g.Fragment,{children:[g.jsx(V.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:g.jsx(kne,{})}),g.jsx(V.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:g.jsx(V.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:g.jsx(V.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},yA=t=>{const{env:e,isProd:n}=t;return n?null:g.jsx(V.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs(V.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},bA=t=>{const{displayName:e,userMenuOptions:n}=t;return g.jsx(fA,{label:e,menuOptions:n,icon:g.jsx(One,{})})},vm=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=V.useTheme(),a=To.useNavigate();return g.jsx(V.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>g.jsx(V.Tab,{icon:l.icon,label:l.label,value:u,...zl(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))})},vA=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&g.jsx(V.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:g.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:r})})},xA=t=>{const{onToggle:e}=t,{palette:n}=V.useTheme(),r=n.mode==="dark";return g.jsx(V.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?g.jsx(TI,{}):g.jsx(CI,{})})},Nde=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:b}=t,v=To.useNavigate(),y=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),{palette:x}=V.useTheme(),{pathname:C}=To.useLocation(),k=x.mode==="dark",[T,S]=D.useState(void 0);D.useEffect(()=>{const P=o.findIndex(j=>j.path&&C.startsWith(j.path));S(P>=0?P:void 0)},[C,o]);const O=s&&g.jsx(xA,{onToggle:s}),R=s&&(y||!y&&l)?[{icon:k?g.jsx(TI,{}):g.jsx(CI,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return g.jsxs(V.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&g.jsx(yA,{...e}),u,g.jsxs(V.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[g.jsx(V.Button,{disableRipple:!0,component:To.Link,to:"/",children:r&&typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),g.jsxs(V.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&g.jsx(gA,{menuOptionLists:[o,a,R],anchor:"right"}),!y&&g.jsxs(g.Fragment,{children:[g.jsx(V.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((P,j)=>g.jsxs(V.Box,{display:"flex",alignItems:"center",children:[j>0&&g.jsx(V.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),g.jsx(V.Button,{variant:"text",sx:{color:"white"},...zl(P,v),children:g.jsxs(V.Box,{display:"flex",gap:"3px",alignItems:"center",children:[P.icon,P.label]})})]},P.label))}),p,l&&g.jsx(bA,{displayName:l,userMenuOptions:R})]})]})]}),!y&&g.jsx(vA,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},jde=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=To.useLocation(),o=V.useMediaQuery(V.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&g.jsx(V.Box,{sx:e,children:g.jsx(V.Card,{sx:{height:"100%",width:200},children:g.jsx(vm,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},$de=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=V.useTheme();return e.length>0&&g.jsx(vm,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},Lde=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return g.jsx(uA.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Bde=t=>g.jsx(ed,{severity:"info",...t}),Fde=t=>g.jsx(ed,{severity:"warning",...t}),wA=t=>{const{crumbs:e}=t,n=To.useNavigate(),r=e.map(o=>({label:o.label,onClick:()=>{var i;o.path?n(o.path):(i=o.onClick)==null||i.call(o)}}));return g.jsx(V.Breadcrumbs,{"aria-label":"breadcrumb",separator:g.jsx(Ene,{}),sx:{marginBottom:2},children:r.map(({label:o,...i},s)=>s<e.length-1?g.jsx(V.Link,{color:"primary",sx:{cursor:"pointer",fontWeight:"600"},underline:"hover",...zl(i,n),children:o},o):g.jsx(V.Typography,{color:"text.primary",children:o},o))})},Vde=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=zde(r);return g.jsx(V.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:g.jsx(ed,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:dO(r),warning:dO(r)},onClose:o,elevation:a,variant:s,children:n?g.jsxs(g.Fragment,{children:[g.jsx(V.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},zde=t=>t=="logout"?"info":t=="timeout"?"warning":t,dO=t=>{if(t=="timeout")return g.jsx(pne,{});if(t=="logout")return g.jsx(Tne,{})},Hde=t=>{Wde(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=V.useMediaQuery(V.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:g.jsxs(V.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&g.jsx(wA,{crumbs:i}),g.jsxs(V.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[g.jsxs(V.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?g.jsx(V.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&g.jsxs(Sr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[g.jsx(mne,{style:{marginRight:"0.5rem"}}),n]})]}),s&&g.jsx(V.Box,{width:u?"100%":"50%",children:s})]})]})},Wde=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},Ude=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=V.useMediaQuery(V.useTheme().breakpoints.down("sm"));return g.jsxs(V.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&g.jsx(V.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),g.jsx(V.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,g.jsx(V.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},qde=t=>{const{title:e="Loading...",message:n}=t;return g.jsxs(V.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[g.jsxs(V.Box,{className:"text-content",children:[g.jsx(V.Typography,{variant:"h1","data-testid":"title",children:e}),n&&g.jsx(V.Typography,{"data-testid":"message",children:n})]}),g.jsx(V.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function Kde({...t}){return g.jsx(lA,{onSelectCitations:()=>{},onClose:()=>{},...t})}const Yde=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return g.jsx(V.Box,{height:n})};exports.AlertModal=Mde;exports.Autocomplete=hI;exports.Breadcrumbs=wA;exports.Button=Sr;exports.Checkbox=gI;exports.CheckboxGroup=Lte;exports.CitationField=vde;exports.CitationFieldProvider=Lde;exports.CitationManager=Kde;exports.Column=Ru;exports.ConfirmationModal=Ode;exports.DarkModeToggle=xA;exports.DateField=Ip;exports.DateRangeField=uce;exports.DecisionModal=_de;exports.Diff=pI;exports.DiffProvider=iM;exports.DiffTable=Ade;exports.DiffTableView=mA;exports.Drawer=gA;exports.DynamicAutocomplete=jte;exports.EnvironmentBanner=yA;exports.ErrorAlert=sA;exports.FileList=Vte;exports.FileUpload=yI;exports.FloatingNavBar=$de;exports.Footer=Pde;exports.FormDebugger=Sde;exports.Header=Nde;exports.HelpTooltip=FD;exports.IconTooltip=BD;exports.InfoAlert=Bde;exports.LoadingButton=rA;exports.LoadingIndicator=qde;exports.LoadingOverlay=Ox;exports.Location=cne;exports.MenuButton=fA;exports.Modal=Qu;exports.MultiAutocomplete=$te;exports.NavBar=vA;exports.NotApplicableCheckbox=xde;exports.PageHeader=Hde;exports.PaginatedTable=VD;exports.ProfileMenu=bA;exports.RadioGroup=xI;exports.RangeSlider=une;exports.ReadOnly=Fi;exports.ReadOnlyProvider=rM;exports.RepeatableFormGroup=kde;exports.RichTextField=iue;exports.Row=Ko;exports.ScrollToTop=Cde;exports.SearchField=EI;exports.Select=dne;exports.SelectableCitationManager=cA;exports.Sidebar=jde;exports.SingleActionCard=Ude;exports.Snackbar=Vde;exports.Spacer=Yde;exports.Stepper=Tde;exports.Submit=wde;exports.SuccessAlert=aA;exports.Switch=fne;exports.Table=Mx;exports.Tabs=vm;exports.TextArea=wI;exports.TextField=_i;exports.TextIcon=P0;exports.ValidationError=Mr;exports.WarningAlert=Fde;exports.baseCitationTableColumns=UD;exports.buildDiffData=pA;exports.buildTableDiff=hA;exports.createAppTheme=e4;exports.useDiff=Ra;exports.useReadOnly=_a;
|
package/dist/index.es.js
CHANGED
|
@@ -63354,7 +63354,7 @@ const Epe = (t) => {
|
|
|
63354
63354
|
width: "100%",
|
|
63355
63355
|
children: [
|
|
63356
63356
|
/* @__PURE__ */ Z(Ne, { display: "flex", flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
63357
|
-
!r && /* @__PURE__ */ v(nv, { htmlFor: `citation-field_${e}`, required: o, children: n }),
|
|
63357
|
+
!r && /* @__PURE__ */ v(nv, { htmlFor: `citation-field_${e}`, required: !i && o, children: n }),
|
|
63358
63358
|
i && /* @__PURE__ */ v(YO, { ...fe, editor: (J = I == null ? void 0 : I.current) == null ? void 0 : J.editor })
|
|
63359
63359
|
] }),
|
|
63360
63360
|
/* @__PURE__ */ v(
|
package/dist/index.umd.js
CHANGED
|
@@ -406,4 +406,4 @@ The following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rg
|
|
|
406
406
|
|
|
407
407
|
attempted value: ${s}
|
|
408
408
|
`+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,n){let r=e===void 0?e:this.transforms.reduce((o,i)=>i.call(this,o,e,this,n),e);return r===void 0&&(r=this.getDefault(n)),r}_validate(e,n={},r,o){let{path:i,originalValue:s=e,strict:a=this.spec.strict}=n,l=e;a||(l=this._cast(l,Object.assign({assert:!1},n)));let u=[];for(let f of Object.values(this.internalTests))f&&u.push(f);this.runTests({path:i,value:l,originalValue:s,options:n,tests:u},r,f=>{if(f.length)return o(f,l);this.runTests({path:i,value:l,originalValue:s,options:n,tests:this.tests},r,o)})}runTests(e,n,r){let o=!1,{tests:i,value:s,originalValue:a,path:l,options:u}=e,f=y=>{o||(o=!0,n(y,s))},p=y=>{o||(o=!0,r(y,s))},m=i.length,b=[];if(!m)return p([]);let v={value:s,originalValue:a,path:l,options:u,schema:this};for(let y=0;y<i.length;y++){const x=i[y];x(v,f,function(k){k&&(Array.isArray(k)?b.push(...k):b.push(k)),--m<=0&&p(b)})}}asNestedTest({key:e,index:n,parent:r,parentPath:o,originalParent:i,options:s}){const a=e??n;if(a==null)throw TypeError("Must include `key` or `index` for nested validations");const l=typeof a=="number";let u=r[a];const f=Object.assign({},s,{strict:!0,parent:r,value:u,originalValue:i[a],key:void 0,[l?"index":"key"]:a,path:l||a.includes(".")?`${o||""}[${l?a:`"${a}"`}]`:(o?`${o}.`:"")+e});return(p,m,b)=>this.resolve(f)._validate(u,f,m,b)}validate(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return new Promise((s,a)=>o._validate(e,n,(l,u)=>{pr.isError(l)&&(l.value=u),a(l)},(l,u)=>{l.length?a(new pr(l,u,void 0,void 0,i)):s(u)}))}validateSync(e,n){var r;let o=this.resolve(Object.assign({},n,{value:e})),i,s=(r=n==null?void 0:n.disableStackTrace)!=null?r:o.spec.disableStackTrace;return o._validate(e,Object.assign({},n,{sync:!0}),(a,l)=>{throw pr.isError(a)&&(a.value=l),a},(a,l)=>{if(a.length)throw new pr(a,e,void 0,void 0,s);i=l}),i}isValid(e,n){return this.validate(e,n).then(()=>!0,r=>{if(pr.isError(r))return!1;throw r})}isValidSync(e,n){try{return this.validateSync(e,n),!0}catch(r){if(pr.isError(r))return!1;throw r}}_getDefault(e){let n=this.spec.default;return n==null?n:typeof n=="function"?n.call(this,e):Fl(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=Bl({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=Bl({message:n,name:"optionality",test(o){return o===void 0?this.schema.spec.optional:!0}}),r}optional(){return this.optionality(!0)}defined(e=ei.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=ei.notNull){return this.nullability(!1,e)}required(e=ei.required){return this.clone().withMutation(n=>n.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let n=this.clone();return n.transforms.push(e),n}test(...e){let n;if(e.length===1?typeof e[0]=="function"?n={test:e[0]}:n=e[0]:e.length===2?n={name:e[0],test:e[1]}:n={name:e[0],message:e[1],test:e[2]},n.message===void 0&&(n.message=ei.default),typeof n.test!="function")throw new TypeError("`test` is a required parameters");let r=this.clone(),o=Bl(n),i=n.exclusive||n.name&&r.exclusiveTests[n.name]===!0;if(n.exclusive&&!n.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return n.name&&(r.exclusiveTests[n.name]=!!n.exclusive),r.tests=r.tests.filter(s=>!(s.OPTIONS.name===n.name&&(i||s.OPTIONS.test===o.OPTIONS.test))),r.tests.push(o),r}when(e,n){!Array.isArray(e)&&typeof e!="string"&&(n=e,e=".");let r=this.clone(),o=fI(e).map(i=>new Ta(i));return o.forEach(i=>{i.isSibling&&r.deps.push(i.key)}),r.conditions.push(typeof n=="function"?new Eh(o,n):Eh.fromOptions(o,n)),r}typeError(e){let n=this.clone();return n.internalTests.typeError=Bl({message:e,name:"typeError",skipAbsent:!0,test(r){return this.schema._typeCheck(r)?!0:this.createError({params:{type:this.schema.type}})}}),n}oneOf(e,n=ei.oneOf){let r=this.clone();return e.forEach(o=>{r._whitelist.add(o),r._blacklist.delete(o)}),r.internalTests.whiteList=Bl({message:n,name:"oneOf",skipAbsent:!0,test(o){let i=this.schema._whitelist,s=i.resolveAll(this.resolve);return s.includes(o)?!0:this.createError({params:{values:Array.from(i).join(", "),resolved:s}})}}),r}notOneOf(e,n=ei.notOneOf){let r=this.clone();return e.forEach(o=>{r._blacklist.add(o),r._whitelist.delete(o)}),r.internalTests.blacklist=Bl({message:n,name:"notOneOf",test(o){let i=this.schema._blacklist,s=i.resolveAll(this.resolve);return s.includes(o)?this.createError({params:{values:Array.from(i).join(", "),resolved:s}}):!0}}),r}strip(e=!0){let n=this.clone();return n.spec.strip=e,n}describe(e){const n=(e?this.resolve(e):this).clone(),{label:r,meta:o,optional:i,nullable:s}=n.spec;return{meta:o,label:r,optional:i,nullable:s,default:n.getDefault(e),type:n.type,oneOf:n._whitelist.describe(),notOneOf:n._blacklist.describe(),tests:n.tests.filter((l,u,f)=>f.findIndex(p=>p.OPTIONS.name===l.OPTIONS.name)===u).map(l=>{const u=l.OPTIONS.params&&e?yI(Object.assign({},l.OPTIONS.params),e):l.OPTIONS.params;return{name:l.OPTIONS.name,params:u}})}}get"~standard"(){const e=this;return{version:1,vendor:"yup",async validate(r){try{return{value:await e.validate(r,{abortEarly:!1})}}catch(o){if(o instanceof pr)return{issues:vI(o)};throw o}}}}}ti.prototype.__isYupSchema__=!0;for(const t of["validate","validateSync"])ti.prototype[`${t}At`]=function(e,n,r={}){const{parent:o,parentPath:i,schema:s}=FQ(this,e,n,r.context);return s[t](o&&o[i],Object.assign({},r,{parent:o,path:e}))};for(const t of["equals","is"])ti.prototype[t]=ti.prototype.oneOf;for(const t of["not","nope"])ti.prototype[t]=ti.prototype.notOneOf;const VQ=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function HQ(t){const e=gv(t);if(!e)return Date.parse?Date.parse(t):Number.NaN;if(e.z===void 0&&e.plusMinus===void 0)return new Date(e.year,e.month,e.day,e.hour,e.minute,e.second,e.millisecond).valueOf();let n=0;return e.z!=="Z"&&e.plusMinus!==void 0&&(n=e.hourOffset*60+e.minuteOffset,e.plusMinus==="+"&&(n=0-n)),Date.UTC(e.year,e.month,e.day,e.hour,e.minute+n,e.second,e.millisecond)}function gv(t){var e,n;const r=VQ.exec(t);return r?{year:Ai(r[1]),month:Ai(r[2],1)-1,day:Ai(r[3],1),hour:Ai(r[4]),minute:Ai(r[5]),second:Ai(r[6]),millisecond:r[7]?Ai(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:Ai(r[10]),minuteOffset:Ai(r[11])}:null}function Ai(t,e=0){return Number(t)||e}let WQ=/^[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])?)*$/,jQ=/^((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,UQ=/^(?:[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,qQ="^\\d{4}-\\d{2}-\\d{2}",KQ="\\d{2}:\\d{2}:\\d{2}",YQ="(([+-]\\d{2}(:?\\d{2})?)|Z)",GQ=new RegExp(`${qQ}T${KQ}(\\.\\d+)?${YQ}$`),JQ=t=>ka(t)||t===t.trim(),XQ={}.toString();function Rl(){return new xI}class xI extends ti{constructor(){super({type:"string",check(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}}),this.withMutation(()=>{this.transform((e,n)=>{if(!this.spec.coerce||this.isType(e)||Array.isArray(e))return e;const r=e!=null&&e.toString?e.toString():e;return r===XQ?e:r})})}required(e){return super.required(e).withMutation(n=>n.test({message:e||ei.required,name:"required",skipAbsent:!0,test:r=>!!r.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(n=>n.OPTIONS.name!=="required"),e))}length(e,n=kr.length){return this.test({message:n,name:"length",exclusive:!0,params:{length:e},skipAbsent:!0,test(r){return r.length===this.resolve(e)}})}min(e,n=kr.min){return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(r){return r.length>=this.resolve(e)}})}max(e,n=kr.max){return this.test({name:"max",exclusive:!0,message:n,params:{max:e},skipAbsent:!0,test(r){return r.length<=this.resolve(e)}})}matches(e,n){let r=!1,o,i;return n&&(typeof n=="object"?{excludeEmptyString:r=!1,message:o,name:i}=n:o=n),this.test({name:i||"matches",message:o||kr.matches,params:{regex:e},skipAbsent:!0,test:s=>s===""&&r||s.search(e)!==-1})}email(e=kr.email){return this.matches(WQ,{name:"email",message:e,excludeEmptyString:!0})}url(e=kr.url){return this.matches(jQ,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=kr.uuid){return this.matches(UQ,{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(GQ,{name:"datetime",message:n||kr.datetime,excludeEmptyString:!0}).test({name:"datetime_offset",message:n||kr.datetime_offset,params:{allowOffset:r},skipAbsent:!0,test:i=>{if(!i||r)return!0;const s=gv(i);return s?!!s.z:!1}}).test({name:"datetime_precision",message:n||kr.datetime_precision,params:{precision:o},skipAbsent:!0,test:i=>{if(!i||o==null)return!0;const s=gv(i);return s?s.precision===o:!1}})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=kr.trim){return this.transform(n=>n!=null?n.trim():n).test({message:e,name:"trim",test:JQ})}lowercase(e=kr.lowercase){return this.transform(n=>ka(n)?n:n.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toLowerCase()})}uppercase(e=kr.uppercase){return this.transform(n=>ka(n)?n:n.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,skipAbsent:!0,test:n=>ka(n)||n===n.toUpperCase()})}}Rl.prototype=xI.prototype;let wI=new Date(""),ZQ=t=>Object.prototype.toString.call(t)==="[object Date]";function yv(){return new Bu}class Bu extends ti{constructor(){super({type:"date",check(e){return ZQ(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((e,n)=>!this.spec.coerce||this.isType(e)||e===null?e:(e=HQ(e),isNaN(e)?Bu.INVALID_DATE:new Date(e)))})}prepareParam(e,n){let r;if(Ta.isRef(e))r=e;else{let o=this.cast(e);if(!this._typeCheck(o))throw new TypeError(`\`${n}\` must be a Date or a value that can be \`cast()\` to a Date`);r=o}return r}min(e,n=hv.min){let r=this.prepareParam(e,"min");return this.test({message:n,name:"min",exclusive:!0,params:{min:e},skipAbsent:!0,test(o){return o>=this.resolve(r)}})}max(e,n=hv.max){let r=this.prepareParam(e,"max");return this.test({message:n,name:"max",exclusive:!0,params:{max:e},skipAbsent:!0,test(o){return o<=this.resolve(r)}})}}Bu.INVALID_DATE=wI,yv.prototype=Bu.prototype,yv.INVALID_DATE=wI;function QQ(t,e=[]){let n=[],r=new Set,o=new Set(e.map(([s,a])=>`${s}-${a}`));function i(s,a){let l=Ca.split(s)[0];r.add(l),o.has(`${a}-${l}`)||n.push([a,l])}for(const s of Object.keys(t)){let a=t[s];r.add(s),Ta.isRef(a)&&a.isSibling?i(a.path,s):mv(a)&&"deps"in a&&a.deps.forEach(l=>i(l,s))}return MQ.array(Array.from(r),n).reverse()}function SI(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 CI(t){return(e,n)=>SI(t,e)-SI(t,n)}const eee=(t,e,n)=>{if(typeof t!="string")return t;let r=t;try{r=JSON.parse(t)}catch{}return n.isType(r)?r:t};function _h(t){if("fields"in t){const e={};for(const[n,r]of Object.entries(t.fields))e[n]=_h(r);return t.setFields(e)}if(t.type==="array"){const e=t.optional();return e.innerType&&(e.innerType=_h(e.innerType)),e}return t.type==="tuple"?t.optional().clone({types:t.spec.types.map(_h)}):"optional"in t?t.optional():t}const tee=(t,e)=>{const n=[...Ca.normalizePath(e)];if(n.length===1)return n[0]in t;let r=n.pop(),o=Ca.getter(Ca.join(n),!0)(t);return!!(o&&r in o)};let TI=t=>Object.prototype.toString.call(t)==="[object Object]";function kI(t,e){let n=Object.keys(t.fields);return Object.keys(e).filter(r=>n.indexOf(r)===-1)}const nee=CI([]);function bv(t){return new EI(t)}class EI extends ti{constructor(e){super({type:"object",check(n){return TI(n)||typeof n=="function"}}),this.fields=Object.create(null),this._sortErrors=nee,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,n={}){var r;let o=super._cast(e,n);if(o===void 0)return this.getDefault(n);if(!this._typeCheck(o))return o;let i=this.fields,s=(r=n.stripUnknown)!=null?r:this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(o).filter(p=>!this._nodes.includes(p))),l={},u=Object.assign({},n,{parent:l,__validating:n.__validating||!1}),f=!1;for(const p of a){let m=i[p],b=p in o,v=o[p];if(m){let y;u.path=(n.path?`${n.path}.`:"")+p,m=m.resolve({value:v,context:n.context,parent:l});let x=m instanceof ti?m.spec:void 0,S=x==null?void 0:x.strict;if(x!=null&&x.strip){f=f||p in o;continue}y=!n.__validating||!S?m.cast(v,u):v,y!==void 0&&(l[p]=y)}else b&&!s&&(l[p]=v);(b!==p in l||l[p]!==v)&&(f=!0)}return f?l:o}_validate(e,n={},r,o){let{from:i=[],originalValue:s=e,recursive:a=this.spec.recursive}=n;n.from=[{schema:this,value:s},...i],n.__validating=!0,n.originalValue=s,super._validate(e,n,r,(l,u)=>{if(!a||!TI(u)){o(l,u);return}s=s||u;let f=[];for(let p of this._nodes){let m=this.fields[p];!m||Ta.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=QQ(e,n),r._sortErrors=CI(Object.keys(e)),n&&(r._excludedEdges=n),r}shape(e,n=[]){return this.clone().withMutation(r=>{let o=r._excludedEdges;return n.length&&(Array.isArray(n[0])||(n=[n]),o=[...r._excludedEdges,...n]),r.setFields(Object.assign(r.fields,e),o)})}partial(){const e={};for(const[n,r]of Object.entries(this.fields))e[n]="optional"in r&&r.optional instanceof Function?r.optional():r;return this.setFields(e)}deepPartial(){return _h(this)}pick(e){const n={};for(const r of e)this.fields[r]&&(n[r]=this.fields[r]);return this.setFields(n,this._excludedEdges.filter(([r,o])=>e.includes(r)&&e.includes(o)))}omit(e){const n=[];for(const r of Object.keys(this.fields))e.includes(r)||n.push(r);return this.pick(n)}from(e,n,r){let o=Ca.getter(e,!0);return this.transform(i=>{if(!i)return i;let s=i;return tee(i,e)&&(s=Object.assign({},i),r||delete s[e],s[n]=o(i)),s})}json(){return this.transform(eee)}exact(e){return this.test({name:"exact",exclusive:!0,message:e||kh.exact,test(n){if(n==null)return!0;const r=kI(this.schema,n);return r.length===0||this.createError({params:{properties:r.join(", ")}})}})}stripUnknown(){return this.clone({noUnknown:!0})}noUnknown(e=!0,n=kh.noUnknown){typeof e!="boolean"&&(n=e,e=!0);let r=this.test({name:"noUnknown",exclusive:!0,message:n,test(o){if(o==null)return!0;const i=kI(this.schema,o);return!e||i.length===0||this.createError({params:{unknown:i.join(", ")}})}});return r.spec.noUnknown=e,r}unknown(e=!0,n=kh.noUnknown){return this.noUnknown(!e,n)}transformKeys(e){return this.transform(n=>{if(!n)return n;const r={};for(const o of Object.keys(n))r[e(o)]=n[o];return r})}camelCase(){return this.transformKeys(pv.camelCase)}snakeCase(){return this.transformKeys(pv.snakeCase)}constantCase(){return this.transformKeys(e=>pv.snakeCase(e).toUpperCase())}describe(e){const n=(e?this.resolve(e):this).clone(),r=super.describe(e);r.fields={};for(const[i,s]of Object.entries(n.fields)){var o;let a=e;(o=a)!=null&&o.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[i]})),r.fields[i]=s.describe(a)}return r}}bv.prototype=EI.prototype;const ree=t=>{const{open:e,anchorEl:n,onGenerateCitation:r,onClose:o}=t;return g.jsx(z.Popper,{open:e,anchorEl:n,placement:"bottom-end",style:{zIndex:1300},sx:{maxWidth:"500px"},children:g.jsxs(Lu,{component:z.Paper,p:1,boxShadow:9,gap:.25,children:[g.jsx(z.Typography,{variant:"body1",children:"Paste in a preformatted citation"}),g.jsx(z.Typography,{variant:"body2",color:"text.secondary",fontStyle:"italic",fontSize:".8em",children:"For best results, ensure your citations use a vertical bar ( | ) to separate the title, source, url, etc. Incomplete citations are allowed but may result in incompletely filled fields."}),g.jsx(Ht.Formik,{initialValues:{pasteExistingCitation:""},onSubmit:({pasteExistingCitation:i})=>{r(see(i)),o()},children:({values:i,submitForm:s,setFieldValue:a})=>g.jsxs(Qo,{flexWrap:"wrap",justifyContent:"flex-end",children:[g.jsx(UM,{name:"pasteExistingCitation",errorMode:"collapse",label:"",placeholder:"Scientific News Today | How to Organize Your Workspace for Maximum Efficiency | https://mock-news-site.com | ACCESSED 2 JAN 2026 | Public Source",endIcon:g.jsx(z.Tooltip,{title:"Paste from Clipboard",children:g.jsx(z.IconButton,{"data-testid":"paste-content-button",onClick:()=>{navigator.clipboard.readText().then(l=>a("pasteExistingCitation",l))},children:g.jsx(AU,{})})})}),g.jsxs(Qo,{children:[g.jsx(Tr,{size:"small",variant:"outlined",onClick:o,"data-testid":"citation-table_paste-prompt_cancel",children:"Cancel"}),g.jsx(Tr,{size:"small",type:"submit",onClick:s,"data-testid":"citation-table_paste-prompt_submit",disabled:!i.pasteExistingCitation,children:"Prefill Citation"})]})]})})]})})},oee=["https://","http://","www."],iee=new RegExp(oee.join("|")),see=t=>{const e=t.replace(/\.\s*$/,"").split("|").map(f=>f.trim()).filter(Boolean),n=e.findIndex(f=>f.match(iee)),r=e.findIndex(f=>f.toUpperCase().startsWith("ACCESSED")),o=e.findIndex(f=>/\bSOURCE\b/.test(f.toUpperCase()));let s=[n,r,o].find(f=>f!==-1)??e.length;const a=s-1,l=s-2;return{type:"Url",source:Ih(e,l),title:Ih(e,a),url:Ih(e,n),accessedAt:aee(e,r),classification:lee(e,o),details:Ih(e,o)}},Ih=(t,e)=>e<0||e>=t.length?"":t[e],aee=(t,e)=>e<0||e>=t.length?"":xZ(t[e].toUpperCase().replace(/^ACCESSED\s+/,"")),lee=(t,e)=>e<0||e>=t.length?"":t[e].toUpperCase().includes("PUBLIC")?"Public Source":"Proprietary Source",OI=t=>{const{loading:e=!1,type:n="submit",size:r="medium",...o}=t,s={small:16,medium:20,large:24}[r];return g.jsx(Tr,{type:n,disabled:e,size:r,startIcon:e?g.jsx(z.CircularProgress,{size:s,color:"inherit"}):null,...o})},MI=t=>{const{onCancel:e,onViewCitationTable:n,readOnly:r=!1,showViewAllCitationsBtn:o=!1,isLoading:i,onSaveClicked:s}=t;return r&&!o?null:r?g.jsx(z.DialogActions,{sx:{px:0},children:g.jsx(z.Button,{onClick:n,size:"small",variant:"outlined",children:"Back To Table"})}):g.jsxs(z.DialogActions,{sx:{px:0,justifyContent:"space-between"},children:[g.jsx(z.Box,{children:o&&g.jsx(z.Button,{onClick:n,size:"small",variant:"outlined",children:"View All Citations"})}),g.jsxs(Qo,{children:[g.jsx(z.Button,{onClick:e,variant:"outlined",size:"small",children:"Cancel"}),g.jsx(OI,{size:"small",loading:i,type:"button",onClick:s,children:"Save"})]})]})},cee=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,canLaunchUrl:l}=t,u=J.useRef(null),[f,p]=J.useState(!1),[m,b]=J.useState(!1),v=J.useRef(null),[y,x]=J.useState(!1),[S,k]=J.useState({type:"Url",source:"",title:"",accessedAt:null,url:"",classification:"",details:""});J.useEffect(()=>{i&&k({...i,type:"Url"})},[]);const T={disabled:f,margin:"none",readOnly:s},C=!s;return g.jsxs(z.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(Qo,{justifyContent:"space-between",children:[g.jsxs(Qo,{gap:2,children:[g.jsxs(z.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Citation"]}),C&&g.jsx(z.Button,{variant:"outlined",size:"small",ref:v,onClick:()=>x(!0),children:"Paste & Prefill"})]}),g.jsx(z.IconButton,{onClick:o,children:g.jsx(fp,{})})]}),g.jsx(Ht.Formik,{innerRef:u,enableReinitialize:!0,initialValues:S,onSubmit:async O=>{p(!0),e(O).catch(I=>{throw p(!1),I}).finally(()=>p(!1))},validationSchema:bv({title:Rl().required("Title is required"),accessedAt:yv().required("Accessed At is required"),url:Rl().required("URL is required"),classification:Rl().required("Classification is required")}),validateOnBlur:m,validateOnChange:m,children:({submitForm:O,setValues:I,values:N})=>g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsxs(z.Box,{display:"flex",flexDirection:"column",gap:s?1:0,alignItems:"flex-start",children:[g.jsx(ki,{...T,name:"title",required:!0}),g.jsx(ki,{...T,name:"source"}),g.jsx(ki,{...T,name:"details",label:"Details (e.g. Source Description)"}),g.jsx(Up,{...T,name:"accessedAt",required:!0,isDatePicker:!0}),s&&(l!=null&&l(N))?g.jsx(g.Fragment,{children:g.jsx(Ti,{label:"URL / Other Identifier",readOnlyValue:g.jsx(uv,{citation:N,canLaunchUrl:l,asLink:!0}),value:N.url??""})}):g.jsx(ki,{...T,name:"url",label:"URL / Other Identifier",required:!0,endIcon:g.jsx(uv,{citation:N,canLaunchUrl:l})}),g.jsx(jM,{...T,name:"classification",row:!0,required:!0,radios:uee})]}),g.jsx(MI,{isLoading:f,onSaveClicked:()=>{b(!0),O()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n}),g.jsx(ree,{open:y,onGenerateCitation:L=>{I(L,!0)},anchorEl:v.current,onClose:()=>x(!1)})]})})]})},uee=[{label:"Public Source",value:"Public Source",helperText:"URL is accessible to anyone from any location without special permissions. You can safely access this URL on any computer, including public or shared devices."},{label:"Proprietary Source",value:"Proprietary Source",helperText:"For private, sensitive, or access-controlled content. Use a VPN, or take extra precautions, when accessing to protect your privacy."}],dee=t=>{const{onSave:e,onCancel:n,onViewCitationTable:r,onClose:o,modifyCitation:i,readOnly:s=!1,showViewAllCitationsBtn:a=!1,onDownloadAttachment:l,onPreviewAttachment:u}=t,f=J.useRef(null),[p,m]=J.useState(!1),[b,v]=J.useState(!1),[y,x]=J.useState({type:"Attachment",title:"",file:void 0,fileName:""});return J.useEffect(()=>{i&&x({...i,type:"Attachment",file:void 0})},[]),g.jsxs(z.Box,{minWidth:"400px",maxWidth:"500px",children:[g.jsxs(z.Box,{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",children:[g.jsxs(z.Typography,{variant:"h6",margin:"10px 0",children:[s?"View":"Edit"," Attachment"]}),g.jsx(z.IconButton,{onClick:o,children:g.jsx(fp,{})})]}),g.jsx(Ht.Formik,{innerRef:f,enableReinitialize:!0,initialValues:y,validationSchema:bv().shape({title:Rl().required("Title is required"),fileName:Rl().required("A file is required")}),validateOnBlur:b,validateOnChange:b,onSubmit:async S=>{m(!0),e(S).catch(k=>{throw m(!1),k}).finally(()=>m(!1))},children:({values:S,setFieldValue:k,handleSubmit:T})=>{var O;const C=!s&&!S.id;return J.useEffect(()=>{var I,N;(I=S.file)!=null&&I.name&&k("fileName",(N=S.file)==null?void 0:N.name)},[(O=S.file)==null?void 0:O.name]),g.jsxs(Ht.Form,{autoComplete:"off",children:[g.jsx(ki,{name:"title",disabled:p,required:!0,margin:"none",readOnly:s}),g.jsxs(z.Box,{marginTop:C?1:0,children:[g.jsxs(Qo,{alignItems:"flex-start",children:[C&&g.jsx(kM,{name:"file",errorMode:"hidden"}),g.jsxs(Qo,{alignItems:"flex-end",children:[g.jsx(ki,{readOnly:!0,name:"fileName",label:C?"":"File Name"}),!C&&g.jsxs(Qo,{children:[g.jsx(oI,{citation:S,onDownloadAttachment:l}),g.jsx(iI,{citation:S,onPreviewAttachment:u})]})]})]}),g.jsx(yr,{name:"fileName"})]}),g.jsx(MI,{isLoading:p,onSaveClicked:()=>{v(!0),T()},readOnly:s,showViewAllCitationsBtn:a,onViewCitationTable:r,onCancel:n})]})}})]})},Fu=t=>{const{open:e=!1,onClose:n,title:r,children:o,actions:i,closeBtnLabel:s,closeButtonPosition:a,closeButtonProps:l={},disableDismiss:u=!1,...f}=t;if(!e)return null;const p=a==="bottom"||a==="top-and-bottom",m=a==="top"||a==="top-and-bottom",b=()=>{if(s&&p)return g.jsx(z.Button,{className:"MBv2_Modal_Close",onClick:t.onClose,...l,children:s})},v=()=>{if(i)return g.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",width:"100%",gap:"0.25rem",children:[g.jsx(z.Box,{children:b()}),g.jsxs(z.Box,{display:"flex",gap:".25rem",children:[...i]})]})});if(s&&p)return g.jsx(z.DialogActions,{className:"MBv2_Modal_Actions",children:g.jsx(z.Box,{children:b()})})};return g.jsxs(z.Dialog,{className:"MBv2_Modal",open:e,onClose:()=>{u||n==null||n()},...f,children:[typeof r=="string"?g.jsx(z.DialogTitle,{className:"MBv2_Modal_Title",children:g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[r,m&&g.jsx(z.IconButton,{"data-testid":"modal-header-close-btn",onClick:n,children:g.jsx(fp,{})})]})}):r,o&&(typeof o=="string"?g.jsx(z.DialogContent,{className:"MBv2_Modal_Content",children:g.jsx(z.DialogContentText,{className:"MBv2_Modal_Content_Text",children:o})}):o),v()]})};function fee(t){return Ke("MuiAlert",t)}const _I=je("MuiAlert",["root","action","icon","message","filled","colorSuccess","colorInfo","colorWarning","colorError","filledSuccess","filledInfo","filledWarning","filledError","outlined","outlinedSuccess","outlinedInfo","outlinedWarning","outlinedError","standard","standardSuccess","standardInfo","standardWarning","standardError"]),pee=Le(g.jsx("path",{d:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2, 4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0, 0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"}),"SuccessOutlined"),hee=Le(g.jsx("path",{d:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z"}),"ReportProblemOutlined"),mee=Le(g.jsx("path",{d:"M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),"ErrorOutline"),gee=Le(g.jsx("path",{d:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20, 12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10, 10 0 0,0 12,2M11,17H13V11H11V17Z"}),"InfoOutlined"),yee=Le(g.jsx("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close"),bee=t=>{const{variant:e,color:n,severity:r,classes:o}=t,i={root:["root",`color${Ne(n||r)}`,`${e}${Ne(n||r)}`,`${e}`],icon:["icon"],message:["message"],action:["action"]};return qe(i,fee,o)},vee=oe(fs,{name:"MuiAlert",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:n}=t;return[e.root,e[n.variant],e[`${n.variant}${Ne(n.color||n.severity)}`]]}})(bt(({theme:t})=>{const e=t.palette.mode==="light"?Vs:Va,n=t.palette.mode==="light"?Va:Vs;return{...t.typography.body2,backgroundColor:"transparent",display:"flex",padding:"6px 16px",variants:[...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"standard"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),backgroundColor:t.vars?t.vars.palette.Alert[`${r}StandardBg`]:n(t.palette[r].light,.9),[`& .${_I.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["light"])).map(([r])=>({props:{colorSeverity:r,variant:"outlined"},style:{color:t.vars?t.vars.palette.Alert[`${r}Color`]:e(t.palette[r].light,.6),border:`1px solid ${(t.vars||t).palette[r].light}`,[`& .${_I.icon}`]:t.vars?{color:t.vars.palette.Alert[`${r}IconColor`]}:{color:t.palette[r].main}}})),...Object.entries(t.palette).filter(Hn(["dark"])).map(([r])=>({props:{colorSeverity:r,variant:"filled"},style:{fontWeight:t.typography.fontWeightMedium,...t.vars?{color:t.vars.palette.Alert[`${r}FilledColor`],backgroundColor:t.vars.palette.Alert[`${r}FilledBg`]}:{backgroundColor:t.palette.mode==="dark"?t.palette[r].dark:t.palette[r].main,color:t.palette.getContrastText(t.palette[r].main)}}}))]}})),xee=oe("div",{name:"MuiAlert",slot:"Icon",overridesResolver:(t,e)=>e.icon})({marginRight:12,padding:"7px 0",display:"flex",fontSize:22,opacity:.9}),wee=oe("div",{name:"MuiAlert",slot:"Message",overridesResolver:(t,e)=>e.message})({padding:"8px 0",minWidth:0,overflow:"auto"}),See=oe("div",{name:"MuiAlert",slot:"Action",overridesResolver:(t,e)=>e.action})({display:"flex",alignItems:"flex-start",padding:"4px 0 0 16px",marginLeft:"auto",marginRight:-8}),II={success:g.jsx(pee,{fontSize:"inherit"}),warning:g.jsx(hee,{fontSize:"inherit"}),error:g.jsx(mee,{fontSize:"inherit"}),info:g.jsx(gee,{fontSize:"inherit"})},DI=A.forwardRef(function(e,n){const r=mt({props:e,name:"MuiAlert"}),{action:o,children:i,className:s,closeText:a="Close",color:l,components:u={},componentsProps:f={},icon:p,iconMapping:m=II,onClose:b,role:v="alert",severity:y="success",slotProps:x={},slots:S={},variant:k="standard",...T}=r,C={...r,color:l,severity:y,variant:k,colorSeverity:l||y},O=bee(C),I={slots:{closeButton:u.CloseButton,closeIcon:u.CloseIcon,...S},slotProps:{...f,...x}},[N,L]=_t("root",{ref:n,shouldForwardComponentProp:!0,className:ge(O.root,s),elementType:vee,externalForwardedProps:{...I,...T},ownerState:C,additionalProps:{role:v,elevation:0}}),[V,M]=_t("icon",{className:O.icon,elementType:xee,externalForwardedProps:I,ownerState:C}),[B,H]=_t("message",{className:O.message,elementType:wee,externalForwardedProps:I,ownerState:C}),[F,P]=_t("action",{className:O.action,elementType:See,externalForwardedProps:I,ownerState:C}),[_,D]=_t("closeButton",{elementType:_l,externalForwardedProps:I,ownerState:C}),[R,j]=_t("closeIcon",{elementType:yee,externalForwardedProps:I,ownerState:C});return g.jsxs(N,{...L,children:[p!==!1?g.jsx(V,{...M,children:p||m[y]||II[y]}):null,g.jsx(B,{...H,children:i}),o!=null?g.jsx(F,{...P,children:o}):null,o==null&&b?g.jsx(F,{...P,children:g.jsx(_,{size:"small","aria-label":a,title:a,color:"inherit",onClick:b,...D,children:g.jsx(R,{fontSize:"small",...j})})}):null]})});process.env.NODE_ENV!=="production"&&(DI.propTypes={action:c.node,children:c.node,classes:c.object,className:c.string,closeText:c.string,color:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),components:c.shape({CloseButton:c.elementType,CloseIcon:c.elementType}),componentsProps:c.shape({closeButton:c.object,closeIcon:c.object}),icon:c.node,iconMapping:c.shape({error:c.node,info:c.node,success:c.node,warning:c.node}),onClose:c.func,role:c.string,severity:c.oneOfType([c.oneOf(["error","info","success","warning"]),c.string]),slotProps:c.shape({action:c.oneOfType([c.func,c.object]),closeButton:c.oneOfType([c.func,c.object]),closeIcon:c.oneOfType([c.func,c.object]),icon:c.oneOfType([c.func,c.object]),message:c.oneOfType([c.func,c.object]),root:c.oneOfType([c.func,c.object])}),slots:c.shape({action:c.elementType,closeButton:c.elementType,closeIcon:c.elementType,icon:c.elementType,message:c.elementType,root:c.elementType}),sx:c.oneOfType([c.arrayOf(c.oneOfType([c.func,c.object,c.bool])),c.func,c.object]),variant:c.oneOfType([c.oneOf(["filled","outlined","standard"]),c.string])});const Ru=t=>{var b;const{noIcon:e=!1,children:n,severity:r="success",variant:o="leftBorder",sx:i,title:s,...a}=t,{palette:l}=z.useTheme(),u=e?{icon:!1}:{},f=o==="leftBorder"?"standard":o,p=o==="leftBorder"?{...i,borderLeft:`4px solid ${(b=l[r])==null?void 0:b.main}`}:i,m=s?{icon:{sx:{mt:"6px"}}}:{};return g.jsxs(DI,{severity:r,variant:f,sx:p,slotProps:m,...u,...a,children:[s&&g.jsx(z.Typography,{variant:"h3",children:s}),n]})},AI=t=>g.jsx(Ru,{severity:"error",...t}),PI=t=>g.jsx(Ru,{severity:"success",...t}),Cee=t=>{const{alert:e,setAlert:n}=t,r=()=>n(void 0);return g.jsxs(g.Fragment,{children:[(e==null?void 0:e.type)==="Error"&&g.jsx(AI,{"data-testid":"citation-menu-error",onClose:r,title:e.title,children:e.message.toString()}),(e==null?void 0:e.type)==="Success"&&g.jsx(PI,{"data-testid":"citation-menu-success",onClose:r,children:e.message})]})};function NI({getCitationsPaginated:t,onCreateCitation:e,onUpdateCitation:n,onDeleteCitation:r,getCitationById:o,onDownloadAttachment:i,onPreviewAttachment:s,onSelectCitations:a,onClose:l,initialSelectedIds:u=[],onContentChange:f,onError:p=()=>{},renderAsPopup:m=!1,canSelect:b=!1,tableTitle:v="Attachments & Citations",addlActions:y,canLaunchUrl:x,readOnly:S,canSearch:k=!1}){const[T,C]=J.useState("Insert Citation/Attachment(s)"),[O,I]=J.useState(u),[N,L]=J.useState(void 0),[V,M]=J.useState(void 0),[B,H]=J.useState(!1),[F,P]=J.useState(!1),_=ee=>{M(void 0),C(ee)},[D,R]=J.useState(0);J.useEffect(()=>{f==null||f()},[T,V,f]);const j=(ee=!1)=>{(!m||ee)&&R(ie=>ie+1)},K=(ee,ie)=>{var Me;const we=typeof((Me=ie.response)==null?void 0:Me.data)=="string"&&ie.response.data,Ce=typeof ie.message=="string"&&ie.message;M({type:"Error",title:ee,message:we??Ce}),p(ie)},U=ee=>M({type:"Success",title:"",message:ee}),Y=async ee=>{if(T==="Insert Citation/Attachment(s)")throw Error("onSave called with invalid state");ee.id?await(n==null?void 0:n(ee).then(()=>{B?l():(_("Insert Citation/Attachment(s)"),j())}).catch(ie=>{K("Failed to update",ie)})):await(e==null?void 0:e(ee).then(ie=>{I([...O,ie.id]),_("Insert Citation/Attachment(s)"),j()}).catch(ie=>{K("Failed to create",ie)}))},fe=r&&(async ee=>r(ee).then(()=>{j(!0),I(O.filter(ie=>ie!==ee)),U("Successfully deleted")}).catch(ie=>K("Failed to delete",ie))),ue=o&&(ee=>{o(ee).then(ie=>{const we=!!ie.fileName;L(ie),_(we?"Attachment":"Citation")}).catch(ie=>{K("Failed to load",ie)}).finally(()=>P(!1))}),pe=n&&ue,Z=n&&ue,te=i&&(async ee=>i(ee).catch(ie=>{K(`Failed to download ${ee.fileName}`,ie)})),ce=s&&(async ee=>s(ee).catch(ie=>{K(`Failed to view ${ee.fileName}`,ie)})),ne=g.jsx(CQ,{refreshKey:D,getCitationsPaginated:(ee,ie)=>t(ee,ie).then(we=>(f==null||f(),we)),onCancel:l,onNewCitation:()=>{L(void 0),_("Citation")},onNewAttachment:()=>{L(void 0),_("Attachment")},onEditCitation:pe,onEditAttachment:Z,onViewCitation:ue,onViewAttachment:ue,onDeleteCitation:fe,onDownloadAttachment:te,onPreviewAttachment:ce,onSelect:a,setSelectedIds:I,selectedIds:O,onError:p,condenseTable:m,canSelect:b,title:v,addlActions:y,canCreate:!!e,canLaunchUrl:x,readOnly:S,showCloseBtn:m,canSearch:k}),re=g.jsx(cee,{modifyCitation:N,onSave:Y,onCancel:()=>B?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),H(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),readOnly:S,showViewAllCitationsBtn:S&&!B||!S&&B,canLaunchUrl:x}),le=g.jsx(dee,{onSave:Y,onCancel:()=>B?l():_("Insert Citation/Attachment(s)"),onViewCitationTable:()=>{_("Insert Citation/Attachment(s)"),H(!1)},onClose:()=>m?l():_("Insert Citation/Attachment(s)"),modifyCitation:N,readOnly:S,showViewAllCitationsBtn:S&&!B||!S&&B,onDownloadAttachment:te,onPreviewAttachment:ce}),ye=g.jsx(Cee,{alert:V,setAlert:M});J.useEffect(()=>{m&&u.length===1&&ue&&(P(!0),H(!0),ue(u[0]))},[]);const X=()=>{switch(T){case"Insert Citation/Attachment(s)":return ne;case"Citation":return re;case"Attachment":return le}};return m?g.jsxs(z.Box,{children:[ye,g.jsx(z.Box,{paddingTop:"8px",children:g.jsx(lv,{isLoading:F,children:X()})})]}):g.jsxs(z.Box,{width:"100%",children:[T==="Insert Citation/Attachment(s)"&&ye,g.jsx(z.Box,{paddingTop:"8px",children:ne}),g.jsx(Fu,{open:T!=="Insert Citation/Attachment(s)",children:g.jsxs(z.Box,{padding:"10px 20px",minWidth:"400px","data-testid":"citation-form-modal",children:[ye,T==="Citation"?re:le]})})]})}function $I({getSelectedCitationsPaginated:t,getCitationsPaginated:e,readOnly:n,initialSelectedIds:r=[],...o}){const i=(s,a)=>n?t(s,r):e(s,a);return g.jsx(NI,{renderAsPopup:!0,canSelect:!n,getCitationsPaginated:i,readOnly:n,tableTitle:`${n?"Selected":"Insert"} Citation/Attachment(s)`,initialSelectedIds:r,...o})}const Tee=z.styled("div",{name:"CitationBubbleMenu",slot:"content",overridesResolver:(t,e)=>e.content})(({theme:t})=>{const e=t.palette.mode==="dark";return{padding:t.spacing(1.5,2,.5),backgroundColor:e?"#101010":"#f9f9f9",border:`1px solid ${t.palette.grey[e?700:200]}`}});function kee({getCitationsPaginated:t,getSelectedCitationsPaginated:e,onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,canLaunchUrl:l,readOnly:u,canSearch:f,...p}){const m=Tt();if(m&&!("citationBubbleMenuHandler"in(m==null?void 0:m.storage)))throw new Error("You must add the CitationBubbleMenuHandler extension to the useEditor `extensions` array in order to use this component!");const b=m==null?void 0:m.storage.citationBubbleMenuHandler,v=b.isOpen,y=b.selectedIds,x=b.selectedNodePos,S=O=>{m&&(O.length===0?m.commands.deleteCitation(x):y.length===0?m.commands.insertCitation({ids:O}):m.commands.updateCitation({ids:O},x))},k=O=>{S(O),m==null||m.commands.closeCitationBubbleMenu()},T=()=>{S(y),m==null||m.commands.closeCitationBubbleMenu()},C=J.useCallback(()=>{requestAnimationFrame(()=>{m!=null&&m.view&&m.view.dispatch(m.view.state.tr)})},[m]);return m?g.jsx(Sy,{editor:m,open:v,...b.bubbleMenuOptions,...p,children:g.jsx(Tee,{children:g.jsx($I,{getCitationsPaginated:t,getSelectedCitationsPaginated:O=>e(O,y),onCreateCitation:n,onUpdateCitation:r,onDeleteCitation:o,getCitationById:i,onDownloadAttachment:s,onPreviewAttachment:a,onSelectCitations:k,onClose:T,initialSelectedIds:y,onContentChange:C,canLaunchUrl:l,readOnly:u,canSearch:f})})}):null}const Eee=()=>cn.create({name:"citationBubbleMenuHandler",addStorage(){return{isOpen:!1,selectedIds:[],bubbleMenuOptions:void 0,selectedNodePos:0}},addCommands(){return{openCitationBubbleMenu:(t={},e)=>({editor:n,dispatch:r})=>{var a;const{doc:o}=n.state,i=o.nodeAt(e??0),s=((a=i==null?void 0:i.attrs)==null?void 0:a.ids)??[];return r&&(this.storage.isOpen=!0,this.storage.selectedIds=s,this.storage.bubbleMenuOptions=t,this.storage.selectedNodePos=e??0),!0},closeCitationBubbleMenu:()=>({commands:t,dispatch:e})=>this.storage.isOpen?(t.focus(),e&&(this.storage.isOpen=!1,this.storage.selectedIds=[],this.storage.selectedNodePos=0),!0):!1}},onSelectionUpdate(){this.storage.isOpen&&!this.editor.isActive("citation")&&this.editor.commands.closeCitationBubbleMenu()},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>(this.editor.commands.openCitationBubbleMenu(),!0)}}});function Oee(t){const e=Tt(),n=J.useRef(null);return g.jsx(wt,{buttonRef:n,tooltipLabel:"Insert Citation/Attachment",tooltipShortcutKeys:["mod","Shift","C"],disabled:!(e!=null&&e.isEditable),onClick:()=>e==null?void 0:e.commands.openCitationBubbleMenu({anchorEl:n.current,placement:"bottom"}),...t,children:g.jsxs(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:[g.jsx(_U,{fontSize:"small"}),g.jsx(z.Typography,{variant:"body2",children:"Insert Citation/Attachment"})]})})}const LI=J.createContext(void 0),BI=()=>{const t=J.useContext(LI);if(!t)throw new Error("useSync must be used inside CitationFieldProvider");return t},Mee=({node:t,HTMLAttributes:e,selected:n,extension:r,updateAttributes:o,deleteNode:i})=>{const s=t.attrs.ids||[],{citations:a,isLoaded:l}=BI(),[u,f]=J.useState(s?String(s):""),[p,m]=J.useState([]),b=r.options.citationMaxLength;if(J.useEffect(()=>{if(!l)return;const v=a.filter(S=>s.includes(S.id)),y=v.map(S=>bs.truncate(S.title,{length:b,omission:"..."})).join(", ");f(y),m(v);const x=v.map(S=>S.id);x.length===0?setTimeout(i,0):x.length!==s.length&&setTimeout(()=>o({ids:v.map(S=>S.id)}),0)},[a,s,l]),p.length!==0)return g.jsx(_b,{as:"span",...e,"data-testid":"citation-node-component",children:g.jsx(z.Tooltip,{title:g.jsx(z.Box,{className:"citation-tooltip",children:p.map((v,y)=>{var k;const S=!!v.fileName?[v.title,v.fileName]:[v.title,v.source,v.details,(k=v.accessedAt)==null?void 0:k.slice(0,10),v.url,v.classification];return g.jsxs(z.Typography,{variant:"subtitle2",children:[S.filter(Boolean).join(" | "),y<p.length-1&&g.jsx(z.Divider,{className:"citation-tooltip-divider"})]},v.id)})}),slotProps:{tooltip:{sx:{maxWidth:500}}},children:g.jsx("a",{href:"#",onClick:v=>{v.preventDefault(),v.stopPropagation()},className:n?"selected-citation-link":"citation-link",children:u})})})},_ee=tn.create({name:"citation",group:"inline",inline:!0,atom:!0,selectable:!0,addAttributes(){return{ids:{default:[],parseHTML:t=>{const e=t.getAttribute("ids");return e?e.split(",").map(n=>parseInt(n.trim(),10)).filter(n=>!isNaN(n)):[]},renderHTML:t=>({ids:Array.isArray(t.ids)?t.ids.join(","):""})}}},parseHTML(){return[{tag:"citation"}]},renderHTML({HTMLAttributes:t}){return["citation",Ct(t)]},addNodeView(){return Ib(Mee)},addProseMirrorPlugins(){return[new en({props:{handleClickOn:(t,e,n,r,o,i)=>n&&n.type.name==="citation"?(this.editor.commands.openCitationBubbleMenu({},r),!0):!1}})]},addCommands(){return{insertCitation:t=>({commands:e})=>e.insertContent({type:"citation",attrs:t}),updateCitation:(t,e)=>({state:n,dispatch:r,tr:o})=>{const i=n.doc.nodeAt(e);return!i||i.type.name!=="citation"?!1:(o.setNodeMarkup(e,void 0,t),r&&r(o),!0)},deleteCitation:t=>({tr:e,dispatch:n})=>{if(typeof t!="number")return!1;const r=t,o=t+1;return n&&n(e.delete(r,o)),!0}}}});function FI({editor:t,canComment:e=!0,onComment:n,commentCount:r,commentResolved:o,...i}){const s=J.useRef(null);if(!n)return null;const a=o?g.jsx(iE,{sx:{width:14,height:14},"data-testid":"resolved-checkmark"}):r,l=o?"success":"primary",u=o?{"& .MuiBadge-badge":{padding:0,height:16,minWidth:16}}:{"& .MuiBadge-badge":{fontSize:14,height:16,minWidth:16}};return e?g.jsx(wt,{buttonRef:s,tooltipLabel:"Comments",onClick:()=>{if(!t)return;const{from:f,to:p}=t.state.selection,m=t.state.doc.textBetween(f,p,`
|
|
409
|
-
`).trim();n(m)},...i,children:g.jsx(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:g.jsx(z.Badge,{"data-testid":"comment-button-badge",badgeContent:a,color:l,sx:u,children:g.jsx(VU,{sx:{fontSize:"22px"}})})})}):null}const Iee=t=>{var Z;const{name:e,label:n=Ln(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x=()=>{},placeholder:S="Start typing here...",errorMode:k="normal",canLaunchUrl:T,canSearch:C=!1,redoUndo:O=!1}=t,I=[FT.configure({code:!1,codeBlock:!1,heading:!1,blockquote:!1,horizontalRule:!1,strike:!1}),Xb,Y2.configure({placeholder:S}),Eee(),_ee.configure({citationMaxLength:a})],[N,L,V]=Ht.useField({name:e}),{setValue:M}=V,{value:B}=N,{addUpdateCitation:H,deleteCitation:F,batchUpdate:P,citations:_}=BI();J.useEffect(()=>{var ne;const te=(ne=D==null?void 0:D.current)==null?void 0:ne.editor;if(!te)return;te.getHTML()!==B&&setTimeout(()=>{te.commands.setContent(B)},0)},[B]);const D=J.useRef(null),R={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},j=(te=void 0)=>{var re,le;const ce=((le=(re=D.current)==null?void 0:re.editor)==null?void 0:le.getHTML())??"",ne=!ce.replace(/<\/?p>|<br>/g,"").trim();M(ne?"":ce,te)},K=J.useMemo(()=>bs.debounce(()=>j(!1),500),[M]),U=Hs(),{showDiff:Y,getPreviousValue:fe}=Ws(),ue=i??U;if(Y){const te=fe(e)??"",ce=B,ne=/<citation\s+ids="([^"]*)"><\/citation>/g,re=(X,ee)=>{const ie=ee.split(",").map(Number);return`<sup>${_.filter(we=>ie.includes(we.id)).map(we=>we.title)}</sup>`},le=te.replace(ne,re),ye=ce.replace(ne,re);return g.jsx(Ti,{label:n,value:ye,showDiff:!0,diffSnapshot:le,mode:"html"})}const pe=bs.pick(t,["canComment","onComment","commentCount","commentResolved"]);return g.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:ue?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...R[s],display:"flex",flexDirection:"column",width:"100%",children:[g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&g.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:o,children:n}),i&&g.jsx(FI,{...pe,editor:(Z=D==null?void 0:D.current)==null?void 0:Z.editor})]}),g.jsx(pM,{ref:D,extensions:I,content:B,editable:!ue,renderControls:()=>{var te;return g.jsxs(jf,{justifyContent:"space-between",children:[g.jsxs(jf,{children:[g.jsx(Oee,{}),g.jsx(An,{}),g.jsx(SE,{}),g.jsx(DE,{}),g.jsx(NE,{}),g.jsx(An,{}),g.jsx(AE,{}),g.jsx(CE,{})]}),g.jsx(FI,{...pe,editor:(te=D==null?void 0:D.current)==null?void 0:te.editor})]})},onBlur:()=>j(),onUpdate:K,RichTextFieldProps:{variant:ue?"standard":"outlined",MenuBarProps:{hide:ue},footer:O&&g.jsxs(z.Stack,{direction:"row",spacing:2,sx:{borderTop:te=>`1px solid ${te.palette.divider}`,p:1},children:[g.jsx($E,{}),g.jsx(PE,{})]})},children:()=>g.jsx(kee,{getCitationsPaginated:(te,ce)=>l(te,ce).then(ne=>(P(ne.data),ne)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(te=>f(te).then(ce=>(H(ce),ce))),onUpdateCitation:p&&(te=>p(te).then(ce=>(H(ce),ce))),onDeleteCitation:m&&(te=>m(te).then(()=>F(te))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x,canLaunchUrl:T,readOnly:ue,canSearch:C})}),g.jsx(yr,{name:e,id:`${e}-err`,errorMode:k})]})},Dee=t=>g.jsx(CM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Aee=t=>{const{name:e="submit"}=t;return g.jsx(Tr,{name:e,type:"submit",...t})},Pee=t=>{const{label:e="Return to Top",icon:n=pp,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return g.jsx(z.Zoom,{in:o,children:g.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:g.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[g.jsx(n,{fontSize:"medium"}),e]})})})},RI=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=bo.useNavigate(),[i,s]=A.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return g.jsxs(g.Fragment,{children:[g.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),g.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>g.jsxs(z.MenuItem,{...La(p,o),children:[p.icon&&g.jsx(z.ListItemIcon,{children:p.icon}),g.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},Nee=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=z.useTheme();return g.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:g.jsxs(z.List,{children:[g.jsxs(z.ListItem,{children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(t,null,2)})]}),g.jsx(z.Divider,{variant:"inset",component:"li"}),g.jsxs(z.ListItem,{id:"testing",children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(e,null,2)})]}),g.jsxs(z.ListItem,{children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},$ee=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=rI();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,...lr({...t},l)};return g.jsx(z.Stepper,{...u,children:e.map(f=>g.jsx(z.Step,{children:g.jsx(z.StepLabel,{children:f})},f))})},Lee=t=>{const{name:e,label:n=Ln(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?g.jsx(GM,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ht.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return g.jsxs(z.FormControl,{fullWidth:!0,children:[g.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?g.jsx(z.Typography,{children:b}):g.jsx(Ht.FieldArray,{name:e,render:T=>g.jsxs("div",{children:[S.map((C,O)=>g.jsx(J.Fragment,{children:g.jsx(Bee,{variant:l,content:g.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[g.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&g.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&g.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&g.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Bee=({variant:t,content:e})=>{switch(t){case"card":return g.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:g.jsx(z.CardContent,{children:e})});case"elevatedCard":return g.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:g.jsx(z.CardContent,{children:e})});case"none":return e}},Fee=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return g.jsx(Fu,{actions:[g.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Ree=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return g.jsx(Fu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},zee=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return g.jsx(Fu,{actions:[g.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),g.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Vee={added:{icon:OU,label:"Added",color:"success"},deleted:{icon:GM,label:"Deleted",color:"error"},modified:{icon:IU,label:"Modified",color:"info"},unmodified:{label:"Unmodified",color:"default"}},Hee=(t,e)=>g.jsxs(g.Fragment,{children:[g.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:up},children:g.jsx("s",{children:t})}),g.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:cp},children:g.jsx("u",{children:e})})]}),Wee=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Ll(s,e,r),l=Ll(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??SM.isEqual(a,l))||(o[xn(s)]=Hee(a,l))}return o},zI=(t,e,n,r=!1,o)=>{const i=[],s=[];let a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);a<e.length&&l<n.length;){const u=e[a],f=n[l];if(u.id===f.id){const p=Wee(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?s.push({...f,changeType:"unmodified"}):i.push({...f,changeType:"modified",modifiedDiff:p}),a++,l++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),a++):(i.push({...f,changeType:"added"}),l++)}for(;a<e.length;)i.push({...e[a],changeType:"deleted"}),a++;for(;l<n.length;)i.push({...n[l],changeType:"added"}),l++;return{dataDiff:i,dataUnmodified:s}},VI=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,dataUnmodified:l}=zI(r,e,n,s,o);return{columns:[{fieldName:"changeType",render:f=>{const p=Vee[f];return g.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:g.jsxs(z.Typography,{children:[p.icon&&g.jsx(Um,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[xn(f)])??Ll(f,m,s)}}))],data:a,unmodifiedData:l,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return g.jsx(mw,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},HI=({columns:t,data:e,unmodifiedData:n=[],emptyTableMsg:r="No changes to display",renderExpand:o,size:i})=>{const[s,a]=J.useState(!1),l=()=>a(!s),u=`${s?"Hide":"Show"} ${n.length} unmodified row${n.length>1?"s":""}`;return g.jsxs(z.Box,{children:[g.jsx(cv,{columns:t,data:[...e,...s?n:[]],emptyTableMsg:r,renderExpand:o,size:i}),n.length>0&&g.jsx(z.Box,{children:g.jsx(z.Button,{onClick:l,children:u})})]})},jee=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?VI({...n,isMobileScreen:r}):n;return g.jsx(HI,{...o,size:t.size})},Uee=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=bo.useNavigate();return g.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[g.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),g.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[g.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>g.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...La(l,a),children:l.label},l.label))}),n&&g.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},WI=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=bo.useLocation(),i=bo.useNavigate(),[s,a]=J.useState(!1),l=(m,b)=>g.jsx(z.MenuList,{children:m.map(v=>g.jsxs(z.MenuItem,{...La(v,i,()=>a(!1)),children:[v.icon&&g.jsx(z.ListItemIcon,{children:v.icon}),g.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>g.jsxs(J.Fragment,{children:[l(b,v),v<m.length-1&&g.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?g.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&g.jsxs(g.Fragment,{children:[g.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:g.jsx(FU,{})}),g.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:g.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:g.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},jI=t=>{const{env:e,isProd:n}=t;return n?null:g.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},UI=t=>{const{displayName:e,userMenuOptions:n}=t;return g.jsx(RI,{label:e,menuOptions:n,icon:g.jsx(zU,{})})},Dh=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=bo.useNavigate();return g.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>g.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,...La(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))})},qI=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&g.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:g.jsx(Dh,{menuOptions:e,activeTabIdx:n,sx:r})})},KI=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return g.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?g.jsx(YM,{}):g.jsx(qM,{})})},qee=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:b}=t,v=bo.useNavigate(),y=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=bo.useLocation(),k=x.mode==="dark",[T,C]=A.useState(void 0);A.useEffect(()=>{const N=o.findIndex(L=>L.path&&S.startsWith(L.path));C(N>=0?N:void 0)},[S,o]);const O=s&&g.jsx(KI,{onToggle:s}),I=s&&(y||!y&&l)?[{icon:k?g.jsx(YM,{}):g.jsx(qM,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return g.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&g.jsx(jI,{...e}),u,g.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[g.jsx(z.Button,{disableRipple:!0,component:bo.Link,to:"/",children:r&&typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),g.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&g.jsx(WI,{menuOptionLists:[o,a,I],anchor:"right"}),!y&&g.jsxs(g.Fragment,{children:[g.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,L)=>g.jsxs(z.Box,{display:"flex",alignItems:"center",children:[L>0&&g.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),g.jsx(z.Button,{variant:"text",sx:{color:"white"},...La(N,v),children:g.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&g.jsx(UI,{displayName:l,userMenuOptions:I})]})]})]}),!y&&g.jsx(qI,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},Kee=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=bo.useLocation(),o=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&g.jsx(z.Box,{sx:e,children:g.jsx(z.Card,{sx:{height:"100%",width:200},children:g.jsx(Dh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Yee=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&g.jsx(Dh,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},Gee=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return g.jsx(LI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Jee=t=>g.jsx(Ru,{severity:"info",...t}),Xee=t=>g.jsx(Ru,{severity:"warning",...t}),YI=t=>{const{crumbs:e}=t,n=bo.useNavigate(),r=e.map(o=>({label:o.label,onClick:()=>{var i;o.path?n(o.path):(i=o.onClick)==null||i.call(o)}}));return g.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:g.jsx(RU,{}),sx:{marginBottom:2},children:r.map(({label:o,...i},s)=>s<e.length-1?g.jsx(z.Link,{color:"primary",sx:{cursor:"pointer",fontWeight:"600"},underline:"hover",...La(i,n),children:o},o):g.jsx(z.Typography,{color:"text.primary",children:o},o))})},Zee=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Qee(r);return g.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:g.jsx(Ru,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:GI(r),warning:GI(r)},onClose:o,elevation:a,variant:s,children:n?g.jsxs(g.Fragment,{children:[g.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Qee=t=>t=="logout"?"info":t=="timeout"?"warning":t,GI=t=>{if(t=="timeout")return g.jsx(EU,{});if(t=="logout")return g.jsx(BU,{})},ete=t=>{tte(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:g.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&g.jsx(YI,{crumbs:i}),g.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[g.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?g.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&g.jsxs(Tr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[g.jsx(MU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&g.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},tte=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},nte=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return g.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&g.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),g.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,g.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},rte=t=>{const{title:e="Loading...",message:n}=t;return g.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[g.jsxs(z.Box,{className:"text-content",children:[g.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&g.jsx(z.Typography,{"data-testid":"message",children:n})]}),g.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function ote({...t}){return g.jsx(NI,{onSelectCitations:()=>{},onClose:()=>{},...t})}const ite=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return g.jsx(z.Box,{height:n})};Pe.AlertModal=Ree,Pe.Autocomplete=xM,Pe.Breadcrumbs=YI,Pe.Button=Tr,Pe.Checkbox=CM,Pe.CheckboxGroup=X7,Pe.CitationField=Iee,Pe.CitationFieldProvider=Gee,Pe.CitationManager=ote,Pe.Column=Lu,Pe.ConfirmationModal=Fee,Pe.DarkModeToggle=KI,Pe.DateField=Up,Pe.DateRangeField=CZ,Pe.DecisionModal=zee,Pe.Diff=bM,Pe.DiffProvider=mw,Pe.DiffTable=jee,Pe.DiffTableView=HI,Pe.Drawer=WI,Pe.DynamicAutocomplete=G7,Pe.EnvironmentBanner=jI,Pe.ErrorAlert=AI,Pe.FileList=eU,Pe.FileUpload=kM,Pe.FloatingNavBar=Yee,Pe.Footer=Uee,Pe.FormDebugger=Nee,Pe.Header=qee,Pe.HelpTooltip=eI,Pe.IconTooltip=Q2,Pe.InfoAlert=Jee,Pe.LoadingButton=OI,Pe.LoadingIndicator=rte,Pe.LoadingOverlay=lv,Pe.Location=SU,Pe.MenuButton=RI,Pe.Modal=Fu,Pe.MultiAutocomplete=J7,Pe.NavBar=qI,Pe.NotApplicableCheckbox=Dee,Pe.PageHeader=ete,Pe.PaginatedTable=tI,Pe.ProfileMenu=UI,Pe.RadioGroup=jM,Pe.RangeSlider=CU,Pe.ReadOnly=Ti,Pe.ReadOnlyProvider=pw,Pe.RepeatableFormGroup=Lee,Pe.RichTextField=bQ,Pe.Row=Qo,Pe.ScrollToTop=Pee,Pe.SearchField=JM,Pe.Select=TU,Pe.SelectableCitationManager=$I,Pe.Sidebar=Kee,Pe.SingleActionCard=nte,Pe.Snackbar=Zee,Pe.Spacer=ite,Pe.Stepper=$ee,Pe.Submit=Aee,Pe.SuccessAlert=PI,Pe.Switch=kU,Pe.Table=cv,Pe.Tabs=Dh,Pe.TextArea=UM,Pe.TextField=ki,Pe.TextIcon=Um,Pe.ValidationError=yr,Pe.WarningAlert=Xee,Pe.baseCitationTableColumns=aI,Pe.buildDiffData=zI,Pe.buildTableDiff=VI,Pe.createAppTheme=MP,Pe.useDiff=Ws,Pe.useReadOnly=Hs,Object.defineProperty(Pe,Symbol.toStringTag,{value:"Module"})}));
|
|
409
|
+
`).trim();n(m)},...i,children:g.jsx(z.Box,{display:"flex",flexDirection:"row",gap:"4px",alignItems:"center",children:g.jsx(z.Badge,{"data-testid":"comment-button-badge",badgeContent:a,color:l,sx:u,children:g.jsx(VU,{sx:{fontSize:"22px"}})})})}):null}const Iee=t=>{var Z;const{name:e,label:n=Ln(e),hideLabel:r=!1,required:o=!1,readOnly:i,margin:s="dense",citationMaxLength:a=24,getCitationsPaginated:l,getSelectedCitationsPaginated:u,onCreateCitation:f,onUpdateCitation:p,onDeleteCitation:m,getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x=()=>{},placeholder:S="Start typing here...",errorMode:k="normal",canLaunchUrl:T,canSearch:C=!1,redoUndo:O=!1}=t,I=[FT.configure({code:!1,codeBlock:!1,heading:!1,blockquote:!1,horizontalRule:!1,strike:!1}),Xb,Y2.configure({placeholder:S}),Eee(),_ee.configure({citationMaxLength:a})],[N,L,V]=Ht.useField({name:e}),{setValue:M}=V,{value:B}=N,{addUpdateCitation:H,deleteCitation:F,batchUpdate:P,citations:_}=BI();J.useEffect(()=>{var ne;const te=(ne=D==null?void 0:D.current)==null?void 0:ne.editor;if(!te)return;te.getHTML()!==B&&setTimeout(()=>{te.commands.setContent(B)},0)},[B]);const D=J.useRef(null),R={normal:{marginTop:"16px",marginBottom:"8px"},dense:{marginTop:"8px",marginBottom:"4px"},none:{margin:0}},j=(te=void 0)=>{var re,le;const ce=((le=(re=D.current)==null?void 0:re.editor)==null?void 0:le.getHTML())??"",ne=!ce.replace(/<\/?p>|<br>/g,"").trim();M(ne?"":ce,te)},K=J.useMemo(()=>bs.debounce(()=>j(!1),500),[M]),U=Hs(),{showDiff:Y,getPreviousValue:fe}=Ws(),ue=i??U;if(Y){const te=fe(e)??"",ce=B,ne=/<citation\s+ids="([^"]*)"><\/citation>/g,re=(X,ee)=>{const ie=ee.split(",").map(Number);return`<sup>${_.filter(we=>ie.includes(we.id)).map(we=>we.title)}</sup>`},le=te.replace(ne,re),ye=ce.replace(ne,re);return g.jsx(Ti,{label:n,value:ye,showDiff:!0,diffSnapshot:le,mode:"html"})}const pe=bs.pick(t,["canComment","onComment","commentCount","commentResolved"]);return g.jsxs(z.Box,{id:`citation-field_${e}`,sx:{"& .ProseMirror":{"& h1, & h2, & h3, & h4, & h5, & h6":{scrollMarginTop:ue?0:50}},".MuiTiptap-RichTextContent-readonly ":{padding:0}},...R[s],display:"flex",flexDirection:"column",width:"100%",children:[g.jsxs(z.Box,{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[!r&&g.jsx(z.InputLabel,{htmlFor:`citation-field_${e}`,required:!i&&o,children:n}),i&&g.jsx(FI,{...pe,editor:(Z=D==null?void 0:D.current)==null?void 0:Z.editor})]}),g.jsx(pM,{ref:D,extensions:I,content:B,editable:!ue,renderControls:()=>{var te;return g.jsxs(jf,{justifyContent:"space-between",children:[g.jsxs(jf,{children:[g.jsx(Oee,{}),g.jsx(An,{}),g.jsx(SE,{}),g.jsx(DE,{}),g.jsx(NE,{}),g.jsx(An,{}),g.jsx(AE,{}),g.jsx(CE,{})]}),g.jsx(FI,{...pe,editor:(te=D==null?void 0:D.current)==null?void 0:te.editor})]})},onBlur:()=>j(),onUpdate:K,RichTextFieldProps:{variant:ue?"standard":"outlined",MenuBarProps:{hide:ue},footer:O&&g.jsxs(z.Stack,{direction:"row",spacing:2,sx:{borderTop:te=>`1px solid ${te.palette.divider}`,p:1},children:[g.jsx($E,{}),g.jsx(PE,{})]})},children:()=>g.jsx(kee,{getCitationsPaginated:(te,ce)=>l(te,ce).then(ne=>(P(ne.data),ne)),getSelectedCitationsPaginated:u,onCreateCitation:f&&(te=>f(te).then(ce=>(H(ce),ce))),onUpdateCitation:p&&(te=>p(te).then(ce=>(H(ce),ce))),onDeleteCitation:m&&(te=>m(te).then(()=>F(te))),getCitationById:b,onDownloadAttachment:v,onPreviewAttachment:y,onError:x,canLaunchUrl:T,readOnly:ue,canSearch:C})}),g.jsx(yr,{name:e,id:`${e}-err`,errorMode:k})]})},Dee=t=>g.jsx(CM,{name:t.name,label:"Not Applicable",errorMode:"hidden"}),Aee=t=>{const{name:e="submit"}=t;return g.jsx(Tr,{name:e,type:"submit",...t})},Pee=t=>{const{label:e="Return to Top",icon:n=pp,scrollThresholdPx:r=100}=t,o=z.useScrollTrigger({threshold:r}),i=J.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"})},[]);return g.jsx(z.Zoom,{in:o,children:g.jsx(z.Box,{sx:{position:"fixed",bottom:32,right:32,zIndex:1},children:g.jsxs(z.Fab,{onClick:i,color:"primary",size:"small",variant:"extended","aria-label":"Scroll back to top",children:[g.jsx(n,{fontSize:"medium"}),e]})})})},RI=t=>{const{label:e,menuOptions:n=[],icon:r}=t,o=bo.useNavigate(),[i,s]=A.useState(null),a=!!i,l=p=>{s(p.currentTarget)},u=()=>{s(null)};if(n.length===0)return null;const f=r&&!e;return g.jsxs(g.Fragment,{children:[g.jsx(z.Button,{startIcon:f?void 0:r,variant:"outlined",color:"inherit",sx:{minWidth:0,...f&&{paddingLeft:"6px",paddingRight:"6px"}},onClick:l,children:f?r:e}),g.jsx(z.Menu,{anchorEl:i,open:a,onClick:u,children:n.map(p=>g.jsxs(z.MenuItem,{...La(p,o),children:[p.icon&&g.jsx(z.ListItemIcon,{children:p.icon}),g.jsx(z.ListItemText,{primary:p.label})]},p.label))})]})},Nee=()=>{const{values:t,errors:e,status:n}=Ht.useFormikContext(),{palette:r}=z.useTheme();return g.jsx(z.Paper,{style:{backgroundColor:r.mode==="dark"?"#303030":"#f0f0f0",margin:"10px 0"},children:g.jsxs(z.List,{children:[g.jsxs(z.ListItem,{children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Values"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(t,null,2)})]}),g.jsx(z.Divider,{variant:"inset",component:"li"}),g.jsxs(z.ListItem,{id:"testing",children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Errors"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(e,null,2)})]}),g.jsxs(z.ListItem,{children:[g.jsx(z.Typography,{display:"block",variant:"h6",children:"Status"}),g.jsx("br",{}),g.jsx(z.Divider,{variant:"inset"}),g.jsx("pre",{children:JSON.stringify(n,null,2)})]})]})})},$ee=t=>{const{steps:e,orientation:n,inlineLabel:r=n=="vertical",isResponsive:o=!1}=t,{width:i}=rI();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,...lr({...t},l)};return g.jsx(z.Stepper,{...u,children:e.map(f=>g.jsx(z.Step,{children:g.jsx(z.StepLabel,{children:f})},f))})},Lee=t=>{const{name:e,label:n=Ln(e),labelProps:r={fontSize:"1.1em",color:"#808080",fontWeight:"600"},initialState:o,renderFormGroup:i,addButtonContent:s="Add Another",removeButtonContent:a=t.removePosition==="right"?g.jsx(GM,{}):"Remove",variant:l="card",addButtonSx:u,removeButtonSx:f,allowRemoveAll:p=!1,readOnly:m=!1,emptyListMsg:b="None",showDivider:v=!1,removePosition:y="bottom"}=t,[x]=Ht.useField({name:e}),{value:S}=x,k=T=>({display:"flex",flexDirection:T==="bottom"?"column":"row",alignItems:T==="bottom"?"flex-start":"center"});return g.jsxs(z.FormControl,{fullWidth:!0,children:[g.jsx(z.Typography,{...r,children:n}),m&&x.value.length===0?g.jsx(z.Typography,{children:b}):g.jsx(Ht.FieldArray,{name:e,render:T=>g.jsxs("div",{children:[S.map((C,O)=>g.jsx(J.Fragment,{children:g.jsx(Bee,{variant:l,content:g.jsxs(z.Box,{"data-testid":"form-group-container",sx:typeof y=="string"?k(y):{...y},children:[g.jsxs(z.Box,{width:"100%",children:[i(`${e}.${O}`,O),v&&O!==S.length-1&&g.jsx(z.Divider,{"data-testid":"divider"})]}),!m&&S.length>(p?0:1)&&g.jsx(z.Button,{"data-testid":"repeatable-form-group_remove-btn",sx:f,onClick:()=>T.remove(O),children:a})]})})},`${e}-${O}`)),!m&&g.jsx(z.Button,{"data-testid":"repeatable-form-group_add-btn",onClick:()=>T.push(o),sx:u,children:s})]})})]})},Bee=({variant:t,content:e})=>{switch(t){case"card":return g.jsx(z.Card,{"data-testid":"repeatable-form-group_card",sx:{padding:"8px",marginBottom:"8px"},children:g.jsx(z.CardContent,{children:e})});case"elevatedCard":return g.jsx(z.Card,{"data-testid":"repeatable-form-group_elevated-card",elevation:4,sx:{border:"unset",padding:"8px",marginBottom:"8px"},children:g.jsx(z.CardContent,{children:e})});case"none":return e}},Fee=t=>{const{confirmBtnLabel:e,onConfirm:n,confirmButtonProps:r={color:"primary",variant:"contained"},closeBtnLabel:o="Cancel",closeButtonPosition:i="bottom",...s}=t;return g.jsx(Fu,{actions:[g.jsx(z.Button,{className:"MBv2_ConfirmationModal_ConfirmBtn",onClick:n,...r,children:e})],closeBtnLabel:o,closeButtonPosition:i,...s})},Ree=t=>{const{closeBtnLabel:e="OK",closeButtonPosition:n="bottom",closeButtonProps:r={color:"primary",variant:"contained"},...o}=t;return g.jsx(Fu,{closeBtnLabel:e,closeButtonPosition:n,closeButtonProps:r,...o})},zee=t=>{const{primaryBtnLabel:e,onPrimaryAction:n,primaryActionProps:r={color:"primary",variant:"contained"},secondaryBtnLabel:o,onSecondaryAction:i,secondaryActionProps:s={color:"primary",variant:"outlined"},closeBtnLabel:a="Cancel",closeButtonPosition:l="bottom",...u}=t;return g.jsx(Fu,{actions:[g.jsx(z.Button,{className:"MBv2_DecisionModal_SecondaryAction",onClick:i,...s,children:o}),g.jsx(z.Button,{className:"MBv2_DecisionModal_PrimaryAction",onClick:n,...r,children:e})],closeBtnLabel:a,closeButtonPosition:l,...u})},Vee={added:{icon:OU,label:"Added",color:"success"},deleted:{icon:GM,label:"Deleted",color:"error"},modified:{icon:IU,label:"Modified",color:"info"},unmodified:{label:"Unmodified",color:"default"}},Hee=(t,e)=>g.jsxs(g.Fragment,{children:[g.jsx(z.Box,{"data-testid":"diff-table-cell-removed",sx:{backgroundColor:up},children:g.jsx("s",{children:t})}),g.jsx(z.Box,{"data-testid":"diff-table-cell-added",sx:{backgroundColor:cp},children:g.jsx("u",{children:e})})]}),Wee=(t,e,n,r=!1)=>{var i;let o={};for(const s of t)if(!s.ignoreDiff){const a=Ll(s,e,r),l=Ll(s,n,r);(((i=s.isEqual)==null?void 0:i.call(s,e,n))??SM.isEqual(a,l))||(o[xn(s)]=Hee(a,l))}return o},zI=(t,e,n,r=!1,o)=>{const i=[],s=[];let a=0,l=0;for(e.sort((u,f)=>u.id-f.id),n.sort((u,f)=>u.id-f.id);a<e.length&&l<n.length;){const u=e[a],f=n[l];if(u.id===f.id){const p=Wee(t,u,f,r);(o==null?void 0:o(u,f))??Object.keys(p).length===0?s.push({...f,changeType:"unmodified"}):i.push({...f,changeType:"modified",modifiedDiff:p}),a++,l++}else u.id<f.id?(i.push({...u,changeType:"deleted"}),a++):(i.push({...f,changeType:"added"}),l++)}for(;a<e.length;)i.push({...e[a],changeType:"deleted"}),a++;for(;l<n.length;)i.push({...n[l],changeType:"added"}),l++;return{dataDiff:i,dataUnmodified:s}},VI=t=>{const{beforeData:e,afterData:n,columns:r,isEqual:o,size:i,isMobileScreen:s}=t;t.renderExpand!=null&&o==null&&console.warn("DiffTable: isEqual prop should be provided when renderExpand is provided");const{dataDiff:a,dataUnmodified:l}=zI(r,e,n,s,o);return{columns:[{fieldName:"changeType",render:f=>{const p=Vee[f];return g.jsx(z.Chip,{color:p.color,size:i=="small"||i=="x-small"?"small":"medium",label:g.jsxs(z.Typography,{children:[p.icon&&g.jsx(Um,{icon:p.icon}),p.label]})})}},...r.map(f=>({...f,render:(p,m)=>{var b;return((b=m.modifiedDiff)==null?void 0:b[xn(f)])??Ll(f,m,s)}}))],data:a,unmodifiedData:l,renderExpand:t.renderExpand?f=>{const p=e.find(m=>m.id===f.id);return g.jsx(mw,{previousSnapshot:p,currentSnapshot:f,showDiff:f.changeType==="modified",children:t.renderExpand(f)})}:void 0}},HI=({columns:t,data:e,unmodifiedData:n=[],emptyTableMsg:r="No changes to display",renderExpand:o,size:i})=>{const[s,a]=J.useState(!1),l=()=>a(!s),u=`${s?"Hide":"Show"} ${n.length} unmodified row${n.length>1?"s":""}`;return g.jsxs(z.Box,{children:[g.jsx(cv,{columns:t,data:[...e,...s?n:[]],emptyTableMsg:r,renderExpand:o,size:i}),n.length>0&&g.jsx(z.Box,{children:g.jsx(z.Button,{onClick:l,children:u})})]})},jee=t=>{const{emptyTableMsg:e="No changes to display",...n}=t,r=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),o="beforeData"in n?VI({...n,isMobileScreen:r}):n;return g.jsx(HI,{...o,size:t.size})},Uee=t=>{const{featureMenuOptions:e=[],copyright:n,logo:r,sx:o={},fontColor:i="primary"}=t,{palette:s}=z.useTheme(),a=bo.useNavigate();return g.jsxs(z.Box,{className:"MBv2_Footer",sx:{backgroundColor:s.mode==="dark"?"#222222":"#ededed",padding:"25px 30px",...o},children:[g.jsx(z.Box,{className:"MBv2_Footer_Logo",sx:{display:"flex",gap:2,alignItems:"center",paddingBottom:1},children:typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px"},alt:"logo"}):r}),g.jsxs(z.Box,{display:"flex",justifyContent:"space-between",flexWrap:"wrap",className:"MBv2_Footer_Nav_Links_Container",gap:2,children:[g.jsx(z.Box,{sx:{flexGrow:1},className:"MBv2_Footer_Nav_Links",display:"flex",flexDirection:"row",justifyContent:"flex-start",gap:3,children:e==null?void 0:e.map(l=>g.jsx(z.Link,{"data-testid":l.label,sx:{cursor:"pointer",fontSize:15},color:i,...La(l,a),children:l.label},l.label))}),n&&g.jsx(z.Typography,{style:{fontSize:15},"data-testid":"copyright",className:"MBv2_Footer_Copyright",color:i,children:n})]})]})},WI=t=>{const{menuOptionLists:e,anchor:n="left",children:r}=t,{pathname:o}=bo.useLocation(),i=bo.useNavigate(),[s,a]=J.useState(!1),l=(m,b)=>g.jsx(z.MenuList,{children:m.map(v=>g.jsxs(z.MenuItem,{...La(v,i,()=>a(!1)),children:[v.icon&&g.jsx(z.ListItemIcon,{children:v.icon}),g.jsx(z.ListItemText,{primary:v.label})]},`mobile-drawer-group-${b}-item-${v.path}`))}),f=(()=>{if(e){const m=e.filter(b=>b&&b.length>0);return m.length===0?null:m.map((b,v)=>g.jsxs(J.Fragment,{children:[l(b,v),v<m.length-1&&g.jsx(z.Divider,{})]},`mobile-drawer-group-${v}`))}return r?g.jsx(z.Box,{role:"presentation",onClick:()=>a(!1),children:r}):null})(),p=f??!1;return J.useEffect(()=>{a(!1)},[o]),p&&g.jsxs(g.Fragment,{children:[g.jsx(z.IconButton,{onClick:()=>a(!0),color:"inherit",title:"Menu",children:g.jsx(FU,{})}),g.jsx(z.Drawer,{"data-testid":"mobile-drawer",anchor:n,open:s,onClose:()=>a(!1),children:g.jsx(z.Box,{sx:{width:300},display:"flex",flexDirection:"column",justifyContent:"space-between",children:g.jsx(z.Box,{display:"flex",justifyContent:"start",flexDirection:"column",children:f})})})]})},jI=t=>{const{env:e,isProd:n}=t;return n?null:g.jsx(z.Paper,{sx:{borderRadius:0,display:"flex",alignItems:"center",justifyContent:"center"},children:g.jsxs(z.Typography,{variant:"h6",color:"error",children:[e," Environment - Test Data Only"]})})},UI=t=>{const{displayName:e,userMenuOptions:n}=t;return g.jsx(RI,{label:e,menuOptions:n,icon:g.jsx(zU,{})})},Dh=t=>{const{menuOptions:e,orientation:n="horizontal",activeTabIdx:r,sx:o=n=="vertical"?{"& .MuiTabs-indicator":{left:0}}:void 0,slotProps:i={indicator:{sx:n=="horizontal"?{height:4}:{width:4}}}}=t,{palette:s}=z.useTheme(),a=bo.useNavigate();return g.jsx(z.Tabs,{orientation:n,value:r??!1,sx:o,slotProps:i,children:e.map((l,u)=>g.jsx(z.Tab,{icon:l.icon,label:l.label,value:u,...La(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))})},qI=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t;return e.length>0&&g.jsx(z.Paper,{sx:{pl:4,pr:4,borderRadius:0},"data-testid":"navBar",children:g.jsx(Dh,{menuOptions:e,activeTabIdx:n,sx:r})})},KI=t=>{const{onToggle:e}=t,{palette:n}=z.useTheme(),r=n.mode==="dark";return g.jsx(z.IconButton,{onClick:e,color:"inherit",title:"Dark Mode Toggle",children:r?g.jsx(YM,{}):g.jsx(qM,{})})},qee=t=>{const{envInfo:e,headerRef:n,logo:r,featureMenuOptions:o=[],userMenuOptions:i=[],onToggleDarkMode:s,quickLinks:a=[],displayName:l,banner:u,position:f="fixed",children:p,sx:m,navBarSx:b}=t,v=bo.useNavigate(),y=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),{palette:x}=z.useTheme(),{pathname:S}=bo.useLocation(),k=x.mode==="dark",[T,C]=A.useState(void 0);A.useEffect(()=>{const N=o.findIndex(L=>L.path&&S.startsWith(L.path));C(N>=0?N:void 0)},[S,o]);const O=s&&g.jsx(KI,{onToggle:s}),I=s&&(y||!y&&l)?[{icon:k?g.jsx(YM,{}):g.jsx(qM,{}),label:`Switch to ${k?"Light":"Dark"} mode`,onClick:s},...i]:i;return g.jsxs(z.AppBar,{ref:n,position:f,sx:m,elevation:4,children:[e&&g.jsx(jI,{...e}),u,g.jsxs(z.Toolbar,{sx:{color:"white",display:"flex",justifyContent:"space-between",gap:2},children:[g.jsx(z.Button,{disableRipple:!0,component:bo.Link,to:"/",children:r&&typeof r=="string"?g.jsx("img",{draggable:"false",src:r,style:{width:"200px",filter:"brightness(0) invert(1)"},alt:"logo"}):r}),g.jsxs(z.Box,{display:"flex",gap:2,alignItems:"center",children:[!l&&!y&&O,y&&g.jsx(WI,{menuOptionLists:[o,a,I],anchor:"right"}),!y&&g.jsxs(g.Fragment,{children:[g.jsx(z.Box,{display:"flex",gap:0,children:a==null?void 0:a.map((N,L)=>g.jsxs(z.Box,{display:"flex",alignItems:"center",children:[L>0&&g.jsx(z.Typography,{className:"quickLink-divider",color:x.primary.contrastText,children:"|"}),g.jsx(z.Button,{variant:"text",sx:{color:"white"},...La(N,v),children:g.jsxs(z.Box,{display:"flex",gap:"3px",alignItems:"center",children:[N.icon,N.label]})})]},N.label))}),p,l&&g.jsx(UI,{displayName:l,userMenuOptions:I})]})]})]}),!y&&g.jsx(qI,{featureMenuOptions:o,activeTabIdx:T,sx:b})]})},Kee=t=>{const{sx:e,menuOptions:n=[]}=t,{pathname:r}=bo.useLocation(),o=z.useMediaQuery(z.useTheme().breakpoints.down("sm")),[i,s]=J.useState(void 0);return J.useEffect(()=>{const a=n.findIndex(l=>l.path&&r.startsWith(l.path))??-1;s(a>=0?a:void 0)},[r,n]),!o&&n.length>0&&g.jsx(z.Box,{sx:e,children:g.jsx(z.Card,{sx:{height:"100%",width:200},children:g.jsx(Dh,{orientation:"vertical",menuOptions:n,activeTabIdx:i})})})},Yee=t=>{const{featureMenuOptions:e=[],activeTabIdx:n,sx:r}=t,{palette:o}=z.useTheme();return e.length>0&&g.jsx(Dh,{menuOptions:e,activeTabIdx:n,sx:{margin:"8px",backgroundColor:o.primary.dark,borderRadius:"8px","& .MuiTab-root":{color:o.secondary.light,flexDirection:"row",gap:"2px","& .MuiTab-icon":{marginBottom:"unset"},minHeight:"58px"},"& .MuiTab-root.Mui-selected":{color:o.primary.contrastText,fontSize:"120%"},"& .MuiTabs-indicator":{display:"none"},...r}})},Gee=({children:t,getCitations:e})=>{const[n,r]=J.useState([]),[o,i]=J.useState(!1);J.useEffect(()=>{(async()=>e().then(f=>{r(p=>{const m=new Set(p.map(v=>v.id));return[...p.filter(v=>!m.has(v.id)),...f]}),i(!0)}).catch(f=>{console.error(`Error fetching citations: ${f==null?void 0:f.toString()}`)}))()},[]);const s=J.useCallback(u=>{r(f=>{const p=f.map(v=>{const y=u.find(x=>x.id===v.id);return y||v}),m=new Set(f.map(v=>v.id)),b=u.filter(v=>!m.has(v.id));return[...p,...b]})},[]),a=J.useCallback(u=>{const f=n.findIndex(p=>p.id===u.id);r(f!==-1?p=>{const m=[...p];return m[f]=u,m}:[...n,u])},[n]),l=J.useCallback(u=>r(n.filter(f=>f.id!==u)),[n]);return g.jsx(LI.Provider,{value:{citations:n,isLoaded:o,addUpdateCitation:a,deleteCitation:l,batchUpdate:s},children:t})},Jee=t=>g.jsx(Ru,{severity:"info",...t}),Xee=t=>g.jsx(Ru,{severity:"warning",...t}),YI=t=>{const{crumbs:e}=t,n=bo.useNavigate(),r=e.map(o=>({label:o.label,onClick:()=>{var i;o.path?n(o.path):(i=o.onClick)==null||i.call(o)}}));return g.jsx(z.Breadcrumbs,{"aria-label":"breadcrumb",separator:g.jsx(RU,{}),sx:{marginBottom:2},children:r.map(({label:o,...i},s)=>s<e.length-1?g.jsx(z.Link,{color:"primary",sx:{cursor:"pointer",fontWeight:"600"},underline:"hover",...La(i,n),children:o},o):g.jsx(z.Typography,{color:"text.primary",children:o},o))})},Zee=t=>{const{title:e,message:n,type:r,onClose:o,autoHideDuration:i,variant:s="leftBorder",elevation:a=6}=t,l=Qee(r);return g.jsx(z.Snackbar,{"data-testid":"message-snackbar",anchorOrigin:{vertical:"bottom",horizontal:"right"},open:!0,onClose:u=>{u==null&&o()},autoHideDuration:i,children:g.jsx(Ru,{"data-testid":"message-snackbar-alert",severity:l,iconMapping:{info:GI(r),warning:GI(r)},onClose:o,elevation:a,variant:s,children:n?g.jsxs(g.Fragment,{children:[g.jsx(z.AlertTitle,{"data-testid":"alertTitle",sx:{fontWeight:"bold"},children:e}),n]}):e})})},Qee=t=>t=="logout"?"info":t=="timeout"?"warning":t,GI=t=>{if(t=="timeout")return g.jsx(EU,{});if(t=="logout")return g.jsx(BU,{})},ete=t=>{tte(t);const{title:e,createButtonLabel:n="Add Item",showAddButton:r=!1,onAdd:o=()=>alert("Not implemented yet"),breadcrumbs:i=[],children:s,sx:a={},bottomGutter:l=!1}=t,u=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return!e&&(!r||!n)?null:g.jsxs(z.Box,{"data-testid":"MBv2-Page-Header",sx:{...a,...l&&{marginBottom:"4px"}},children:[i.length>0&&g.jsx(YI,{crumbs:i}),g.jsxs(z.Box,{className:"MBv2_PageHeader_Header",display:"flex",flexDirection:u?"column":"row",justifyContent:"space-between",alignItems:"center",gap:1,children:[g.jsxs(z.Box,{className:"MBv2_PageHeader_TitleAndCreateBtn",display:"flex",flexDirection:"row",justifyContent:u||!s?"space-between":"start",alignItems:"center",width:"100%",gap:1,children:[typeof e=="string"?g.jsx(z.Typography,{className:"MBv2_PageHeader_Title",variant:"h2",children:e}):e,r&&g.jsxs(Tr,{className:"MBv2_PageHeader_CreateBtn",onClick:()=>o(),children:[g.jsx(MU,{style:{marginRight:"0.5rem"}}),n]})]}),s&&g.jsx(z.Box,{width:u?"100%":"50%",children:s})]})]})},tte=t=>{const{showAddButton:e,onAdd:n,createButtonLabel:r}=t,o="PageHeader component:";e&&!n&&console.warn(`${o} "showAddButton" is true but "onAdd" is not defined.`),e&&!r&&console.warn(`${o} "showAddButton" is true but "createButtonLabel" is not defined`)},nte=t=>{const{title:e,titleIcon:n,fullWidthIcon:r=!1,children:o,actionLabel:i,action:s,sx:a}=t,l=z.useMediaQuery(z.useTheme().breakpoints.down("sm"));return g.jsxs(z.Card,{sx:a||{padding:"30px 40px",display:"flex",flexDirection:"column",gap:"1rem"},children:[n&&g.jsx(z.Box,{className:"MBv2_SingleActionCard_Img",sx:[r?{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"20px",marginBottom:"10px"}:{display:"inline"}],children:n}),g.jsx(z.Typography,{variant:"h1",display:"inline",fontSize:"calc(20px + .9vw)",className:"MBv2_SingleActionCard_Title",children:e}),o,g.jsx(z.Button,{variant:"contained",color:"primary",onClick:s,fullWidth:l,className:"MBv2_SingleActionCard_ActionButton",children:i})]})},rte=t=>{const{title:e="Loading...",message:n}=t;return g.jsxs(z.Box,{className:"loading-page",sx:{gap:2},"data-testid":"loading-page",children:[g.jsxs(z.Box,{className:"text-content",children:[g.jsx(z.Typography,{variant:"h1","data-testid":"title",children:e}),n&&g.jsx(z.Typography,{"data-testid":"message",children:n})]}),g.jsx(z.CircularProgress,{size:75,"data-testid":"loading-spinner"})]})};function ote({...t}){return g.jsx(NI,{onSelectCitations:()=>{},onClose:()=>{},...t})}const ite=t=>{const{size:e="small"}=t;let n=`${e}px`;switch(e){case"x-small":n="6px";break;case"small":n="10px";break;case"medium":n="14px";break;case"large":n="18px";break;case"x-large":n="22px";break}return g.jsx(z.Box,{height:n})};Pe.AlertModal=Ree,Pe.Autocomplete=xM,Pe.Breadcrumbs=YI,Pe.Button=Tr,Pe.Checkbox=CM,Pe.CheckboxGroup=X7,Pe.CitationField=Iee,Pe.CitationFieldProvider=Gee,Pe.CitationManager=ote,Pe.Column=Lu,Pe.ConfirmationModal=Fee,Pe.DarkModeToggle=KI,Pe.DateField=Up,Pe.DateRangeField=CZ,Pe.DecisionModal=zee,Pe.Diff=bM,Pe.DiffProvider=mw,Pe.DiffTable=jee,Pe.DiffTableView=HI,Pe.Drawer=WI,Pe.DynamicAutocomplete=G7,Pe.EnvironmentBanner=jI,Pe.ErrorAlert=AI,Pe.FileList=eU,Pe.FileUpload=kM,Pe.FloatingNavBar=Yee,Pe.Footer=Uee,Pe.FormDebugger=Nee,Pe.Header=qee,Pe.HelpTooltip=eI,Pe.IconTooltip=Q2,Pe.InfoAlert=Jee,Pe.LoadingButton=OI,Pe.LoadingIndicator=rte,Pe.LoadingOverlay=lv,Pe.Location=SU,Pe.MenuButton=RI,Pe.Modal=Fu,Pe.MultiAutocomplete=J7,Pe.NavBar=qI,Pe.NotApplicableCheckbox=Dee,Pe.PageHeader=ete,Pe.PaginatedTable=tI,Pe.ProfileMenu=UI,Pe.RadioGroup=jM,Pe.RangeSlider=CU,Pe.ReadOnly=Ti,Pe.ReadOnlyProvider=pw,Pe.RepeatableFormGroup=Lee,Pe.RichTextField=bQ,Pe.Row=Qo,Pe.ScrollToTop=Pee,Pe.SearchField=JM,Pe.Select=TU,Pe.SelectableCitationManager=$I,Pe.Sidebar=Kee,Pe.SingleActionCard=nte,Pe.Snackbar=Zee,Pe.Spacer=ite,Pe.Stepper=$ee,Pe.Submit=Aee,Pe.SuccessAlert=PI,Pe.Switch=kU,Pe.Table=cv,Pe.Tabs=Dh,Pe.TextArea=UM,Pe.TextField=ki,Pe.TextIcon=Um,Pe.ValidationError=yr,Pe.WarningAlert=Xee,Pe.baseCitationTableColumns=aI,Pe.buildDiffData=zI,Pe.buildTableDiff=VI,Pe.createAppTheme=MP,Pe.useDiff=Ws,Pe.useReadOnly=Hs,Object.defineProperty(Pe,Symbol.toStringTag,{value:"Module"})}));
|